Get / read out extrude feature of an existing structure

Get / read out extrude feature of an existing structure

holzblattDesign
Contributor Contributor
867 Views
4 Replies
Message 1 of 5

Get / read out extrude feature of an existing structure

holzblattDesign
Contributor
Contributor

Hello,

 

just new in programming with the api of Fusion 360. I am looking for a possibility to read out the distance of an extrusion of an existing component/body. So I don't want to create a new one or append it somewhere, just read out an existing structure like this

 

- Component 1

    - Component 2

        - Body 1

 

I found a lot of samples how to create a new extrusion, but nothing about reading out this specific property. At the moment I iterate through my object tree and check if there is an extrusion:

for occ in occurrences:
        if occ.isVisible:        
            if occ.component.features.extrudeFeatures.count > 0:
                 occ.component.features.extrudeFeatures[0].
     

 

 

For sure, a simple thing, but I didn't fount anything here.

 

Can someone help me please.

 

Thanks.

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

goyals
Autodesk
Autodesk
Accepted solution

May be you can use below scripts to get the distance of an existing extrude feature. In my design I was having only one feature that is why used 0 index but you can search only features which are of extrudeFeature type

 

features = comp.features 

extrude = features[0] 

extentOne = extrude.extentOne 

type(extentOne) 

<class 'adsk.fusion.DistanceExtentDefinition'>

distanceDef = adsk.fusion.DistanceExtentDefinition.cast(extentOne) 

distanceDef.distance.value 



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

holzblattDesign
Contributor
Contributor

Hello goyals,

 

thank you for your fast response and help. That works for me somehow. I go directly to the extrudeFeatures as you mentioned (features.extrudeFeatures) and take there the first index. The two lines before the cast are not really clear for me (type(extentOne) and the class string)? Also it was marked as an error I tried it without and it worked.

 

Thanks a lot for your help!

 

 

0 Likes
Message 4 of 5

goyals
Autodesk
Autodesk

I am glad that it works for you. Following two lines should not be part of script. I just added them to showh  that what is type of extentOne obj. In first line I am using type method and second line is just the output of it. I copied them mistakenly in my previous post.

 

type(extentOne) 

<class 'adsk.fusion.DistanceExtentDefinition'>



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

holzblattDesign
Contributor
Contributor

ok, thanks for this information and help again! My mistake.

 

Have a nice Sunday.

0 Likes