Hello All,
This is directed to Curtis, although anyone's input is certainly welcome...
I have an assembly (lets call it a tank cover) which is configured using an iLogic input form. The assembly will have about 20-30 parts, depending on the options the user selects. I t works very well as a standalone configurator, but I want to make it into a tool which can be used by others. Currently, this can be done using the 'Copy Design' function from Vault, but that is not the workflow I want for several reasons, not important here.
So how can I:
I would like this rule or section of code to run only when the user clicks a "Save Local Files" button at the bottom of my form (which only becomes active after user fills in required parameters)
I figure someone out there has a canned solution for this or very similar to it... Any help is so appreciated.
Thanks
James
Hi James,
You want to do the above just so that the rules will be available in other/new files?
If so, then what about creating external rules instead which could be used from any part/assembly?
Cheers,
Hi James,
If it's a single level (simple assembly with parts) then you could do something like this:
Sub CopyAssembly() Const newFolder As String = "C:\temp\asm\" Const prefix As String = "new_" Dim fileMgr As FileManager Set fileMgr = ThisApplication.FileManager ' In case folder or file already exists ' we get an error that we can ignore On Error Resume Next Call fileMgr.FileSystemObject.CreateFolder(newFolder) Dim asm As AssemblyDocument Set asm = ThisApplication.ActiveDocument Dim fileName As String fileName = fileMgr.FileSystemObject.GetFileName(asm.FullFileName) Call asm.SaveAs(newFolder + prefix + fileName, True) ' Just open it in the background Set asm = ThisApplication.Documents.Open(newFolder + prefix + fileName, False) Dim fileDesc As FileDescriptor For Each fileDesc In asm.file.ReferencedFileDescriptors fileName = fileMgr.FileSystemObject.GetFileName(fileDesc.FullFileName) Call fileMgr.CopyFile(fileDesc.FullFileName, newFolder + prefix + fileName) Call fileDesc.ReplaceReference(newFolder + prefix + fileName) Next On Error GoTo 0 asm.Update asm.Save asm.Close End Sub
I hope this helps.
Cheers,
Hello Adam
great can you give me the right way to do this also with a multi level assembly ?
Please i need this badly 🙂
Thank's for your help
You may test Inventor plugin Hierarchy Clone for Inventor.
It can be found in the ADN PLUGIN OF THE MONTH CATALOG
http://labs.autodesk.com/utilities/ADN_plugins/catalog/
(see Inventor section).
This utility is delivered with the source VB code, so you may learn a lot on the "Copy Design" internals.
Cheers,
I've been looking for a code that does kind of like this one you posted.
There is a function in assembly called Save and Replace Component.
I would like to do Save and Replace Component and at the same time save a copy of the related drawing.
Then I also need to replace the model reference in the drawing of course.
Thanks a lot!
BR
Azem
Sorry to awaken an old thread but was this solved for an assembly document with sub-assemblies?
Trying to do the exact same thing as you describe.
Thanks,
Max