Feature
#
featureAPIProvides functions for interaction with the classcad feature api.
#
rollback#
moveToEndMoves the rollback bar to the end of the feature list.
Calls
- Feature.OperationMoveToEnd
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. |
Returns Promise<void>
#
moveBeforeMoves the rollback bar before the given feature.
Calls
- Feature.OperationMoveBefore
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
featureId | ObjectID | The id of the feature to move the rollback bar before. |
Returns Promise<void>
#
calculateMovementCalculates the feature id according on the new and the old index of the rollback bar.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
oldIndex | number | The old rollback bar index. | |
newIndex | number | The new rollback bar index. | |
featureIds | ObjectID[] | The feature id list. | |
offset? | number | 4 | The 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.
#
closeFeatureMoves GhostRollbackBar back to RollbackBar, sets relevant solids' visibility.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
featureId | ObjectID | The id of the feature to close. |
Returns Promise<void>
#
createFeatureCreates a new (empty) Feature in part.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
partId | ObjectID | The id of the part, where the feature will be added. | |
type | string | Class name of the feature to create. | |
name | string | The name the created feature will get. |
Returns Promise<number>
The id of the new created Feature or null.
#
createNamedCoordSystemCreates new NamedCoordSystem in product and sets its coordinate system.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
productId | ObjectID | The id of the product, where the named coordinate system will be added. | |
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.
#
createNamedPointCreates new NamedPoint in product and sets its position.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
productId | ObjectID | The id of the product, where the named point will be added. | |
name? | string | 'Point' | |
origin? | PointMemValue | { x: 0, y: 0, z: 0 } |
Returns Promise<number>
The id of the new created NamedPoint or null.
#
createWorkGeometryCreates new (default) WorkGeometry in a part
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
partId | ObjectID | Id of the product to which the new work geometry is added | |
type | string | Class of work geometry as string which will be created | |
name | string | Name of the created work geometry object |
Returns Promise<number>
The id of the new created WorkGeometry or null.
#
deleteDimensionsDeletes dimensions
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
ids | ObjectID[] | Ids of the dimensions to delete. |
Returns Promise<void>
#
deleteFeatureDeletes feature object and its reference in operation sequence.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
id | ObjectID | Id of the feature to delete. |
Returns Promise<void>
#
getFeatureByNameReturns the id of the feature with name = featureName which is located in solid set.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
partId | ObjectID | Part to look for the feature | |
featureName | string l null | Name of the feature to look for |
Returns Promise<number>
The id of the found feature
#
linkWithExpressionConnects expression in ExpressionSet with dimensional constraints in sketcher or parameter in feature.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
objectId | ObjectID | Id of dimension or feature object | |
expressionName | string | Expression name | |
parameterName | string | Parameter in feature which will be connected to expression |
Returns Promise<void>
#
newPartClears the drawing and creates a new part
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
name | string | Name of the new part |
Returns Promise<number>
The id of the new part.
#
openFeatureMoves GhostRollbackBar to the position before passed feature, sets relevant solids' visibility.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
featureId | ObjectID | Id of the feature to open |
Returns Promise<void>
#
operationMoveBeforeMoves 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
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
partId | ObjectID | Id of the part where the rollback bar will be moved | |
featureId | ObjectID | Id of the feature to move the rollback bar to |
Returns Promise<void>
#
operationMoveToEndMoves RollbackBar to the end of OperationSequence and sets relevant solids' visibility, if OperationSequence.isDirty = TRUE then OperationSequence.GenerateSequence ("Recalc") will be called
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
partId | ObjectID | Id of the part where the rollback bar will be moved to the end |
Returns Promise<void>
#
pickReturns found vertices, edges or faces depending on given type and points. Given points define where to look for elements.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
partId | ObjectID | Id of the part to pick elements | |
type | string | Type of element to pick, 'vertex' l 'edge' l 'face' | |
points | PointMemValue[] | Points containing 3D coordinates to look for possible element |
Returns Promise<number[]>
Array containing ids of found geometries
#
unlinkExpressionUnlinks expression from dimensional constraints in sketcher or parameter in feature
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
objectId | ObjectID | Id of dimension or feature object | |
parameterName | string | Parameter in feature which will be connected to expression |
Returns Promise<void>
#
updateBooleanOperationSets 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
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
operationId | ObjectID | Id of the boolean operation | |
type | BooleanOperationType | Type of the boolean operation (0= "Union", 1= "Subtraction",2= "Intersection") | |
entities | ObjectID[] | Entities for the operation [entity1,entity2,entity3,...] |
Returns Promise<void>
#
updateBoxUpdates box feature
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
featureId | ObjectID | The id of the box feature to update. | |
references | ObjectID[] | Reference of the work coordinate system to place the box at. | |
width | APIParam<number> | Width of the box. | |
length | APIParam<number> | Length of the box. | |
height | APIParam<number> | Height of the box. |
Returns Promise<void>
#
updateChamferUpdates the chamfer feature
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
featureId | ObjectID | The id of the chamfer feature to update. | |
type | ChamferType | Type of the chamfer | |
references | GraphicID[] | References of the edges to add the chamfers | |
distance1 | APIParam<number> | First distance of the chamfer | |
distance2 | APIParam<number> | Second distance of the chamfer, depends on type if necessary | |
angle | APIParam<number> | Angle of the chamfer, depends on type if necessary |
Returns Promise<void>
#
updateCompositeCurveUpdates composite curve
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
featureId | ObjectID | The id of the composite curve feature to update. | |
references | GraphicID[] | Ids of the selected sketch curves or breps |
Returns Promise<void>
#
updateConeUpdates cone feature
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
featureId | ObjectID | The id of the cone feature to update. | |
references | ObjectID[] | Reference of the work coordinate system to place the cone at. | |
bDiameter | APIParam<number> | Diameter at the bottom of the cone | |
tDiameter | APIParam<number> | Diameter at the top of the cone | |
height | APIParam<number> | Height of the cone |
Returns Promise<void>
#
updateCylinderUpdates cylinder feature
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
featureId | ObjectID | The id of the cylinder feature to update. | |
references | ObjectID[] | Reference of the work coordinate system to place the cylinder at. | |
diameter | APIParam<number> | Diameter of the cylinder | |
height | APIParam<number> | Height of the cylinder |
Returns Promise<void>
#
updateEntityDeletionUpdates the entity deletion feature
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
featureId | ObjectID | Id of the entity deletion feature | |
bodiesToDelete | ObjectID[] | Ids of the entityObjs to delete |
Returns Promise<void>
#
updateExpressionsAdds, updates, or deletes expressions in different parts
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
expressions | ExpressionParam[] | Array of expression objects containing the product id, to add members, to update members and to delete members |
Returns Promise<boolean>
#
updateExtrusionUpdates the extrusion feature
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
featureId | ObjectID | The id of the extusion feature to update | |
selectedIds | ObjectID[] | Array of ids of the sketch contour elements | |
type | ExtrusionType | Type of the extrusion | |
limit1 | APIParam<number> | First limit of the extrusion | |
limit2 | APIParam<number> | Second limit of the extusion, depends on the type if necessary | |
taperAngle | APIParam<number> | Taper angle of the extrusion | |
direction | APIParam<PointMemValue> | Direction of the extrusion, by default {0,0,1} | |
capEnds | 0 l 1 | If true, ends will be capped, else a sheet will be created |
Returns Promise<void>
#
updateFilletUpdates the fillet feature
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
featureId | ObjectID | Id of the feature fillet to update | |
references | GraphicID[] | References of the edges to add the chamfers | |
radius | APIParam<number> | Radius of the fillet |
Returns Promise<void>
#
updateImportUpdates Import - Removes old solids, sets new imported ones, and renames the feature.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
featureId | ObjectID | Id of the import feature | |
stream | any | Geometry stream | |
fileFormat | 'stp' l 'step' | Supported file formats are: 'stp', 'step' | |
fileName | string | Name the import feature will get |
Returns Promise<void>
#
updateMirrorUpdates mirror feature.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
featureId | ObjectID | Id of the mirror operation | |
solidObjectsToMirror | ObjectID[] | Ids of the solids to be mirrored | |
references | ObjectID[] | Ids of plane(s) or face(s) |
Returns Promise<void>
#
updatePatternUpdates pattern feature - sets parameters, handles references, does recalc.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
operationId | ObjectID | Id of the operation | |
solidObjectsToPattern | ObjectID[] | Solid objects for the operation | |
references | GraphicID[] | 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) | |
references2 | GraphicID[] l null | Selected 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>
#
updateRevolveUpdates revolve feature.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
featureId | ObjectID | Id of the feature | |
selectedIds | ObjectID[] | Ids of curves | |
axisIds | ObjectID[] | Ids of the axis entities | |
angle1 | APIParam<number> | Revolve start angle | |
angle2 | APIParam<number> | Revolve end angle | |
inverted | 0 l 1 | 0 or 1 - determines the direction (clockwise / counterclockwise) of revolve |
Returns Promise<void>
#
updateSliceUpdates slice feature.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
featureId | ObjectID | Id of the operation | |
solidObjectsToSlice | ObjectID[] | Array of solid objects to be sliced | |
plane | ObjectID | Selected workplane | |
sideFlag | 0 l 1 | 0 or 1 - determines which side of the solid remains and which one is culled |
Returns Promise<void>
#
updateSliceBySheetUpdates slice by sheet feature.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
featureId | ObjectID | Id of the operation | |
solidToCut | ObjectID | Solid which will be cutted | |
sheet | ObjectID | Sheet to slice the solidToCut with | |
inverted | 0 l 1 | 0 or 1 - flag to toggle direction of sheet |
Returns Promise<void>
#
updateSphereUpdates sphere feature
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
featureId | ObjectID | The id of the sphere feature to update. | |
references | ObjectID[] | Reference of the work coordinate system to place the sphere at. | |
radius | APIParam<number> | Radius of the sphere. |
Returns Promise<void>
#
updateTransformationUpdates transformation feature.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
featureId | ObjectID | Id of the transformation operation | |
solidObjectsToTransform | ObjectID[] | Id of the solids to be transformed | |
references | ObjectID[] | Ids of 2 points that define the transformation axis or 2 coordinate systems | |
inverted | 0 l 1 | 0 or 1 - determines the direction of transformation | |
distanceOrAngle | APIParam<number> | Translation distance or rotation angle |
Returns Promise<void>
#
updateTwistUpdates the twist feature
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
featureId | ObjectID | The id of the twist feature to update | |
selectedIds | ObjectID[] | Array of ids of the sketch contour elements | |
type | ExtrusionType | Type of the twist | |
limit1 | APIParam<number> | First limit of the twist | |
limit2 | APIParam<number> | Second limit of the twist, depends on the type if necessary | |
direction | APIParam<PointMemValue> | Direction of the twist, by default {0,0,1} | |
twistAngle | APIParam<number> | Twist angle of the sketch along height of twist | |
twistCenter | APIParam<PointMemValue> | Point which together with direction defines the twist axis. The actual center/start of the twist is where the defined twist axis intersects the sketch plane. | |
capEnds | 0 l 1 | If true, ends will be capped and a solid is created, else a sheet will be created. |
Returns Promise<void>
#
updateWorkAxisUpdates the work axis
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
workAxisId | ObjectID | The id of the work axis to update | |
axisType | WorkAxisType | Type of the work axis | |
references | GraphicID[] | References for the work axis, needed for all types except 'Custom' | |
position | APIParam<PointMemValue> | Position of axis, only needed if type = 'Custom' | |
direction | APIParam<PointMemValue> | Direction of axis, only needed if type = 'Custom' | |
local | boolean | Boolean specifying if position and direction are global or local to parent |
Returns Promise<void>
#
updateWorkCSysUpdates the work coordinate system
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
workCoordSystemId | ObjectID | The id of the work coordinate system to update. | |
coordSystemType | WorkCoordSystemType | Type of the work coordinate system | |
references | GraphicID[] | Refereneces of origin, first axis and second axis | |
offset | APIParam<PointMemValue> | Offset vector {x,y,z} | |
rotation | APIParam<PointMemValue> | Rotation vector {x,y,z} | |
inverted | 0 l 1 | Inverts the direction of the primary axis |
Returns Promise<void>
#
updateWorkCoordSystemUpdates the work coordinate system
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
workCoordSystemId | ObjectID | The id of the work coordinate system to update. | |
coordSystemType | WorkCoordSystemType | Type of the work coordinate system | |
references | GraphicID[] | Refereneces of origin, first axis and second axis | |
coordinateSystem | PointMemValue[] | Array of points for origin, first axis and second axis, if type is custom | |
offset | APIParam<PointMemValue> | Offset vector {x,y,z} | |
rotation | APIParam<PointMemValue> | Rotation vector {x,y,z} | |
inverted | 0 l 1 | Inverts the direction of the primary axis | |
local | boolean | Boolean specifying if coord system is global or local to parent |
Returns Promise<void>
#
updateWorkPlaneUpdates the work plane
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
workPlaneId | ObjectID | The id of the work plane to update. | |
planeType | WorkPlaneType | Type of the work plane | |
references | GraphicID[] | References for the work plane, needed for all types except 'Custom' | |
offset | APIParam<number> | Offset in normal direction, can be used for all types except 'LinePlaneAndAngle' | |
angle | APIParam<number> | Angle in degrees, needed for type 'LinePlaneAndAngle' | |
position | APIParam<PointMemValue> | Position of plane, only needed if type = 'Custom' | |
normal | APIParam<PointMemValue> | Normal vector of work plane, only needed if type = 'Custom' | |
local | boolean | If true, work plane is set in local coordinates of part |
Returns Promise<void>
#
updateWorkPointUpdates the work point
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
workPointId | ObjectID | The id of the work point to update. | |
pointType | WorkPointType | Type of the work point. | |
references | GraphicID[] | References for the work point, needed for all types except 'Custom' | |
position | APIParam<PointMemValue> | Position of point, only needed if type = 'Custom' | |
local | boolean | If true, work point is set in local coordinates of part |
Returns Promise<void>