Search code examples
rubysketchup

Dynamic Component Attributes of Arc's in Sketchup


I have a 3 point arc in my drawing. The dynamic attributes provided in standard are the same as for rectangles. Is there a way to define the 3 points as attributes to be able to change them dynamically afterwards?


Solution

  • You can use an AttributeDictionary that are attached to every Entity and Model to store custom attributes.

    dictname = "TestDictionary"
    key = "arcs"
    value = ["x", "y", "z"]
    model = Sketchup.active_model
    model.set_attribute dictname, key, value
    
    dict = model.attribute_dictionary dictname
    arcs = dict[key]
    
    // or
    
    arcs = model.get_attribute dictname, key