Custom pull-down menus

Custom pull-down menus

Anonymous
Not applicable
1,013 Views
5 Replies
Message 1 of 6

Custom pull-down menus

Anonymous
Not applicable

Hi, folks. I am trying to set up a custom pull-down menu for our field engineering team. I've managed to figure out how to set up the menus, but I need help on executing the commands within the menu. I am trying to set up our menu so that we can select something inside of it and it will run a routine to set the lineweights, colors etc. In other words, if I select existing sewer line, it will run a routine to start a polyline, set color to green, weight to 2 etc. Any help would be appreciated! Thanks.

 

Gary

0 Likes
1,014 Views
5 Replies
Replies (5)
Message 2 of 6

hencoop
Advisor
Advisor

Set the values of the various system variables to what you require first and then call the PLINE command.  You can use a semicolon in place of the spaces to issue enter key (returns) to make it easier to see them.  A semicolon does the same as a space in menu macros.

For example, I use the following to set both system and custom variables before hatching using my "Bar Grate" hatch pattern. Notice that you can also load and call a lisp function (hop.lsp does some other custom things with the custom variables I set): 

^C^C(setvar"hpang"0)(setvar"hpname""grate")(setvar"hpscale"32)(setq prod "GRTE")(setq modf "PATT")(if hop nil (load"hop"))(c:hop) \bhatch  

///////////////////// Below are some of the system variables involved with the setting you mentioned //////////////////////////////

(SETVAR "CELAYER" <existing layer name to use>)

(SETVAR "CECOLOR" <1-256>) ; color number 256=bylayer

(SETVAR "CELWEIGHT" <value>)

Value                         Description
-1                       Sets the lineweight to "BYLAYER."
-2                       Sets the lineweight to "BYBLOCK."
-3                       Sets the lineweight to "DEFAULT." "DEFAULT" is controlled by the LWDEFAULT system variable.

 

Other valid values entered in hundredths of millimeters include 0, 5, 9, 13, 15, 18, 20, 25, 30, 35, 40, 50, 53, 60, 70, 80, 90, 100, 106, 120, 140, 158, 200, and 211.  All values must be entered in hundredths of millimeters. (Multiply a value by 2540 to convert values from inches to hundredths of millimeters.)

 

(SETVAR "LWDEFAULT" <value>)

Initial value: 25
The default lineweight can be set to any valid lineweight value in hundredths of millimeters, including: 0, 5, 9, 13, 15, 18, 20, 25, 30, 35, 40, 50, 53, 60, 70, 80, 90, 100, 106, 120, 140, 158, 200, and 211. All values must be entered in hundredths of millimeters. (Multiply a value by 2540 to convert values from inches to hundredths of millimeters.)

 

(SETVAR "LWDISPLAY" <value>)

Value                            Description
OFF                     Lineweights are not displayed
ON                      Lineweights are displayed

 

Note: You can use 1 and 0 in place of ON and OFF to change the setting.

 

(SETVAR "LWUNITS" <value>)

Initial value: 1
Value                            Description
0                          Inches
1                          Millimeters

 

AutoCAD User since 1989. Civil Engineering Professional since 1983
Product Version: 13.6.1963.0 Civil 3D 2024.4.1 Update Built on: U.202.0.0 AutoCAD 2024.1.6
                        27.0.37.14 Autodesk AutoCAD Map 3D 2024.0.1
                        8.6.52.0 AutoCAD Architecture 2024
0 Likes
Message 3 of 6

scot-65
Advisor
Advisor
Mr. Hencoop is able to set you in the right direction by
populating the "macro" line of the created command.

I will take for granted that you have initially created the
command(s) [in the bottom-left pane, inside the CUI]
and need to fill out the macro part?

From what you are describing it seems it is a little more
work than to simply fill out the macro with scripting.
What comes to mind is trying to set a layer when in fact
it is locked/frozen/off. One will need to check for that
before setting as current.

In the macro part I would make a call to LISP.
If set up correctly, the LISP can be called from the keyboard
as well as from the user interface (UI). From inside the LISP
one can check for possible obstructions and remedy them.
In the macro line it might become a daunting task...

There are plenty of threads here that can teach you to load
LISP when the editor is first started.

You did not state if you are using LT?

And welcome to these Forums.

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
Message 4 of 6

Anonymous
Not applicable

Thank you for the responses. I am still having trouble getting this to work. I'm definitely in over my head on this one. Smiley Sad I've managed to get the menu/sub-menus set up, but I am having trouble initiating the commands within the menu.

 

Lets say I have a menu that looks like this:

 

Field Engineering (main menu)

-Survey As-built (sub-menu)

 -Storm (sub-menu)

 -Sewer

 -Water etc...

 

Ultimately, I want the command to activate once I pick one of the sub-menus (Storm, sewer, etc.) It requires me to put in a "command" from the bottom left of the CUI. If I want all my utility lines (storm, sewer, etc.) to be polylines, then would I add the polyline from the command list and modify that? Thanks.

Gary

 

 

0 Likes
Message 5 of 6

scot-65
Advisor
Advisor
Do not modify the existing OOTB commands in the command list!
These commands are populated throughout the UI as described
in the next paragraph. By changing the command, it will affect the
existing.

Drag and drop the command from the bottom-left pane into the tree
structure in the top-left pane. If the command in the bottom-left pane
is not what you desire, then create one!

Once created, and named accordingly, you will need to fill out the macro
part by first highlighting this new command in the bottom-left and add
the macro in the bottom-right pane. Add an icon if desired from the
top-right pane.

Next, drag and drop from bottom-left to the top-left pane.
Highlight the newly placed top-left command and in the bottom-right
pane rename accordingly. I think the line is "Display". I tend to group
my "custom" commands by adding a prefix to the initial command
name and remove this prefix for the display. I also add the keyboard
shortcut preceded by a \t on the display line if the macro will start
a LISP [IF IT IS A PULL-DOWN MENU ITEM]. Example: "Storm Line\tSL".

For example, you want to start a polyline on the layer "Storm".
In the macro part:
^C^C-Layer;Make;Storm;;Pline;

And welcome to these Forums.

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
Message 6 of 6

Anonymous
Not applicable

Thank you for all the help. It's working great now. Cheers!Smiley Happy

0 Likes