Change reference .ipt from .idw

Change reference .ipt from .idw

Anonymous
Not applicable
1,549 Views
12 Replies
Message 1 of 13

Change reference .ipt from .idw

Anonymous
Not applicable
Hello All,
I think this question has been asked before but I couldn't find it. I have Sample.ipt, SampleRev.ipt and Sample.idw. (Sample.ipt and SampleRev.ipt are the same configuration part with some different parameter value)
Sample .idw is a drawing of Sample.ipt. How can I use code to change Sample.idw to be a drawing of SampleRev.ipt.

Thank in advance for any help!
NewVBA
0 Likes
1,550 Views
12 Replies
Replies (12)
Message 2 of 13

Anonymous
Not applicable
To my knowledge there is no way to change the referenced part in a IDW. -- Kent Keller http://www.KWiKMcad.com Autodesk Discussion Group Facilitator "NewVBA" wrote in message news:31837100.1112223422416.JavaMail.jive@jiveforum2.autodesk.com... > Hello All, > I think this question has been asked before but I couldn't find it. I > have Sample.ipt, SampleRev.ipt and Sample.idw. (Sample.ipt and > SampleRev.ipt are the same configuration part with some different > parameter value) > Sample .idw is a drawing of Sample.ipt. How can I use code to change > Sample.idw to be a drawing of SampleRev.ipt. > > Thank in advance for any help! > NewVBA
0 Likes
Message 3 of 13

Anonymous
Not applicable
> To my knowledge there is no way to change the referenced part in a IDW. I do it all the time (with Apprentice) The code should look something like this: Dim oApprentice As New ApprenticeServerComponent Dim oAppDrawDoc As ApprenticeServerDrawingDocument Dim oRefFileDesc As ReferencedFileDescriptor Dim oFileSaveAs As FileSaveAs Dim sNewReference As String Set oAppDrawDoc = oApprentice.Open("C:\Sample.idw") For Each oRefFileDesc In oAppDrawDoc.ReferencedFileDescriptors sNewReference = "C:\SampleRev.ipt" On Error Resume Next Call oRefFileDesc.PutLogicalFileNameUsingFull(sNewReference) If Err Then MsgBox "Error number = " & Err.Number & vbCrLf & "Error description = " & Err.Description, vbCritical Err.Clear Exit For End If On Error GoTo 0 Next oRefFileDesc ' Set a reference to the FileSaveAs object. Set oFileSaveAs = oApprentice.FileSaveAs ' Save the IDW. Call oFileSaveAs.AddFileToSave(oAppDrawDoc, oAppDrawDoc.FullFileName) Call oFileSaveAs.ExecuteSave But I first copy the IPT and the IDW to another location (with a different name) before I start changing things in the new part. I don't think Inventor will allow you to change the reference after the part has been modified (but I havn't tested that in a while) Cheers, Teun "Kent Keller" wrote in message news:424b7156_3@newsprd01... > To my knowledge there is no way to change the referenced part in a IDW. > -- > Kent Keller > http://www.KWiKMcad.com > > Autodesk Discussion Group Facilitator > > "NewVBA" wrote in message > news:31837100.1112223422416.JavaMail.jive@jiveforum2.autodesk.com... > > Hello All, > > I think this question has been asked before but I couldn't find it. I > > have Sample.ipt, SampleRev.ipt and Sample.idw. (Sample.ipt and > > SampleRev.ipt are the same configuration part with some different > > parameter value) > > Sample .idw is a drawing of Sample.ipt. How can I use code to change > > Sample.idw to be a drawing of SampleRev.ipt. > > > > Thank in advance for any help! > > NewVBA > >
0 Likes
Message 4 of 13

Anonymous
Not applicable
See how far my knowledge gets me ;~) -- Kent Keller Autodesk Discussion Forum Facilitator "Teun Ham (IV9 SP2)" wrote in message news:424ba10b$1_1@newsprd01... > > To my knowledge there is no way to change the referenced part in a IDW. > > I do it all the time (with Apprentice)
0 Likes
Message 5 of 13

Anonymous
Not applicable
I appreciated all your help! It works great. This is the first time I work with Apprentice. Is there a way to use apprentice within IV VBAIDE?

NewVBA
0 Likes
Message 6 of 13

Anonymous
Not applicable
Hello, Open IV VBA, bring up a code window and hit F2, this will open the object browser, RMB anywhere I believe and this should bring up a context menu with References being an option, select this, a dialogue will appear showing the currently referenced References at the top and all the other available references underneath, Autodesk Inventor's Apprentice is in there somewhere, select it. Teun, does this work with changing the referenced derived part component with in a part document do you know? IV won't allow you to delete a derived solid part, move the EOP marker to above all the other solid creating features and then derive another solid again in the document, surfaces only, just wondered if this could be a sneaky route. :-) Thanks Scott "NewVBA" wrote in message news:14126667.1112291344480.JavaMail.jive@jiveforum1.autodesk.com... >I appreciated all your help! It works great. This is the first time I work >with Apprentice. Is there a way to use apprentice within IV VBAIDE? > > NewVBA
0 Likes
Message 7 of 13

Anonymous
Not applicable
Hello Scott,
I put a check mark on Autodesk Inventor's Apprentice Object Library on my IV VBAIDE. I tested the code and I still have runtime error. Any idea?

New VBA
0 Likes
Message 8 of 13

Anonymous
Not applicable
You can't run Apprentice within Inventors VBAIDE. You need to run it in something like Word or Excel or VB6. I am not sure if it would work by referencing Inventor instead and changing the calls from oApprentice to Thisapplication?? -- Kent Keller Autodesk Discussion Forum Facilitator "NewVBA" wrote in message news:26546027.1112300351796.JavaMail.jive@jiveforum2.autodesk.com... > Hello Scott, > I put a check mark on Autodesk Inventor's Apprentice Object Library on my IV VBAIDE. I tested the code and I still have runtime error. Any idea? > > New VBA
0 Likes
Message 9 of 13

fourholesn1
Enthusiast
Enthusiast
I don't think it would work by referencing Inventor instead of Inventor Apprentice because, according to the help file, the method PutLogicalFileNameUsingFull is only valid within Apprentice.
0 Likes
Message 10 of 13

Anonymous
Not applicable

I was getting confused with all these apprentice thing. (what is that?)

 

try this

 

Close idw, then change the ipt name (from 123.ipt to 123a.ipt) then open up idw again, it will prompt locate 123.ipt select 123REVA.ipt. This should work.

 

Jis

0 Likes
Message 11 of 13

jdkriek
Advisor
Advisor

jis.augustin, you are responding to a question that is 7 years old.

Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


0 Likes
Message 12 of 13

Anonymous
Not applicable

do you have a better solution by any chance?

0 Likes
Message 13 of 13

Anonymous
Not applicable

The command you are looking for I believe is:

 

dim oDoc as DrawingDocument

Set oDoc = ThisApplication.ActiveDocument 'provided your active document is an .idw

Call oDoc.Sheets(1).DrawingViews(1).ReferencedDocumentDescriptor.ReferencedFileDescriptor.ReplaceReference("C:\Path\Part.ipt") 'set the sheet number to the page and the drawing view number to the base view (typically 1)

0 Likes