jzecha
Aerospace
- Jan 20, 2016
- 236
I am running into a an error I have never seen before.
I want to search a product for visible faces, extract those faces, and join them all together.
The code fails on the oPart.Update, saying "Update Failed"
When I look at what was created in the model, it creates all the Extracts, but they need updated.
When I go to edit one of the extracts, it pops up with an Error stating:
Update Failed
An error occurred in GenericNaming treatment, the selected element may be not piecewise connected.
Please select another one.
Can someone please help me figure out the correct way to code this?
I want to search a product for visible faces, extract those faces, and join them all together.
The code fails on the oPart.Update, saying "Update Failed"
When I look at what was created in the model, it creates all the Extracts, but they need updated.
When I go to edit one of the extracts, it pops up with an Error stating:
Update Failed
An error occurred in GenericNaming treatment, the selected element may be not piecewise connected.
Please select another one.
Can someone please help me figure out the correct way to code this?
Code:
Dim AssyFaceSelection As Selection
Set AssyFaceSelection = oTopProductDocument.Selection
AssyFaceSelection.Search "(Topology.CGMFace & Visibility=Shown),all"
Debug.Print AssyFaceSelection.Count
Dim oInitialJoin As HybridShapeAssemble
Dim FaceCount As Integer
FaceCount = AssyFaceSelection.Count
Set oInitialJoin = oHybridShapeFactory.AddNewJoin(Nothing, Nothing)
oInitialJoin.SetConnex (False)
For X = 1 To FaceCount
Set oSelectedBodyRef = AssyFaceSelection.Item(X).Value
Set oSurfExtract = oHybridShapeFactory.AddNewExtract(oSelectedBodyRef)
oSurfExtract.PropagationType = 3
oSurfExtract.ComplementaryExtract = False
oSurfExtract.IsFederated = False
oSurfExtract.Name = "Part Surface " & X
oHybridBody.AppendHybridShape oSurfExtract
oInitialJoin.AddElement oSurfExtract
Next
oHybridBody.AppendHybridShape oInitialJoin
oPart.Update