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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Creo 2.0 - Open a drawing from active part?

dhanley
2-Explorer

Creo 2.0 - Open a drawing from active part?

Has anybody managed some sort of shortcut/mapkey for this yet? I'm taking about quickly opening a drawing of same name when the model is on screen, the way you can open a model by right clicking in the drawings model tree . .

ACCEPTED SOLUTION

Accepted Solutions

Daryl,

my script was tested in D:\PTC\Open_Model_Drawing_AutoIt directory, if it is possible, create the same path on your disk. If you decide to use different path, then you have to change the path inside my macro.

  1. save open_drawing_cr2.exe into D:\PTC\Open_Model_Drawing_AutoIt
  2. open my config.pro and copy the line into your config.pro (you can see the above mentioned path inside the mapkey)
  3. restart Creo 2.0
  4. open part
  5. typ dd to run my macro

Martin Hanak


Martin Hanák

View solution in original post

33 REPLIES 33

Daryl,

some time ago I created AutoIt script with requested functionality. It can be used in English version of Creo Parametric 2.0.

This script works when you follow these rules:

  1. model name = drawing name
  2. drawing file is saved in current working directory -OR- in the directory specified in SEARCH_PATH option

If you are in the same "situation", then I can upload my script.

Martin Hanak


Martin Hanák

That would be great, yes!

Oh and what would I do with an AutoIt file?

Daryl,

my script was tested in D:\PTC\Open_Model_Drawing_AutoIt directory, if it is possible, create the same path on your disk. If you decide to use different path, then you have to change the path inside my macro.

  1. save open_drawing_cr2.exe into D:\PTC\Open_Model_Drawing_AutoIt
  2. open my config.pro and copy the line into your config.pro (you can see the above mentioned path inside the mapkey)
  3. restart Creo 2.0
  4. open part
  5. typ dd to run my macro

Martin Hanak


Martin Hanák

Perfect, thank you very much!

Martin I don't suppose you would be willing to share the AutoIt script itself? I had a look into it and it seems very interesting and something I would want to look into myself! As a little starter excercise for I was just thinking of looking at your script and making the reverse (part opens from drawing). I noticed that if you have a lot of items open in Creo, typing "dd" in this case is a quick way of setting the drawing you want to active, even when it's already open.

Many thanks!

Daryl,

I attached the source code. Comments are in Czech language.

Martin Hanak


Martin Hanák

My hero, thanks!

Daryl,

You know that if you just use File Open then hit enter it opens the active part of a drawing that you are in.

I do Kevin thanks. As I mentioned, I was just interested to see Martin's original code to play with as this type of thing would be useful in other situations. Cheers for the input.

I corrected the problem related to switching keyboard layouts. See attachment.


Martin Hanák

Hi Martin, and thanks for your help here !
I've follow your procedure for the Open_Model_Drawing script, and I can now launch it for the mapkey DD.
But nothing happend, Creo just open his file explorer...Smiley Frustrated

I've yee your latest update, but it's no more an *.exe file, so I don'' know how to use it...dd.JPG

-----------------------------------
Pierre, 25 years on CAD tools

Hi,

 

unfortunately your description of the problem is not clear - I do not know what is going on on your PC.

 

Note no.1:

open_drawing_cr2 application uses keyboard shortcuts (click ALT key to see them) valid in English version of Creo.

 

Note no.2:

My Open_Model_Drawing_AutoIt_2018-05-11.zip file contains also open_drawing_cr2.au3 source code, you can use it to investigate application behaviour.

 


Martin Hanák

Hi Martin, all apologies, I'll try to be more clear next text.

All apolologies also because the picture I've send previously came from another "Open_Model_Drawing" solution (see here).

I've now update the *.exe file with the latest version you send (2018-05-11) and it works now ! Thanks for it ! Smiley Happy

-----------------------------------
Pierre, 25 years on CAD tools

Hi,

 

please read my replay from ‎2015-01-07 05:02 PM.


Martin Hanák
Vermont_95
14-Alexandrite
(To:MartinHanak)

Hello Martin
we are using your exe since a couple of years and we very happy with it. It opens the related draawing but today come the question:

If you are in an assy is it possible to click on a part and to have the related drawing open from this selected part?

also if I activate a part in an assy can this open the related drawing of the activated part?

 

thanks for your answer

 

regards

Vero

Hi,

I uploaded Open_Model_Drawing_from_mt_AutoIt_2019-03-01.zip

  • unzip the file
  • move Open_Model_Drawing_from_mt_AutoIt directory into D:\PTC
  • my config.pro contains 3 mapkeys ... place them into your config.pro
  • launch Creo
  • select part in model tree
  • type d3 and hope that your computer is quick enough

mapkey d3 runs mapkey d1 and d2

 

mapkey d1 opens selected part in separate window

 

mapkey d2 runs application file

application

  • takes name of the part
  • closes part's window
  • opens drawing of selected part

 

Testing on my computer was not 100% successful. There were problems with synchronization of individual steps. Unfortunatelly I was not able to solve this problem.

 

So ... test the new script and you will see 🙂


Martin Hanák
vicor
3-Newcomer
(To:MartinHanak)

thanks,

 

very useful macro,

 

Thanks

MartinHanak
24-Ruby III
(To:vicor)

Hi,

when you place files to C: drive, you have to modify d2 mapkey definition in config.pro.


Martin Hanák
Vermont_95
14-Alexandrite
(To:MartinHanak)

Hello Martin

thanks again but unfortunatly this is not fully working for us , like for you.

but I founded a workarround

I have opened first, on a new session, a drawing, and saved the trail file in a text file (open_drawing.txt).

 

when I have an assembly opened, I founded then the way to extract from the trail file the part number of the last selected item (in the graphic windows or in the tree)

for axample

if I select a part in the graphic windows i need to find the last line in the trail file containing

!%CIShowing surface created by feature 5 (Creo Geometry), model xxxxxx.

if I select the part in the tree I will I have to find the last line containing

!xxxxxxx.PRT

if I select an assembly in the tree I will I have to find the last line containing

!xxxxxxx.ASM

 

using vbscript I am able to read this trail,  find the last line whatever I select in the graphic windows or the tree, and than put this part number in the "open_drawing.txt"

 

so my mapkey now is in fact 2 mapkeys

the first one extract the part number xxxxxxx (last line containg  !xxxxxxx.PRT or !xxxxxxx.ASM or !%CIShowing )

the second mapkey run the "play trail file" feature  and call the "open_drawing.txt"

 

work like a charm!

We still use your mapkey to open the related drawing of the activate part, this will be maybe my next challenge to make this possible  in vbapi (maybe) 🙂

 

thanks again

 

Regards

 

 

Hello Amethyst,

 

could you kindly share the mapkeys?

Thanks a lot

 

Best regards

 

Luca

Hi Martin,

 

i am trying to use this app with windows 11 and creo 5. but it seems broken and not able to use.

 

can you please check and suggest what could have gone wrong. 

 

Thanks in advance,

Rahul


@rahulvish07 wrote:

Hi Martin,

 

i am trying to use this app with windows 11 and creo 5. but it seems broken and not able to use.

 

can you please check and suggest what could have gone wrong. 

 

Thanks in advance,

Rahul


Hi,

I am sorry I cannot help you. I use Windows 10.


Martin Hanák


@rahulvish07 wrote:

Hi Martin,

 

i am trying to use this app with windows 11 and creo 5. but it seems broken and not able to use.

 

can you please check and suggest what could have gone wrong. 

 

Thanks in advance,

Rahul


Hi,

I tested version packed in Open_Model_Drawing_AutoIt_2018-05-11.zip with Creo 5.0.4.0 successfully in Windows 10.


Martin Hanák

Thank you for replying. 

I have done some updates in the windows and now it's working.

Thanks,

Rahul

We love your macro.

I edited the config pro so you can make an icon in your quickmenu's, using the ORIGINAL open_drawing_cr2 script.

If you run this macro by typing it, it will have the same effect as before but now additionally it will work on sub-assembly's, and parts.

If you are in an assembly and right-click a part or subassembly, then customize in the menu.

Then you can add the mapkey by searching.

whulshof_0-1686053485312.png

I added the button to my quickmenu and customized the icon to the drawing icon.

We are using it for a year now and it works like a charm.

 

Just today i added an additional line, so it will also open if an assembly has a representation (it used to get stuck on the rep menu).

That's when i looked up this post again, so I'd like to share this with everyone.

 

Kind regards,

 

Hi Mr. Martin
I tried your .exe file it's working fine, it's really helpful to us. And can we use the same thing using search.pro. Because drawing and CAD models are stored in different locations.

Thanks in Advance,

Amir

could you please help me in it, i want to learn it


@kamleshjoshi wrote:

could you please help me in it, i want to learn it


Hi,

unfortunately I do not understand your question.

1.] in .au3 file you can find source code of an application

2.] use Google to get explanation of individual commands functionality


Martin Hanák

Hello Martin,

 

thanks for your very good application. It is very usefull!!!!

 

We tried on more PC and until a week ago it worked perfectly.


Now only on one PC the shortcut seems to start but it doesn't complete the opening of the drawing. What it can be? On the other PC as said it continues to work perfectly. The "windows updates" are the same and the PC are identic.


Thanks

 

Luca

Announcements
NEW Creo+ Topics: Real-time Collaboration


Top Tags