TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: like_citrus on April 02, 2020, 08:54:10 AM

Title: Cursor menu - custom
Post by: like_citrus on April 02, 2020, 08:54:10 AM
Is there a way to create a custom cursor menu (right-click menu), as shown in the attached image ... not by editing the Customize User interface (CUI) ... but instead editing a file with a text editor.

Apparently the older versions of AutoCAD used a ".mns" file (POP501 may have been the default cursor menu). Now it may be a ".cui" or ".cuix" file ... which may or may not be easy to change using a text editor.

If possible, I would prefer to edit the ".mns" file, using AutoCAD 2013.

Can it be done for a start? If so, how can it be done? For information, I have an equivalent pull-down menu made as follows:


LOAD USING SCRIPT FILE (TEST.scr)
Code: [Select]
(if (and (not (findfile "TEST.mnu"))
(findfile "C:\\Folder1\\POP13 Test\\TEST.mnu")
)
(setenv "ACAD" (strcat (getenv "ACAD") "C:\\Folder1\\POP13 Test"))
)
(command "._MENULOAD" "TEST.mnu")
(menucmd "P13=+TEST.CTOPopTEST")

MENU FILE (TEST/mnu)
Code: [Select]
***MENUGROUP=TEST
***POP13
**CTOPopTEST
[Test]

               [->UC]
                 [310UC158]^C^C-INSERT UniversalColumns_310UC158;scale;1;
                 [310UC137]^C^C-INSERT UniversalColumns_310UC137;scale;1;
                 [310UC118]^C^C-INSERT UniversalColumns_310UC118;scale;1;
                 [310UC96.8]^C^C-INSERT UniversalColumns_310UC96.8;scale;1;
Title: Re: Cursor menu - custom
Post by: T.Willey on April 02, 2020, 10:34:02 AM
This is more a general Acad question than a lisp one, but the answer is yes, kind of.  I have a custom menu that pops up, but mine is a middle mouse button.  I have used it for years, and the main editing I do is to the mns file.  You can still use one, but when you load it into Acad a cui(x) will be created along side.  If you need to change it, you can use either the cui editor or you can change the mns file and un/re-load the file.  Here is the contents of my mns file:

Quote
//
//      AutoCAD menu file - C:\Custom\custom2.mnc
//

***MENUGROUP=custom2

***AUX1
$M=$(if,$(eq,$(substr,$(getvar,cmdnames),1,5),GRIP_),$P0=ACAD.GRIPS $P0=*);
//$M=$(if,$(wcmatch,$(getvar,cprofile),"*3M"),$P0=custom2.WilleySnapMMM $p0=*,$P0=custom2.WilleySnap $p0=*);
$P0=custom2.WilleySnap $p0=*
^C^C
^B
^O
^G
^D
^E
^T

***POP0
**WilleySnap
[MyMenu]
[Move Orient]^c^cMoveOrient
[Total Length]^c^cTLen
[TOrient]^c^cTOrient
[Distance]^c^cDist
[Circle, 2p]^c^cCircle;2p
[--]
[Next Tab]^c^cNTB
[Previous Tab]^c^cPTB
[--]
//[->Layers]
//   [Freeze]^c^c^c_LayFrez
//   [Off]^c^c^c_LayerOff
//   [--]
//   [Isolate]^c^c^c_IsoLays
//   [UnIsolate]^c^c^c_UnisoLays
//[<-Edit Props by Entity]^c^c^c_EditLayerFromSelection
[->Text/Attribute Routines]
   [Text to MText]^C^C^C_Dt2Mt
   [Space Notes]^C^C^C_SpaceNotes
   [Break Text Inplace]^C^C^C_BreakTextInplace
   [Add Notes to Numbers]^C^C^C_AddNotes
   [Add Numbers to Notes]^C^C^C_NumberNotes
   [Remove From Text]^c^c^c_RemoveFromText
   [Replace in Text]^c^c^c_ReplaceInText
   [--]
   [Move Text/Attributes]^C^C^C_MoveAttText
   [Make Attributes Invisible]^c^c^c_AttInvisible
   [Make Attributes Visible]^c^c^c_AttVisible
   [Scale Attributes]^c^c^c_ScaleAttributes
   [Multi-Attribute Edit]^C^C^C_MATT
   [Change Attribute Style]^c^c^c_ChangeAttStyle
   [Change Atts (per Tag n Value)]^C^C^C_AttUpdate
   [Move Attributes, Default]^C^C^C_AttDftLoc
   [Change Attributes Rotation]^C^C^C_AttRot
[<-Change Attributes Height]^C^C^C_AttHeight
[->Block Routines]
   [Change Block]^C^C^C_cb
   [LineUp Blocks]^C^C^C_LUB
   [Rotate Block Geometry]^c^c^c_RBlkGeometry
   [Change Block Objects to ByLayer]^C^C^C_ChangeBlockByLayer
   [Replace Block]^C^C^C_ReplaceBlock
   [Erase (nested) Block Object]^c^c^c_EraseObjectFromBlock
   [--]
   [Update Atts from Other Dwg]^c^c^c_CopyAttributesFromDrawing
   [Add Extra Attribute]^C^C^C_AddExtraAtt
[<-Copy Attributes to New Block]^C^C^C_CopyAtts
[->Xref Routines]
   [Copy Layer Properties]^c^c^c_CopyXrefLayerProps
   [Check if xrefs will load]^c^c^c_XrefCheck
   [My Xref Manger]^c^c^c_MyXrefManager
   [--]
   [Unload]^C^C_xr-u
   [Reload]^C^C_xr-r
   [Reload (Last one un-Loaded)]^C^C_xr-rt
   [Reload All]^C^C^C_ReloadAllXrefs
   [Unload All]^C^C^C_UnloadAllXrefs
   [Reload Only Loaded]^C^C^C_ReloadLoadedXrefs
   [--]
   [Bind (as Insert)]^C^C_xr-bi
   [Bind (as Bind)]^C^C_xr-bb
   [Detatch]^C^C_xr-d
   [--]
   [Open Drawing]^C^C_xr-open
   [Copy Layer Settings]^C^C_CopyXrefLayerSet
   [Match Color/Linetype to Origianl]^C^C^C_SetOrigLayerProps
   [Change color of all xrefs layers, ObjectDBX]^c^c^c_ChangeXrefsLayerColorMulti
[<-Change layers color]^C^C_xr-c
//[->Drawing Routines]
//   [Next Drawing]^C^C^C_MyNext
//   [Next Drawing Close Current]^C^C^C_MyNextAndCloseCurrent
//   [Previous Drawing]^C^C^C_MyPrevious
//   [Previous Drawing Close Current]^C^C^C_MyPreviousAndCloseCurrent
//   [Active Next Open Drawing]^C^C^C_NextInDocManager
//   [--]
//   [Close All (without saving)]^C^C_CloseAllButActive
//   [Close Select]^C^C_CloseSelect
//[<-Tile Selected Drawings]^C^C_TileSelect
//[->Plotting]
//   [Batch Plot]^c^c^c_MyBPlot
//[<-Quick Publish]^C^C^C_QuickPublish
//[->Zoom Operations]
//   [Zoom Window]'_.zoom;_window
//   [Zoom Previous]'_zoom;_previous
//   [Zoom Extents]'_zoom;_extent
//   [--]
//   [Realtime Zoom]'_zoom;;
//   [Realtime Pan]'_rtpan
//[<-3d Orbit]'_3dOrbit
[--]
[Perpendicular]_per
[Bisect]'bi
[Mid Between 2 Points]_m2p
[->Align]
   [Aling X]'alignx
   [Align Y]'aligny
[<-Align Z]'alignz
[Intersection of Points]'intpoints
[->From]
   [From]_from
   [From X]'fromx
   [From Y]'fromy
[<-From Z]'fromz
[--]
[Edit Properties]^C^C^C(if (not c:EditProps) (load "GrabPropertiesv02.lsp"));_EditProps
//[Match Properties]^C^C_Match

That is most, if not all, the help I can give.  I have not had to set it up in a long time, since I wrote this way back when.  But the top portion of the file is where it makes it available in the cui editor to select it as an option for the middle mouse button.  You might be able to do it for the right-click option, but I have never tried.

Hope it was at least a little helpful.
Title: Re: Cursor menu - custom
Post by: MP on April 02, 2020, 11:20:34 AM
**WilleySnap - consequence of priapism?
Title: Re: Cursor menu - custom
Post by: Lee Mac on April 02, 2020, 02:28:33 PM
**WilleySnap - consequence of priapism?

 :lol:
Title: Re: Cursor menu - custom
Post by: T.Willey on April 02, 2020, 02:59:02 PM
**WilleySnap - consequence of priapism?

Nice vocabulary, MP!!  I had to look it up, and now I'm thinking maybe I shouldn't have posed that portion.  Too late now, and not that I'm aware of.  Yet...
Title: Re: Cursor menu - custom
Post by: MP on April 02, 2020, 03:22:27 PM
Nice vocabulary, MP!! 

Given the stiff competition nice compliment! :lol:

I'm thinking maybe I shouldn't have posed that portion.

Naw man, totally swole! :lol:

:lol:

 :lmao:
Title: Re: Cursor menu - custom
Post by: ronjonp on April 02, 2020, 06:22:02 PM
**WilleySnap - consequence of priapism?
:-D
Title: Re: Cursor menu - custom
Post by: MP on April 02, 2020, 07:32:49 PM
Random: Your avatar (Ron) has been my fav for more years than I can recall. :-)
Title: Re: Cursor menu - custom
Post by: ronjonp on April 03, 2020, 01:03:03 PM
Random: Your avatar (Ron) has been my fav for more years than I can recall. :-)
Thanks! :) I found a base picture on the interwebs many moons ago and made my tweaks to it ( in AutoCAD of course ).
Title: Re: Cursor menu - custom
Post by: like_citrus on June 19, 2020, 06:09:51 AM
T.Willey, thanks for your response in post #2, I had not seen it for some reason (3 months ago nearly).
I loaded it using the command "MENULOAD", in the CUI Editor it comes up as COSTOM2 and all the commands show up in the Command List.
However when I click the middle button, I get the "Hand" icon which is for panning, and not your customised menu.
Is there a way to get it to show as the next step?
Title: Re: Cursor menu - custom
Post by: Crank on June 19, 2020, 06:46:20 AM
MBUTTONPAN=0 (https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2017/ENU/AutoCAD-Core/files/GUID-07122CB7-EC98-4D5F-B3BE-16EA6FB54CED-htm.html)
Title: Re: Cursor menu - custom
Post by: BIGAL on June 19, 2020, 09:10:09 PM
If your old like me there is the screen menu option it was removed a number of versions ago but it is actually still there it was very nice to do what you want have a submenu pop up of choices. You have to turn it back on trying to remember how its a setvar etc. It would return the contents to say a lisp request like getstring, nicer thing is it has a double entry screen & actual
Title: Re: Cursor menu - custom
Post by: like_citrus on June 20, 2020, 02:56:57 AM
Crank, this worked and now I can see the menu from post #2 ... now to figure out how to get from right click.
BIGAL, sorry but I can't understand what you mean as I don't have a background on the programming side of AutoCAD. Can you please explain in simpler terms.
Title: Re: Cursor menu - custom
Post by: like_citrus on June 22, 2020, 06:36:52 AM
Still no luck.
I found this from a book, from page 5-33 onwards:
https://books.google.com.au/books?id=-QeqbCTU3_YC&pg=SA5-PA33&lpg=SA5-PA33&dq=autocad+lisp+default+menu+modify&source=bl&ots=ZEvrfMusAD&sig=ACfU3U2kAn8aeFgQ93VulSGc54kFpLlEpw&hl=en&sa=X&ved=2ahUKEwjimd2flpXqAhUDSX0KHZRDCWwQ6AEwEHoECAkQAQ#v=onepage&q=autocad%20lisp%20default%20menu%20modify&f=false (https://books.google.com.au/books?id=-QeqbCTU3_YC&pg=SA5-PA33&lpg=SA5-PA33&dq=autocad+lisp+default+menu+modify&source=bl&ots=ZEvrfMusAD&sig=ACfU3U2kAn8aeFgQ93VulSGc54kFpLlEpw&hl=en&sa=X&ved=2ahUKEwjimd2flpXqAhUDSX0KHZRDCWwQ6AEwEHoECAkQAQ#v=onepage&q=autocad%20lisp%20default%20menu%20modify&f=false)

However cannot get to work.
The default menus still show.
Title: Re: Cursor menu - custom
Post by: VovKa on June 22, 2020, 08:23:44 AM
Is there a way to create a custom cursor menu (right-click menu)
here's an example of custom 'left-click' shortcut menu
https://www.theswamp.org/index.php?topic=32261.0
Title: Re: Cursor menu - custom
Post by: like_citrus on June 22, 2020, 09:27:05 PM
OK cheers.
Title: Re: Cursor menu - custom
Post by: BIGAL on June 23, 2020, 10:22:32 PM
What I am talking about is Screen menus. These were very helpful a bit like a dcl but much easier to code they would appear on the right side. You could pick an answer for your lisp code etc. Its not code but rather its part of the menu.

Code: [Select]
Begin AutoCAD Screen Menus

***SCREEN
**S
[AutoCAD]^C^C^P(ai_rootmenus) ^P


**WALLW 3
[AutoCAD]^C^C^P$S=X $S=S
[--]
[SELECT]
[WALL]
[WIDTH]
[------]
[  50mm]50
[  60mm]60
[  70mm]70
[  80mm]80
[  90mm]90

**SET_SC 2
[SCALES: ]
[  1:1   ]1
[  1:2   ]2
[  1:5   ]5
[  1:10  ]10
[  1:20  ]20

**brickwid 3
[AutoCAD]^C^C^P$S=X $S=S
[select]
[no of]
[bricks]

[ 0.5]110
[ 1.0]230
[ 1.5]360
[ 2.0]470
[ 2.5]590

https://forums.autodesk.com/t5/autocad-forum/screen-menu/td-p/5376189

For me now I use a library dcl its only a couple of lines of code required depending on a list choice or a Button dcl

Title: Re: Cursor menu - custom
Post by: like_citrus on June 24, 2020, 02:55:40 AM
Thanks this was interesting to know.