Jump to content

Curb offset


Alexia

Recommended Posts

Hello, 

Does anyone have a lisp routine to quickly create curb lines? 

I'm looking for a LISP that can be done in one command line and two clicks:

1. Request to select a polyline and change it to P-PVMT-FOC layer

2. Ask to click in a direction above or below the first line, create a new polyline with a 0.5' offset and move this new line to P-PVMT-BOC

3. Create another polyline in the opposite direction from the second one with a 1.5' offset from the initial FOC line and move it to P-PVMT-EOP layer. 

 

To summarize:

BOC -0.5- FOC -----1.5'----- EOP

 

Thanks a lot!!!

Link to comment
Share on other sites

@Alexia Give this a try:
 

(defun c:foo (/ _lyr s)
  ;; RJP » 2024-06-07
  (defun _lyr (e l) (entmod (append (entget e) (list (cons 8 l)))))
  (cond	((setq s (ssget ":L" '((0 . "LWPOLYLINE"))))
	 (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
	   (_lyr e "P-PVMT-FOC")
	   (and (setq p (getpoint "\nPick 0.5 offset side")) (command "_.offset" 0.5 e p ""))
	   (_lyr (entlast) "P-PVMT-BOC")
	   (and (setq p (getpoint "\nPick 1.5 offset side")) (command "_.offset" 1.5 e p ""))
	   (_lyr (entlast) "P-PVMT-EOP")
	 )
	)
  )
  (princ)
)

 

Link to comment
Share on other sites

Posted (edited)

Another method, if you pick a pline and want fixed offsets a simple trick is pick near start end, this can give direction of pline then use VLA-Offset  will go left or right then automatically.

 

; change single pline to multiple
; By AlanH June 2024

(defun c:drawcurb  ( / off1 off2 ent pt obj start end d1 d2 obj2 ent2)
(command "-layer" "m" "P-PVMT-FOC" "C" 1 "" "M" "P-PVMT-BOC" "C" 2 "" "m" "P-PVMT-EOP" "C" 3 "" "") ; added in case layers don't exsit
(setq off1 0.5 off2 1.5)
(setq ent (entsel "\nPick pt near start of pline "))
(setq pt (cadr ent))
(setq obj (vlax-ename->vla-object (car ent)))
(setq start (vlax-curve-getstartPoint obj))
(setq end (vlax-curve-getendPoint obj))
(setq d1 (distance pt start))
(setq d2 (distance pt end))
(if (< d1 d2)
(command "Pedit" ent "R" "")
)
(setq ent2 (entget (car ent)))
(entmod (subst (cons 8 "P-PVMT-FOC") (assoc 8 ent2) ent2))
(setq obj2 (vla-offset obj off1))
(setq ent2 (entget (entlast)))
(entmod (subst (cons 8 "P-PVMT-BOC") (assoc 8 ent2) ent2))
(setq obj2 (vla-offset obj off2))
(setq ent2 (entget (entlast)))
(entmod (subst (cons 8 "P-PVMT-EOP") (assoc 8 ent2) ent2))
(princ)
)
(c:drawcurb)

Ps if I have side wrong change change (> d1 d2)

Edited by BIGAL
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...