GroupRef
A lightweight placeholder for a Group that hasn’t been fully loaded yet.
When you create a group inside a SketchupOperation, the
API returns a GroupRef object immediately, before SketchUp has
finished creating the group. You can pass this ref as a container
to other operation methods (like createFace or createEdge)
to add geometry into the group. If you need the full Group
object, you can request it with entityForRef().
Think of a ref as a “claim ticket” — it guarantees a group will
exist after the operation commits, but it doesn’t carry the
group’s properties (name, transformation, entities, etc.) yet.
A ref is only valid inside the performOperation callback that
created it — do not return it or use it after the operation
commits.
Example
Section titled “Example”let model = await SketchUpApi.getActiveModel();
await model.performOperation(async op => { const groupRef = op.createGroup(model); // Add a face into the group op.createFace(groupRef, [ [0, 0, 0], [24, 0, 0], [24, 24, 0], [0, 24, 0], ]); // Use the ref to name the group op.groupSetName(groupRef, 'Floor Slab');}, 'Create a named group');Properties
Section titled “Properties”sketchupId
Section titled “sketchupId”
readonlysketchupId:SketchupId
readonlytype:Group=EntityType.Group
Accessors
Section titled “Accessors”typeName
Section titled “typeName”Get Signature
Section titled “Get Signature”get typeName():
string
Returns a named variant of the type field.
SDK 2.35.0
Returns
Section titled “Returns”string
Methods
Section titled “Methods”toString()
Section titled “toString()”toString():
string
Returns
Section titled “Returns”string