BoundaryPatch to sketch relationship

BoundaryPatch to sketch relationship

gilsdorf_e
Collaborator Collaborator
367 Views
2 Replies
Message 1 of 3

BoundaryPatch to sketch relationship

gilsdorf_e
Collaborator
Collaborator

Hi, 

I'm struggling to get the relationship between BoundaryPatchFeature and input sketch in API. 

In the Inventor model tree, sketches show up as direct inputs to boundary patches. In API it seems cumbersome to get this relation. I cannot find any "parent" property, that would return an input sketch for a boundary patch.

The other way around, I can try to get the dependents of the sketches. This works so so, if you only have one loop per sketch. 

Then the boundary patch is a direct dependent of the planar sketch.

If there is more than one loop per sketch, the sketch will have a "ProfileObject" as dependent.

 

I'm I missing something or is there a magic property to get this easier, instead of iterating through multiple levels of dependents?

 

 

0 Likes
Accepted solutions (1)
368 Views
2 Replies
  • API
Replies (2)
Message 2 of 3

JelteDeJong
Mentor
Mentor
Accepted solution

Try it like this:

Dim doc As PartDocument = ThisDoc.Document
Dim features As PartFeatures = doc.ComponentDefinition.Features

Dim boundaryPatchFeature As BoundaryPatchFeature = features.BoundaryPatchFeatures.Item(1)
Dim boundaryPatchLoop As BoundaryPatchLoop = boundaryPatchFeature.Definition.BoundaryPatchLoops.Item(1)
Dim profile As Profile = boundaryPatchLoop.BoundaryPath
Dim sketch As Sketch = profile.Parent

MsgBox(sketch.Name)

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

Message 3 of 3

gilsdorf_e
Collaborator
Collaborator

Thank you.

0 Likes