Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Adding Coincident constraints

Message 1 of 6
1819 Views, 5 Replies

Adding Coincident constraints

Hi All


The reference manual states:


GeometricConstraints.addCoincident Method

Parent Object: GeometricConstraints


Creates a new coincident constraint between two entities. The first argument is a sketch point. The second argument is a sketch curve or point.

Defined in namespace "adsk.fusion" and the header file is "adsk/fusion/Sketch/GeometricConstraints.h".


returnValue = geometricConstraints_var.addCoincident(point, entity)

But when I run this

CCC = CC.addCoincident(shank, intersectShank[1])     I get an error stating the add.Coincident needs 3 arguments only 2 given.


I'm trying to set coincident between a cure and project point.  What am I doing wrong


InterectShanks[1] is a projected point.


Cheers, Stephen


Message 2 of 6
in reply to: StephenCim-001

Did you check if the parameter types are correct?


parameter types.PNG

Message 3 of 6
in reply to: Anonymous

I had to add multiple constraints to get it to behave the way I wanted.


first I drew a line , then added a circle by 2 points , using the line end points.

Then added 2 coincident constraints between the line endpoints and circle 

Then I needed to add a midpoint constraint between the line and projected point.


This kept the line and circle locked to the projected point.


Then to finish off I needed to add a vertical constraint to the line to stop it from rotating has I changed it's length and finally a coincident constraint between the circle centre and projected point to keep the circle in place.


But I don't need to add all these constraints when I'm working with the GUI interface ?


Cheers, Stephen


Message 4 of 6
in reply to: StephenCim-001

When you draw a sketch using the UI, it uses your mouse movements to infer the creation of some constraints and automatically creates them.  The API doesn't have this inference information so you have to explicitly create each one.  In the end, it's all the same sketch geometry and constraints regardless of if it's created by the UI or the API.  Once it's created, Fusion doesn't how it was created.

Brian Ekins
Inventor and Fusion 360 API Expert
Message 5 of 6
in reply to: BrianEkins

Thanks for the info Brian, make sense 🙂



Message 6 of 6
in reply to: BrianEkins

Hi @BrianEkins , thanks for your comment.

though you are right about the API not having the ability to infer from mouse movement, there are still some cases where I expected constraints to be created and they where not. 

one such case is when I use 

I would expect some sort of constraints to be applied to the generated lines (perpendicularity IMHO)
but this does not seem to be the case.
I would have at least expected some comment on the documentation of addThreePointRectangle
and perhaps some guidelines as to how to actually create an actual rectangle and not only 4 lines that are temporarily arranged in a rectangular shape. (if i use sketch.sketchDimensions.addDistanceDimension to add length to the first two lines the shape becomes a trapezoid 😞 
anyway , I will try to go based on whats in this thread to add the appropriate constraints.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th

Autodesk Design & Make Report