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: 

Customized copy design

18 REPLIES 18
Reply
Message 1 of 19
darrell.wcd
1550 Views, 18 Replies

Customized copy design

I have a configurator assembly with parts and drawings.

I have been trying to use design copy.. but i want to give the files a completely new name... not just a prefix or suffix

I will always copy the exact same files and the file name will be based off of user input.

egg. (Contract number-Order Line Number) and then incremental numbers.

 

I would preferer to name the files to copy rather then iterating through the assembly.. that way I have better control on what happens.

 

In my office I use Vault, but my client does not have and we do a lot of work without internet connections.

Any help would be appreciated.

Labels (3)
18 REPLIES 18
Message 2 of 19
gcoombridge
in reply to: darrell.wcd

I suppose you could iterate through each part in an assembly, save as (Contract number-Order Line Number), then replace the component. Do you have any derived relationships between parts though?

Use iLogic Copy? Please consider voting for this long overdue idea (not mine):https://forums.autodesk.com/t5/inventor-ideas/string-replace-for-ilogic-design-copy/idi-p/3821399
Message 3 of 19
Ralf_Krieg
in reply to: darrell.wcd

Hello

 

Is the incremental number also part of the original file names? So would a simple search and replace of the static part do the job? You could give this modified version of copy design a try.

Or do you need a editable list of all filenames? This a lot more complicated, cause you'll have to take care e.g. if a filename is changed, the name of the assembly containing an occurrence of that part needs a new name too.


R. Krieg
RKW Solutions GmbH
www.rkw-solutions.com
Message 4 of 19
darrell.wcd
in reply to: darrell.wcd

Here is a screen shot of all the documents in the folder.... I want to be able to copy design all the documents in this folder. Replacing the (22-1334) with a specific contract number and the (ZTL01) with a specific order line number, by default it would be ((ZTL01 + 1) = ZTL02) the trailing (-12, -13) would stay the same.

 

Previously I have put together snips of code found here that will copy the part and the drawing... or the assembly and drawing...  see txt files below

darrellwcd_0-1646318716049.png

 

Message 5 of 19
Ralf_Krieg
in reply to: darrell.wcd

Hello

 

I assume all the parts are placed in the assembly? If so, you can try the attached copy design tool. After extract the zipfile:

- Start the copydesign.exe

- select the source assembly file

- select a target folder (i recommend an empty subfolder of the source folder)

- activate the "Replace" control

- fill "22-1334-ZTL01" in the textbox for the string to replace

- fill the new contract number and "ZTL02" in the textbox for the string to insert

- activate the "Include Drawings" control

- click OK and wait until the finished message appears.

 

I can not guarantee it's free of bugs, but maybe it fit your needs.


R. Krieg
RKW Solutions GmbH
www.rkw-solutions.com
Message 6 of 19
darrell.wcd
in reply to: Ralf_Krieg

@Ralf_Krieg  this is almost perfect.... I would need an option to not copy content center items... is this code available in iLogic... so I could adapt it into some other programs?

Message 7 of 19
Ralf_Krieg
in reply to: darrell.wcd

Hello

 

Sorry, being a bit busy last days.

The version attached ignores content center files as long as they are not inserted as user defined. They will not be copied, the references are not changed and points further to the original files. User defined CC files are copied. I think this is the correct and expected program behaviour.

I'm struggling a bit with iParts and iAssemblies. Until now, these files where handled same as CC files and not copied. This means, drawing files of iParts, iAssemblies and CC files will not be copied too.

The program is based on the CopyDesign code which is included in the SDK delivered with Inventor. You can get the source code there. The program uses apprentice server, so it is not possible to direct integrate this code in an iLogic rule.

 


R. Krieg
RKW Solutions GmbH
www.rkw-solutions.com
Message 8 of 19
jalil.a.tayaa
in reply to: Ralf_Krieg

Hi @Ralf_Krieg,

 

I tried to use the EXE file in the SDK from Inventor but it didn't work and it seems that it works only if a drawing file is created (I also tested after creating a .dwg file but it's still not working).

Your version is working fine and doesn't need to have a drawing file but I'm looking for something to create multiple copies with different names based on a list probably in an excel sheet.

I would be grateful if you can share your code or the part the code used to link new parts in the new assembly.

 

Thanks!

Message 9 of 19
Ralf_Krieg
in reply to: darrell.wcd

Hello

 

Sorry, seen your question but forgot to answer. You can use the source code of the copy design tool in the SDK. The method to create the copy is unchanged. I wrote only a modification around that to create multiple copies in a loop. The rest, like search and replace parts of the filename is useless, cause you'll use an excelfile to get the new filenames.

After removing the obsolete parts you'll have the original source code and a "for i=1 to number of copies" loop to run it multiple times.


R. Krieg
RKW Solutions GmbH
www.rkw-solutions.com
Message 10 of 19
jalil.a.tayaa
in reply to: Ralf_Krieg

Hi,
I will finally not use the same method used in copy design tool in the SDK. I find that using apprentice server can be an issue with assemblies/parts that need to be migrated (it's not my case now but I think for the future). Then, I also want to be able to modify the assemblies that I will copy and I learned that apprentice server opens the documents in read-only mode.
So, I will just open the template document and adapt the code to do the same without apprentice server.
Thank you for your help!
Message 11 of 19
Ralf_Krieg
in reply to: jalil.a.tayaa

Hello

 

It's right, Apprentice server can not migrate documents. And Apprentice has no graphical user interface and access to geometric informations, so you can't modify your model with it. The question was to create a copy of the assembly, all referenced files and replace all the references within. I would always migrate an assembly before copy. Any changes to the model could be done after copying. Or do you want to change your template assembly?

If you adapt the code to Inventor, you'll shortly recognize that there's no FileSaveAs object. This is Apprentice only, there is no equivalent in Inventor.


R. Krieg
RKW Solutions GmbH
www.rkw-solutions.com
Message 12 of 19
jalil.a.tayaa
in reply to: Ralf_Krieg

Hi,
By reading your message, I think I am going to the wrong way. I think I can use apprentice server to made all the copies of the template that I need. And, in a second step modify its with the data I have in Excel by using Inventor API.
I can maybe add a check during the copy process and return a message if the assembly needs to be migrated (I read somewhere that there is property to check if the migration is needed but I need to find it again).
Apart from that, it's also possible to make the copy with Inventor without FileSaveAs method by using SaveAs method and then use ReplaceReference method. It's more work but feasible I think.

Thanks for your help
Message 13 of 19
Ralf_Krieg
in reply to: darrell.wcd

Hello

 

There's a boolean property "NeedsMigrating" in every document.

I think the most problematic thing is that you change one document reference and Inventor tries to recompute your assembly, recalculate dimensions, solve contraints and so on. This will most time result in a destroyed model. I think there's a reason why desgin assistant and any other tools who clones complete designs always use Apprentice.


R. Krieg
RKW Solutions GmbH
www.rkw-solutions.com
Message 14 of 19
jalil.a.tayaa
in reply to: Ralf_Krieg

Hi,

Thank you for these details, I will then go back to the solution with Apprentice to do the copies.
I have a last question related to copy process (not for this specific project). If I want to copy an Excel file used as a 3rd party in an Inventor document, I need to use ReferencedOLEFileDescriptors property to find it, is it correct?
Message 15 of 19
Ralf_Krieg
in reply to: darrell.wcd

Hello

 

Yes, this should be correct for linked files. If the 3rd party file is embedded, it will be automatic copied with the containing Inventor document and no extra handling is required.


R. Krieg
RKW Solutions GmbH
www.rkw-solutions.com
Message 16 of 19
jalil.a.tayaa
in reply to: Ralf_Krieg

Hi,
Perfect, thank you a lot for your help!
Message 17 of 19

Does this excel file can help you?

it's in french but I can translate

 

https://autode.sk/3u8RuE3

Message 18 of 19

Hi,
I'm French so no problem to understand haha. Thank you for sharing but it's not really what I need.
My objective is to make multiple copies of a template in one time and then configure each copy with parameters that will be in an Excel file.
To have more context the idea is to design all the storage racks of a workshop. Each rack are different and the configurations are (almost) infinite (that's why I don't use iAssemblies).
Today, thanks to @Anonymous I'm able to make multiple copies with adding a prefix (name of the rack). Now, I'm working on the change of parameters (Level of details, constraints value, ...) with Inventor API.
Message 19 of 19
Maxim-CADman77
in reply to: Ralf_Krieg

Dear @Ralf_Krieg I wonder if 1.1.1 version is the latest?
Haven't you by chance shared the project (somewhere at GitHub or alike)?

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

Post to forums  

Autodesk Design & Make Report