vivekgrs Posted December 17, 2008 Share Posted December 17, 2008 i am facing some problems to offset the polylines in two sides through lisp. i can able 2 offset the polylines in one side.but its difficult to perform offset in another side. the code which i have written is display below. please check it and help to solve the problem. thanks in advance (defun c:p() (vl-load-com) (setq ply(ssget "x" (list(cons 0 "lwpolyline")(cons 8 "Property_Boundary")))) (setq dist(getreal "Specify offset distance :")) (setq slen(sslength ply)) (setq nos 0) (repeat slen (setq pl_sequence(entget(ssname ply nos))) (setq entity_name(cdr(assoc -1 pl_sequence))) (setq startpt (vlax-curve-getstartPoint entity_name)) (setq endpt (vlax-curve-getEndPoint entity_name)) (setq len (distance startpt endpt)) (setq pt (polar startpt (setq ang (angle startpt endpt)) (/ len 2))) (setq ang (angle startpt endpt)) (setq ang_pnt(polar pt ang dist)) (command "offset" dist entity_name ang_pnt "") (setq nos (+ 1 nos)) ) ) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 17, 2008 Share Posted December 17, 2008 Maybe this? - untested (defun c:p (/ ply dist slen nos pl_sequence entity_name startpt endpt len pt ang_pt) (vl-load-com) (setq ply (ssget "x" (list (cons 0 "lwpolyline") (cons 8 "Property_Boundary")))) (setq dist (getreal "Specify offset distance :")) (setq slen (sslength ply)) (setq nos 0) (repeat slen (setq pl_sequence (entget (ssname ply nos))) (setq entity_name (cdr (assoc -1 pl_sequence))) (setq startpt (vlax-curve-getstartPoint entity_name)) (setq endpt (vlax-curve-getEndPoint entity_name)) (setq len (distance startpt endpt)) (setq pt (polar startpt (setq ang (angle startpt endpt)) (/ len 2))) (setq ang_pnt (polar pt (+ ang (/ pi 2)) dist)) (command "offset" dist entity_name ang_pnt "") (setq nos (+ 1 nos)) ) ;_ end repeat (princ) ) ;_ end defun Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.