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_defThanks for your time.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement