Jump to content

Dimensioning using lisp


kareemuddin

Recommended Posts

Hello,

I have found a lisp (code) from the current threads which makes dimensioning to polylines selected (doesn't work on lines) , it would be of great help if the lisp can be modified so that it works on both (polylines and lines)

 

I have posted below the coding for reference

 

note:- I am very new to auto lisp and would really appreciate the help

 

 

(defun c:pdim(/ plSet pLlst vLst oldOsn cAng cDis cPt)
 (princ "\n<<< Select LwPolyline for dimensioning >>> ")
 (if(setq plSet(ssget '((0 . "LWPOLYLINE"))))
   (progn
     (setq pLlst(vl-remove-if 'listp
                        (mapcar 'cadr(ssnamex plSet))))
     (setvar "OSMODE" 0)(setvar "CMDECHO" 0)
     (foreach pl pLlst
(setq vLst(mapcar 'cdr
	    (vl-remove-if-not
	      '(lambda(x)(= 10(car x)))(entget pl)))
      oldOsn(getvar "OSMODE")
      ); end setq
(while(< 1(length vLst))
  (setq cAng(angle(car vLst)(cadr vLst))
	cDis(/(distance(car vLst)(cadr vLst))2)
	cPt(polar(polar(car vLst)cAng cDis)
		 (+ cAng(/ pi 2))(* 2(getvar "DIMTXT")))
	); end setq
  (command "_.dimaligned"(car vLst)(cadr vLst) cPt)
  (setq vLst(cdr vLst))
  ); end while
); end foreach
     (setvar "OSMODE" oldOsn)(setvar "CMDECHO" 1)
     ); end progn
   ); end if
 (princ)
 ); end of c:pdim

Edited by SLW210
Added Code Tags
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...