Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Trouble with selecting sketch profiles in API

brad.bylls
Collaborator

Trouble with selecting sketch profiles in API

brad.bylls
Collaborator
Collaborator

I am having trouble with selecting the correct profile in a script.

The user creates a plate (rectangular extrude) and then selects a face to create a component on.

That face is used as the sketch plane that the API creates the sketch on.

The problem is, when the API does an extrude of the sketch profile, it picks the outer edges of the plate and not the profile of the sketch.

Can you limit the profiles selected to just those of the sketch only, and not anything else on the sketch plane?

The attached code is what makes the component that bombs out at line 244 because it is looking for edges that don't exist, because the wrong profile has been selected.

Thank you.

Brad Bylls
0 Likes
Reply
Accepted solutions (1)
386 Views
1 Reply
Reply (1)

BrianEkins
Mentor
Mentor
Accepted solution

When you use the Sketches.add method and provide a face as input, the edges of the sketch are automatically projected into the sketch.  This is the default in the UI so that you have those edges available to add constraints and dimensions to.  However, as you've found this isn't always desirable when using the API because you're not typically using these edges and even if you do it's easier to include them yourself so you know which edge is which.  The solution to this is to use the addWithoutEdges method when creating the sketch.  This won't include the face edges so the sketch will only contain the geometry you create.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
1 Like