Skip to main content
12-Amethyst
December 6, 2019
Question

Global rename of drawing templates

  • December 6, 2019
  • 3 replies
  • 4985 views

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.  🙂

3 replies

17-Peridot
December 7, 2019

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

 

 

cstarnes12-AmethystAuthor
12-Amethyst
December 7, 2019

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?

17-Peridot
December 7, 2019
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
16-Pearl
December 9, 2019

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

1-Visitor
August 25, 2022

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