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: 

Get holes in pattern or mirror

4 REPLIES 4
Reply
Message 1 of 5
DWhiteley
379 Views, 4 Replies

Get holes in pattern or mirror

I am extracting the thread info of holes as well as the brep data of each hole in a pattern or mirror.

At the moment I can only get the properties of the original hole.

Here is a snippet of the code. How can I get the properties of each hole in a pattern or mirror?

 

Ptr<Features> features = comp->features();
Ptr<ThreadFeatures> threads = features->threadFeatures();

Ptr<HoleFeatures> holes = features->holeFeatures();
size_t i = threads->count();
for (size_t j = 0; j < i; ++j)
{
Ptr<ThreadFeature> thread = threads->item(j);
Ptr<ThreadInfo> threadinfo = thread->threadInfo();
Ptr<BaseFeature> basef = thread->baseFeature();
Ptr<BRepFace> bface = thread->inputCylindricalFace();

 

Many thanks in advance, Dave

4 REPLIES 4
Message 2 of 5
prainsberry
in reply to: DWhiteley

I think it's just about taking a different approach.  Get the info from the seed features on the pattern then get the placement information from the pattern and mirror features to compute the values for the rest of the holes.  Since there really isn't a "Hole Feature" in the locations created by the pattern.  Does that work for your application?

 



Patrick Rainsberry
Developer Advocate, Fusion 360
Message 3 of 5
DWhiteley
in reply to: prainsberry

Hi Patrick,

 

I'm really stumped here. There seems to be no way to find out if a hole is in a pattern & to get access to that pattern.

 

Dave

Message 4 of 5
prainsberry
in reply to: DWhiteley

i think the approach would be to kind of go in reverse.   Iterate over any pattern features that may exist in a design, then check if those pattern features contain any hole features you "care" about.

 

in pseudo code:

for rect_pattern in my_design.featuress.rectangularPatternFeatures:
    if rect_pattern.patternEntityType == adsk.fusion.PatternEntityTypes.FeaturesPatternType:
        for pattern_item in rect_pattern.inputEntities:
            if pattern_item.objectType == adsk.fusion.HoleFeature.classType():
                if pattern_item.is.something.I.care.about:
                    count_this()
    elif rect_pattern.patternEntityType == adsk.fusion.PatternEntityTypes.FacesPatternType:
        for pattern_item in rect_pattern.inputEntities:
            if figure_out_if_this_face_is_from_an_important_hole():
                count_this()

 Does that make sense?  If you are worried about if a user did a pattern of "faces" for the holes, you may have to do something tricky, like first iterate the hole features, find the "created" faces, then check if those faces are used in any patterns.  
You may want to take a look at Attributes, as this is a good way to keep track of faces.  You can put attributes on faces that are of concern, then easily check if the attribute exists, or find all faces with a particular attribute.

 

Another completely alternate approach, could be, iterate over all faces of all bodies in a design.  For each face figure out if it is a "hole."  Then get its characteristics.  



Patrick Rainsberry
Developer Advocate, Fusion 360
Message 5 of 5
DWhiteley
in reply to: prainsberry

That pointed me in the right direction. Many thanks for taking the time to assist me.

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