Jump to content

Recommended Posts

Posted

I`m new with .lsp files so i would ask you guys if you could post here the .lsp that you find usefull for you and what it does.

Posted

Visit here:

http://www.dotsoft.com/

 

I would post the 2 i like but due to fear of copyright i will just send you to the website. lsp files are inside the zip files with information on how to load/use them.

 

Quickkey.zip- will shorten any command to a key stroke i.e. zoom extents=ze. any command that needs another input can be used. very cool.

 

Recent.zip-Keeps a record of the last 26 files opened in Autocad. Great for when you are working accross 3 network drives and 8 folders deep to just have this there instead of going all the way back though the paths.

Posted

for radius ductwork and piping, search this site for a thread titled "Better Multiline" and grab the *.lsp file that AMSI made.... it's friggin awesome. i feel like i should pay him money for that one... lol

Posted

Constructs a 3D polyline, asks user for elevation at each vertex. No error checking included.

 

(defun c:my3dPoly ( / a)
 (command "._3dpoly")
 (while (eq 1 (logand 1 (getvar "cmdactive")))
   (if a
     (setq a (getpoint a "\n Pick Point: "))
     (setq a (getpoint "\n Pick Point: "))
   )
   (if a
     (command (list (car a) (cadr a) (getreal "\n Enter Elevation: ")))      
     (command)
   )
 )
 (princ)
)

Posted

Having looked at the offered functions of drafting 3D polylines with the elevation inquiry for each vertex I could not be kept to write the:

 

(defun c:3pl(/ pt tPt oldEcho msCount oldOsn undoLst *error*)

 (defun *error*(msg)
   	(command)
   	(setvar "CMDECHO" oldEcho)
   	(princ)
   ); end of *error*

 (if(not 3pl:elev)(setq 3pl:elev 0.0))
 (setq pt T
oldEcho(getvar "CMDECHO")
msCount 0
undoLst '()
); end setq
 (setvar "CMDECHO" 0)
 (while(/= 'LIST(type pt))
   (initget 128)
 	(setq pt(getpoint
    		(strcat "\n>>> Pick point, specify X,Y or new elevation Z = <"
    		(rtos 3pl:elev)
    		">: ")
	)
      ); end setq
   (cond
     ((= 'LIST(type pt))
  	(setq pt(list(car pt)(cadr pt)3pl:elev)
             tPt pt); end setq
		); end condition #1
((and(not(null pt))(distof pt))
		(setq 3pl:elev(atof pt))
	); end condition #2
      ((= 'STR(type pt))
	(princ "\nInvalid option keyword! ")
); end condition #3
     ); end cond
   ); end while
 (if pt
   (progn
     (setq oldOsn(getvar "OSMODE"))
     (setvar "OSMODE" 0)
 	(command "_.3dpoly" pt)
     (setvar "OSMODE" oldOsn)
 	(while(= 1(getvar "CMDACTIVE"))
   	 (if(= 'LIST(type pt))
     		(setq undoLst
    		 (append(list pt)undoLst))
     	); end if
 	(initget 128)
 (if
   (setq pt(getpoint tPt
    	(strcat "\n>>> Pick point, specify X,Y or new elevation Z = <"
    	(rtos 3pl:elev)
    	(if(= 0 msCount)"> [undo]: "
      "> [Close/Undo]: "); end if
    		)
      	      )
    ); end setq
     (cond
((= 'LIST(type pt))
 (setq oldOsn(getvar "OSMODE"))
         (setvar "OSMODE" 0)
		(command
  		 (list(car pt)(cadr pt)3pl:elev)); end command
  (setvar "OSMODE" oldOsn)
  	  (setq tPt pt
	        msCount(1+ msCount); end setq
	); end setq
      	); end condition #1
	((distof pt)
		(setq 3pl:elev(atof pt))
      	); end condition #2
((and(= "C"(strcase pt))(/= 0 msCount))
	 	(command "_c")
	); end condition #3
((= "U"(strcase pt))
		(if undoLst
  		 (progn
		  (setq undoLst(cdr undoLst)
      	      	    tPt(car undoLst)); end setq
		(command "_u")
   		); end progn
  	      ); end if
	); end condition #4
  	(t
		(princ "\nInvalid keyword option! ")
	); end condition #5
); end cond
     (command)
); end if
   ); end while
     ); end progn
   ); end if
 (setvar "CMDECHO" oldEcho)
 (princ)
 ); end of c:3pl

Posted

Some changes was made in c:3pl function for best work.

Posted
One suggestion, if you are going to redefine the *error* function, you should consider saving the old *error* function and restoring it at the completion of your routine.

 

If you write *error* function as local variable and your *error* is interanal function no need to save and restore original *error* function:

 

(defun myFun (/ *error* ....)

 (defun *error*(msg)
 .....
  ); end of *error*
......
); end of myFun

 

The changed version of error handler will exist only during work of your function. You can will be convinced of it if will lead experiment. It seems to me is the extremely convenient than each time to save and restore the handler.

Posted
If you write *error* function as local variable and your *error* is interanal function no need to save and restore original *error* function:

 

You are right, I missed the fact that it was a local function.

Posted

Coming back to a 'best' *.lsp. Look 'Get the code!' on http://www.cadalyst.com. It is impossible to tell that all the published programs concern to the category of the 'best', however they pass preliminary selection and among them is a lot of good.

Posted

Here is one that is in discussion in the AUGI forums....

 

I took the original and made a few changes. The purpose is to save an *additional* backup copy (above and beyond the BAK file) of the current drawing when you save. I wouldn't necessarily use this, but for some, this may be desired. (anyone using this might want to alter the path for the extra file - which is currently set to C:\)

 

(DEFUN C:MRSAVE (/ newname)
  (setvar "CMDECHO" 0)
  (if (zerop (getvar "dwgtitled"))
	(command "._qsave" (getstring "\n Enter drawing name: "))
	(command "_.qsave")
  )
  (setvar "filedia" 0)
  (setq newname 
		(strcat
		  "C:\\"
		  (getvar "DWGNAME")
		  "-BAK"		  
		)
  )  
  (if (findfile (strcat newname ".dwg"))
	(command "_.save" newname "_Y")
	(command "_.save" newname)
  )
  (setvar "filedia" 1)
  (princ)
)

Posted
Coming back to a 'best' *.lsp. Look 'Get the code!' on http://www.cadalyst.com. It is impossible to tell that all the published programs concern to the category of the 'best', however they pass preliminary selection and among them is a lot of good.

yeah i've spent lots of time looking through all those archives. some definite good stuff in there. i didn't even think about posting that link :)

  • 5 years later...
Posted
www.lee-mac.com this guy has everything for lisp... he is on here very frequently... amazing writer

 

Cheers Trae! I really appreciate your recommendation and compliments for my work :)

Posted

Back to Designer what are you using Autocad for then you will get lots of relevant hints about Lisp programs out there.

 

Totally agree have a look at Lee-Macs site first some great stuf.

Posted

I use this simple one from Kent Cooper a ton. It simply joins all entities that touch at their endpoints into a polyline by simply selecting on object in the chain.

;Entity Join All
;Joins lines, arcs & Polylines at their endpoints automatically.
; All you have to do is select one object
; by Kent Cooper @ Autodesk forums

(defun C:EJA (/ peac cmde); = Polyline Edit: Join All
 (setq peac (getvar 'peditaccept))
 (setvar 'peditaccept 1)
 (setq cmde (getvar 'cmdecho))
 (setvar 'cmdecho 0)
 (command "_.pedit" pause "_join" "_all" "" "")
 (setvar 'peditaccept peac)
 (setvar 'cmdecho cmde)
 (princ)
)

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...