Skip to main content
3-Newcomer
February 7, 2024
Question

Quick open drawing from part

  • February 7, 2024
  • 1 reply
  • 4269 views

Hello Team,

-Creo 9 with Windchill.

I'm looking to create a mapkey to quickly open a drawing of a room that's already open.

I've done a lot of research and i can never find a working solution. please don't redirect me to an alternative solution.


I know that a part can have several drawings or be included in other drawings. However, in my case, 90% of the parts created have only one drawing, which has exactly the same name as the part, with .drw instead of .prt.
I've created a relationship: DRAWING = PART_ID+ ".DRW".
I now have a parameter with the right value.
Since copy and paste doesn't work in mapkey commands, is there a line of OS script code that you could put in a mapkey to say, open "parametre drawing"?
I work in a company that doesn't allow third-party applications to be installed.

Thank in advance.

1 reply

12-Amethyst
February 8, 2024

Hello,

I made this mapkey many years ago, not sure if it is still working these days. Try putting it in you config.pro and calling mapkey X.

 

mapkey x @MAPKEY_NAMEOpen drawing;@MAPKEY_LABELDrawing;\
mapkey(continued) %>partname; %load;\
mapkey(continued) ~ Command `ProCmdModelOpen` ;\
mapkey(continued) ~ Select `file_open` `Type` 1 `db_4`; %partname;\
mapkey(continued) ~ Command `ProFileSelPushOpen_Standard@context_dlg_open_cmd`;
!!!!!!!!!!!!!!!!!!!!!!!!
mapkey >partname @MAPKEY_NAMEGets partname;\
mapkey(continued) ~ Command `ProCmdModelSaveAs` ;~ Select `file_saveas` `type_option` 1 `db_129`;\
mapkey(continued) ~ Activate `file_saveas` `OK`;~ Activate `UI Message Dialog` `ok`;\
mapkey(continued) @SYSTEMdel sw.pro\ndir /b *.pic>filename.txt\nset /p \
mapkey(continued) VAR1=<filename.txt\ndel filename.txt\nSET FILENAME=\%VAR1:\~0,-4\%\necho mapk\
mapkey(continued) ey partname \~ Input `file_open` `EMBED_BROWSER_SEARCH_IP` `%FILENAME%`\\
mapkey(continued) ;>>sw.pro\ndel *.pic;
!!!!!!!!!!!!!!!!!!!!!!!!
mapkey load @MAPKEY_NAMEload mapkey;\
mapkey(continued) ~ Command `ProCmdRibbonOptionsDlg` ;\
mapkey(continued) ~ Select `ribbon_options_dialog` `PageSwitcherPageList` 1 `ConfigLayout`;\
mapkey(continued) ~ Select `ribbon_options_dialog` `ConfigLayout.ImportExportBtn`;\
mapkey(continued) ~ Activate `ribbon_options_dialog` `ConfigLayout.Open`;\
mapkey(continued) ~ Activate `file_open` `Current Dir`;\
mapkey(continued) ~ Activate `file_open` `Ph_list.Filelist` 1 `sw.pro`;\
mapkey(continued) ~ Update `file_open` `Inputname` `sw.pro`;~ Activate `file_open` `Inputname`;\
mapkey(continued) ~ Activate `ribbon_options_dialog` `OkPshBtn`; @SYSTEMDel sw.pro;

 

 

24-Ruby III
February 8, 2024

Hi,

OP uses Creo 9 with Windchill. Therefore I am curious where partname.pic will be saved by your mapkey. Maybe it will be necessary to modify the mapkey a little bit to save partname.pic into specific directory.

15-Moonstone
May 14, 2025

Hi,
We noticed a bit of a problem with this old mapkey trick if Creo is connected to Windchill and automatic number generation is on. It uses Save As dialog to get the current part filename, so every time the mapkey is used, it wastes one number from the sequence.

I modified the >storetmpfile and >partnameopen mapkeys to use parameter export instead:

mapkey >storetmpfile @MAPKEY_LABELStore model name to temp file;\
@SYSTEMdel *_par.txt\n;\
~ Command `ProCmdMmParams` ;\
~ Activate `relation_dlg` `PBExportTXT`;\
~ Activate `file_open` `Current Dir`;\
~ Command `ProFileSelPushOpen@context_dlg_open_cmd` ;\
~ Activate `relation_dlg` `PB_Cancel`;

mapkey >partnameopen @MAPKEY_LABELGets partname to open drawing;\
@SYSTEMdel sw.pro\n\
dir /b *_par.txt>\%temp\%\\filename.txt\n\
set /p VAR1=<\%temp\%\\filename.txt\n\
del \%temp\%\\filename.txt\n\
set FILENAME=\%VAR1:\~0,-8\%\n\
echo mapkey partnameopen \~ Update `file_open` \
`Inputname` `\%FILENAME\%.drw`\;>>sw.pro\n\
del *_par.txt;

 
Otherwise the combined mapkey should work as before, so you can just replace these two mapkeys regardless of whether you use the "old" mapkeys or the Creo 11 compatible one made by TC_9543675 (catchy name btw).

 

It would be nice if PTC created a proper way to open a related drawing LIKE EVERY OTHER CAD IN EXISTENCE so we wouldn't have to keep using this 20 year old hack.

 

And yes, I know that you can have multiple drawings of one model, but then you could have a dialog listing those drawings and ask the user which one they want to open.