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.

Mapkeys and Layers

handyman2000

New member
Is there an easier way to make corrections to a mapkey than re-creating every step again? I am used to working with Excel macros and most times can just edit the existing code. The code for the mapkeys found in the config.pro file doesn't seem as straight forward to edit. Is there a different way to edit a mapkey and step through the existing steps to make changes? I am just having trouble creating an effective mapkey to reset all the layers and cleanup parts so that in big assemblies it is not a complete mess of datum features.
 
I have had success in troubleshooting by breaking the mapkey down in steps and recording them separately. I thien can record the small chunks in various contexts and then comparing the results in a text editor. Still not too straightforward, but it'll get you there.

I like to nest my mapkeys too, that allows you to build some modular mapkeys. For example, I have a series of export mapkeys. I have several mapkeys that do the universal things liek open the file save as dialog, dimiss the export options dialog, etc. Then in the middle there's just a short mapkey to pick the export type that's unique to the file I'm exporting. Then the DXF export mapkey might call EX1 to call the salvve as, pick the DXF option, then call some other common export mapkeys.

Breaking it up in smaller chunks canmake them more manageable adn easier to trouble shoot. I then, in the example above, only need to make sure the EX1 mapkey reliably opens the save as dialog in various contexts.
 
I've created a mapkey to clean up layers, and it works great, but I'm only creating a handful oflayers in my models. If I decide to add more layers, I have to redo the whole thing. I would love to know how to avoid this by simply adding a few more steps to the existing mapkey.
 
I would think that you can record a mapkey that defines each rule based layer separately. Then, create one that calls each of them one at at time. Then adding a new layer to your list woudl be a simple matter of recording the new mapkey for tha layer and adding it to the list for the main one.
 
That seems pretty smooth. But, once again, since it's so difficult to modify an existing mapkay, the user winds up creating multiple mapkeys! Then what happens when you need to add another layer? You would need to write a new mapkey to create the new layer, then write another mapkey to call out the existing "overall" layer mapkey and the "new layer" mapkey.


Don't get me wrong, this is an elegant solution; it would just be so much easier to be able to edit mapkeys by stepping through them...


Ah well, Pro-E for ya....
 
Mapkeys used to be very easy to edit back in the menu manager days. Now with the more graphical interface they look like Greek. However, many of my old menu manager mapkeys still work. Can you switch to legacy mode & create mapkeys with the old menu structure? Even if that works, is it a good idea?
 
Another related question I have is how do I create a mapkey to select all current layers and delete them so I can re-create my own layer structure. I can't seem to find a way to select all for the first step.
 
Tough one. I'd never tried that until just now; I just delete the part layers before running my mapkey.


I haven't figured it out...if I have a chance later, I'll try again.


Anyone ever figure this out?
 
Verge - Calling another mapkey from within a mapkey is pretty easy, you can add that text in notepad. All you need to do is add ;%[text] to the end. If it's in the middle, you need to make sure there's a; in between it and the command before and after.

Here's an example. This mapkey spits out a DXF file of a drawing in a specific server folder and appends the REVISION to the file name.

So, it first calls mapkey EX1, then mapkey EX4 then does some specific stuff, then calls mapkey EX2, then EX3 and finally a batch file before notifying the user that it's done.

<div style="margin-left: 40px;">mapkey dx2 @MAPKEY_LABELExp DXF with Revision in filename;%EX1;%EX4;\
mapkey(continued) ~ Open `file_saveas` `type_option`;~ Close `file_saveas` `type_option`;\
mapkey(continued) ~ Select `file_saveas` `type_option`1 `db_137`;%EX2;%EX3;\
mapkey(continued) @SYSTEMP:\\config\\00_design_central\\export\\dc_dxf_export; \
mapkey(continued) @MANUAL_PAUSEYour DXF file is now in your temporary folder, in a sub-folder \
mapkey(continued) marked with today's date.\n\nThank you.;
</div>
It's 5 lines (and 2 of them are the ending notice) that does the job of 60+, a lot more if you count the batch file.

Edited by: dgs
 
Hey John,


Here is a mapkey that will delete all layersI use it in WF2. As Doug mentioned you can nest it front ofmapkeys that create new layers. One problem I've run into in doing so is that Pro/E maycrash if some of the models arein an intralink released state. This is why I have it avilable both as nested an standalone.


If I know that there are released models, I run it standalone so that Pro/E will not crash. Then it actually get run agian, not req'd too, but becuse it is nested in my layer creation mapkey it run even thought there is nothing to delete the second time around.Once the layers are created and extended down you will need admin privliges to force check-in the modified released models.


Awork around to force check-in would be to remove those models prior to running the mapkey, but then you would not get those models cleaned up.


I need to add a couple more lines to this mapkey, but right now all my mapkey time is going to 3D general notes. When you swiitch back to the model tree everthingwill beexpanded, just double clik the top level to un-expand and double click it again to return to the expansion you had prior to running the mapkey.


2009-04-08_195117_del_layers_mapkey.zip


Later Jim
 
Thanks Jim

That worked great. My part layer delete and re-create map key works great now. Now I just have to work on getting an assembly version created. That was a big help.

John
 
I've found that you can sometimes embed both the part and assembly bits in the same mapkey.

For example, I have a mapkey that exports parameters to a text file. At one point, in assy mode, you have to choose part or assy when choosing the item for saving the parameter file. In part mode the assy pick is grayed out, so I recorded the assy pick first then added the part pick immediately after in notepad.

In assy mode, it picks assy and then continues on as the part pick isn't there. In part mode, the assy pick isn't there so it skips that and selects part.
 
John,


Doug is right, there is no reason to have a separate mapkey for assembly layers. the delete portion of the mapkey will work in both parts and assemblies. If you recall the thread that this one spun out of Glen recommended that you not have an all components layer (will cause issues when trying to isolate).


So unless you are trying to capture some other type of assembly items on a layer; you should be able to use the same one. Just rember that when it is run in an assembly the layers are deleted in both the asembly and the sub-componentes but the new layers are only creted in the assembly.


The new layers must be extended to the sub-components thru the layer tree menus.I usally do it manually but you could append to the maykey to do it for you. should not affect anything when run in part mode.
 
I'll have to check out Jim's mapkey when I have a chance. The one thing I mess up at times is forgetting to delete the original layers before running the "create layers" mapkey.


Thanks to Doug and Jim, and John for pursuing this one.
 

Sponsor

Articles From 3DCAD World

Back
Top