Jump to content

hi everyone


vivekgrs

Recommended Posts

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

 

)

)

Link to comment
Share on other sites

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

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