cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Global rename of drawing templates

cstarnes
10-Marble

Global rename of drawing templates

I have an assembly that is configurable via Pro/Program (modified dimensions, substituted parts, etc. Lets call it "widget1.asm". It contains about 100 parts in total, and can be configured in virtually countless ways.

Under this assembly are all of the possible parts, depending on the configuration.

widget1_part_a.prt

widget1_part_b.prt

widget1_bolt.prt

etc

 

Using a program parameter called "ignore_program", along with an "or" operator on all of the program statements, it's easy enough to get all of the parts assembled at once and and then perform a save-as in order to create a complete independently configurable copy, such as "widget2.asm", along with all of it's "widget2_xxx" parts.

Here's my problem...

I also have 117 drawing templates, which are obviously not all named "widget1.drw".  🙂  More like:

widget1_config1.drw
widget1_config2.drw
widget1_no big hole.drw

widget1_extra_toast.drw

etc.

So...  how do I get a new independent copy of the assembly, parts, and drawing templates, without having to load 117 drawings into memory, rename and save the assembly/parts, and then manually rename and save all of those templates one at a time? (I actually need 4 versions of widget, to incorporate into a higher level assembly. So, imagine that process times 4...every time we change the widget design in some minor way. 😬)

The only thing I can come up with is to maybe make a trail file for loading, regenerating, and saving all of the templates after the assembly has been renamed and is still in session, but even that is tedious. (not sure about renaming them also).

I sure miss the very early days when Pro/E's database files were ascii text.  🙂

9 REPLIES 9

Do the drawing templates have any connection to the assembly/part - they should not if they are true drawing templates in creo.

 

Or are your drawing templates - basically pre-defined drawings of specific (generic) components already placed and you are renaming them at the end of your design process?  I am betting this is your use case.

 

If my assumption is correct ... it could be done with a batch process in Nitro-CELL (which uses Excel to setup the automation script) - OR- you could use CREOSON to perform these operations if you feel like scripting/coding a bit in your language of choice using JSON Transactions.

 

I don't think you can do it "at one time" - more like a batch or loop through the files.  And what is in memory is crucial to the files you are working with.  So if you have the SAME models showing up on multiple drawing templates, that could be a problem...  BUT I don't think it will be an issue with the approach I have outlined below.

 

The basic workflow would be as follows (psudo code) in Nitro-CELL:

 

Execute Worksheet ->  getData

      list all the drawings from the workspace/working directory write them to myBatchDrawings

Batch Worksheet -> myBatchDrawings

      <contains the list of drawings to batch process>

Execute Worksheet -> processDrawing

     open curDrawing (should open the models associated with it)

     get list of models associated with drawing -- write myBatchModels

     start myBatchModels Worksheet using processModel Worksheet

     rename curDrawing insession

     save curDrawing

Batch Worksheet -> myBatchModels

       <contains the list of drawings to batch process>

Execute Worksheet -> processModel

      rename curModel based on whatever logic you determine (e.g. lookup of name or whatever)

 

CREOSON would follow the same basic process above, but without the Excel Worksheets as the mechanism for containing your commands and data to process.  It would look something more like this (again psudo code):

 

myDrawings = creo : list_files

for each drawing in myDrawings

    file : open <drawing>

    modelsOnDrawing - drawing : list_models

    for each modelName in modelsOnDrawing

          file : rename  <modelName> <new_name> onlysession = true

          file : save -or- file : backup 

    

CREOSON would be simpler - but a bit more has to be considered for the logic to make the renames of the cur drawing template and models to the new ones (e.g. array or something to say fileA will be renamed to fileX ,etc.)

 

If you have any questions or I have over simplified the issue you are facing, please let me know.  But based on my read of your question/problem -- either of the above would do the trick.  Hope this helps or gives you a different thought process on solving the problem.

 

Dave

 

 

My use of the phrase "drawing templates" wasn't the best choice. They are actually completed drawings with all dimensions (driven, created in the drawing for more flexibility), automated BOM, notes, etc... each of a certain configuration.

Each configuration contains certain parts and is assembled in a certain way. But, it's dimensions can change from time to time. So when I need to generate a new version (different dimensions) of a certain configuration, I simply load the drawing "template" and regenerate and/or fix any dimensions, alignments, etc.

This is all done with one master model and it's associated parts. The models don't get saved between runs; only a new drawing, if one doesn't already exist for that particular configuration.

15 years ago I started with one drawing, named the same as the top assembly, and drawing states, drawing program, etc...you know, like PTC wants everyone to work.  :).  But drawing states are difficult to use in dynamic situations, and since then designs have been expanded, options added, and now we are up to 117 different configurations... with a seemingly almost infinite number of dimensional variations within each one.

The problem is just getting all those drawings into memory before the master model is saved off to a new copy, so that all those drawings go with it (and get renamed to have a matching prefix)...since each of the 4 assembly copies can be any one of the 117 configurations.

 

Does that help clarify it a little?

YES .... sounds exactly like what I was talking about.

I think the advice I replied with will work perfectly given that scenario.

The question is which way do you think will be the best for your situation. Code a little with CREOSON ... or work it through Nitro-CELL using Excel to sequence the command and workflow for the results.

Alternatively ... you can wait for other input ... I am sure someone will propose a trail file or something - but the problem with those approaches... they assume a fixed process based on the number of models on each drawing (associated)... if some of your drawings have more than one model being displayed (eg two or more top level assemblies or two or more part ... or combinations like that that need to be renamed) then a trail file will be basically useless except for each variation you can somehow classify to handle all those possibilities ahead of time.

You can get a demo of Nitro-CELL for free and is very easy to use after watching a few videos and learning how it basically works.

CREOSON is 100% free and you can likely use your favorite scripting language to get things working .... CREOSON also has a Python library that was created to make it even easier to use.

BOTH CREOSON and Nitro-CELL require JLINK to be installed for Creo Parametric.

Hope that helps. Let me know if you want any help navigating either of those options.

Dave

Thanks for the input Dave.

Each of the drawings does contain different models, since any given configuration will use parts that others don't. And each drawing has it's own individual sheets with detail views of certain parts (necessary part models added to the drawing to create those detail views).

But, I'm not worried about the drawings looking correct when they are saved, since they will update when the master assembly is regenerated with parameters and the proper suppressed/resumed parts that each configuration and it's associated drawing needs.

I always use a parameter called "ignore_program", and "or" it with any other conditional lines in pro/program. Setting that one parameter to "yes" will cause every component part to be assembled, regardless of the configuration. That way, when a save-as is performed, all of the models are included and can be renamed with a new prefix and saved. At the same time, it ensures that any loaded drawing will have it's required parts in memory, even if the drawing isn't exactly pretty in that state.  🙂

A bit more info... the master assembly model's driving parameters are all controlled externally with an application that I built on Excel and it's VBA back-end. (They can also be entered with program prompts of course, but normally everything is driven externally, so that configuration data can be stored and manipulated outside of Creo).

well heck....

If you are using Excel that much for your automation... you should look at Nitro-CELL for sure..

You can add Nitro-CELL commands and operations to your existing Excel Workbook and skip the parameter import to the Pro/PROGRAM as well everything else if you wanted to accomplish.

You can get a FREE demo here:

https://www.simplifiedlogic.com/nitro-cell

And since you are using Pro/PROGRAM so extensively.... you should also check this out:

https://www.simplifiedlogic.com/nitro-program

We use both extensively to automate Creo parts, assemblies and drawings (not Nitro-PROGRAM for drawings).

I think you will find that process I outlined pretty straightforward.

Let me know if you need any help with either.

Dave

I'll definitely check those out. Thanks for the help.

For quick reference, is NITRO-cell an Excel add-in, or a standalone spreadsheet with code on the backend?

Just as an FYI -- Nitro-CELL uses a standard Excel Workbook - your existing Workbook or you can allow it to create one from scratch.  No "add-in" or "special" Workbook required.

 

Nitro-CELL's execution is on-demand using the Nitro-CELL interface - so there is no special hook required into your models (no baggage).   It connects, processes the Workbook and then disconnects from Creo.

 

For existing Workbooks, you just need to select the Workbook you want to use and press the "Upgrade Workbook" Button on the UI - Nitro-CELL will all the command reference/help sheet automatically.  Then you just have to create any Execute Sheet(s) and Batch Sheet(s) as you need them to put the rest of your workflow together.

 

On the Execute Sheets - the command are entered in a specific format.. Here is an overview of how that works - the command format to make it more efficient to find all the functions that are available within Nitro-CELL:

 

https://www.youtube.com/watch?v=jkzmYIxmCX4

 

The Getting Started Overview is a good place to start with Nitro-CELL:

 

https://www.youtube.com/playlist?list=PLcWd1Ea7i_tzsmpZLOos9d30WVNsYXQ7z

 

Hope that helps!

 

Dave

Have you taken a look at the setting rename_drawings_with_object both? If you set this setting to "both", you will get correctly named drawings as a result of the save as when a CAD model is selected for Save A Copy. The drawings do not need to be in session before executing the save as. 

 

Ty

Would you mind sharing how you implemented the ignore_program parameter into your program? I'm struggling with that as we have the same scenario as you. Large assembly with a lot of parts but I need to rename and not break the model after the rename

Top Tags