Hallo Paul,
besten Dank.
Na manchmal steht man halt auf dem Schlauch.
Da hab ich doch noch so einen ähnlichen Fall.
Hast Du dafür auch noch einen Tip:
(Dies Jahr scheint der Wurm drin zu sein)
Public Sub AddOccurrence()
' Set a reference to the assembly component definintion.
' This assumes an assembly document is open.
Dim oAsmCompDef As AssemblyComponentDefinition
Set oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
Dim oCompOcc1 As ComponentOccurrence
Set oCompOcc1 = oAsmCompDef.Occurrences(11)
Dim oAsmCompDef2 As AssemblyComponentDefinition
Set oAsmCompDef2 = oCompOcc1.Definition
' Set a reference to the transient geometry object.
Dim oTG As TransientGeometry
Set oTG = ThisApplication.TransientGeometry
' Create a matrix. A new matrix is initialized with an identity matrix.
Dim oMatrix As Matrix
Set oMatrix = oTG.CreateMatrix
' Set the rotation of the matrix for a 45 degree rotation about the
Z axis.
Call oMatrix.SetToRotation(3.14159265358979 / 4, _
oTG.CreateVector(0, 0, 1),
oTG.CreatePoint(0, 0, 0))
' Set the translation portion of the matrix so the part will be
positioned
' at (3,2,1).
Call oMatrix.SetTranslation(oTG.CreateVector(3, 2, 1))
' Add the occurrence.
Dim oOcc As ComponentOccurrence
Set oOcc = oAsmCompDef2.Occurrences.Add("C:\_Temp\Bauteil2.ipt",
oMatrix)
ThisApplication.ActiveDocument.SelectSet.Clear
ThisApplication.ActiveDocument.SelectSet.Select (oOcc)
End Sub
In der letzten Zeile gibt es wieder einen Fehler.
------------------
Gruß Jörn
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP