1
我试图创建一个将文件放入程序集的方法,并且我希望它能像在Inventor中选择放置文件时一样。Autodesk 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
感谢布莱恩为那段代码。它肯定有帮助,但你的答案的第二部分对我来说很有意思。因为我想在地点事件之后做一些重命名等。你能展示一个我如何获得放置物体的例子吗? –