Hi @Anonymous
You can export a BIM component with a user coordinate system using the following:
Dim oDoc As Document = ThisApplication.ActiveDocument
CompDef = oDoc.ComponentDefinition
Dim oBIMOrientType As BIMComponentOrientationTypeEnum
oBIMOrientType = kUserCoordinateSystemOrientationType
FullFileName = "C:\Temp\Test.adsk"
CompDef.BIMComponent.ExportBuildingComponent(FullFileName)
If you need to create and set the UCS before export, you can use this.
Sub Main()
CreateUCSBy3Points()
End Sub
Sub CreateUCSBy3Points()
Dim oDoc As Document = ThisApplication.ActiveDocument
' Set a reference to the PartComponentDefinition object
Dim oCompDef As PartComponentDefinition
oCompDef = oDoc.ComponentDefinition
Dim oTG As TransientGeometry
oTG = ThisApplication.TransientGeometry
' Create 3 workpoints to define the origin, x-direction and y-direction points
Dim oWorkPoint1 As WorkPoint
oWorkPoint1 = oCompDef.WorkPoints.AddFixed(oTG.CreatePoint(2, 0, 0))
Dim oWorkPoint2 As WorkPoint
oWorkPoint2 = oCompDef.WorkPoints.AddFixed(oTG.CreatePoint(4, 0, 0))
Dim oWorkPoint3 As WorkPoint
oWorkPoint3 = oCompDef.WorkPoints.AddFixed(oTG.CreatePoint(2, 2, 0))
' Create an empty definition object
Dim oUCSDef As UserCoordinateSystemDefinition
oUCSDef = oCompDef.UserCoordinateSystems.CreateDefinition
' Set it to be based on the 3 points
Call oUCSDef.SetByThreePoints(oWorkPoint1, oWorkPoint2, oWorkPoint3)
' Create the UCS
Dim oUCS As UserCoordinateSystem
oUCS = oCompDef.UserCoordinateSystems.Add(oUCSDef)
ExportBIM(oDoc)
End Sub
Sub ExportBIM(oDoc As Inventor.Document)
'Dim oDoc As Document = ThisApplication.ActiveDocument
CompDef = oDoc.ComponentDefinition
Dim oBIMOrientType As BIMComponentOrientationTypeEnum
oBIMOrientType = kUserCoordinateSystemOrientationType
FullFileName = "C:\Temp\Test.adsk"
CompDef.BIMComponent.ExportBuildingComponent(FullFileName)
End Sub
Is this what you were asking?