In response to my last question, I
have determined that it is not necessary to insert a component. The Part6
is updated to 99999-0103 when I exit the assembly and re-open. I am asked
if I would like to do an update.
The question is, can I perform this
update automatically? In the code below, these two lines are what I
question.
size=2> Call
oPartDoc2.Close(False)
ThisApplication.ActiveDocument.Update
Latest code posted below...
Update incorporated. Thanks in advance for the help...
-----------------
' If
oPartDoc2.FullFileName = "" Then
Call oPartDoc2.SaveAs(JobPath & PN & ".ipt",
False)
' ElseIf Right(Left(oPartDoc2.FullFileName, (len3 -
5)), 4) = "Part" Then
' If TypeOf
ThisApplication.ActiveEditObject Is Sketch Then
' Dim oSketch As
Sketch
'
Set oSketch = ThisApplication.ActiveEditObject
'
oSketch.ExitEdit
' End
If
' Call oPartDoc2.SaveAs(JobPath & PN & ".ipt",
False)
' End If
' Add newly saved part to the
assembly
If ThisApplication.ActiveDocumentType =
kAssemblyDocumentObject Then
'
Need to close and remove the current
component
Call
oPartDoc2.Close(False)
ThisApplication.ActiveDocument.Update
' The Code Below is for adding
components. We only need to update in this
case...
'
-----------------------------------------------------------------------------------------------------------------------------------------------------
' Dim oAsmCompDef As
AssemblyComponentDefinition
' Set
oAsmCompDef =
ThisApplication.ActiveDocument.ComponentDefinition
' Dim oTG As
TransientGeometry
' Set oTG =
ThisApplication.TransientGeometry
' Dim oMatrix As
Matrix
' Set oMatrix =
oTG.CreateMatrix
' Call
oMatrix.SetToRotation(3.14159265358979 / 4, oTG.CreateVector(0, 0, 1),
oTG.CreatePoint(0, 0, 0))
' Call
oMatrix.SetTranslation(oTG.CreateVector(3, 2,
1))
' Dim oOcc As
ComponentOccurrence
' Debug.Print
JobPath & PN & ".ipt"
'
Set oOcc = oAsmCompDef.Occurrences.Add(JobPath & PN & ".ipt",
oMatrix)
End If