Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a subroutine that takes a face, unwraps it, and exports it as a DXF. This subroutine works as expected when the PartDocument is on its own but does not export a DXF when the PartDocument is a child of an assembly, it also does not produce an error upon failing. I've confirmed that the unwrap is created successfully, and the rest of my code works fine with a PartDocument that is part of an AssemblyDocument.
Any help is appreciated, let me know if I need to provide more context.
Here's the subroutine:
Private Sub Unwrap(oFace As Face)
Dim oFaceCollection As FaceCollection = oInvApp.TransientObjects.CreateFaceCollection()
oFaceCollection.Add(oFace)
Dim oUnwrapDef As UnwrapDefinition = oPartDoc.ComponentDefinition.Features.UnwrapFeatures.CreateDefinition(oFaceCollection)
Dim oUnwrapFeature As UnwrapFeature = oPartDoc.ComponentDefinition.Features.UnwrapFeatures.Add(oUnwrapDef)
Dim oUnwrappedFace As Face = oUnwrapFeature.SurfaceBody.Faces(1)
Dim oSelect As SelectSet = oPartDoc.SelectSet
Dim sFileType = oPartDoc.DisplayName.Split(".").Last()
Dim sUnwrapFilename As String = Left(oPartDoc.DisplayName, (oPartDoc.DisplayName.Length - (sFileType.Length + 1))) & ".dxf"
oSelect.Select(oUnwrappedFace)
If oSelect.Count > 0 Then
Console.WriteLine("saving dxf: " & sDestinationFolder & "\" & sCustomerName & "\" & sUnwrapFilename)
oInvApp.CommandManager.PostPrivateEvent(PrivateEventTypeEnum.kFileNameEvent, (sDestinationFolder & "\" & sCustomerName & "\" & sUnwrapFilename))
oInvApp.CommandManager.ControlDefinitions.Item("GeomToDXFCommand").Execute2(True)
End If
oSelect.Clear()
End Sub
Solved! Go to Solution.