Get individual Hole Faces from a Patterned Holes

Get individual Hole Faces from a Patterned Holes

amitabhVA4SD
Advocate Advocate
596 Views
8 Replies
Message 1 of 9

Get individual Hole Faces from a Patterned Holes

amitabhVA4SD
Advocate
Advocate

Hello All,

 

Is there a way to get the individual faces from the Patterned Holes?

I need the individual Hole Faces with each Hole of the Patterned Holes (Rectangular, Circular, Mirrored, etc)

 

I followed the steps mentioned in this forum post but I am only able to get the Sketch Points or Points but not the Hole Faces associated with each Hole (created from the Hole Pattern)

https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/vba-module-to-extract-hole-patterns/...

 

Inventor API experts, can you please help?

@MjDeck  @JelteDeJong @@johnsonshiue 

 

Thanks,

Amitabh Mukherjee

 

 

0 Likes
597 Views
8 Replies
Replies (8)
Message 2 of 9

MjDeck
Autodesk
Autodesk

Here's a rule to get the faces of any pattern. It doesn't check to see if the patterned feature is a hole.

It also includes the faces of the parent feature or features. You can take out that code if you don't need it.

Just for demonstration purposes, the faces are selected.

 


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 3 of 9

amitabhVA4SD
Advocate
Advocate

Hi @MjDeck, Thank you for the quick response. I am able to collect all the faces from the Patterned Holes. I am not able to match these collected faces with face internal id from the list of all faces collected from the Solid Body (Topology). I need to find a way to match the 2 entities. I can go the Reference Key and Reference Key Context way but that would be quite demanding on the program as it is document-specific persistent data. Any suggestions?

0 Likes
Message 4 of 9

MjDeck
Autodesk
Autodesk

What is your workflow? Are you using the Face.InternalName?
Do you store a list of internal names, then make a change to the part, and then try to find faces that match the InternalNames in your stored list?


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 5 of 9

amitabhVA4SD
Advocate
Advocate

Yes, I am using Face.InternalName

I do not make any model changes to the part in-between, but I do add a set of Face Attributes during the data collection stage within the Assembly.

Under what circumstance will the InternalName GUID on the face change?

In this Application, I am trying to collect all the Hole Features and the Hole Feature Data along with all the Faces that are associated with this hole.

0 Likes
Message 6 of 9

MjDeck
Autodesk
Autodesk

You know how to get the faces.
But it sounds like you want to be able to be able to identify individual faces so that you can find them later. Is that true?
If you are not changing the definition of the parent hole (add counterbore for instance) or the pattern (number of elements) then you should be able to identify the faces by starting at the PatternFeature. Then get its PatternElements. Each PatternElement has its own Faces collection. There should be a small number of faces in that collection, and the order will not change unless the parent feature definition is changed.

Or, since you're already adding attributes to the faces, why not add a name?


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 7 of 9

amitabhVA4SD
Advocate
Advocate

Yes, @MjDeck that is exactly my need.

I will explore more in the suggested direction and share the findings.

0 Likes
Message 8 of 9

amitabhVA4SD
Advocate
Advocate

Good Morning @MjDeck 

While I was exploring further, I also found this helpful code

https://adndevblog.typepad.com/manufacturing/2012/06/use-pointonface-and-locateusingpoint-to-find-co...

Can you please throw some light on this?

0 Likes
Message 9 of 9

MjDeck
Autodesk
Autodesk

If you want to find the face on the parent feature that corresponds to a face on an element of the pattern, then it looks like that code would work.
But I think it could be improved. Unless the face in the parent feature or in the pattern element has been modified by another feature, you should be able to find the face without using the LocateUsingPoint method to search. Then if the easier way doesn't work, you can fall back to LocateUsingPoint.
One problem with the code as written : it will only search in the first solid body in the part. If you want it to work in a part with more than one solid body, that would need fixing.

Can you give more details about what you want to do?


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes