Batch Copy Drawing

Batch Copy Drawing

HogueOne
Advocate Advocate
241 Views
2 Replies
Message 1 of 3

Batch Copy Drawing

HogueOne
Advocate
Advocate

Goal

Create an iLogic script that will allow a user to make multiple copies of a drawing and all of the referenced documents. Each document from the copy will have an incrementing number like "-001"; "-002"; "-003" etc. in the folder the user chooses to save it.

 

Things I've looked into

  • iLogic Design Copy
    • Doesn't seem to be a way to access this programmatically
  • Design Assistant
    • Doesn't seem to be a way to access this programmatically
  • Vault Copy Design
    • I'm familiar with Vault, but I don't think I will be able to convince my employer to make use of it. The Copy Design tool works great for the most part. But even if we were to use Vault I'm not sure how I would use copy design programmatically from iLogic
  • Copy Assembly
    • I can't find anything in the API that allows you to use this tool programmatically other than running the command to open the tool for manual input.
  • Pack and Go
    • I've been able to use iLogic to make a Pack and Go package, but all of the references seem to refer back to the originals that were copied. I think this is because I was saving the package in the same workspace as the original, and I suppose Pack and Go relies on the relative location of documents outside the workspace to establish relationships. I'm not sure how to do this with iLogic and have the relationships work correctly.

The Problem
I have a script that seems to work as long as there are no frame generator assemblies. It basically makes all the copies with new names in the desired location, and then uses FileDescriptor-ReplaceReference to establish relationships correctly. There is a dependency between the skeleton and the frame generator assembly that seems to break if you try to use Document-SaveAs . I tried FileManager-CopyFile with Documents-OpenWithOptions to ignore offending broken relationships, but it doesn't help. The skeleton can only be saved in the context of the associated assembly. I suppose there's some kind of magic going on with iLogic Design Copy that can't be replicated with API.

 

FAQ: Couldn't you solve your problem by making an Addin or separate Windows Forms app instead of iLogic?
Great question. I'm not a programmer, and I rely heavily on AI to write scripts for me. I've been using Inventor for 15 years and I'm familiar with the structure of the API classes, objects, methods, properties, enums, etc. But Because I need to test so often it's been easier to just overwrite a VB file and run it rather than compiling, closing inventor, reloading, etc. Maybe there's a simpler way I just haven't figured it out.

TLDR;

Is it possible to make multiple copies of a drawing of an assembly that includes a frame generated subassembly while maintaining all the relationships? I've attached my iLogic code in case you want to examine what I'm working with. It's over 4000 lines though, so. You've been warned.




0 Likes
Accepted solutions (1)
242 Views
2 Replies
Replies (2)
Message 2 of 3

HogueOne
Advocate
Advocate

There's one small caveat, but I think I've figured it out. I'm able to avoid bricking the copied assembly by replacing references with a bottom-up approach. The problem is that the frame generator member alignment seems to break in the copy. I'll probably make a post about this in a different thread. If anybody wants more information just reply to this message.

0 Likes
Message 3 of 3

HogueOne
Advocate
Advocate
Accepted solution

The best way to do this is with the apprentice server. I solved my problem. Send me a message if you want details.

0 Likes