Skip to main content

Feature

featureAPI#

Provides functions for interaction with the classcad feature api.

closeFeature#

Moves GhostRollbackBar back to RollbackBar, sets relevant solids' visibility.

Declaration

async (drawingId: DrawingID, featureId: ObjectID): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingIDThe drawing id.
featureIdObjectIDThe id of the feature to close.

Returns Promise<void>

createBooleanOperation#

Creates new BooleanOperation in part and sets entities for the operation

Declaration

async (drawingId: DrawingID, partId: ObjectID, { type = BooleanOperationType.UNION, entities = null, }: {
type?: BooleanOperationType;
entities?: ObjectID[] | null;
} = {}): Promise<number>

Params

NameTypeDefaultDescription
drawingIdDrawingID
partIdObjectID
type?BooleanOperationTypeBooleanOperationType.UNION
entities?ObjectID[] l nullnull

Returns Promise<number>
The id of the new created operation or null.

createExtrusion#

Creates new extrusion feature.

Declaration

async (drawingId: DrawingID, partId: ObjectID): Promise<number>

Params

NameTypeDefaultDescription
drawingIdDrawingID
partIdObjectID

Returns Promise<number>
The id of the new created operation or null.

createFeature#

Creates a new (empty) Feature in part.

Declaration

async (drawingId: DrawingID, partId: ObjectID, type: string, name: string): Promise<number>

Params

NameTypeDefaultDescription
drawingIdDrawingID
partIdObjectID
typestring
namestring

Returns Promise<number>
The id of the new created Feature or null.

createWorkGeometry#

Creates new (default) WorkGeometry in a part

Declaration

async (drawingId: DrawingID, partId: ObjectID, type: string, name: string): Promise<number>

Params

NameTypeDefaultDescription
drawingIdDrawingIDThe drawing id.
partIdObjectIDId of the product to which the new work geometry is added
typestringClass of work geometry as string which will be created
namestringName of the created work geometry object

Returns Promise<number>
The id of the new created WorkGeometry or null.

createNamedCoordSystem#

Creates new NamedCoordSystem in product and sets its coordinate system.

Declaration

async (drawingId: DrawingID, productId: ObjectID, { name = 'CoordSystem', origin = { x: 0, y: 0, z: 0 }, xVec = { x: 1, y: 0, z: 0 }, yVec = { x: 0, y: 1, z: 0 }, }: {
name?: string;
origin?: PointMemValue;
xVec?: PointMemValue;
yVec?: PointMemValue;
} = {}): Promise<number>

Params

NameTypeDefaultDescription
drawingIdDrawingID
productIdObjectID
name?string'CoordSystem'
origin?PointMemValue{ x: 0, y: 0, z: 0 }
xVec?PointMemValue{ x: 1, y: 0, z: 0 }
yVec?PointMemValue{ x: 0, y: 1, z: 0 }

Returns Promise<number>
The id of the new created NamedCoordSystem or null.

createNamedPoint#

Creates new NamedPoint in product and sets its position.

Declaration

async (drawingId: DrawingID, productId: ObjectID, { name = 'Point', origin = { x: 0, y: 0, z: 0 }, }: {
name?: string;
origin?: PointMemValue;
} = {}): Promise<number>

Params

NameTypeDefaultDescription
drawingIdDrawingID
productIdObjectID
name?string'Point'
origin?PointMemValue{ x: 0, y: 0, z: 0 }

Returns Promise<number>
The id of the new created NamedPoint or null.

createRevolve#

Creates new Revolve feature

Declaration

async (drawingId: DrawingID, partId: ObjectID): Promise<number>

Params

NameTypeDefaultDescription
drawingIdDrawingID
partIdObjectID

Returns Promise<number>
The id of the new created Revolve or null.

deleteFeature#

Deletes feature object and its reference in operation sequence.

Declaration

async (drawingId: DrawingID, id: ObjectID): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
idObjectID

Returns Promise<void>

deleteDimensions#

Deletes dimensions

Declaration

async (drawingId: DrawingID, ids: ObjectID[]): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
idsObjectID[]

Returns Promise<void>

getFeatureByName#

Returns the id of the feature with name = featureName which is located in solid set.

Declaration

async (drawingId: DrawingID, productId: ObjectID, featureName: string | null): Promise<number>

Params

NameTypeDefaultDescription
drawingIdDrawingIDThe drawing id.
productIdObjectIDProduct (part) to look for the feature in its solid set
featureNamestring l nullName of the feature to look for

Returns Promise<number>

linkWithExpression#

Connects expression in ExpressionSet with dimensional constraints in sketcher or parameter in feature.

Declaration

async (drawingId: DrawingID, objectId: ObjectID, expressionName: string, parameterName: string): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingIDThe drawing id.
objectIdObjectIDId of dimension or feature object
expressionNamestringExpression name
parameterNamestringParameter in feature which will be connected to expression

Returns Promise<void>

newPart#

Clears the drawing and creates a new part

Declaration

async (drawingId: DrawingID, name: string): Promise<number>

Params

NameTypeDefaultDescription
drawingIdDrawingIDThe drawing id.
namestringName of the new part

Returns Promise<number>

openFeature#

Moves GhostRollbackBar to the position before passed feature, sets relevant solids' visibility.

Declaration

async (drawingId: DrawingID, featureId: ObjectID): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
featureIdObjectID

Returns Promise<void>

operationMoveBefore#

Moves RollbackBar to the position before passed feature (backwards or forwards), sets relevant solids' visibility, if OperationSequence.isDirty = TRUE and forwards(to end direction) then OperationSequence.GenerateSequence ("Recalc") will be called

Declaration

async (drawingId: DrawingID, partId: ObjectID, featureId: ObjectID): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
partIdObjectID
featureIdObjectID

Returns Promise<void>

operationMoveToEnd#

Moves RollbackBar to the end of OperationSequence and sets relevant solids' visibility, if OperationSequence.isDirty = TRUE then OperationSequence.GenerateSequence ("Recalc") will be called

Declaration

async (drawingId: DrawingID, partId: ObjectID): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
partIdObjectID

Returns Promise<void>

pick#

Declaration

async (drawingId: DrawingID, partId: ObjectID, type: string, points: PointMemValue[]): Promise<number[]>

Params

NameTypeDefaultDescription
drawingIdDrawingID
partIdObjectID
typestring
pointsPointMemValue[]

Returns Promise<number[]>

unlinkExpression#

Unlinks expression from dimensional constraints in sketcher or parameter in feature

Declaration

async (drawingId: DrawingID, objectId: ObjectID, parameterName: string): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
objectIdObjectID
parameterNamestring

Returns Promise<void>

updateBooleanOperation#

Sets entities on BooleanOperation This method can be used to complete the boolean operation, if CreateBooleanOperation was used to only create the operation without passing entities or to change the operation entities when editing operation.

Declaration

async (drawingId: DrawingID, operationId: ObjectID, type: BooleanOperationType, entities: ObjectID[]): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
operationIdObjectID
typeBooleanOperationType
entitiesObjectID[]

Returns Promise<void>

updateBox#

Updates box feature

Declaration

async (drawingId: DrawingID, featureId: ObjectID, references: ObjectID[], width: APIParam<number>, length: APIParam<number>, height: APIParam<number>): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
featureIdObjectID
referencesObjectID[]
widthAPIParam<number>
lengthAPIParam<number>
heightAPIParam<number>

Returns Promise<void>

updateChamfer#

Updates Chamfers - sets parameters, handles references

Declaration

async (drawingId: DrawingID, featureId: ObjectID, type: ChamferType, references: GraphicID[], distance1: APIParam<number>, distance2: APIParam<number>, angle: APIParam<number>): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
featureIdObjectID
typeChamferType
referencesGraphicID[]
distance1APIParam<number>
distance2APIParam<number>
angleAPIParam<number>

Returns Promise<void>

updateCone#

Updates cone feature

Declaration

async (drawingId: DrawingID, featureId: ObjectID, references: ObjectID[], bDiameter: APIParam<number>, tDiameter: APIParam<number>, height: APIParam<number>): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
featureIdObjectID
referencesObjectID[]
bDiameterAPIParam<number>
tDiameterAPIParam<number>
heightAPIParam<number>

Returns Promise<void>

updateCylinder#

Updates cylinder feature

Declaration

async (drawingId: DrawingID, featureId: ObjectID, references: ObjectID[], diameter: APIParam<number>, height: APIParam<number>): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
featureIdObjectID
referencesObjectID[]
diameterAPIParam<number>
heightAPIParam<number>

Returns Promise<void>

updateExpressions#

Updates the expressions of multiple parts Expression objects with name names[i] will be updated with expressions[i] formula. Thus their length should match! Expression objects with name toDeleteList[j] will be deleted.

Declaration

async (drawingId: DrawingID, expressions: ExpressionParam[]): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
expressionsExpressionParam[]

Returns Promise<void>

updateExtrusion#

Updates extrusion feature.

Declaration

async (drawingId: DrawingID, featureId: ObjectID, selectedIds: ObjectID[], type: ExtrusionType, limit1: APIParam<number>, limit2: APIParam<number>, taperAngle: APIParam<number>, direction: APIParam<PointMemValue>, capEnds: 0 | 1): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
featureIdObjectID
selectedIdsObjectID[]
typeExtrusionType
limit1APIParam<number>
limit2APIParam<number>
taperAngleAPIParam<number>
directionAPIParam<PointMemValue>
capEnds0 l 1

Returns Promise<void>

updateImport#

Updates Import - Removes old solids, sets new imported ones, and renames the feature.

Declaration

async (drawingId: DrawingID, featureId: ObjectID, stream: any, fileFormat: 'stp' | 'step', fileName: string): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingIDThe drawing id.
featureIdObjectIDId of the import feature
streamanyGeometry stream
fileFormat'stp' l 'step'Supported file formats are: 'stp', 'step'
fileNamestring

Returns Promise<void>

updateFillet#

Updates Fillets - sets parameters, handles references.

A reference can be either a classcad object of type CC_Brepreference or the BrepId (edgeId, faceId, etc) of such an object.

Declaration

async (drawingId: DrawingID, featureId: ObjectID, references: GraphicID[], radius: APIParam<number>): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
featureIdObjectID
referencesGraphicID[]
radiusAPIParam<number>

Returns Promise<void>

updatePattern#

Updates pattern feature - sets parameters, handles references, does recalc.

Declaration

async (drawingId: DrawingID, operationId: ObjectID, solidObjectsToPattern: ObjectID[], references: GraphicID[], params: [
0 | 1,
APIParam<number>,
APIParam<number>,
0 | 1
], references2: GraphicID[] | null, params2: [
0 | 1,
APIParam<number>,
APIParam<number>
] | null): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingIDThe drawing id.
operationIdObjectIDId of the operation
solidObjectsToPatternObjectID[]Solid objects for the operation
referencesGraphicID[]Selected vertices or points for the 1st direction
params[0 l 1, APIParam<number>, APIParam<number>, 0 l 1][inverted, distanceOrAngle, count, merged], where inverted - 0 or 1 - determines the 1st direction of the pattern; distanceOrAngle - distance (LinearPattern) or angle (CircularPattern) between consecutive copied elements over the 1st direction; count - number of copies over the 1st direction (including the original element); merged - 0 or 1 - determines whether the copies will be merged into a single solid (1) or separate solids (0)
references2GraphicID[] l nullSelected vertices or points for the 2nd direction (optional for LinearPattern)
params2[0 l 1, APIParam<number>, APIParam<number>] l null[inverted2, distance2, count2] (optional for LinearPattern), where inverted2 - 0 or 1 - determines the 2nd direction of the pattern; distance2 - distance between consecutive copied elements over the 2nd direction; count2 - number of copies over the 2nd direction (including the original element);

Returns Promise<void>

updateMirror#

Updates mirror feature.

Declaration

async (drawingId: DrawingID, featureId: ObjectID, solidObjectsToMirror: ObjectID[], references: ObjectID[]): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingIDThe drawing id.
featureIdObjectIDId of the mirror operation
solidObjectsToMirrorObjectID[]Ids of the solids to be mirrored
referencesObjectID[]Ids of plane(s) or face(s)

Returns Promise<void>

updateRevolve#

Updates revolve feature.

Declaration

async (drawingId: DrawingID, featureId: ObjectID, selectedIds: ObjectID[], axisIds: ObjectID[], angle1: APIParam<number>, angle2: APIParam<number>, inverted: 0 | 1): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingIDThe drawing id.
featureIdObjectIDId of the feature
selectedIdsObjectID[]Ids of curves
axisIdsObjectID[]Ids of the axis entities
angle1APIParam<number>Revolve start angle
angle2APIParam<number>Revolve end angle
inverted0 l 10 or 1 - determines the direction (clockwise / counterclockwise) of revolve

Returns Promise<void>

updateSlice#

Updates slice feature.

Declaration

async (drawingId: DrawingID, featureId: ObjectID, solidObjectsToSlice: ObjectID[], plane: ObjectID, sideFlag: 0 | 1): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingIDThe drawing id.
featureIdObjectIDId of the operation
solidObjectsToSliceObjectID[]Array of solid objects to be sliced
planeObjectIDSelected workplane
sideFlag0 l 10 or 1 - determines which side of the solid remains and which one is culled

Returns Promise<void>

updateSliceBySheet#

Updates slice by sheet feature.

Declaration

async (drawingId: DrawingID, featureId: ObjectID, solidToCut: ObjectID, sheet: ObjectID, inverted: 0 | 1): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingIDThe drawing id.
featureIdObjectIDId of the operation
solidToCutObjectIDSolid which will be cutted
sheetObjectIDSheet to slice the solidToCut with
inverted0 l 10 or 1 - flag to toggle direction of sheet

Returns Promise<void>

updateSphere#

Updates sphere feature

Declaration

async (drawingId: DrawingID, featureId: ObjectID, references: ObjectID[], radius: APIParam<number>): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
featureIdObjectID
referencesObjectID[]
radiusAPIParam<number>

Returns Promise<void>

updateTransformation#

Updates transformation feature.

Declaration

async (drawingId: DrawingID, featureId: ObjectID, solidObjectsToTransform: ObjectID[], references: ObjectID[], inverted: 0 | 1, distanceOrAngle: APIParam<number>): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingIDThe drawing id.
featureIdObjectIDId of the transformation operation
solidObjectsToTransformObjectID[]Id of the solids to be transformed
referencesObjectID[]Ids of 2 points that define the transformation axis or 2 coordinate systems
inverted0 l 10 or 1 - determines the direction of transformation
distanceOrAngleAPIParam<number>Translation distance or rotation angle

Returns Promise<void>

updateWorkAxis#

Updates WorkAxis - sets parameters, handles references.

Declaration

async (drawingId: DrawingID, workAxisId: ObjectID, axisType: WorkAxisType, references: GraphicID[], position: APIParam<PointMemValue>, direction: APIParam<PointMemValue>, local: boolean): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
workAxisIdObjectID
axisTypeWorkAxisType
referencesGraphicID[]
positionAPIParam<PointMemValue>
directionAPIParam<PointMemValue>
localboolean

Returns Promise<void>

updateWorkCoordSystem#

Updates WorkCoordSystem - sets parameters, handles references.

Declaration

async (drawingId: DrawingID, workCoordSystemId: ObjectID, coordSystemType: WorkCoordSystemType, references: GraphicID[], coordinateSystem: PointMemValue[], offset: APIParam<PointMemValue>, rotation: APIParam<PointMemValue>, inverted: 0 | 1, local: boolean): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
workCoordSystemIdObjectID
coordSystemTypeWorkCoordSystemType
referencesGraphicID[]
coordinateSystemPointMemValue[]
offsetAPIParam<PointMemValue>
rotationAPIParam<PointMemValue>
inverted0 l 1
localboolean

Returns Promise<void>

updateWorkPlane#

Updates WorkPlane - sets parameters, handles references.

Declaration

async (drawingId: DrawingID, workPlaneId: ObjectID, planeType: WorkPlaneType, references: GraphicID[], offset: APIParam<number>, angle: APIParam<number>, position: APIParam<PointMemValue>, normal: APIParam<PointMemValue>, local: boolean): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
workPlaneIdObjectID
planeTypeWorkPlaneType
referencesGraphicID[]
offsetAPIParam<number>
angleAPIParam<number>
positionAPIParam<PointMemValue>
normalAPIParam<PointMemValue>
localboolean

Returns Promise<void>

updateWorkPoint#

Updates WorkPoint - sets parameters, handles references.

Declaration

async (drawingId: DrawingID, workPointId: ObjectID, pointType: WorkPointType, references: GraphicID[], position: APIParam<PointMemValue>, local: boolean): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
workPointIdObjectID
pointTypeWorkPointType
referencesGraphicID[]
positionAPIParam<PointMemValue>
localboolean

Returns Promise<void>

rollback#

moveToEnd#

Moves the rollback bar to the end of the feature list.

Calls

  • Feature.OperationMoveToEnd

Declaration

async (drawingId: DrawingID): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID

Returns Promise<void>

moveBefore#

Moves the rollback bar before the given feature.

Calls

  • Feature.OperationMoveBefore

Declaration

async (drawingId: DrawingID, featureId: ObjectID): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
featureIdObjectID

Returns Promise<void>

calculateMovement#

Calculates the feature id according on the new and the old index of the rollback bar.

Declaration

(oldIndex: number, newIndex: number, featureIds: ObjectID[], offset: number = 4): {
moveTo: 'end' | 'before';
featureId: ObjectID;
index: number;
}

Params

NameTypeDefaultDescription
oldIndexnumberThe old rollback bar index.
newIndexnumberThe new rollback bar index.
featureIdsObjectID[]The feature id list.
offset?number4The number of features at the top of the list that should not be considered by the rollback bar.

Returns { moveTo: 'end' | 'before'; featureId: ObjectID; index: number }
An object in the form { moveTo: 'end' | 'before'; featureId: ObjectId, index: number }. If moveTo is equal to 'end', the end of the list is reached and the featureId will be -1.