Replace with copy + get idw

Replace with copy + get idw

Anonymous
Not applicable
614 Views
8 Replies
Message 1 of 9

Replace with copy + get idw

Anonymous
Not applicable

Hi,

 

I am looking for an easy way to do a "point on part in assy - replace it with a copy - AND copying the idw".

I have searched the internet thin with no result, but maybe the all knowing masses of Inventor forums has an idea or a link?

0 Likes
615 Views
8 Replies
Replies (8)
Message 2 of 9

MechMachineMan
Advisor
Advisor

Point on a part? 

-Do you mean using something like the Pick method?

 

Copy?

- Copy of what?

 

IDW?

-Which idw? The one of the old part to be modified, or the one of the new part?

 

 

 

 

Details.


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 3 of 9

Anonymous
Not applicable
Tanks for your input. Let me try to explain it differently: With an open asm I would like to Select a part (or asm) with the mouse either from the model browser or directly in the window Then run the code The code should replace the selected part (or asm) with a copy that I can select the new name of eg. from an save as menu If there is already created a idw of the part (or asm) in the same dir as the original, the idw should be copied as well and referer to the new part. does it make more sense?
0 Likes
Message 4 of 9

MechMachineMan
Advisor
Advisor
So when you select the part, you want to program to make a copy of it, put
that copy in a new folder directory, replace the part in the assembly, then
also move the idw to the new file directory?

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 5 of 9

Anonymous
Not applicable
Same directory, just new part/file number for both part and idw.
0 Likes
Message 6 of 9

MechMachineMan
Advisor
Advisor
Sounds like one way you could do this is to just use the command manager to run the control definition for the Save And Replace feature on the part, but then also have a chunk of code in there that opens up your idw, replaces the model reference for the new part in there and saves it as a new idw.

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 7 of 9

Anonymous
Not applicable

This can definately be done and it's not too difficult really

 

You can use a simple SaveAs Command to save and replace a component. You can use this code to get the part you have selected with the mouse 

 

SyntaxEditor Code Snippet

Dim oOccurrence As ComponentOccurrence


Try
  oOccurrence = ThisDoc.Document.SelectSet.Item(1)
Catch
  MessageBox.Show("Please select a component before running this rule.", "TKSY")
  Return
End Try

 

You can open the drawing of the original part and then change the reference part with this code:

 

SyntaxEditor Code Snippet

doc = ThisApplication.Documents.ItemByName(*Drawing Path*)

'MsgBox(doc.DisplayName)

oFD = doc.ReferencedFileDescriptors(1).DocumentDescriptor.ReferencedFileDescriptor
oFD.ReplaceReference(*New Part Path* & ".ipt")
doc.Update()

 

I hope this points you in the right direction 

0 Likes
Message 8 of 9

Anonymous
Not applicable
Thanks for the suggestions. I will try to run some tests and post result if I get something useable.
0 Likes
Message 9 of 9

Crstiano
Collaborator
Collaborator

Try https://apps.autodesk.com/INVNTOR/en/Detail/Index?id=appstore.exchange.autodesk.com%3areplacecopy_wi...

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


Cristiano Oliveira
EESignature
ConsultCAD.com

0 Likes