I'm openning an assembly document and saving it into another directory using the line of code bellow:
assembly.SaveAs(_pastaObra + "\\LUMIFORM-PB-" + _nomeArquivo.ToString() + ".asm");
The problem is that it only copies the assembly. Does anybody know any method that would copy the parts as well?
Thanks in advance!
Solved! Go to Solution.
Actually, if You do it manually (not by the code) You'll get the same result.
The Assembly document contains only links to the Parts/Sub-Assemblies.
So, when You use SaveAs, you only save the Assembly document in new place. Not the parts includded.
The way to move/copy the assembly with the parts (and/or drawings) is to use Revision Manager.
Revision Manager is utility to do some rename/copy tasks. It also have API access
So you have 2 ways to copy/move your assembly to new directory:
1 - if all the parts, sub-assemblies and drawings are located in same directory (and sub-directories) as main assembly, You can simply copy all this folder with its contents to new one.
After You open next time the copied assembly, it will automatically redefine links to the parts to the current directory.
This is a fastest method to do Your task (manually and by code)
2 - start Revision Manager application, open the assembly in the Revision Manager, You'll get the entire assembly tree.
Set Copy action to all the nodes (parts and sub-assemblies) in the tree.
Set the destination folder for each node,
Then, use Perform Actions to do the defined actions.
This way is more complicated and when last time i tried to do it by code, it was many bugs in the functions. Like some functions just did nothink (even no error).
So if all the parts, sub-assemblies and drawings located in one directory or subdirectories, use first way.
I'll try to automate this process through Revision manager API and give you a feedback as soon as possible!
Thanks for your reply!
I managed to copy the parts using Revision Manager API and the online documentation.
Thanks for your advice!