Closed cloud1980 closed 5 years ago
At the moment there are two supported methods for writing properties.
I hope this helps you on the way!
Thanks a lot.
It’s so kind of you! And I have more questions when I try to write ruby code to realize it.
I think there is a dictionary named “'IFC 2x3”, and the “IFC 2x3” dictionary has a dictionary named “BaseQuantities”. Then the “BaseQuantities” dictionary has the dictionary named “Width”, “Depth”, “Height”. Each of “Width”, “Depth”, “Height” has the key named “Value”.
Is my understanding correct?
For I can’t find any threads about it in the SketchUp Ruby API documents, can you teach me more about how to realize the nested dictionary in ruby?
For example, I creat “Width”, “Depth”, “Height” dictionary in the lowest level. How to nest them inside the “BaseQuantities” dictionary and “IFC 2x3” dictionary.
status = componentinstance.set_attribute "Width", "Value", b.to_s status = componentinstance.set_attribute "Depth", "Value", l.to_s status = componentinstance.set_attribute "Height", "Value", h.to_s
I want to generate the su model by ruby and save the ifc information at the same time.
That’s my code:
1. create a group by l, b, h and transform group to component
l = 5000 b = 600 h = 800 model = Sketchup.active_model entities = model.active_entities status = entities.clear! #clear the entities!!! group = entities.add_group pts = pts[0] = [0, 0, 0] pts[1] = [l, 0, 0] pts[2] = [l, b, 0] pts[3] = [0, b, 0] face = group.entities.add_face(pts) status = face.pushpull(h) componentinstance = group.to_component
My question is: How to save my User-defined properties? For example, how to save the IfcBeam’s l, b ,h attributes.
Thanks.