Advanced Autocad and programming in Autocad - 12

ors


 Part 2: Menu name, Menu name starts with 2 asterisks and requires

is unique. This name is used to link

you

item

crab

you

other menu

, you

success

you, guys

support line

and others

image menu. The name of the menu is not shown.

how many

more than 12 characters and must not contain spaces. Otherwise it will be ignored.

 Part 3: label and name of the menu group. The syntax to describe it is as follows:

ID_NameLabel [description will appear on screen]

 Part 3: component menus. The syntax to describe a menu item is as follows: ID_NameLabel [name]menu_macro

In which: name is the name that will appear on the menu item screen.

Menu_macros are macros that are executed when this menu is selected.

Consider an example in the acad.mnu file as follows


***POP1

Section name

**FILE

Nenu name

ID_MnFile [&File]

The menu ID and description line of the menu will appear on the screen (like file, edit, draw,…)

ID_New [&New...tCtrl+N]^C^C_new ID_NewSheet [Ne&w Sheet Set...]^c^c_newsheetset ID_Open [&Open...tCtrl+O]^C^C_open ID_OpenSheet [Op&en Sheet Set.. .]^c^c_opensheetset

ID_DWG_CLOSE [&Close]^C^C_close

The following lines describe the selections (also known as menu items).

Maybe you are interested!

Advanced Autocad and programming in Autocad - 12

2.2. Macro Menu

This is the most important part of the menu and all types of menus contain it.

A macro menu is a string of characters containing the name of the command that will be called when the MenuItem is selected. The order of the parameters in the macro menu is the same as the order in which these parameters appear at the AutoCAD command prompt.

Conventions used in macro menus.


Character

Describe

Space bar, ;

Enter key in AutoCAD

Space bar

Is a space when entering text

sign

Pause to allow the user to enter data, either by clicking a point or entering a value.

+ sign

Used when the description line is too long, want to continue the description on the next line

We put the + sign at the end of the line.

Sign *

Placed at the beginning of the macro, after ^C^C, will repeat the command until we press ESC or select another Menu Item

^C

Cancel all active commands (Escapse)

^P

Turn off all macro displays on screen. (Turn MenuEcho system on,off).

^M

ENTER character (Ctrl+M)

^B

Toggle (on/off) cursor coordinate display modes (Ctrl+B)

^E

Move the cursor hair position on the screen to one of 3 positions in the measuring axis plane (Ctrl+E)

^G

Toggle grid display mode (Ctrl+G)

Similar to the BackSpace key, used to delete the character before noa of the command line.

^O

Convert to Ortho Drawing mode.

^T

Switch input function from tablet input panel (Ctrl+T)

^Z

Empty character, automatically adds a space to the end of the Menu Item.

//

Convention for starting comment strings.

^H

Example 1:

ID_ArcStCeAn [S&tart, Center, Angle]^C^C_arc _c _a Example analysis:

S&tart, Center, Angle : Displayed on menu : Start, Center, Angle

^C^C : Cancels all commands before it.

_arc : Start drawing an arc, allows switching between versions with different languages.

space is equivalent to the enter key.

: pauses for the user to enter the coordinates of a point on the screen.

_c : Select option center, allows switching between versions with different languages

each other


: pauses for the user to enter the coordinates of a point on the screen.

_a : Select an angle option, allowing switching between language versions

different.

Example 2

ID_MoveRight [Move .1 Right]^C^Cselect move previous ;.1,0 ; Example analysis:

^C^C : Exit all active commands. Select : Start select command.

Space represents enter, ending the select command.

Then move the selected objects to the Right 0.1 drawing units

Example 3

The following macro will convert the selected polyline to a polyline with a width of 0.1 units.

^C^Cpedit w .1 ;

Example 4

You can use the following macro to automatically draw 4 circles with pre-defined radius and center. Because the line is too long, we have to write it in 2 lines, so we add a plus sign at the end.

^C^Ccircle 2,2 1.5 circle 6,2 1.5 circle 10,2 1.5 circle + 14,2 1.5

2.3. Pull-down Menu

2.3.1. Section of Pull-down menu

Pulldown menus are declared from section Pop1 to pop499. Each section can have one or more pulldown menus (usually 1). Each pulldown menu can have up to 999 menu items. AutoCAD will ignore menu items that exceed the above limit. If the

If the image does not have enough space to contain all the menu items, AutoCAD will automatically crop them to fit.

man size

hint

h and two up arrows

g will appear.

Pulldown is divided into two types.

 First type

has sections from pop1 to

pop 16. The

this menu

will be

self-freezing

into corner position

it's on man

If this section has more than one menu then

Only the first menu is loaded into the screen.

 The second type has sections from Pop17 to

pop 499. The

this menu

will not freeze

got ear

into the screen. However, we still

can ear

it goes to command screen

menuload or menu swapping function.

2.3.2. Title of pull-down menu

For pull-down menus, the title of the first item selected will be used as the title that appears on the menu bar. The subsequent descriptions will serve as the labels, titles, and macros of the component menus.

The way to create titles for dropdown menus and component menus is the same; the titles must be enclosed in square brackets.

Menu title creation conventions.

Character

Meaning

--

Separator line on the drop down menu bar

->

Start a submenu

<-

End parent menu (end submenu)

<-<-

Final declaration of submenu and dropdown menu

$( )

Allows the use of the DIESEL string in menuItem title.

~

Dim the selection and do not allow this item to be selected

!.

Makes the selection button () appear before the menu.

&

Make the underline appear for the character that follows it (declares the shortcut)

t

Right align the characters in the selection title.

c

Declare hotkeys.

Analyze the following example:

**FILE

ID_MnFile [&File]

ID_New [&New...tCtrl+N]^C^C_new ID_Open [&Open...tCtrl+O]^C^C_open ID_DWG_CLOSE [&Close]^C^C_close

[--]

ID_Save [&SavetCtrl+S]^C^C_qsave

ID_Saveas [Save &As...tCtrl+Shift+S]^C^C_saveas ID_Export [&Export...]^C^C_export

[--]

ID_Inan [->Print]

ID_Preview [/vPlot Preview]^C^C_preview ID_PlotSetup [Pa&ge Setup Manager...]^C^C_pagesetup ID_PlotMgr [Plotter &Manager...]^C^C_plottermanager ID_Print [<-&Plot...tCtrl+P]^C ^C_plot

[--]

ID_MRU [Drawing History] [--]

ID_APP_EXIT [E&xittCtrl+Q]^C^C_quit

Analyze the following example:

[Pop&3]

ID_ortho [$(if,$(getvar,orthomode),!.)Ortho]^O ID_Snap [$(if,$(getvar,snapmode),!.)Snap]^B ID_grid [$(if,$(getvar, gridmode),!.)Gride]^G ID_cmdactive [$(if,$(getvar,cmdactive),~)line]Line

2.3.3. Reference to pulldown menu

We can dim or highlight menu Items, or we can also get the status parameters of each menu Item by using references through AutoLisp functions.

There are two types of references:

 Relative reference

 Absolute reference.

 Relative references.

A relative reference is a reference that uses the menu item's label name.

The AutoLisp menucmd function allows us to reference items in a pulldown menu.

Syntax:

 To assign status to menu

(menucmd “Gyyy.zzz=xxx”)

 To get the status parameter of the menu (menucmd “Gyyy.zzz=?”) the function returns the value xxx In which

yyy – name of menu group zzz – selection item label

xxx - menu status: “~” (dimmed), “!.” (checked) “” (normal status.

 Absolute reference

Absolute references are references based on counting the number of menus on the screen.

image.

The AutoLisp menucmd function allows us to reference pulldown items.

menu

Syntax:

 To assign status to menu

(menucmd “Pn.i=xxx”)

 To get the status parameter of the menu (menucmd “Pn.i=#?”) the function returns the value xxx In which

n – the menu number from left to right on the screen.

i – the order number of the menu item to reference (including submenus and separators between sections in the dropdown menu)

xxx – The value of xxx is equal to “Pn.i=”&menu status: “~” (dimmed), “!.” (checked) “” (normal status.

For example :

ID_Swap1 [Swaping1]^C^C^P(if (= (menucmd "P1.1=#?") "P1.1=~") (menucmd "P1.1=") (menucmd "p1.1=~ ") )

ID_Swap2 [Swaping2]^C^C^P(if (= (menucmd "GACAD.ID_new=?") "~") (menucmd "GACAD.ID_new=") (menucmd "GACAD.ID_new=~") )

2.3.4. Insert and remove Pull-down menu on menubar

In addition to the MenuLoad command, pull-down menus of this group can be added to the menu bar using the following syntax:

(Menucmd “Gyyy.zzz=+uuu.vvv)

In there :

Gyyyzzz - will define the position of the pull-down menu uuu.vvv will insert. yyy – The menu group name of the pull-down menu to be positioned.

zzz – The alias (or item name) of the pull-down menu that specifies the location for uuu.vvv to be inserted.

uuu – Menu group name of the pull-down menu to be inserted. uvv – Alias ​​name of the pull-down menu to be inserted

We can also remove a Pull-down menu from the menu bar with the following command:

(Menucmd “Gyyy.zzz=-)

In there :

yyy – Menu group name of the pull-down menu to be deleted. zzz – Alias ​​of the pull-down menu to be deleted.

For example :

***pop3

**Test3 [Pop&3]

ID_ortho [$(if,$(getvar,orthomode),!.)Ortho]^O ID_Snap [$(if,$(getvar,snapmode),!.)Snap]^B ID_grid [$(if,$(getvar, gridmode),!.)Gride]^G ID_cmdactive [$(if,$(getvar,cmdactive),~)line]Line

ID_huybo [Delete menu]^c^C(menucmd "Gcustom.pop3=-")

ID_chenpop4 [Chen pop4]^C^C(menucmd "Gcustom.pop3=+Custom.Pop4")


***pop4

**Test4

[Pop&4]

ID_monew1 [mo new]^C^C^P(menucmd "Gcustom.ID_New=~");^P ID_hiennew1 [show new]^C^C^P(menucmd "Gcustom.ID_New=");^P ID_TTnew1 [new] menucmd]^C^C^P(alert (menucmd "Gcustom.ID_New=?"));^P

[--]

ID_monew2 [mo new]^C^C^P(menucmd "P5.1=~");^P ID_hiennew2 [show new]^C^C^P(menucmd "P5.1=");^P

ID_TTnew2 [ben menucmd]^C^C^P(alert "Cmdmenu"&(menucmd "P5.1=#?"));^P

2.4. Shortcut menu.

Shortcut menu is basically the same as Pull-down menu. The only difference is in section declaration. Shortcut menu is declared from section Pop500 to pop999 and Pop0. In each

A dropdown menu can have up to 499 menu items. AutoCAD will ignore menu items that exceed 499.

exceeds the upper limit. If the screen does not have enough space to accommodate all menu items, AutoCAD will automatically

cut it down to fit the current one.

ruler

hint

h and two up arrows

g will be exported

AutoCAD's Pop0 menu is the Snap menu, which appears

you

method of capture

point

The

Pop500 menu to

Pop999 is cac

context menu

2.5. Buttons menu and auxiliary menu.

2.5.1. Section of Buttons menu and auxiliary menu

The mouse device buttons are reported by auxiliary menus and are described in the menu file from section ***AUXn (from ***AUX1 to ***AUX4)

Other pointing devices such as electronic pens are indicated by the Buttons menu and are described in the menu file from the ***Buttonsn section.

Note that the menu buttons and auxiliary menus are only effective in the base menu file (main menu) and have no effect if we declare them in the partial menus (component menus).

Since the descriptions of the menu and auxiliary buttons are the same, here we only consider the AUX menus, while the menu buttons are similar.

The menus from section AUX1 to AUX4 have the following meanings:

Section

Keyboard and mouse combination

AUX1

Press one of the mouse buttons

AUX2

Shift key + one mouse button

AUX3

Ctrl key + one mouse button

AUX4

Ctrl+Shift+one mouse button

2.5.2. Create AUX menus.

Lip

The line in this section is a

selected item

. The structure of the section is similar to

you

other section

However, the name and title are not required.

, we can ignore them

or

We use them as annotations. Consider the following example:

***AUX1

// Simple button

// if a grip is hot bring up the Grips Cursor Menu (POP 500), else send a carriage return

// If the SHORTCUTMENU sysvar is not 0 the first item (for button 1, the "right

button")

// is NOT USED.

$M=$(if,$(eq,$(substr,$(getvar,cmdnames),1,5),GRIP_),$P0=ACAD.GRIPS $P0=*);

$P0=SNAP $p0=*

^C^C

^B

^O

^G

^D

^E

^T


The first item is equivalent to the second mouse button if the system variable shortcutmenu=0.

But if this variable is different

Otherwise this button will be linked to

you

default menu shortcut

nail

of the AutoCAD system.

The second item corresponds to button number 3 of the above mouse system.


system variable

Mbuttonpan=0. Child

this variable is different

Otherwise this button will be linked to the default pan button.

nail

of AutoCAD (the default of this variable is 1).

The third selection item is equivalent to the fourth mouse button.

In general, the number of buttons a mouse has, the number of commands we have.

Note that only Pop0 has the ability to display the mouse position on the screen.


image.

The following example uses the title as a caption:

***AUX1

[button number 2]; the second button is the enter command.

[button number 3](alert "button number 2 is eaten") the third button gives an announcement. [button number 4]^C^C the 4th button is the escape button.


Likewise, you give according to the

can be effective

h AUX2, AUX3, AUX4 menus of

min

how

2.5.3. Menu swapping.

Menu swapping dun

g to exchange cribs

between menus. For example, when we are performing

zoo command, right click to switch to another shortcut menu

. Or when entering

Draw

Surfaces 3D surface... AutoCAD specialized slides included.

The syntax to swap pairs is as follows:

go to image menu to choose the image

h weight

draw with

$Section=MenuGroup.MenuName $Section=MenuGroup.*

If we want to exchange 2 menus

lie down

g in a group we can ignore MenuGroup.

That means our syntax will be as follows;

$Section=MenuName $Section=*

The following example is taken from the Acad.mnu file:

ID_3dsurface [&3D Surfaces...]$I=ACAD.image_3dobjects $I=ACAD.*

This is the 3d surfaces menu item in the draw menu.

AutoCAD. When we choose

item

now

exam

AutoCAD will switch to the image menu named image_3dobjects

The following example is taken from the Acad.mnu file:

***AUX2

// Shift + button

$P0=SNAP $p0=*

When we press shift + right click, it will switch to section Pop0, Snap menu is in Section Pop0.

2.6. Image Tile menus


in

Menu hint

h an

h is a special type of menu in AutoCAD, containing a list of

h guys

item

choose and

you

slides corresponding to the items

select that. When selecting

into categories

choose

2.6.1. Section of Image menu

The

year image menu

in the Image section. And get

declare

is ***Image. Section

example of a section menu

h an

h as follows:

***image Declare section name

**image_poly Menu name

[Set Spline Fit Variables] The title of the image menu. [acad(pm-quad,Quadric Fit Mesh)]'_surftype 5 The menus


g describes the


selection

[acad(pm-cubic,Cubic Fit Mesh)]'_surftype 6 of the image menu [acad(pm-bezr,Bezier Fit Mesh)]'_surftype 8

[acad(pl-quad,Quadric Fit Pline)]'_splinetype 5 [acad(pl-cubic,Cubic Fit Pline)]'_splinetype 6

2.6.2. Description of selected items

of the menu

h image

Each image menu item is described in two parts: title and macro menu.

(no ID label like pull-down menus).

Separation

[sldname]

title has cac

you

h describes the following:

The image of the slide sldname will be displayed in the right frame of the menu box, the title is

sldname will be displayed

[sldname,labeltext]

up in the list to the left of the menu box.

Title is LabelText will be displayed

up in the left list of the menu box.

h of

The slide sldname will be displayed in the right frame.

[sldlib(sldname)]

of the menu box.

The title is sldname will be displayed

up in the left list of the menu box.

h of slide

sldname is located in the slide library named sldlib which will be displayed in the menu box.

[sldlib(sldname,labeltext)]

up in the right frame

Title is the labeltext that will be displayed .

up in the left list of the menu box.

h of slide

sldname is located in the slide library named sldlib which will be displayed in the menu box.

[blank]

up in the right frame

When you want

insert a python icon

g on the list of slides to the right of the menu box. One

distribution line

[ labeltext]

h will be displayed on the list on the left side of the menu box.

When the first character of the description item is a space, the description item will be displayed in

list but not one

Which icon?

are displayed on the right side of the menu box. You

Usually use it in case you want to create an exit button to exit the image menu, this option usually does not have an accompanying Icon.

2.6.3. Call to display image menus

In addition to calling

show the

menu hint

h an

h using the swap menu function (as shown).

presented in section 2.5.3), we can also use the following:

don

g AutoLisp command to call

them. Syntax like

(MenuCmd “I=yyy.xxx”)(menu cmd “i=*)

In there

yyy – Menu group name. If they are in the same group, we can omit yyy.

xxx – Menu name hin Example as follows:

he

(menucmd "I=acad.image_vporti")(memucmd "i=*") (menucmd "I=image_vporti")(memucmd "i=*")

2.6.4. Slides and slide libraries.

 Create slides.

Note :

 Slides must be easily recognizable.

 Security

h must fit the frame. Hin

h an

h is created with a ratio of (1 x 1.5)

 Cac

Highlighted objects like Pline, trace, 2d solid only appear

up

contour. To shrink

We use the shading command to create the shapes:

 Switch to drawing space

 Create Viewport with size 1.5:1

 Create slide library.


2.7. Screen menu.

2.7.1. Section of the image menu.

g Shade before creating slide.

Comment


Agree Privacy Policy *