The definition method is used to retrieve the component definition for this group.
The IFC classification is assigned to the definition of the object.
Here is a small example where you first have to select a group, after which you can use this code immediately assigns the IFC4 classification “IfcBeam” to the selected object.
mod = Sketchup.active_model # Open model
sel = mod.selection # Current selection
group_definition = sel[0].definition
group_definition.add_classification("IFC 4", "IfcBeam")
You may need to apply .make_unique method on a selected group before classifying. Otherwise an “unmodified” copy of the group will get the same classification, witch, maybe, could not be your intention…
See:
The Group #make_unique method is used to force a group to have a unique definition. If the group is already unique in the model, nothing happens.
Copying a group in SketchUp will create a group that shares the same definition. SketchUp implicitly makes group unique when edited from the GUI, and from a user point of view groups could be thought of as always being unique. To honor this behavior, call this method before editing a group through the API.