vcSnapCommand
vcSnapCommand provides options for handling the position and orientation of 3D world points selected using the interactiveSnap command.
Inherits: vcCommand
Properties
| Name | Type | Access | Description |
| Snap | Boolean | RW | Turns on or off the ability to snap to a target. |
| SnapOnCircleCenter | Boolean | RW | Turns on or off the center of circles as potential targets. |
| SnapOnCurve | Boolean | RW | Turns on or off curves as potential targets. |
| SnapOnEdge | Boolean | RW | Turns on or off edges as potential targets. |
| SnapOnEdgeCenter | Boolean | RW | Turns on or off the midpoint of edges as potential targets. |
| SnapOnFaceCenter | Boolean | RW | Turns on or off the center of faces as potential targets. |
| SnapOnFrame | Boolean | RW | Turns on or off frames as potential targets. |
| SnapOnNodeCenter | Boolean | RW | Turns on or off the center of nodes as potential targets. |
| SnapOnNodeOrigin | Boolean | RW | Turns on or off the origin of nodes as potential targets. |
| SnapOnPoint | Boolean | RW | Turns on or off points on lines and polygons, for example corner points, as potential targets. |
| SnapOnPolygon | Boolean | RW | Turns on or off polygons as potential targets. |
| SnapOnSurface | Boolean | RW | Turns on or off faces as potential targets. |
| TargetAvailable | Boolean | R | Indicates if pointing at an available target in the 3D world. |
| TargetCircleCenterAvailable | Boolean | R | Indicates if center of a circle is available as a target. |
| TargetCurve | List of vcVector | R | Provides a list of positions for a target curve in World coordinate system. |
| TargetCurveAvailable | Boolean | R | Indicates if a curve is available as a target. |
| TargetCurveIndex | Integer | R | Indicates the index position of a target curve in a geometry set. |
| TargetFaceCenterAvailable | Boolean | R | Indicates if the center of a face is available as a target. |
| TargetGeoset | vcGeometrySet | R | Indicates the geometry set of a target. |
| TargetLocked | Boolean | R | Indicates if a target has been selected in the 3D world. |
| TargetMatrix | vcMatrix | R | Indicates the position and orientation matrix for target in World coordinates. |
| TargetMatrixAvailable | Boolean | R | Indicates if the position and orientation matrix for a target is available. (only valid for frame type targets) |
| TargetNode | vcNode | R | Indicates the node containing a target. |
| TargetNormal | vcVector | R | Indicates the normal vector of a target in World coordinates. |
| TargetNormalAvailable | Boolean | R | Indicates if the normal vector of a target is available. (only valid for polygon and frame type targets). |
| TargetPosition | vcVector | R | Indicates the position of a target in World coordinates. |
| TargetPrimitive | vcPrimitive | R | Indicates the geometry primitive object of a target. |
| TargetSurfaceAvailable | Boolean | R | Indicates if the surface of a target is available. |
| TargetSurfaceIndex | Integer | R | Indicates the index position of a target surface in a component, for example the faces of a cube. |
Methods
| Name | Return Type | Parameters | Description |
| clear | None | None | Resets the command and clears its target data. |
Events
| Name | Parameters | Description |
| OnTargetAvailable | vcSnapCommand command | Triggered when pointer is hovering over a valid target in 3D world.
The command itself as passed as an argument, thereby allowing you to access its updated properties. |
| OnTargetSet | vcSnapCommand command | Triggered when a valid target has been selected in 3D world.
The command itself as passed as an argument, thereby allowing you to access its updated properties. |
Examples
Example. Execute snap command and use event handlers
| from vcScript import * app = getApplication() snap = app.findCommand('interactiveSnap') def TargetPicked(args): global snap pos = snap.TargetPosition print 'Picked: %.2f %.2f %.2f' % (pos.X, pos.Y, pos.Z) if snap.TargetAvailable: print 'Starting picking!' snap.execute() else: print "Finished snapping!" def StartPicking(): global snap snap.clear() snap.SnapOnPoint = True snap.SnapOnEdge = True snap.SnapOnPolygon = True snap.SnapOnSurface = True snap.SnapOnNodeCenter = False snap.SnapOnNodeOrigin = False snap.OnTargetSet = TargetPicked print 'Starting picking!' snap.execute() def StopPicking(): global snap snap.clear() StartPicking() #StopPicking() |