Message 1 of 7
add method error

Not applicable
07-07-2006
05:30 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
hello
i have a problem in Inventor 10 with the add method, which i didn't have in inventor 8, it's very puzzling. I open an assembly, add some parts (this goes without problems) then i open another assembly, change some stuff,close it again, so i'm back in the first assy and then the next add method fails.
please help me out. thanks
Anton Sterenborg M Eng
here's a view of what i want basically:
Public Sub AddOccurrence()
' open assy
Set oAssy = ThisApplication.Documents.Open("C:\Temp\Assy.iam", True)
' Set a reference to the assembly component definintion.
Dim oAsmCompDef As AssemblyComponentDefinition
Set oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
' Set a reference to the transient geometry object.
Dim oTG As TransientGeometry
Set oTG = ThisApplication.TransientGeometry
Set oMatrix = Inventor.GetApp.TransientGeometry.CreateMatrix
' Add the occurrence.
Dim oOcc As ComponentOccurrence
Set oOcc = oAsmCompDef.Occurrences.Add("C:\Temp\Part1.ipt", oMatrix)
' open a subassy
Set oSubAssy = ThisApplication.Documents.Open("C:\Temp\SubAssy.iam", True)
oSubAssy.close
Set oMatrix = Inventor.GetApp.TransientGeometry.CreateMatrix
' Add the subassy to assy.iam
Dim oOcc1 As ComponentOccurrence
Set oOcc1 = oAsmCompDef.Occurrences.Add("C:\Temp\ SubAssy.iam ", oMatrix)
End Sub
i have a problem in Inventor 10 with the add method, which i didn't have in inventor 8, it's very puzzling. I open an assembly, add some parts (this goes without problems) then i open another assembly, change some stuff,close it again, so i'm back in the first assy and then the next add method fails.
please help me out. thanks
Anton Sterenborg M Eng
here's a view of what i want basically:
Public Sub AddOccurrence()
' open assy
Set oAssy = ThisApplication.Documents.Open("C:\Temp\Assy.iam", True)
' Set a reference to the assembly component definintion.
Dim oAsmCompDef As AssemblyComponentDefinition
Set oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
' Set a reference to the transient geometry object.
Dim oTG As TransientGeometry
Set oTG = ThisApplication.TransientGeometry
Set oMatrix = Inventor.GetApp.TransientGeometry.CreateMatrix
' Add the occurrence.
Dim oOcc As ComponentOccurrence
Set oOcc = oAsmCompDef.Occurrences.Add("C:\Temp\Part1.ipt", oMatrix)
' open a subassy
Set oSubAssy = ThisApplication.Documents.Open("C:\Temp\SubAssy.iam", True)
oSubAssy.close
Set oMatrix = Inventor.GetApp.TransientGeometry.CreateMatrix
' Add the subassy to assy.iam
Dim oOcc1 As ComponentOccurrence
Set oOcc1 = oAsmCompDef.Occurrences.Add("C:\Temp\ SubAssy.iam ", oMatrix)
End Sub