GeometricConstraints Object

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

Description

A collection of all of the geometric constraints in a sketch. This object also supports the methods to create new geometric constraints.

Methods

Name Description
addCircularPattern Creates a new circular pattern in the sketch.
addCoincident Creates a new coincident constraint between two entities. The first argument is a sketch point. The second argument is a sketch curve or point.
addCoincidentToSurface Creates a new coincident constraint between the sketch point and surface. This forces the point to lie on the surface.
addCollinear Creates a new collinear constraint between two lines.
addConcentric Creates a new concentric constraint between two circles, arcs, ellipses, or elliptical arcs.
addEqual Creates a new equal constraint between two lines, or between arcs and circles.
addHorizontal Creates a new horizontal constraint on a line.
addHorizontalPoints Creates a new horizontal constraint between two points.
addLineOnPlanarSurface Creates a new constraint that forces the sketch line to lie on a planar surface.
addLineParallelToPlanarSurface Creates a new parallel constraint between a sketch line and a planar surface that will constrain the line to lie on a plane parallel to the specified surface.
addMidPoint Creates a new midpoint constraint between a point and a curve.
addOffset Creates an offset constraint, which results in creating a new set of curves that are an offset of the input curves. The returned offset constraint provides access to the created curves and the parameter controlling the offset.

The offset direction is implied by the flow direction of the provided curves. For example, if two connected lines are offset, the flow direction is from line 1 to line 2. A positive offset value creates the offset curve to the "right" of the lines and a negative offset goes to the "left". Left and right are evaluated with respect to the geometry. If you are standing on line 1 looking towards line 2 your left and right are the offset left and right. For closed single curves like circles and ellipses their flow direction is always counterclockwise so a positive offset is always to the outsides.
addParallel Creates a new parallel constraint between two lines.
addPerpendicular Creates a new perpendicular constraint between two lines.
addPerpendicularToSurface Creates a new perpendicular constraint that forces the sketch curve to be perpendicular to the specified surface. Line and spline curves are supported.
addRectangularPattern Creates a new rectangular pattern in the sketch.
addSmooth Creates a new smooth constraint between two curves. One of the curves must be a spline. The other curve can be a spline or any other type of curve.
addSymmetry Creates a new symmetry constraint.
addTangent Creates a new tangent constraint between two curves.
addVertical Creates a new vertical constraint on a line.
addVerticalPoints Creates a new vertical constraint between two points.
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().
createCircularPatternInput Creates a CircularPatternConstraintInput object. Use properties and methods on this object to define the circular pattern you want to create and then use the Add method, passing in the CircularPatternConstraintInput object.
createRectangularPatternInput Creates a new RectangularPatternConstraintInput object. Use this object to define the various settings associated with a rectangular pattern in a sketch. Once the pattern is defined you can call the addRectangularPattern method and pass in the input object to create the sketch rectangular pattern.
item Function that returns the specified sketch constraint using an index into the collection.

Properties

Name Description
count Returns the number of constraints in the sketch.
isValid Indicates if this object is still valid, i.e. hasn't been deleted or some other action done to invalidate the reference.
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():

Accessed From

Sketch.geometricConstraints

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.
GeometricConstraints.addConcentric Demonstrates the GeometricConstraints.addConcentric method.

Version

Introduced in version August 2014