Announcements

Community notifications may experience intermittent interruptions between 10–12 November during scheduled maintenance. We appreciate your patience.

Adding Coincident constraints

Adding Coincident constraints

StephenCim-001
Advocate Advocate
2,874 Views
5 Replies
Message 1 of 6

Adding Coincident constraints

StephenCim-001
Advocate
Advocate

Hi All

 

The reference manual states:

 

GeometricConstraints.addCoincident Method

Parent Object: GeometricConstraints

Description

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".

Syntax

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

 

 
0 Likes
Accepted solutions (1)
2,875 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable

Did you check if the parameter types are correct?

 

parameter types.PNG

Message 3 of 6

StephenCim-001
Advocate
Advocate
Accepted solution

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

 

0 Likes
Message 4 of 6

BrianEkins
Mentor
Mentor

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
Website/Blog: https://EkinsSolutions.com
Message 5 of 6

StephenCim-001
Advocate
Advocate

Thanks for the info Brian, make sense 🙂

 

 

0 Likes
Message 6 of 6

epeleg
Participant
Participant

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 

sketch.sketchCurves.sketchLines.addThreePointRectangle(p1,p2,p3)
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.
 
0 Likes