Component Options are not directly entity attributes, but a GUI with its own features, called “component options”.
If you want to access the underlaying entity attributes, you need to know the attribute dictionary names and attribute names. These are not displayed in Component Options. You need a tool for displaying entity attributes, like Attribute Helper, Eneroth Attribute Editor or Attribute Inspector.
And then read up on these …
Also note that there are some options that are not allowed to be set via Ruby. (Multiple choice select options.)
Anyone interested in working with BIM and IFC in SketchUp may benefit from reading this topic thread …
The attributes pointed to in that screenshot is related to Classifications. While you can read/write these manually with the generic get/set_attribute methods, you would have to know exactly how they are organized.
While dealing with classification attributes you should use the Classifiction API:
The native export to ifc is still broken:
i also trying to do same your work … so i wondering if can i add sub attribute dictionary to attribute dictionary because i searched to found any api can do this job, but all api i found that can used to add key and its value to a dictionary , so i want to add sub dictionary in IFC 2x3 dictionary like in image below and the sub dictionary contains a number of keys with them values
You would have to have xml writing software and make your own schema or .SKC file:
Yes you can.
At the Ruby console …
Sketchup::AttributeDictionary.ancestors #=> [ Sketchup::AttributeDictionary, Enumerable, Sketchup::Entity, Object, PP::ObjectMixin, JSON::Ext::Generator::GeneratorMethods::Object, Kernel, BasicObject ]
The API documentation only lists methods inherited from API ancestor classes.
To see the methods from Core Ruby classes refer to the Core Ruby documentation …
i used set_attribute “dictName” , “key” , “value”
this method used to adding key in dictionary “dictName” And that is what I do not want
i want to add nested dictionary to parent dictionary for example i have dictionary called parent and other one called child , i want to add child dictionary to parent then adds keys to child by using set_attribute “child” , “x” , “y”
can that happens or i have misunderstand
I answered the question above …
To create the child dictionary, either …
create = true child_dict = parent_dict.attribute_dictionary( "child", create ) child_dict["x"]= "y" #=> "y"
… or …
parent_dict.set_attribute( "child", "x", "y" ) #=> "y" child_dict = parent_dict.attribute_dictionaries["child"]
Are you working with IFC data? Or are you adding arbitrary data not related to IFC?
ya i working with ifc data , and i trying to solve any problem facing to me …
first problem faced me when import ifc file to sketchup layers and materials not imported inside sketchup , so i wrote some script to get layers and materials using ifcopenshell in python language and ruby to dealing with sketchup .
and now i working on how to add ifcPropertSet to any SU component