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

Is there a button to quickly open the drawing for an on-screen model/assembly ?

BernardWielfaer
12-Amethyst

Is there a button to quickly open the drawing for an on-screen model/assembly ?


I wonder were there is a button or a way to open the corresponding drawing for a model or assembly ? The other way around is easy as in the drawing you have on the left bottom a component tree to open the component but not reversed. This operation, retype the number of the drawing, is done several times a day by many designers and would be a real time saver.

ACCEPTED SOLUTION

Accepted Solutions

Hi,

2 years ago I created AutoIt script, which can be launched by mapkey dd - see attachments.

Installation:

  • unzip Open_Model_Drawing_AutoIt.zip file to D:\PTC directory
  • copy mapkey saved in my config.pro file to yours
  • launch Creo 2 or Creo 3
  • open model
  • type dd
  • Creo opens model's drawing

The script will work properly, if:

  • drawing name = model name
  • drawing is saved in working directory -or- is accesible via SEARCH_PATH config.pro option
  • is used in English version of Creo

MH


Martin Hanák

View solution in original post

17 REPLIES 17

Hi,

2 years ago I created AutoIt script, which can be launched by mapkey dd - see attachments.

Installation:

  • unzip Open_Model_Drawing_AutoIt.zip file to D:\PTC directory
  • copy mapkey saved in my config.pro file to yours
  • launch Creo 2 or Creo 3
  • open model
  • type dd
  • Creo opens model's drawing

The script will work properly, if:

  • drawing name = model name
  • drawing is saved in working directory -or- is accesible via SEARCH_PATH config.pro option
  • is used in English version of Creo

MH


Martin Hanák

Hi Martin,

I tested this and this works well also on Pro/E 5. Thank you very much, this saved me a day or 2 work. This should be an ou-of-the-box functionality in Creo.
Regards, Bernard

Martin, if you don't mind me asking, what API did you use to make this?

Thanks,

Geoff Baxter

www.baxsaa.com

Hi,

I used AutoIt ... https://www.autoitscript.com/

MH


Martin Hanák

Hello Martin,

We do see some unintended behaviour; an extra zero or a double character or a very weird case here below. I guess due to the fact it is Pro/E ?
button.png

Hi Bernard,


I tested the script with Creo Elements/Pro 5.0 M280 64-bit in local disk directory successfully.


I don't have access to Windchill, therefore I cannot simulate your situation - i.e. working in workspace (MITAS on WT).


In attached file you can find script modified for testing purposes. When you run it, it will show you what it finds in window title block. Replace original exe file with new one and give it a try ...


MH


Martin Hanák

Very Cool! The only issue I am stuck on is when path has a space (i.e C:\\Program Files\\PTC\\Open_Model_Drawing_AutoIt\\open_drawing_cr2.exe;

I have tried single quotes, double quotes, an underscore and even %20. None worked.

Thanks!

Hi,

in Windows directories have long names and short names. You can enter dir /x command to see short names (max. 8 characters) which does not contain spaces.

Then you can use short name in mapkey definition. See example below:

mapkey dd @SYSTEMstart D:\\PROGRA~1\\Open_Model_Drawing_AutoIt\\open_drawing_cr2.exe;

MH


Martin Hanák

Thanks. That's a great tip!

OK since you are on a roll, on my laptop it doesn't matter if drawing is open or not, the script always works. On another persons laptop he gets prompt to rename file due to file already in session. I looked through config options and don't see anything to turn this off. Not sure why two laptops would work differently.

Hi,

I am sorry I do not know, what is going on another laptop. Maybe you can compare config.pro files on laptops. Maybe you can create testing data - abc.prt + abc.drw and test these data.

MH


Martin Hanák

Martin,

I love it and would like to roll it out to our Creo users. I have tested it and it works on Creo 3 M120. Do we need some type of agreement with you in order to use this in our Production environment.

AAI2018
4-Participant
(To:llie)

Wonderful MAPKEY Martin!

 

Thanks a lot!!!

barneybence
4-Participant
(To:llie)

Martin,

 

I would like to ask. Is your program free? so I can use it in my department.

This is a little bit late but I wonder if anyone still wants the following features:

 

- Opening the corresponding drawing of a part directly from its assembly

- Opening the corresponding drawing of a part/assembly if it is saved in the same folder as the part/assembly.

That folder is not necessarily defined as a search path.

 

I have wrote an ahk script to do the above. It is not the most elegant way to do the tasks, but it works. 

If someone needs the script (or its executable file), I can share it here. 

 

Note: the script has only been tested on Creo 7.0

Hello Hidetaka, 

 

I'm really interested. Could you send me this script ?

 

Thanks,

 

Look at this thread.  I have not tried it.

Solved: Creo 2.0 - Open a drawing from active part? - PTC Community


There is always more to learn in Creo.
Hidetaka
15-Moonstone
(To:BH_10112168)

This is the ahk script to open the corresponding drawing of a component in an assembly.

 

If WinActive("asm")
{
Click ; select part
SendInput _op ; Open selected part in assembly with mapkey op
WinWaitActive, prt,, 7
if ErrorLevel
{
MsgBox,
(
It takes too long to open part.
Please check whether you have too many windows open
and try again after closing some windows.
)
return
}
else
{
openDrawingCloseModel()
return
}
}

 

/*

The first part is to open the selected components. The _op mapkey is very easy to create.

The second part is to open the corresponding drawing of the component (same name, saved in working directory) and then close the component model, so that it look like you choose a component and directly open that component's drawing.

 

openDrawingCloseModel() 

 

is a function

 

openDrawingCloseModel() ;open drawing of active model and close the model
{
DrwName := getBareActiveName()  ;get model name
WinClose, A
SendInput ^o%DrwName%.drw{Enter} ;Send inputs: Ctr o, enter PartName.drw Enter
return
}

 

Hope this helps 🙂

*/

Announcements
NEW Creo+ Topics: Real-time Collaboration


Top Tags