vcFeature

vcFeature is the base class for all types of features in a component.

Hierarchy

Only Geometry and Frame features have a specific implementations. For example, a vcGeometry type object and its vcGeometryContainer type property can be used to create custom geometry. All other features can be manipulated as vcFeature type objects.

vcFeature

vcFrameFeature

vcGeometryFeature

Features can represent geometry loaded from a CAD file, generated from a primitive or the result of an operation applied to subfeatures. The result of a feature tree evaluation is placed into the geometry container of a vcNode object. This process is governed by properties in feature objects, which are accessible through vcFeature.

Common Properties

The following properties are common in all feature types.

Name Type Access Description
Children List of vcFeature R Gets a list of feature's immediate child features.
Name String RW Defines the name of feature.
NodePositionMatrix vcMatrix R Gets the position matrix of the feature relative to its node's coordinate system.
Parent vcFeature R Gets the parent of this feature in the node feature tree.

If the feature is root feature, return value is None.

PhysicsCollider Enumeration RW Defines the type of collider used by the feature for physics.

Note: A feature inherits the collider of its parent feature.

See Collider Constants for more information.

PositionMatrix vcMatrix RW Defines the position matrix of this feature relative to its parent feature's coordinate system.
Properties List of vcProperty R Gets a list of all properties in feature.
Type Enumeration R Gets the feature type.

See Feature Constants for more information.

Visible Boolean RW Turns on/off the visibility of the frame in the 3D world.

Feature Specific Properties

Angular Clone

Name Type Access Description
Count Expression (integer) RW Defines an expression that when evaluated returns the number of times to clone the feature's subtree.

0
No geometry is rendered.

1
The original geometry of the feature's subtree is rendered.

1+n
The original geometry is rendered and cloned n amount of times.

When evaluated, the expression should return an integer.

Offset Expression (vector) RW Defines an expression that when evaluated returns a vector used to offset the direction of each clone from one another.
Step Expression (real) RW Defines an expression that when evaluated returns the angular distance used to offset each clone from one another.

Block

Name Type Access Description
Height Expression (real) RW Defines an expression that when evaluated returns the height of the block projected along its Z-axis.
Length Expression (real) RW Defines an expression that when evaluated returns the length of the block projected along its X-axis.
Material vcMaterial RW Defines the material of the block.
Width Expression (real) RW Defines an expression that when evaluated returns the width of the block projected along its Y-axis.

Boolean

Name Type Access Description
Operation Enumeration RW

Defines how the geometry is visualized.

Material vcMaterial RW Defines the material.

Cone

Name Type Access Description
BottomRadius Expression (real) RW Defines an expression that when evaluated returns the bottom radius of the cone.
Caps Boolean RW Turns on/off the rendering of caps for the cone.
EndSweep Expression (real) RW Defines an expression that when evaluated returns the angle where the cone's geometry is swept to relative to the cone's center.
Height Expression (real) RW Defines an expression that when evaluated returns the height of the cone projected along its Z-axis.
Material vcMaterial RW Defines the material of the cone.
Sections Expression (integer) RW Defines an expression that when evaluated returns the number of sections (sides) generated for the cone.
StartSweep Expression (real) RW Defines an expression that when evaluated returns the angle where the cone's geometry is swept from relative to the cone's center.
TopRadius Expression (real) RW Defines an expression that when evaluated returns the top radius of the cone.

Cylinder

Name Type Access Description
Caps Boolean RW Turns on/off the rendering of caps for th cylinder.
EndSweep Expression (real) RW Defines an expression that when evaluated returns the angle the cylinder's geometry is swept to relative to the cylinder's center.
Height Expression (real) RW Defines an expression that when evaluated returns the height of the cylinder projected along its Z-axis.
Material vcMaterial RW Defines the material of the cylinder.
Radius Expression (real) RW Defines an expression that when evaluated returns the radius of the cylinder.
Sections Expression (integer) RW Defines an expression that when evaluated returns the number of sections (sides) generated for the cylinder.
StartSweep Expression (real) RW Defines an expression that when evaluated returns the angle the cylinder's geometry is swept from relative to the cylinder's center.

Extrude

Name Type Access Description
Direction Expression (vector) RW Defines an expression that when evaluated returns a vector defining the direction of the extrusion.
Length Expression (real) RW Defines an expression that when evaluated returns the length of the extrusion.
Material vcMaterial RW Defines the material of the extrusion.
ShowBackFaces Boolean RW Turns on/off the rendering of geometry backfaces in the extrusion.

Frame

Name Type Access Description
UseAsGuide Integer RW Defines if the frame can be selected when adding dimensions in the Drawing view.

Linear Clone

Name Type Access Description
Count Expression (integer) RW Defines an expression that when evaluated returns the number of times to clone the feature's subtree.

0
No geometry is rendered.

1
The original geometry of the feature's subtree is rendered.

1+n
The original geometry is rendered and cloned n amount of times.

When evaluated, the expression should return an integer.

Direction Expression (vector) RW Defines an expression that when evaluated returns a vector used to offset the direction of each clone from one another.
Step Expression (real) RW Defines an expression that when evaluated returns the linear distance used to offset each clone from one another.

Mirror

Name Type Access Description
HideOriginal Boolean RW Turns on/off the visibility of feature being mirrored.
Offset Expression (vector) RW Defines an expression that when evaluated returns a vector/the axis of reflection, for example (1,0,0) would reflect along X-axis.

Plane

Name Type Access Description
Size Expression (real) RW Defines an expression that when evaluated returns the length and width of the plane.

Python Feature

Name Type Access Description
Script String RW Defines the code of the Python feature.

Revolve

Name Type Access Description
Caps Boolean RW Turns on/off the rendering of caps for revolved geometry.
Material vcMaterial RW Defines the material of revolved geometry.
RevolveAngle Expression (real) RW Defines an expression that when evaluated returns the angle for revolving geometry.
RevolveAxis Expression (vector) RW Defines an expression that when evaluated returns a vector/direction for revolving geometry, for example (0,0,1) would revolve geometry around Z-axis.
RevolveOffset Expression (real) RW Defines an expression that when evaluated returns an offset for revolved geometry.
Reverse Boolean RW Turns on/off the inverting of revolved geometry.
Sections Expression (real) RW Defines an expression that when evaluated returns the number of sections/sides for revolved geometry.

Sphere

Name Type Access Description
Caps Boolean RW Turns on/off the rendering of caps for the sphere.
EndSweep Expression (real) RW Defines an expression that when evaluated returns the end angle for sweeping geometry.
Material vcMaterial RW Defines the material of the sphere.
Radius Expression (real) RW Defines an expression that when evaluated returns the radius of the sphere.
Sections Expression (integer) RW Defines an expression that when evaluated returns the number of sections/sides along the longitude of swept geometry.
Spans Expression (integer) RW Defines an expression that when evaluated returns the number of sections/sides between the equator and poles of swept geometry.
StartSweep Expression (real) RW Defines an expression that when evaluated returns the starting angle for sweeping geometry.

Switch

Name Type Access Description
Choice Expression (integer) RW Defines an expression that when evaluated returns which immediate child of the switch to render in 3D world.

A zero value selects the switch, thereby not rendering any of its subfeatures. That is, indexing starts at one.

Text

Name Type Access Description
IsFloating Boolean RW Defines if the text floats freely in 3D world or is anchored directly to feature location.
IsReadOnly Boolean   RW Defines if the text is read-only and locked from editing.
Material vcMaterial RW Defines the material of the text.

Size

Expression (real)

RW Defines the scale factor for sizing rendered text.

Text

String   RW Defines an expression that when evaluated returns the text to be visualized in the 3D world.

Transform

Name Type Access Description
Expression Expression (matrix) RW Defines an expression for transforming subfeatures.

Wedge

Name Type Access Description
BiggerHeight Expression (real) RW Defines an expression that when evaluated returns the Z-axis height of the wedge's back end.
BiggerLength Expression (real) RW Defines an expression that when evaluated returns the X-axis length of the wedge's bottom.
Material vcMaterial RW Defines the material of the wedge.
MirrorBack Boolean RW Turns on/off the mirroring of the wedge along its X-axis.
MirrorDown Boolean RW Turns on/off the mirroring of the wedge along its negative Z-axis.
SmallerHeight Expression (real) RW Defines an expression that when evaluated returns the Z-axis height of the wedge's front end.
SmallerLength Expression (real) RW Defines an expression that when evaluated returns the X-axis length of the wedge's top.
Width Expression (real) RW Defines an expression that when evaluated returns the Y-axis width of the wedge.

Methods

Name Return Type Parameters Description
attach Boolean vcFeature feature, [Boolean rebuild] Attaches a given feature to this feature, thereby allowing you to reorder the containing node's feature tree.

The given feature cannot be the root feature or parent of this feature.

An optional rebuild argument can be used to control the rebuilding of geometry for an attached feature. Default is False value and will not rebuild geometry, whereas a True value will rebuild geometry.

Returns True if attachment is successful; otherwise returns False.

clone vcFeature None Copies the feature to the same level in containing node's feature tree, and then returns the clone.
collapse None None Collapses the feature into a new Geometry feature.

The original feature will be deleted, thereby you need to get handle for the new feature.

createFeature vcFeature Enumeration type, String name Adds a new feature of a given type and name as a child of this feature.

See Feature Constants for more information.

createProperty vcProperty Enumeration type, String name, [Enumeration constraints] Adds a new property of a given type and name to the feature.

An optional constraints argument can be given to define constraints for the new property, which must be done at the time of creation.

See Property Constants for more information.

delete Boolean None Deletes the feature and its subfeatures, and then returns True; otherwise returns False.
deleteProperty None vcProperty property Deletes a given property from the feature.
getFeature vcFeature None Returns the feature.
getProperty vcProperty String name Returns a property of the feature that matches the given name; otherwise returns None.
rebuild None None Rebuilds the feature and its subfeature tree.

Examples

Example. Create features and rebuild geometry

from vcScript import *

app = getApplication()

comp = app.findComponent("MyComponent")

transform = comp.findFeature("Transform")

transform.Expression = 'Tx(400.0)'

block = transform.createFeature(VC_BLOCK, "MyBlock")

# create feature under another feature

cylinder = comp.RootFeature.createFeature(VC_CYLINDER, "MyCylinder")

#create feature under the tree root

cylinder.Height = '300'

#expression properties are set as strings

cylinder.Radius = '150'

cylinder.Sections = '24'

cylinder.rebuild()

app.render()