Sketch Object

Derived from: Base Object
Defined in namespace "adsk::fusion" and the header file is <Fusion/Sketch/Sketch.h>

Description

Represents a sketch within a component.

Methods

Name Description
classType Static function that all classes support that returns the type of the class as a string. The returned string matches the string returned by the objectType property. For example if you have a reference to an object and you want to check if it's a SketchLine you can use myObject.objectType == fusion.SketchLine.classType().
copy Copies the specified sketch entities, applying the specified transform. Any geometric or dimension constraints associated with the entities will automatically be copied, if possible. For example, if there is a horizontal dimension and the transform defines a rotation then it will not be included in the result. This same behavior can be seen when performing a copy/paste operation in the user interface.
createForAssemblyContext Creates or returns a proxy for the native object - i.e. a new object that represents this object but adds the assembly context defined by the input occurrence.
deleteMe Deletes the sketch.
findConnectedCurves Finds the sketch curves that are end connected to the input curve. This can be useful for many cases but is especially useful in gathering the input when creating an offset.
importSVG Imports the contents of an SVG file into the active sketch.
include Creates new sketch curves and points that represent the specified entity as sketch geometry. The sketch geometry is not projected but is created in the same location in space as the input geometry.
intersectWithSketchPlane Intersects the specified entities (BRepBody, BRepFace, BRepEdge, BRepVertex, SketchCurve, ConstructionPoint, ConstructionAxis, and ConstructionPlane) with the sketch plane and creates sketch geometry that represents the intersection.
modelToSketchSpace A specified point in model space returns the equivalent point in sketch space. This is sensitive to the assembly context.
move Moves the specified sketch entities using the specified transform. Transform respects any constraints that would normally prohibit the move.
offset Creates offset curves for the set of input curves. If the offset distance is not provided, the offset distance is defined by the direction point.
project Projects the specified entity or entities onto the x-y plane of the sketch and returns the created sketch entity(s). You can provide either a single entity or an ObjectCollection of multiple entities, which will be projected simultaneously.
projectCutEdges Intersects the specified body with the sketch plane and creates new curves representing the intersection.
projectToSurface Projects the specified set of curves onto the specified set of faces using the specified method of projection. if the projection type is along a vector, then the directionEntity argument must be supplied. if the projectionType is the closest point method, the directionEntity argument is ignored.
redefine Changes which plane the sketch is based on.
saveAsDXF Saves the contents of the sketch to a specified DXF file.
setCenterlineState Method that sets the Centerline state for an array of sketch lines.
setConstructionState Method that sets the Construction state for an array of sketch curves.
sketchToModelSpace A specified point in sketch space returns the equivalent point in model space. This is sensitive to the assembly context.

Properties

Name Description
areConstraintsShown Indicates if the constraints of the sketch are displayed when the sketch is active.
areDimensionsShown Indicates if the dimensions of the sketch are displayed when the sketch is not active (in sketch edit mode)
arePointsShown Indicates if the sketch points in the sketch are displayed. Points that are not connected to any other geometry will continue to be shown.
areProfilesShown Indicates if the profiles of the sketch are displayed
assemblyContext Returns the assembly occurrence (i.e. the occurrence) of this object in an assembly. This is only valid in the case where this is acting as a proxy in an assembly. Returns null in the case where the object is not in the context of an assembly. but is already the native object.
attributes Returns the collection of attributes associated with this face.
baseOrFormFeature This property returns the base or form feature that this sketch is associated with. It returns null in the case where the sketch is parametrically defined and is not related to a base or form feature. It also returns null in the case where the modeling design history is not being captured (direct edit model).
boundingBox Returns the 3D bounding box of the sketch
entityToken Returns a token for the Sketch object. This can be saved and used at a later time with the Design.findEntityByToken method to get back the same token.

When using entity tokens it's important to understand that the token string returned for a specific entity can be different over time. However, even if you have two different token strings that were obtained from the same entity, when you use findEntityByToken they will both return the same entity. Because of that you should never compare entity tokens as way to determine what the token represents. Instead, you need to use the findEntityByToken method to get the two entities identified by the tokens and then compare them.
errorOrWarningMessage Returns the error or warning message in the case where the healthState property returns either WarningFeatureHealthState or ErrorFeatureHealthState. Otherwise this property returns an empty string.
geometricConstraints Returns the sketch constraints collection associated with this sketch. This provides access to the existing sketch constraints and supports the creation of new sketch constraints.
healthState Returns the current health state of this sketch.
isComputeDeferred Temporarily turns off the compute of the sketch. This is used to increase the performance as sketch geometry is created. Once the sketch is drawn the this property should be set to false to allow the sketch to recompute. This setting is not saved by the file and is always false when a file is opened.
isConstructionGeometryShown Gets and sets whether construction geometry in the sketch is displayed. This provides access to the "Construction Geometries" setting in the "SKETCH PALETTE".
isFullyConstrained Indicates if this sketch is fully constrained.
isLightBulbOn Gets and set if the light bulb beside the sketch node in the browser is on or not. Parent nodes in the browser can have their light bulb off which affects all of their children so this property does not indicate if the body is actually visible, just that it should be visible if all of it's parent nodes are also visible. Use the isVisible property to determine if it's actually visible.
isModelSliced Gets and sets whether the model is sliced along the sketch plane when this sketch is active. This provides access to the "Slice" setting in the "SKETCH PALETTE".
isParametric Indicates if this sketch is parametric or not. For parametric sketches, you can also get the construction plane or face it is associative to using the ReferencePlane property.
isProjectedGeometryShown Gets and sets whether projected geometry in the sketch is displayed. This provides access to the "Projected Geometries" setting in the "SKETCH PALETTE".
isValid Indicates if this object is still valid, i.e. hasn't been deleted or some other action done to invalidate the reference.
isVisible Gets if this sketch is currently visible in the graphics window. Use the isLightBulbOn to change if the light bulb beside the sketch node in the browser is on or not. Parent nodes in the browser can have their light bulb off which affects all of their children. This property indicates the final result and whether this body is actually visible or not.
name Gets and sets the name of this sketch as seen in the browser and timeline.
nativeObject The NativeObject is the object outside the context of an assembly and in the context of it's parent component. Returns null in the case where this object is not in the context of an assembly but is already the native object.
objectType This property is supported by all objects in the API and returns a string that contains the full name (namespace::objecttype) describing the type of the object.

It's often useful to use this in combination with the classType method to see if an object is a certain type. For example: if obj.objectType == adsk.core.Point3D.classType():
origin Returns the origin point of the sketch in model space.
originPoint Returns the sketch point that was automatically created by projecting the origin construction point into the sketch.
parentComponent Returns the parent Component.
profiles Returns the profiles currently computed for the sketch.
referencePlane Gets and sets the construction plane or planar face the sketch is associated to. This is only valid when the IsParametric property is True otherwise this returns null and setting the property will fail.

Setting this property is the equivalent of the Redefine command.
revisionId Returns the current revision ID of the sketch. This ID changes any time the sketch is modified in any way. By getting and saving the ID when you create any data that is dependent on the sketch, you can then compare the saved ID with the current ID to determine if the sketch has changed to know if you should update your data.
sketchCurves Returns the sketch curves collection associated with this sketch. This provides access to the existing sketch curves which is all geometry in the sketch except for sketch points. It is through this collection that new sketch geometry gets created.
sketchDimensions Returns the sketch dimensions collection associated with this sketch. This provides access to the existing sketch dimensions and supports the creation of new sketch dimensions.
sketchPoints Returns the sketch points collection associated with this sketch. This provides access to the existing sketch points and supports the creation of new sketch points.
sketchTexts Returns the sketch text collection associated with this sketch. This provides access to existing text and supports the creation of new text.
timelineObject Returns the timeline object associated with this sketch.
transform Gets and sets the transform of the sketch with respect to model space. This defines the transform from the parent component space to the sketch space. For example, if you have point coordinates in the space of the parent component and apply this transform it will result in the coordinates of the equivalent position in sketch space. The transform is sensitive to the assembly context. Setting the transform will fail in the case where the sketch is parametric
xDirection Returns the X direction of the sketch as defined in model space.
yDirection Returns the Y direction of the sketch as defined in model space.

Accessed From

BaseFeature.sketches, CircularPatternConstraint.parentSketch, CoincidentConstraint.parentSketch, CoincidentToSurfaceConstraint.parentSketch, CollinearConstraint.parentSketch, ConcentricConstraint.parentSketch, EqualConstraint.parentSketch, GeometricConstraint.parentSketch, HorizontalConstraint.parentSketch, HorizontalPointsConstraint.parentSketch, LineOnPlanarSurfaceConstraint.parentSketch, LineParallelToPlanarSurfaceConstraint.parentSketch, MidPointConstraint.parentSketch, OffsetConstraint.parentSketch, ParallelConstraint.parentSketch, PerpendicularConstraint.parentSketch, PerpendicularToSurfaceConstraint.parentSketch, PolygonConstraint.parentSketch, Profile.parentSketch, ProfileCurve.parentSketch, RectangularPatternConstraint.parentSketch, Sketch.createForAssemblyContext, Sketch.nativeObject, SketchAngularDimension.parentSketch, SketchArc.parentSketch, SketchCircle.parentSketch, SketchConcentricCircleDimension.parentSketch, SketchConicCurve.parentSketch, SketchControlPointSpline.parentSketch, SketchCurve.parentSketch, SketchDiameterDimension.parentSketch, SketchDimension.parentSketch, SketchDistanceBetweenLineAndPlanarSurfaceDimension.parentSketch, SketchDistanceBetweenPointAndSurfaceDimension.parentSketch, SketchEllipse.parentSketch, SketchEllipseMajorRadiusDimension.parentSketch, SketchEllipseMinorRadiusDimension.parentSketch, SketchEllipticalArc.parentSketch, SketchEntity.parentSketch, Sketches.add, Sketches.addToBaseOrFormFeature, Sketches.addWithoutEdges, Sketches.item, Sketches.itemByName, SketchFittedSpline.parentSketch, SketchFixedSpline.parentSketch, SketchLine.parentSketch, SketchLinearDiameterDimension.parentSketch, SketchLinearDimension.parentSketch, SketchOffsetCurvesDimension.parentSketch, SketchOffsetDimension.parentSketch, SketchPoint.parentSketch, SketchRadialDimension.parentSketch, SketchTangentDistanceDimension.parentSketch, SketchText.parentSketch, SmoothConstraint.parentSketch, SymmetryConstraint.parentSketch, TangentConstraint.parentSketch, VerticalConstraint.parentSketch, VerticalPointsConstraint.parentSketch

Samples

Name Description
API Sample that demonstrates creating sketch lines in various ways. Demonstrates several ways to create sketch lines, including as the result of creating a rectangle.
Loft Feature API Sample Demonstrates creating a new loft feature.
Patch Feature API Sample Demonstrates creating a new patch feature.
Simple Extrusion Sample Creates a new extrusion feature, resulting in a new component.
Simple Revolve Feature Sample Creates a new revolve feature, resulting in a new component.

Version

Introduced in version August 2014