Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Change reference .ipt from .idw

12 REPLIES 12
Reply
Message 1 of 13
Hank51111
895 Views, 12 Replies

Change reference .ipt from .idw

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
12 REPLIES 12
Message 2 of 13
Anonymous
in reply to: Hank51111

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
Message 3 of 13
Anonymous
in reply to: Hank51111

> 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 > >
Message 4 of 13
Anonymous
in reply to: Hank51111

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)
Message 5 of 13
Hank51111
in reply to: Hank51111

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
Message 6 of 13
Anonymous
in reply to: Hank51111

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
Message 7 of 13
Hank51111
in reply to: Hank51111

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
Message 8 of 13
Anonymous
in reply to: Hank51111

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
Message 9 of 13
fourholesn1
in reply to: Hank51111

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.
Message 10 of 13
Anonymous
in reply to: Hank51111

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

Message 11 of 13
jdkriek
in reply to: Anonymous

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

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


Message 12 of 13
Anonymous
in reply to: jdkriek

do you have a better solution by any chance?

Message 13 of 13
andrewwhiteinc
in reply to: Anonymous

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)

P. Andrew White, P.Eng
Manufacturing Engineering Manager
Silent-Aire Manufacturing

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report