hello,
Can some one help me…The goal of the code below was to change a component to a dynamic one adding lenx, leny and lenz attributes. And force values to 100, 200 and 300
#Change a component to dynamic component
def crdc
model = Sketchup.active_model
selection = model.selection
if selection.empty? or selection.length > 1.0
UI.messagebox ("Select one entity")
else
ents=selection[0]
compo=ents.definition #component definition
#add attributs
compo.set_attribute("dynamic_attributes","lenx", "100.0")
compo.set_attribute("dynamic_attributes","leny", "200.0")
compo.set_attribute("dynamic_attributes","lenz", "300.0")
#attribus labels
compo.set_attribute("dynamic_attributes","_lenx_label", "L")
compo.set_attribute("dynamic_attributes","_leny_label", "P")
compo.set_attribute("dynamic_attributes","_lenz_label", "H")
#attributs format
compo.set_attribute("dynamic_attributes" , "_lenx_access", "TEXTBOX")
compo.set_attribute("dynamic_attributes" , "_leny_access", "TEXTBOX")
compo.set_attribute("dynamic_attributes" , "_lenz_access", "TEXTBOX")
#regen
$dc_observers.get_latest_class.redraw_with_undo(ents)
end
end
The component is a cube 1000mm x 1000mm x 1000mm
This code is ok to transform the component into dynamic one. But the dimension are not changed, still 1000mm x 1000mm x 1000m.
However we can see with “Attribute Helper” that values have been changed !!!
is this a regen issue ? Or else…
Thanks in advance
BR