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.

Modelname to copy/paste memory?

caddie

New member
Hi,


I am trying to get a mapkey to work that involves exporting files in current model to disk, and after running a batch file on them, the mapkey should read the files in again (using a file open).


The easiest (?) would be to open the top model that I exported to disk, but this would require that I could make the mapkey "type in" the name of the model in the file open dialog, and I simply can not get this to work. If I create the mapkey using an example model, this is the name it holds in the mapkey. The trick is to get this mapkey to copy the name of whatever model I have in memory at the moment.


Did anyone succeed in copying the name of active model to the clipboard and later use it to call for the model in a file open dialog? Or am I using the wrong method? Is this where toolkit comes into the picture?
 
Perhaps if you'll outline / block out the logical steps you
want to perform someone might offer suggestions. (Not I, but
there are a few regular readers that seem to be pretty sharp
at that sorta stuff ...)
 
You can do this with a batch file that writes the mapkey open command to the config.pro file.


your mapkey will:-


1. Export a tiff file to c:
(tiff is an example, you can use other files. Use this to obtain the proe filename)


2.Call batch file drwopen.bat.This gets proe name and writes the mapkey command to the config.pro.


3.Load the config.pro into Proe.


4.call mapkey od to open the drawing.


Note:- This adds extra od mapkey commands to the config.pro.
You may want to backup the original config.pro before using this technique and overwrite the new one after you have finished.


Adjust the file path to suit your default Proe directory


Here is a batch file that will open a drawing from the current model


drwopen.bat:-
******************************************************
@echo off
::eek:pen proe drawing from prt or asm


for %%F in (*.tif) do set picname=%%F


set drwname=%picname:.tif=.drw%


del %picname%


>>c:\config.pro echo mapkey od ~ Activate `main_dlg_cur` `ProCmdModelOpen.file`;\
>>c:\config.pro echo mapkey(continued) ~ Activate `file_open` `Inputname` `%drwname%`;\
>>c:\config.pro echo mapkey(continued) ~ Activate `file_open` `Open`;


exit
******************************************************
 
What a great way to get the modelname out of proe
smiley32.gif
 
Hello,


...and thanks for that great solution!
smiley32.gif


Maybe I should not say this, but I have been in the game for nearly 10 years, but never heard of this beeing possible. This was my last reach for a solution, and you nailed it!


I am sorry for the weak explanation I gave in my first post, I realize it was. The agenda for me is to:


1
Linked to intralink, I want to open a model (assembly mostly)from a third party, be it from harddrive or from workspace. It would bestandard components like bearings, pumps, entire enginesand more


2
I activate a mapkey that:
a/ backs up all files to HD and clears memory
b/ launches a DOS batch file that starts modelcheck in batchmode. In this I aim
to fix all layer names and parameters as far as possible.
c/ return to proe and read in the files that are now fixed by modelcheck.


The ultimate goal is to reduce all the varying layer names we have in our top assemblies (~4000 parts) when introducing import models with "strange" names.


point c/ is the one that was solved here, I have the other pieces worked out, and soon I will see the result. If anyone is interrested in point b/ PM me.


Regards


/caddie
 
Hi Jnoval,


The reason for running in batch is that I want the auto correction. I might receive an assembly with many sub-components, and instead of manually fixing each one, I dump the contents to harddrive and run batch on each file. The most important cleanup is forlayers, importing geometry makes the layer list "explode" in our top assemblies.
 
@doronron1
I've been looking for exactly this command, which you created by using mapkeys and batches! Very nice 'trick'!

Wouldn't it be great if PTC simply implemented exactly this kind of command 'open the .drw which has the same name as the part'.

Why do so many simple things in ProE have to be so unneccesarily laborious...
 
You may find using Autoit is now a better solution.


Export the tiff file and use an autoit script to get the filename. You can then open the drawing with Autoit.
 
I just noticed the command real_model_name that can be used in relations, to make a parameter that is equal to the modelname. Then you can find the parameter with a search and copy it's contents (use the drop down menues not Cntrl+v or something), record this in a mapkey and hey presto, a mapkey that puts the modelname in the clipboard.


Im not sure if you can paste it in Pro/e though...


Before I saw the real_name_model function I actually exported a model_info file and a VVBScript read the name (and alot of other functions), kinda makes me feel silly , hehe.
 
I doubt you'll have success with copy and paste commands in pro|E mapkeys. I know that using paste in a mapkey records the actual text pasted rather than the paste operation. Running the mapkey gets the original text when the mapkey was recorded rather than the contents of the clipboard.


I haven't tried it yet, but the autoit scripts look pretty powerful in this regard. You can generate small scripts that will actually perform the copy & paste operations in Pro|E. Call those scripts from your mapkey and you're there. Search the forum for autoit and you'll find some examples.
 
I have been having some sucess with diffrerent VBScripts that use info ported from Pro/E. Pro/E can export alot of into model info, bom info and tree info and suchs, then processing it in the vbscript and making mapkeys in a config_temp.pro, which is later read in and the mapkeys therein called. Works well except for in one regard, I can't remove the mapkeys automatically afterwards. Anyone done this?
 
Well, they open the generic of an instanceif you only have theinstance open,for example.

Another puts Pos Nr as component parameters in an assembly (our production system requires fixed PosNR and PTC has no solution but using component parameters) automatically, since it's a hassle manually.

Then others make files for attachments and such, but I guess all automation mapkeys that requires things like that use these. I don't want the user to have to click anything if they can avoid it.

Pro/toolkit could do this alot easier I guess?????, but no license for that. J-Link seems to be very cumbersome to me, but I guess I havn't put any time in it, thought someone has made a parameter editor here.

Well the issue solved itself when I fixed some other bugs, now it just overwrites the old with the new all the time. That is ok for me. It's deleted on start of pro/e again anyhow.
 
You can "delete" a mapkey by load a config.pro file that overwrite the mapkey with a empty mapkey
Ex. I use s-batch from spekan to print pdf files drom Intralink workspace. By default s-batch close Proe when it is finish. I don't like that. I have make a mapkey that load spekan.pro and after load the dummy remove-mapkey.pro that will overwrite one of the mapkeys in spekan.pro
 

Sponsor

Back
Top