More on the API based document creation system mentioned inearlier posts:
Having successfully copied the basic parts to new names andlocations using the Windows FileSystemObject, and having gotten allthe part/assembly/drawing references straight with:
bRet = swApp.ReplaceReferencedDocument(strAssyToReference, strBP,strPartToReference)
'replace ring in assembly
bRet = swApp.ReplaceReferencedDocument(strDrawingToOpen, strBP,strPartToReference)
'replace individual ring in drawing
bRet = swApp.ReplaceReferencedDocument(strDrawingToOpen, strBA,strAssyToReference)
'replace ring assembly in drawing
Which all works just fine, now I need to make the assemblyreference a given configuration of the part, and the drawingreference a given configuration of the assembly and also of thepart, because it has views of both.
I diligently looked through the API help and could find nothingthat did this.
I looked at swAssy.ReplaceComponents but that requires that acomponent be selected. What I have to do is identify the componentby name, and then change the configuration used in the assembly.Ditto for the assembly in the drawing and the part in the drawing.
Thanks a million!
-plhSolidworksApi macros




Having successfully copied the basic parts to new names andlocations using the Windows FileSystemObject, and having gotten allthe part/assembly/drawing references straight with:
bRet = swApp.ReplaceReferencedDocument(strAssyToReference, strBP,strPartToReference)
'replace ring in assembly
bRet = swApp.ReplaceReferencedDocument(strDrawingToOpen, strBP,strPartToReference)
'replace individual ring in drawing
bRet = swApp.ReplaceReferencedDocument(strDrawingToOpen, strBA,strAssyToReference)
'replace ring assembly in drawing
Which all works just fine, now I need to make the assemblyreference a given configuration of the part, and the drawingreference a given configuration of the assembly and also of thepart, because it has views of both.
I diligently looked through the API help and could find nothingthat did this.
I looked at swAssy.ReplaceComponents but that requires that acomponent be selected. What I have to do is identify the componentby name, and then change the configuration used in the assembly.Ditto for the assembly in the drawing and the part in the drawing.
Thanks a million!
-plhSolidworksApi macros