thankyou - it works 🙂
but i've managed to break it too:
(added comment in code marked '***** below)
Dim oDoc As Document
oDoc = ThisApplication.ActiveDocument
xx=ThisDoc.Path
yy=ThisDoc.FileName(False) 'without extension
nn = xx &"\"& yy
'nn =yy
nnM = nn & "_M.iam"
nnR = nn & "_R.iam"
'MessageBox.Show(nn, "ThisDoc.Path")
MessageBox.Show(nnM, "ThisDoc.Path")
'MessageBox.Show(nnR, "ThisDoc.Path")
ThisDoc.Document.SaveAs(nnM , True)
ThisDoc.Document.SaveAs(nnR , True)
Dim asm As AssemblyDocument = ThisDoc.Document
Dim asmCompDef As AssemblyComponentDefinition = asm.ComponentDefinition
Dim oOcc = asmCompDef.Occurrences.Add(nnM, ThisApplication.TransientGeometry.CreateMatrix)
oOcc.Grounded = True
'***** everything above this line is good & one sub assembly is placed in the assembly
'***** below a 2 suffix was added because errors were cropping up & still do. trying to place the second assy (nnR)
Dim asm2 As AssemblyDocument = ThisDoc.Document
Dim asmCompDef2 As AssemblyComponentDefinition = asm.ComponentDefinition
Dim oOcc2 = asmCompDef.Occurrences.Add(nnR, ThisApplication.TransientGeometry.CreateMatrix)
oOcc2.Grounded = True
Regards
Andrew