Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

open generic from assembly

sander

New member
In an assembly I have included an instance from a family table.
When I "right-click-open" that part from within the assembly I want Pro/E to ask me if I want to open this instance or the generic part.

Is this possible ?
 
The generic should be an In Session model click the blue window icon in File Open for in session objects and you'll see it.

Michael
 
Dell_Boy said:
File this in the Rant & Rave section. Users have been asking for this for years.


DB

PTC could do it with ease. I have been asking for it since about
release 5. PTC does not think making things easy for you is good for
you. Making things hard build character.
 
dr_gallup said:
Dell_Boy said:
File this in the Rant & Rave section. Users have been asking for this for years.


DB

PTC could do it with ease. I have been asking for it since about release 5. PTC does not think making things easy for you is good for you. Making things hard build character.


By that logic we are therefore the engineers with the best character (I like that
smiley36.gif
)


Kev
 
I have only been able to open a generic from a part as follows:-
Create a mapkey to export the model info file and call an Autoit script.



Mapkey to open generic part from instance (Proe 2001)
mapkey og @MAPKEY_NAMEopen generic;@MAPKEY_LABELopen generic;\
mapkey(continued) ~ Select `main_dlg_cur` `MenuBar1`1 `Info`;\
mapkey(continued) ~ Close `main_dlg_cur` `MenuBar1`;\
mapkey(continued) ~ Activate `main_dlg_cur` `Info.psh_info_model`;#FILE;\
mapkey(continued) @SYSTEMstart C:\\utils\\proegenopen.exe;
Change above line to suit your setup.



Change the script below with your details and recompile.


; AutoIt Version: 3.0
; Language: English
; Platform: Win9x/NT
;
; Script Function:
; Open generic part from instance


#include <file.au3>


$source = "C:\proe_start_folder\"& nbsp; ;change to your Proe start folder
$text = "INSTANCE OF GENERIC"


AutoItSetOption ( "WinTitleMatchMode", 2 )


$search = FileFindFirstFile($source & "*.inf.1")


If $search = -1 Then
MsgBox(0 + 16, "Program Error", "No inf file to create part name")
Exit
EndIf


$file = FileFindNextFile($search)


FileClose($search)


Dim $value
If Not _FileReadToArray($source & $file, $value) Then
MsgBox(0 + 16, "Program Error", "Error reading " & $file)
exit
EndIf


FileDelete($source & $file)


For $i = 1 To $value[0]
$result = StringInStr($value[$i],$text)
If $result Then
$location1 = StringInStr($value[$i], " ", 0, 7)
$location2 = StringInStr($value[$i], " ", 0, 8)
$genericname = StringMid($value[$i], $location1, $location2 - $location1)
exitloop
EndIf
Next


$genericname = $genericname & ".prt"


WinActivate("Pro/ENGINEER")
Sleep(250)


Send("!fo")


Send($genericname)


Send("{ENTER 2}")


exit
 
Hi,

I also made a script for this for WF 4. It works with English and German language versions.


2009-09-10_070042_Open_generic_v0.01.zip

It's still in 'beta', so suggestions are welcome!

To use it, put the .exe somewhere and change the mapkey to point to the .exe.
Then in ProE just activate the mapkey and wait a few seconds. ProE will write and .inf file. The script will read the generic info from the file and switch back to ProE and open it.

Hope it's of use to other people as well.
 
How to open the Generic from an instance with mapkeys only.


With a little workaround it is possible in Pro-E mapkeys only (without scripts and all):
smiley1.gif



Record a mapkey of this (withan instance open):


Make new "dummy" drw named "to-be-deleted.drw", The instance will default be model. Now replace model (file properties ....) The Generic will default be the new model. Now OPEN, and the drw model opens default. Finally open "to-be-deleted.drw", and erase from session.


So now if you have an instance open type rg and the generic openes. Simple??
smiley2.gif



It works for parts AND assemblies
smiley20.gif



In config.pro it looks like this: Youjust copy-paste if you use Wildfire3 or 4. Please give some feedback if it works for you or not. So far I had no negative responce.


Works also if you use Pro-e in another language!


mapkey rg @MAPKEY_LABELretreive generic from instance;\
mapkey(continued) ~ Select `main_dlg_cur` `MenuBar1`1 `File`;\
mapkey(continued) ~ Close `main_dlg_cur` `MenuBar1`;~ Activate `main_dlg_cur` `File.psh_new`;\
mapkey(continued) ~ Select `new` `Type`1 `Drawing`;~ Input `new` `InputPanel1` `to_be_deleted`;\
mapkey(continued) ~ Update `new` `InputPanel1` `to_be_deleted`;\
mapkey(continued) ~ Activate `new` `chk_use_default_template`0 ;~ Activate `new` `OK`;\
mapkey(continued) ~ FocusIn `UI Message Dialog` `ok`;~ Activate `UI Message Dialog` `ok`;\
mapkey(continued) ~ FocusIn `dwg_create` `inp_model_name`;~ Activate `dwg_create` `psh_ok`;\
mapkey(continued) ~ Activate `open_instance` `open`;~ Activate `open_rep` `OK`;\
mapkey(continued) ~ Select `main_dlg_cur` `MenuBar1`1 `File`;\
mapkey(continued) ~ Close `main_dlg_cur` `MenuBar1`;\
mapkey(continued) ~ Activate `main_dlg_cur` `File.psh_properties`;#DRAWING MODELS;#REPLACE;\
mapkey(continued) ~ Activate `open_instance` `open`;\
mapkey(continued) ~ Select `main_dlg_cur` `MenuBar1`1 `File`;\
mapkey(continued) ~ Close `main_dlg_cur` `MenuBar1`;~ Activate `main_dlg_cur` `File.psh_open`;\
mapkey(continued) ~ Activate `file_open` `Inputname`;\
mapkey(continued) ~ Activate `open_instance` `instnamelist1`1 `the generic`;\
mapkey(continued) ~ Select `main_dlg_cur` `MenuBar1`1 `File`;\
mapkey(continued) ~ Close `main_dlg_cur` `MenuBar1`;~ Activate `main_dlg_cur` `File.psh_open`;\
mapkey(continued) ~ Input `file_open` `Inputname` `to_be_deleted`;\
mapkey(continued) ~ Update `file_open` `Inputname` `to_be_deleted`;~ Activate `file_open` `Open`;\
mapkey(continued) ~ Activate `open_rep` `OK`;~ Select `main_dlg_cur` `MenuBar1`1 `File`;\
mapkey(continued) ~ Select `main_dlg_cur` `File.cb_file_erase`;\
mapkey(continued) ~ Close `main_dlg_cur` `File.cb_file_erase`;\
mapkey(continued) ~ Select `main_dlg_cur` `File.cb_file_erase`;\
mapkey(continued) ~ Close `main_dlg_cur` `MenuBar1`;\
mapkey(continued) ~ Close `main_dlg_cur` `File.cb_file_erase`;\
mapkey(continued) ~ Activate `main_dlg_cur` `psh_erase`;~ Activate `0_std_confirm` `OK`;


After edit it works also from generic (if you type rg by mistake in a generic). Also no matter if the config.prooption "open_draw_simp_rep_by_default" is yes or no.
Works only if you can open two more windows than you already have.


Thanks for your inputs, everybody. People arequite happy with this mapkey.
smiley4.gif



It works in WF3 and also WF4. Just copy-paste into your config.pro.


Best Regards from Gunnar
Edited by: GunnarHansen
 
Wildfire 5 does gives you this option. Right clicking on a part gives an added option "Open Generic" where you can choose to open the generic part or a different instance.

Sam
 
@Doronron1: Your solution is comparable to mine, except that i use an .inf file instead of a .tif to retrieve the information I need
smiley1.gif
 
Here's another mapkey that could be used. I actually like Gunnar's approach better, but I'm posting mine here because it demonstrates a useful technique of creating a trail file "on the fly". This idea can be used to make some really advanced mapkeys without resorting to an AutoIt script.


Here's a walkthrough:

  1. <LI>Run "model info" on the current window, and save the result to a file (called Model_Info.html</LI>
    <LI>Use the @system command to run some batch file commands which create a text file called "trailfile.txt". The text file contains the commands to tell pro/e to open up a model.</LI>
    <LI>Find the name of the model within the Model_Info.html file, and write it into the trailfile</LI>
    <LI>Tell pro/e to run the trail file</LI>
    <LI>Delete the Model_Info.html and trailfile.txt files</LI>


mapkey og @MAPKEY_LABELOpen Generic;~ Command `ProCmdInfoModel` ;\
mapkey(continued) ~ Trail `main_dlg_cur` `bwTheBrowser` `Load Complete`;\
mapkey(continued) ~ Command `ProCmdBrowserSave` ;~ Activate `file_saveas` `OK`;\
mapkey(continued) ~ Activate `UI Message Dialog` `ok`;\
mapkey(continued) ~ Activate `main_dlg_cur` `TAB_BROWSER_OPEN_NAME`0 ;\
mapkey(continued) ~ Timer `UI Desktop` `UI Desktop` `EmbedBrowserTimer`;\
mapkey(continued) @SYSTEM\@echo.^!trail file version No. 1301>trailfile.txt&\@echo.~ Activate \
mapkey(continued) `main_dlg_cur` `File.psh_open`>>trailfile.txt&\@echo.~ Input \
mapkey(continued) `file_open` `Inputname` \\>>trailfile.txt \n\@for /F "skip=2 usebackq \
mapkey(continued) tokens=2 delims='" \%\%a IN (`find "appendCellsToTableRow ('" \
mapkey(continued) Model_Info.html`) do \@echo. \`\%\%a\`>>trailfile.txt\n\@echo.~ Activate \
mapkey(continued) `file_open` `Open`>>trailfile.txt;\
mapkey(continued) ~ Activate `main_dlg_cur` `Utilities.psh_util_trail_train`;\
mapkey(continued) ~ Activate `file_open` `Ph_list.Filelist`1 `trailfile.txt`;\
mapkey(continued) @SYSTEM\@del /f Model_Info.html trailfile.txt;\
mapkey(continued) ~ Activate `open_instance` `open`;
Edited by: mekaneck
 
SW said:
Wildfire 5 does gives you this option. Right clicking on a part gives an added option "Open Generic" where you can choose to open the generic part or a different instance.



Sam

yep. doesn't help those that haven't upgraded yet but i found this new feature most useful and long overdue
 

Sponsor

Articles From 3DCAD World

Back
Top