Using iLogic to replace reference WITHOUT opening drawing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Cliffnotes version of my question:
Is there a way to use iLogic to replicate the old-school method of replacing drawing references? (ie, where you'd temporarily rename the originally referenced file, open the drawing, and then point it to the new file after Inventor says it can't find the original)
Longer version:
I have an iLogic configurator that manipulates skeletal models, copies them out as new files, and swaps them into template drawings. The original skeletal model can be configured in several different ways (different features, surfaces, etc), so I have several template drawings set up for each model depending on the configuration.
The problem that I'm encountering involves the order in which the drawing is loaded and then has its references replaced. When first opened, the drawing loads the original skeletal model which doesn't have all the geometry of the "new" model for which the particular template drawing was intended. This makes most of my section and detail view constraints go belly-up. After subsequently replacing the model references with the "new" model with the correct geometry, the section and detail view constraints fail to resolve themselves, and my once-perfect detail drawing is ruined.
If I instead force the drawing to open with the new model from the git-go (via the workaround discussed above), everything loads perfectly. However, I haven't yet found a way to handle this automatically with iLogic.
FWIW, I am currently using the following code in a subroutine:
DESTINATIONDOC=ThisApplication.DOCUMENTS.Open(TemplateDrawing, False)
DESTINATIONDOC.SAVEAS(filePath&Left(PN,6)&".idw", False)
DimSTRNEWREFNAMEAsString
DimOREFFILEAsFILEDESCRIPTOR
ForEachOREFFILEInDESTINATIONDOC.FILE.REFERENCEDFILEDESCRIPTORS
DimOORIGREFNAMEAsObject
OORIGREFNAME=OREFFILE.FULLFILENAME
IfSystem.io.Path.getextension(OORIGREFNAME)=".ipt"Then
STRNEWREFNAME=filePath&PN&".ipt"
ElseIfSystem.io.Path.getextension(OORIGREFNAME)=".iam"Then
STRNEWREFNAME=filePath&ASSYPN&".iam"
EndIf
OREFFILE.REPLACEREFERENCE(STRNEWREFNAME)
Next
DESTINATIONDOC.Save
DESTINATIONDOC.Close
Can anybody provide some suggestions or alternatives?
Thanks for your help,
Steve
