Using iLogic to replace reference WITHOUT opening drawing

Using iLogic to replace reference WITHOUT opening drawing

SteveX82
Advocate Advocate
2,383 Views
2 Replies
Message 1 of 3

Using iLogic to replace reference WITHOUT opening drawing

SteveX82
Advocate
Advocate

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

0 Likes
2,384 Views
2 Replies
Replies (2)
Message 2 of 3

Curtis_W
Consultant
Consultant

HiSteveX82,

 

I do something like this with iLogic, but I never found away to do it without opening the files. Here's what I came up with:

http://inventortrenches.blogspot.com/2011/08/copy-design-and-revision-rolling-with.html

 

Maybe you can glean something from the code, but it looks like you code is pretty similar already.

 

There is also this, which I havn't had a chance to test much, but it seemed to work on my intial test, at least the folder copy version that is:

 

Hierarchy Clone for Inventor

http://labs.autodesk.com/utilities/ADN_plugins/catalog/

This plugin can be used to copy and rename Inventor IAM/IDW/DWG file along with any files it references (including substitute parts and OLE references).
download now

 

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

 

EESignature

0 Likes
Message 3 of 3

Anonymous
Not applicable

This Hierarchy Clone utility may worth your attention also

due to the VB .NET. source code supplied.

0 Likes