Community
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.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Adding collinear constraint to a line with a sketch axis

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
jphalip
216 Views, 4 Replies

Adding collinear constraint to a line with a sketch axis

Hi,

 

I've got a sketch line and would like to constraint it to be collinear with the X axis in the sketch. I can easily do that in the Fusion 360 UI, however I can't figure out how to do it using the Python API.

 

I'm aware of the addCollinear() method, which accepts two SketchLines. However, I'm not sure how to retrieve the sketch's X axis in the first place. Do you know how to get the axis, and then would I be able to pass it to addCollinear() along with my sketch line or should I use a different method?

 

Thanks,

 

Julien

4 REPLIES 4
Message 2 of 5
BrianEkins
in reply to: jphalip

Do you mean one of the component's construction axes? A sketch only has a point at it's origin, but nothing for it's axes.

 

Assuming you mean a construction axis, you'll need to use the Sketch.project method to project it into the sketch, which will create a sketch line that you can use for the constraint.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 3 of 5
jphalip
in reply to: BrianEkins

Oh I see, yes I mean the construction axis.

 

It's interesting, so in the UI I can select "Collinear", then the line, and then the axis. It doesn't seem to create a projection. But perhaps as you suggest the projection is required when using the API. I'll give that a try. Thanks!

Message 4 of 5
BrianEkins
in reply to: jphalip

The UI is automatically doing the projection. If you do it through the UI and then turn off the display of the construction geometry, you'll see the sketch curve that was created. The API doesn't provide this shortcut like the command does.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 5 of 5
jphalip
in reply to: jphalip

Ok that makes sense, thanks!

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