On my workpart I have many LINKED_BODY features from the wave geometry linker tool. My goal is to get a reference to the body (and likewise component) from which the wave-linked body originated from.
My current process is to take the LINKED_BODY feature and cast it to an ExtractFace class, from the extractFace class I can create an ExtraceFaceBuilder class. Then I access the ExtractBodyCollector property and call GetObjects(), which returns a body. However, this body does not have the same tag as the source body OR the wave-linked body, nor does it have an owning component.
Solved! Go to Solution.
Yes I did search the solution center, but did not find what I was looking for. The journal you linked is great at finding the source part (part file), but I was looking to find the occurrence source body within the assembly!
The .AskLinkSource method (used in the code above) is supposed to return the "tag of the source geometry entity". A null tag may be returned if the link is broken or the file cannot be loaded. What is it returning for you?
It's been a while since I last used this method, so I don't remember if it returns the occurrence or prototype object tag.
I believe it is returning the prototype object tag. The previous method descrbed in the original post was also returning the prototype object. (ExtractFaceBuilder)
The ExtractFaceBuilder's .SourcePartOccurrence property looks promising.
If that does not work, perhaps the .AskLinkedFeatureMap or .MapLinkGeomToSource methods will give something useful.
I tried the sourcePartOccurrence with no luck. The SourcePartOccurrence property was nothing and returned nothing.
I've tried MapLinkGeomToSource, which returned the source body, but it was a prototype not an occurrence.
Perhaps something is incorrect in my initialization? I'm taking an extraceFace class (temp) and passing it into the CreateExtraceFaceBuilder method and then attempting to access the sourcePartOccurrence property.
Dim extractFaceBuilder As ExtractFaceBuilder = wrkPrt.Features.CreateExtractFaceBuilder(temp) Dim bodOcc As Body = extractFaceBuilder.SourcePartOccurrence
Maybe the .AskAssyCtxtPartOcc method will be of use. Here is a link with some source code showing its use:
The journal specifically works with linked mirrored bodies, but I think it can also be made to work with "regular" linked bodies.
The .AskAssyCtxtPartOcc method was a winner! (.AskLinkXform method is used as well). This is exactly what I needed, the component used to make a linked feature.
Thanks so much,