I have been feeding on your collective knowledge and experience for some time, and now is the time for me to join in. This time it’s a question, but hopefully in the future I will be able so help others with answers.
I’m developing a number of plugins, and have recently stumbled upon an issue. I’m not sure if this is a bug, or if I’m doing something wrong.
When you create a component, and subsequently change it’s behavior so it will glue to a certain type of surface, this change is not actually effective. Let me demonstrate via the Ruby console:
# I create a simple component group = Sketchup.active_model.entities.add_group face = group.entities.add_face([0,0,0],[100,0,0],[100,100,0],[0,100,0]) face.pushpull(-5,false) component = group.to_component
By default the GlueTo value in the UI is set to None. I can verify this by printing its value, which will be zero:
When I change it in the API, this value is updated:
# change the GlueTo value component.definition.behavior.snapto = SnapTo_Vertical # and verify the value puts component.definition.behavior.snapto
It shows the value two, as expected. Unfortunately the UI still shows None.
Now if I change the value in the UI to something (like Horizontal) and then print the value, the expected value is printed.
puts component.definition.behavior.snapto 1
Change it to Vertical and the value two is printed.
So the API value is updated by changes in the UI, but the UI seems to ignore changes made through the API. Am I doing something wrong, is this a bug, or os something els going on.
I have tested this on SketchUp 2018 Pro and 2019 Pro. Both show the same results.