Select specific profile from sketch

Select specific profile from sketch

pa.haider
Observer Observer
1,952 Views
2 Replies
Message 1 of 3

Select specific profile from sketch

pa.haider
Observer
Observer

Hi,

 

I have just recently started using the Fusion 360 API for Python. I want it to automatically generate a Model that consists of many (~1000) simple extrusions.

 

I can create a sketch, draw a rectangle (using "addTwoPointRectangle") and create an extrusion. However, If I create two or more rectangles in the same sketch, I found that the list "sketch.profiles.item(...)" that I would then use to create the extrusions is not necessarily in the same order as I created the rectangles.

 

Is there any way to specify a rectangle and then later access the profile that corresponds to this specific rectangle?

 

What I currently do as a workaround is create a new sketch for each extrusion, then delete the sketch which gets quite slow for 500+ extrusions.

 

Thanks for your help.

 

 

1,953 Views
2 Replies
Replies (2)
Message 2 of 3

goyals
Autodesk
Autodesk

May be you can assign an attribute to a sketchEntity of profile to identify profile later. Please take a look at this link http://help.autodesk.com/view/fusion360/ENU/?guid=GUID-CD83B86A-1065-4E44-A8AF-08D6573214C8



Shyam Goyal
Sr. Software Dev. Manager
0 Likes
Message 3 of 3

BrianEkins
Mentor
Mentor

There isn't a way to go from the sketch geometry to the profile, but you can go from the profile to the sketch geometry.  With this approach, you can iterate over all of the profiles and for each profile iterate over the ProfileLoop objects of each profile, which in this case there will just be one loop per profile.  Then for each loop iterate over the ProfileCurve objects in each loop.  From each ProfileCurve object you can use the sketchEntity property to get the sketch curve it's derived from.  If that sketch entity matches one of the four lines in the rectangle, then you know that's the profile you're looking for.

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