我正在尝试创建一种将文件放置到装配中的方法,并且我希望它就像您在 Inventor 中选择放置文件时一样。
该文件是由它的路径选择的。现在需要放置它。我知道如何将文件放置在坐标处,但我希望文件位于光标上,并且用户能够选择放置它的位置。
你如何做到这一点?我尝试了编程帮助搜索,但我只能找到有关事件和对话的内容。
FileDialog.InsertMode() As Boolean
通常我只是放置和接地,但现在不好..
Public Function Place_and_Ground_Part(ByVal oDef As AssemblyComponentDefinition,
ByVal path As String) As ComponentOccurrence
' Set a reference to the assembly component definintion.
' This assumes an assembly document is open.
' Set a reference to the transient geometry object.
Dim oTG As TransientGeometry
oTG = oInvApp.TransientGeometry
' Create a matrix. A new matrix is initialized with an identity matrix.
Dim oMatrix As Matrix
oMatrix = oTG.CreateMatrix
' Set the translation portion of the matrix so the part will be positioned
' at (3,2,1).
oMatrix.SetTranslation(oTG.CreateVector(0, 0, 0))
' Add the occurrence.
Dim oOcc As ComponentOccurrence
oOcc = oDef.Occurrences.Add(path, oMatrix)
' Make sure the master part is grounded
oOcc.Grounded = True
Return oOcc
End Function