Hi,
Inventor 2022
API VB.NET Visual Studio
I try to make a Unwrap Feature. but without success.
When i understand this corect, than i need only put info which Face i want to Unroll?
The Rest is a Optional Value null or True False, or?
This is my Code:
Dim oPartDoc As PartDocument = g_inventorApplication.ActiveDocument
Dim oCompDef As PartComponentDefinition = oPartDoc.ComponentDefinition
Dim oTO As TransientObjects = g_inventorApplication.TransientObjects
Dim oTG As TransientGeometry = g_inventorApplication.TransientGeometry
Dim oFace As Face = CType(g_inventorApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Pick a Face"), Face)
Dim oVertex_01 As Vertex = CType(g_inventorApplication.CommandManager.Pick(SelectionFilterEnum.kPartVertexFilter, "Pick a Vertex 01"), Vertex)
Dim oFaceColl As ObjectCollection
oFaceColl = oTO.CreateObjectCollection
Call oFaceColl.Add(oFace)
Dim oUnwrapDef As UnwrapDefinition
oUnwrapDef = oCompDef.Features.UnwrapFeatures.CreateDefinition(oFaceColl, oVertex_01, UnwrapResultAlignmentEnum.kOriginAlignment,,, True, True)
Dim oUnwrap As UnwrapFeature
oUnwrap = oCompDef.Features.UnwrapFeatures.Add(oUnwrapDef)
Error:
System.InvalidCastException: "The COM object of type 'System.__ComObject' cannot be cast to the interface type 'Inventor.FaceCollection'. This operation could not be performed because the QueryInterface call to the COM component for the interface with The IID "{24B7B991-46D9-45F8-82CD-05212ECFC6DD}" could not be performed due to the following error: Interface not supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))."
INFO:
Surface B is a Created in Inventor
Surface A is from STP from Rhino, this can be problematic.
But i can not do Unwrap even with Surface B.
Thanks for Any Sugestion
Solved! Go to Solution.
Solved by florian_wenzel. Go to Solution.
ok,
my mistake, sorry
Should be
Dim oFaceColl As FaceCollection
oFaceColl = oTO.CreateFaceCollection
Call oFaceColl.Add(oFace)
Was ObjectCollection
Surface B Works Fine.
Surface A Work not with GUI
is Possible to make the Unwrap to Surface A, with any other Method?
Error:
Unknow Error
Update:
The Surface A Unwrap Works Fine
"The Unwrap failure is due to the fact that the geometry is located way outside of valid model range (+- 100m in each direction)."
Solution Post:
Gelöst: Unwrap Surface Problem - Autodesk Community - Inventor
Thanks for Any Suggestion