💡 LightUp 7.1 | SketchUp's only real-time renderer that uses object-based rendering
Download Trial
Apply changes when click on the element
-
Hello guys, need some help again.
Scenario:
Have two entities selected, and when I click in my plugin need to calculate the sum of both selected LenX and apply this value on the next entity that i'll click. Like image below:
My code until now:
model = Sketchup.active_model selections = model.selection lenx_total = 0.to_i leny_total = 0.to_i lenz_total = 0.to_i if selections.empty? UI.messagebox('Select at least one component.') else selections.each do |sel| lenx_total = lenx_total + sel.definition.get_attribute('dynamic_attributes', '_lenx_nominal') end end # All this is for test only, where i'm stuck and trying to discover something model.find_entity_by_id(18618).definition.set_attribute 'dynamic_attributes', '_lenx_nominal', lenx_total new_def = model.find_entity_by_id(18618).definition model.place_component new_def
Thanks for your time.
Advertisement