Jump to content

Lisp to Icon


rengised

Recommended Posts

Hi its me again, is it possibe to convert this lisp below into icon? Instead of typing the command.

I got this good lisp in asmitools. Thanks to asmitools site.

Thanks again guys.

 

(princ "\n<<< Select LwPolyline for dimensioning >>> ")
 (if(setq plSet(ssget '((0 . "LWPOLYLINE"))))
   (progn
     (setq pLlst(vl-remove-if 'listp
                        (mapcar 'cadr(ssnamex plSet)))
    oldDss(getvar "DIMASSOC")
    ); end if
     (setvar "CMDECHO" 0)
     (command "_.undo" "_be")
     (setvar "DIMASSOC" 2)
     (foreach pl pLlst
(setq vLst(mapcar '(lambda(x)
	   (trans x 0 1))(mapcar 'cdr
	     (vl-remove-if-not
	       '(lambda(x)(= 10(car x)))(entget pl))))
      ); end setq
(if(equal '(70 . 1)(assoc 70(entget pl)))
  (setq vLst(append vLst(list(car vLst))))
  ); end if
(while(< 1(length vLst))
  (setq cAng(angle(car vLst)(cadr vLst))
        cDis(/(distance(car vLst)(cadr vLst))2))
  (if(>=(caar vLst)(caadr vLst))
    (setq cAng(- cAng pi))
    ); end if
  (setq cPt(polar
	     (polar(car vLst)cAng cDis)
	     (+ cAng(* 0.5 pi))(* tOff
				  (*(getvar "DIMSCALE")
				      (getvar "DIMTXT"))))
	); end setq
  (command "_.dimaligned" "_end" (car vLst)
	   "_end" (cadr vLst) "_none" cPt)
  (setq vLst(cdr vLst))
  ); end while
); end foreach
     (setvar "DIMASSOC" oldDss)
     (command "_.undo" "_e")
     (setvar "CMDECHO" 1)
     ); end progn
   ); end if
 (princ)
 ); end of c:pdim

(princ "\n[info] http:\\\\[url]www.AsmiTools.com[/url] [info]")
(princ "\n[info] Type PDIM for multiple LwPolyline dimensioning. [info]")


Link to comment
Share on other sites

I'm assuming you want to make a toolbar button. You know that all of the code isn't posted, but I think I can figure it out. In the CUI, create a new command; Use this as the macro.

(if (not c:pdim)(load "LispName"));pdim;

Where LispName is the name of the lisp file

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