Message 1 of 2
How to add multiple parts within a loop

Not applicable
03-28-2003
02:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
The first iteration through this loop adds a part successfully. The next time through gives this error:
"Method 'Add' of object _IRxComponentOccurrences Failed"
For x = 1 To lPartCount
Call oMatrix.SetToRotation(0, _
oTG.CreateVector(0, 0, 0), oTG.CreatePoint(0, 0, 0))
Call oMatrix.SetTranslation(oTG.CreateVector(3, 2, 1))
Dim oOcc As ComponentOccurrence
sPartFileName = "D:/data/parts/Post.ipt"
Set oOcc = oAsmCompDef.Occurrences.Add(sPartFileName, oMatrix)
Next x
I think it's because I'm trying to add a part with the exact same name. Does anyone have examples of adding parts to an assembly drawing within a loop?
tia,
clu
"Method 'Add' of object _IRxComponentOccurrences Failed"
For x = 1 To lPartCount
Call oMatrix.SetToRotation(0, _
oTG.CreateVector(0, 0, 0), oTG.CreatePoint(0, 0, 0))
Call oMatrix.SetTranslation(oTG.CreateVector(3, 2, 1))
Dim oOcc As ComponentOccurrence
sPartFileName = "D:/data/parts/Post.ipt"
Set oOcc = oAsmCompDef.Occurrences.Add(sPartFileName, oMatrix)
Next x
I think it's because I'm trying to add a part with the exact same name. Does anyone have examples of adding parts to an assembly drawing within a loop?
tia,
clu