Visual LISP, AutoLISP and General Customization

Reply
*Expert Elite*
pbejse
Posts: 2,406
Registered: ‎11-24-2009
Message 11 of 11 (108 Views)

Re: Auto offset for selected items

01-27-2013 09:53 PM in reply to: lai

lai wrote:

Hi pbejse,

I not sure if the lisp can be modify to do it to be as shown in attachment.


But of course

 

(defun c:osdc ( /  ss e )
(setq ofd (cond
((getdist (strcat "\nEnter Offset distance"
 (if ofd (strcat " <" (rtos ofd) ">: ") ": ")
            )))(ofd))
)
(if (setq ss (ssget ":L"))
  (repeat (sslength ss)
          	(setq e (vlax-ename->vla-object (ssname ss 0)))
    		(if (vlax-method-applicable-p e 'Offset)
            (progn
			(mapcar '(lambda (o)
				(vl-catch-all-error-p
					(vl-catch-all-apply
						'vla-offset (list e o))))(list ofd (- ofd)))
              (mapcar '(lambda (p)
              	(entmakex (list (cons 0 "CIRCLE")
                  		(cons 10 p)
                  		(cons 40 ofd))))
                    (list (vlax-curve-getstartpoint e)
				(vlax-curve-getendpoint e)))  
              				)
                  )
    	(ssdel (ssname ss 0) ss)))
(princ)
)

 

command: Osdc

Select objects:

 

HTH

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community