Add Virtual Component

Add Virtual Component

Anonymous
Not applicable
374 Views
2 Replies
Message 1 of 3

Add Virtual Component

Anonymous
Not applicable
Hi,

Any one now why this Code dosent work in a Assembly
I want create a Virtual Component

Inventor 2009 / Sp3

thx for help
Mario

Dim oAsm As AssemblyDocument
Dim oOcc As ComponentOccurrence
Dim oMatrix As Matrix

Set oMatrix = ThisApplication.TransientGeometry.CreateMatrix

Dim vInvVRDesc As String
vInvVRDesc = "test"

Set oOcc = oAsm.ComponentDefinition.Occurrences.AddVirtual(vInvVRDesc, oMatrix)
0 Likes
375 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
You forgot to assign your oAsm variable.

Assuming your active document is an assembly document. Try:

Dim oAsm As AssemblyDocument
Set oAsm = ThisApplication.ActiveDocument

Dim oMatrix As Matrix
Set oMatrix = ThisApplication.TransientGeometry.CreateMatrix

Dim vInvVRDesc As String
vInvVRDesc = "test"

Dim oOcc As ComponentOccurrence
Set oOcc = oAsm.ComponentDefinition.Occurrences.AddVirtual(vInvVRDesc, oMatrix)
0 Likes
Message 3 of 3

Anonymous
Not applicable
hi,

thx works fine

Mario
0 Likes