Submitted by wizdar on Fri, 06/10/2016 - 08:56
Forums:
I have a journal that creates mirrored wave linked bodies. In order to do it I need to have a part fully loaded.
But I get error when I select the bodies inside the workpart. It's because of the code for loading parts fully as below:
Dim part1 As Part = myBody.OwningComponent.Prototype.OwningPart
If part1.IsFullyLoaded = False Then part1.LoadThisPartFully()
I know it crashes on .OwningComponent.Prototype.OwningPart
How can I check if the body belongs to the workpart (which is normally fully loaded) and I could skip the code to load it fully?
re: OwningComponent
The body's .IsOccurrence property will tell you whether the body is owned by a component (.IsOccurrence = True) or whether the body is a prototype body owned by a part (.IsOccurrence = False).
OwningComponent
I will test it tomorrow.
So the working code could be like:
Dim part1 As Part
If myBody.IsOccurrence = True Then part1=myBody.OwningComponent.Prototype.OwningPart
Else
part1=myBody.OwningPart
End If
If part1.IsFullyLoaded = False Then part1.LoadThisPartFully()