Jump to content

A couple of simple lisp routines


Jman

Recommended Posts

I am not a lisp guru but occasionally I have been known to write some

simple routines to speed up my productivity. I use these all the time so

the have been tested.

 

This one is for layer isolate: type lai

 

(defun C:lai () (COMMAND "layiso" PAUSE "" "P" "")

(PROMPT "nlayer is isolated."))

 

 

This is for layer unisolate: type lau

 

 

(defun C:lau () (COMMAND "layuniso" PAUSE "" "P" "")

)

 

 

The last one is for those of us who use the autocadclassic workspace

it will bring up the array dialogue box. type acl

 

 

(defun c:acl () (command "arrayclassic" "")

)

Link to comment
Share on other sites

1. When you post code, make sure you put it in the brackets, or the mods will yell at you.

 

2. Why wouldn't you just update the acad.pgp to add the commands? It seems as though your code is just changing the command call for normal commands. Just my 2 cents

Link to comment
Share on other sites

Thanks for the heads up. I'm not sure what brackets are.

I write small lisp stuff like this to make the command keystroke

something short that I will remember. I have my own lisp file

that I've been adding to for the past 20 years.

I don't mess with the pgp file.

Link to comment
Share on other sites

I don't mess with the pgp file.

 

I am pretty new at this (7 years), and perhaps there was a time when the .pgp was somewhat more daunting, but these days, have no fear.

If you should be so bold as to open your .pgp file, TOOLS (in the Menu Bar) down near the bottom of the list CUSTOMIZE then click EDIT PGP,

and your .pgp will open in Notepad. If you scroll all the way to the bottom of that long list of stuff you will come to the area intended to be for personalization, as shown in the screenshot. In a new install, it will be empty, awaiting any custom shortcalls you would care to add. There is no need to edit anything above this section period. Later after entering any personalizations, in the format as shown, you need to SAVE the .pgp. After making some additions use REINIT command to put them into immediate service without the need to reboot.

 

The next time you migrate to a newer version, all of these customizations will be brought along for the ride automagically, and they will trump the default aliases which are above this section, should there be any conflict. Meaning, that if you use an alias which has been used in the default ootb list, for something else, it will be accepted and changed to your specification.

 

Still got cold feet?

There is another even easier way, the ALIASEDIT command, which will do the exact same thing for you, but without the need to open the dreaded .pgp, it will all be done from a small onscreen dialog box. Just be sure to CONFIRM any changes before closing the dialog. This command will write them into that same USER DEFINED ALIASES section, no muss, no fuss.

 

I too use the toolbars, and it sounds to me like you may be unfamiliar with all of the wonderful tools available on the LAYERS 2 toolbar. Check them out, you'll be glad you did. :) You might just run into a few old friends, as well as make some new (Layer Walk is cool) ones.

don't be afraid of your pgp.jpg

aliasedit dialog box.JPG

LAYERS 2 toolbar.JPG

pgp modifications advice.JPG

Edited by Dadgad
Link to comment
Share on other sites

It is rare that I ever point someone away from using lisp for anything, but in this case you are taking commands which have certain functionalities that, in this case, you are taking away from yourself. That being said, don't stop using LISP to make your life easier.

Link to comment
Share on other sites

We have Autoload.lsp which does just that loads on startup so all our aliases are in it, just 1 less step when updating to a new version. It even has preferences in their with the snap settings in 4 ways to suit the way people like to work.

 

Re toolbars think about stealing bits from lots of toolbars to make a more useable one its pretty easy. Save this as a MNU file and just menuload it. I just used cui and had notebook open at same time and copy and pasted between the two to get correct code.

 

***MENUGROUP=ALANSTOOLBAR
***TOOLBARS
**ALANSTOOLS
ID_ALAN_0    [_Toolbar("Alans1", _Right, _Show, 0, 0, 1)]
AECC_ShowTS  [_Button("Show Toolspace", RCDATA_16_IMAGE, RCDATA_16_IMAGE)]^C^C^C^P_ShowTS
ID_Matchprop [_Button("Match Properties", RCDATA_16_MATCH, RCDATA_16_MATCH)]^C^C_matchprop
ID_Erase     [_Button("Erase", RCDATA_16_ERASE, RCDATA_32_ERASE)]^C^C_erase
ID_Copy      [_Button("Copy", RCDATA_16_COPYOB, RCDATA_32_COPYOB)]$M=$(if,$(eq,$(substr,$(getvar,cmdnames),1,4),GRIP),_copy,^C^C_copy)
ID_Mirror    [_Button("Mirror", RCDATA_16_MIRROR, RCDATA_32_MIRROR)]$M=$(if,$(eq,$(substr,$(getvar,cmdnames),1,4),GRIP),_mirror,^C^C_mirror)
ID_Offset    [_Button("Offset", RCDATA_16_OFFSET, RCDATA_32_OFFSET)]^C^C_offset
ID_Array     [_Button("Array...", RCDATA_16_ARRREC, RCDATA_32_ARRREC)]^C^C_array
ID_Move      [_Button("Move", RCDATA_16_MOVE, RCDATA_32_MOVE)]$M=$(if,$(eq,$(substr,$(getvar,cmdnames),1,4),GRIP),_move,^C^C_move)
ID_Rotate    [_Button("Rotate", RCDATA_16_ROTATE, RCDATA_32_ROTATE)]$M=$(if,$(eq,$(substr,$(getvar,cmdnames),1,4),GRIP),_rotate,^C^C_rotate)
ID_Scale     [_Button("Scale", RCDATA_16_SCALE, RCDATA_32_SCALE)]$M=$(if,$(eq,$(substr,$(getvar,cmdnames),1,4),GRIP),_scale,^C^C_scale)
ID_Stretch   [_Button("Stretch", RCDATA_16_STRETC, RCDATA_32_STRETC)]$M=$(if,$(eq,$(substr,$(getvar,cmdnames),1,4),GRIP),_stretch,^C^C_stretch)
ID_Trim      [_Button("Trim", RCDATA_16_TRIM, RCDATA_32_TRIM)]^C^C_trim
ID_Extend    [_Button("Extend", RCDATA_16_EXTEND, RCDATA_32_EXTEND)]^C^C_extend
ID_BreakSele [_Button("Break at Point", RCDATA_16_BREAKATPT, RCDATA_32_BREAKATPT)]^C^C_break \_f \@
ID_Break     [_Button("Break", RCDATA_16_BRE2PT, RCDATA_32_BRE2PT)]^C^C_break
ID_Join      [_Button("Join", RCDATA_16_JOIN, RCDATA_32_JOIN)]^C^C_join
ID_Chamfer   [_Button("Chamfer", RCDATA_16_CHAMFE, RCDATA_32_CHAMFE)]^C^C_chamfer
ID_Fillet    [_Button("Fillet", RCDATA_16_FILLET, RCDATA_32_FILLET)]^C^C_fillet
ID_Explode   [_Button("Explode", RCDATA_16_EXPLODE, RCDATA_32_EXPLODE)]^C^C_explode
ID_LAYFRZ    [_Button("Layer, Layer Freeze", RCDATA_16_FRZLAY, RCDATA_32_FRZLAY)]^C^C_layfrz
ID_LAYOFF    [_Button("Layer Off", RCDATA_16_OFFLAY, RCDATA_32_OFFLAY)]^C^C_layoff
ID_LAYISO    [_Button("Layer Isolate", RCDATA_16_LAYISO,RCDATA_32_LAYISO)]^C^C_layiso
MM_LAYUNISO  [_Button("Layer Unisolate", RCDATA_16_LAYUNISO, RCDATA_32_LAYUNISO)]^C^C_Layuniso
ID_LAYDEL    [_Button("Layer, Layer Delete", RCDATA_16_LAYER_DELETE,RCDATA_32_LAYER_DELETE)]^C^C_laydel
ID_Line      [_Button("Line", RCDATA_16_LINE,RCDATA_32_LINE)]^C^C_line
MM_1608      [_Button("Circle", RCDATA_16_CIRRAD,RCDATA_32_CIRRAD)]^C^C_circle
MM_1607      [_Button("Arc", RCDATA_16_ARC3PT,RCDATA_32_ARC3PT)]^C^C_arc
ID_Pline     [_Button("Polyline", RCDATA_16_PLINE,RCDATA_32_PLINE)]^C^C_pline
ID_Pedit     [_Button("Polyline Edit", RCDATA_16_PEDIT, RCDATA_32_PEDIT)]^C^C_pedit
ID_DrawordeB [_Button("Draw Order, Send to Back", RCDATA_16_SN2BCK,RCDATA_32_SN2BCK)]^C^C^P_ai_draworder _Back ^P
ID_Appload   [_Button("Load Application...", RCDATA_16_LOAD_APPLICATIONS,RCDATA_16_LOAD_APPLICATIONS)]^C^C_appload

**ALANSTOOLS2
ID_ALAN_1    [_Toolbar("Alans2", _LEFT, _Show, 50,50, 1)]
CL           [_Button("Draw Cl", COGGCL.BMP, COGGCL.BMP)]^C^C^C-la s Design-Cl  line;
Lip          [_Button("Draw Lip", COGGLIP.BMP, COGGLIP.BMP)]^C^C^C-la s Design-Lip  line;
Bok          [_Button("Draw Bok", COGGBOK.BMP, COGGBOK.BMP)]^C^C^C-la s Design-Bok  line;
Conc         [_Button("Draw Design Line", "S:\AutoDESK\ICONS\COGGCONC.BMP", "S:\AutoDESK\ICONS\COGGCONC.BMP")]^C^C^C-la s Design-General  line;
Drive        [_Button("Draw Driveway", RCDATA_16_THICKEN, RCDATA_32_THICKEN)]^C^C^C-la s Design-Driveway  line;
Draincl      [_Button("Draw Drain Cl", RCDATA_16_LINE, RCDATA_32_LINE)]^C^C^C-la s Design-Drainage-Cl  line;
Draininv     [_Button("Draw Drain Inv", RCDATA_16_OSNPAR, RCDATA_32_OSNPAR)]^C^C^C-la s Design-Drainage-Invert  line;
Drainpit     [_Button("Draw Drain Pit", RCDATA_16_EXTRACT_EDGES, RCDATA_32_EXTRACT_EDGES)]^C^C^C-la s Design-Drainage-Pits  line;
Housedrain   [_Button("Draw House Drain", RCDATA_16_OSNNEA, RCDATA_32_OSNNEA)]^C^C^C-la s Design-Drainage-House-drain  line;
Linemark     [_Button("Draw Linemarking", RCDATA_16_DIMARC, RCDATA_32_DIMARC)]^C^C^C-la s Design-Linemarkings  line;
Hatch        [_Button("Draw Road hatch", RCDATA_16_MYWORKSPACE, RCDATA_32_MYWORKSPACE)]^C^C^C-la s Design-Hatch  hatch;
Pathatch     [_Button("Draw Path hatch", RCDATA_16_WALK-THROUGH_SAVE, RCDATA_32_WALK-THROUGH_SAVE)]^C^C^C-la s Design-Hatch-path  hatch;
Nathatch     [_Button("Draw Nature hatch", RCDATA_16_RECTAN, RCDATA_32_RECTAN)]^C^C^C-la s Design-Hatch-naturestrip  hatch;
Text         [_Button("Draw Text 1", RCDATA_16_MTEXT, RCDATA_32_MTEXT)]^C^C^C-la s Text  text;
Text2        [_Button("Draw Text 2", RCDATA_16_SINGLE_DTEXT, RCDATA_32_SINGLE_DTEXT)]^C^C^C-la s Text  text;
MiddlePt     [_Button("Middle 2 pts","COGGMTP.BMP","COGGMTP.BMP")]MTP;
ZZZ          [_Button("Command","COGGZZZ.BMP","COGGZZZ.BMP")]^c^cZZZ;
Alloff       [_Button("All Off","Alloff.BMP","alloff.BMP")]^c^c^c(setq surface "_COGG All Off")(load "vercheck")(load "listselect")(load "changecontours6")
50mm         [_Button("50mm cont","50mm.bmp","50mm.bmp")]^c^c^c(setq surface "_COGG NS 0.05 Contours")(load "vercheck")(load "listselect")(load "changecontours6")
100mm        [_Button("100mm cont","100mm.BMP","100mm.BMP")]^c^c^c(setq surface "_COGG NS 0.1 Contours")(load "vercheck")(load "listselect")(load "changecontours6")
200mm        [_Button("200mm cont","200mm.BMP","200mm.BMP")]^c^c^c(setq surface "_COGG NS 0.2 Contours")(load "vercheck")(load "listselect")(load "changecontours6")
500mm        [_Button("0.50m cont","500mm.BMP","500mm.BMP")]^c^c^c(setq surface "_COGG NS 0.5m Contours")(load "vercheck")(load "listselect")(load "changecontours6")
1m           [_Button("1m cont","1m.BMP","1m.BMP")]^c^c^c(setq surface "_COGG NS 1m Contours" )(load "vercheck")(load "listselect")(load "changecontours6")
Triangles    [_Button("Triangles","TRI.BMP","TRI.BMP")]^c^c^c(setq surface "_COGG NS Triangles" )(load "vercheck")(load "listselect")(load "changecontours6")
Slope        [_Button("Slope","RCDATA_16_SM_EXTEND","RCDATA_32_SM_EXTEND")]^c^c^c(setq surface "_COGG Slope Arrows & Catchments" )(if (not AH:Vercheck)(load "vercheck"))(if (not AT:ListSelect)(load "listselect"))(if (not AH:Changecont)(load "changecontours6"))
Delard       [_Button("Delard","RCDATA_16_MAPRSREMOVE","RCDATA_32_MAPRSREMOVE")]^c^c^c(if (not XXX)(LOAD "del-ard") ) xxx
ID_Ddim      [_Button("Dim Style",RCDATA_16_DIMSTY,RCDATA_32_DIMSTY)]^c^c_dimstyle
ID_Dimaligned[_Button("Dim align",RCDATA_16_DIMALI,RCDATA_32_DIMALI)]^c^c_dimaligned
ID_Dimlinear [_Button("Dim Lin",RCDATA_16_DIMLIN,RCDATA_32_DIMLIN)]^C^C_dimlinear
ID_Mleader_Style[_button("MLEADERSTYLE",RCDATA_16_ML_STYLE,RCDATA_32_ML_STYLE)]^c^c_mleaderst
M2P          [_Button("M2P","M2P.BMP","M2P.BMP")](command "M2P")

Link to comment
Share on other sites

Thanks Guys,

Proof positive you can teach an old dog new tricks. I knew when I found this place that there

was a wealth of knowledge and knowledgeable people inside.

I have a lot of catching up to do. I've always believed that although pull down menus

and tool bars are great, that the time I spend looking for things was time not spent

drawing. That's why I got into lisp. I've compiled a large lisp routine which I have been

adding to since the 90's which is all short keystroke commands that I would remember

so I could just keep the typing hand going as well as the mouse hand. With these new tricks

I may be able to trim down my lisp file.

Thanks again

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...