News:

Please note new Forum URL: forum.designcad.com

Main Menu
DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

macro for layer commands

Started by rccon, April 11, 2014, 08:41:24 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

rccon

When I'm doing a floor plan I often have the different levels of the building one atop another, in different layers. I'm frequently needing to show or hide layers other than the active one. To hide all, I use L, alt+h, enter and to show all, L, alt+w, enter. I tried to make a macro so I could do these with a single keystroke, but the macro recorder would not record the keystrokes when the layer options window was active, as it apparently works only in the drawing window.

I have a keystroke for the same as finger, thanks to JJG, which activates a command in the dc3maxcmd.ini file. Could I do something similar for the layer options commands?

DrollTroll

I don't think Hide All Layers/Show All Layers are available as separate commands -- the program just iterates through all but the current layer and turns them off or on.

To do the same in a macro,  you'd need to use a loop from 0-2000, setting Layer(i) = 0 (turns it off) or Layer(i) = 6 (fully on), where 'i' is your loop variable. Since you *can't* turn off the current layer, you shouldn't have to worry about skipping the current layer -- it'll just quietly ignore that one.
25 years with DesignCAD

DrollTroll

Actually, the sample macros folder already contains macros to do this. Please examine Layeroff.d3m and Layeron.d3m in a text editor. If you're using more than the first 255 layers, change the 255 to 2000 in both macros.
25 years with DesignCAD

Bob P

Try out my layer utilities:

http://www.wwslalom.net/dc/layers.zip

From the included "help" file:

Bob's Layer Manipulation Suite
Bob Putnam ([email protected])
----------------------------------------------------------------

Program: mall.d3m
Changes to Edit all (visible) layers

Program: mclo.d3m
Edit current layer only

Program cl.d3m
Makes the layer of the selected entity the current one.  Only works if the layer is selectable.

Program: hsl.d3m
Hide Selected Layers"
The program will hide the entities in the layers of the entities selected.
If the current layer is to be hidden, the program will change to a high layer.

Program: l.d3m
Changes to or changes entities to a given layer
At the command line type l <n>, where n is a layer number.
If there are entities selected, they will be moved into that layer.
If there are no entities selected, n will become the current layer.
The color will be changed to that in the colors.txt file.

Program: shl.d3m 
Displays all layers

Program ssl.d3m 
Show Selected Layers"
If no entities are selected, all layers but the current one are hidden.
If entities are already selected, the layer of the first is made current and the rest are left visible.  Unselected layers are turned off (hidden).

-----------------------------------------------------------------

The following are a group of programs that allow you to remember up to 19 layer
configurations that associate with the current drawing.  That is, each drawing can
have its own set of "views".  They can be recalled, added, subtracted, replaced
and new ones saved.  When you save a layer state (savl.d3m), you will be asked for a short
description, which will be shown when you run the other programs. The layer states
are saved in files that are named <filename>.dv(n) where n is a letter from a-q

Program: savl.d3m
Saves the current layer state to a file for retrieval by rv.d3m, av.d3m, subv.d3m

Program: rv.d3m
Retrieves a saved layer group to display from file

Program: av.d3m
Adds a layer group to the current view

Program: subv.d3m
Removes a layer group from the current view

Note that each layer "state" creates a file in the same folder as the drawing.  You could end up with 17 separate files associated with a drawing.

SFA

Bob,

Thank you very much for these.

As we say in Scotland, you dancer!


Stan



SEMPER IN EXCRETIA

rccon

I found the layeroff and layeron macros suggested by DT, discovered the layer(x) command, and made some new macros to do pretty much what I want with keystrokes. But this led to another problem which has me stumped. I have a "macros" category on my custom menu which lists the macros that i use, in case I need a reminder of the keystrokes. I assigned the keystrokes, then added the macros to the menu, and they appeared with the wrong keystroke reminders. I have deleted the new keystrokes and menu entries, and erased dc3maxkey.ini, then started over, but still the keystroke reminders on the menu are either on the wrong macro or missing entirely, even though the keystrokes are working properly. Can anyone help me get this sorted out?

samdavo

rccon,
Sorry I don't use a customised menu, but sounds interesting, and worth checking out.
The other option is to use toolboxes of course.
I'm guessing you've saved the new hotkeys as a new keyboard?  Anyway you say they are working so all good there at least.

DrollTroll

rccon, save your keystroke file in ascii format (*.dka) and your menu file in ascii format (*.dma). Zip them up along with dc3maxkey.ini and post them here; someone here can probably help troubleshoot the problem from there.
25 years with DesignCAD

rccon

DT, here are the files, and a screenshot showing the incorrect keystroke reminders.

SciGraphics

To Stan (SFA): I just spent 6 minutes deciphering "YOU DANCER". The correct spelling/punctuation seems to be "YA, DANCER! Below is what I found:

 
I'm from Scotland, and if someone says - ''ya dancer" it's normally a response of excitement at something nice that's just happened, or some good news.

Works for me!  Jim A., Tucson, AZ

DrollTroll

rccon,

Wow, that's a tangled mess of definitions there. The same macro may have more than one identifier and the identifier used in a keystroke or menu may not match any of the established identifiers. Best bet may be to reset the menu, Save as Default, then reset the keystrokes, Save as Default.
Then remove DC3Maxkey.ini -- it's got conflicting ids for the macros.

Finally, assign your macros back to the menu all at one go, Save as Default. restart DC and verify menus, then reassign the custom keystrokes, save as default, and restart DC once more to verify.

That *should* fix it.
25 years with DesignCAD