Announcements
Autodesk Community will be read-only between April 26 and April 27 as we complete essential maintenance. We will remove this banner once completed. Thanks for your understanding

Adding collinear constraint to a line with a sketch axis

jphalip
Enthusiast Enthusiast
897 Views
4 Replies
Message 1 of 5

Adding collinear constraint to a line with a sketch axis

jphalip
Enthusiast
Enthusiast

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

0 Likes
Accepted solutions (1)
898 Views
4 Replies
Replies (4)
Message 2 of 5

BrianEkins
Mentor
Mentor
Accepted solution

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
0 Likes
Message 3 of 5

jphalip
Enthusiast
Enthusiast

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!

0 Likes
Message 4 of 5

BrianEkins
Mentor
Mentor

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
0 Likes
Message 5 of 5

jphalip
Enthusiast
Enthusiast

Ok that makes sense, thanks!

0 Likes