Jump to content

Storm Pipe Lisp Command


Dcarucci

Recommended Posts

Hi,

 

I was wondering if someone could help me out with the attached lisp file. My company likes to show the storm drain in our base with 4 different lines. One line for the centerline with a global width of zero with linetype continuous that would be on layer A, a polyline for the centerline with a global width of whatever size the pipe is with dashed2 linetype on layer B. The other two lines will offset half the distance of the pipe size from the centerline and will be continuous on layer B. The way the lisp currently works is it Converts selection set of Lines, Polylines, LWPolylines, and Arcs to sets of triple parallel polylines. Outer polylines have zero width and CONTINUOUS line type, while inner polyline uses Dashed2 linetype with user-selected width. I would like it for it does not change the original line i drew but instead copies and changes it to whatever my current layer is and offset it half the size of the pipe to both sides and than changes it to to a polyline with the global width of the pipe size and dashed2. I would appreciate any help.

strmpipe.lsp

Link to comment
Share on other sites

it seems to work maybe something wrong in the linetype scaling, also linetype use this, you need to look at the sequence of events in your code before changing the line type make a copy of it and move it slightly away do the edits then move it back

 

*EqualPipe,Equalpipe _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

A, 2.4, -2.4

 

also this

; pipe offset for different size pipes
; by Alan H July 2014

(vl-load-com)
(defun existLinetype (LineTypeName / item loaded)
 (setq  doc (vla-get-activedocument (vlax-get-acad-object))) ; open database
 (vlax-for item (vla-get-linetypes doc)
   (if (= (strcase (vla-get-name item)) (strcase LineTypeName))
     (setq loaded T)
   )  
 )

 (if (= Loaded T)
   (princ "loaded")
   (command "-linetype" "L" LineTypeName "P:\\AUTODESK\\SUPPORTFILES\\CUSTOM.LIN" "")
 )
)
(existLinetype "EX_PIPE250")

(defun pipeoffset (w / ang stpt pt3 pt4 obj whatis)
(setq oldsnap (getvar "osmode"))
(setvar "osmode" 0)
(setq obj (entsel "\nPick line"))
(setq objtype (vla-get-objectname (vlax-ename->vla-object (car obj))))
(if (= "AcDbLINE" objtype)
 (progn
    (alert "You have picked an object which is not a line\nTry Again")
    (exit)
 )
 (princ "\nLine")
)
(setq stpt (assoc 10 (entget (car obj))))
(setq stpt (list (nth 1 stpt)(nth 2 stpt)))
(setq endpt (assoc 11 (entget (car obj))))
(setq endpt (list (nth 1 endpt)(nth 2 endpt)))
(setq ang (angle stpt endpt))
(setq pt3 (polar stpt (+ ang (/ pi 2.0)) 1.0))
(setq pt4 (polar stpt (- ang (/ pi 2.0)) 1.0))
(command "offset" w obj pt3 "")
(Command "chprop" "last" "" "LT" "EX_PIPE250" "")
(command "offset" w obj pt4 "")
(Command "chprop" "last" "" "LT" "EX_PIPE250" "")
(command "Erase" obj "")
(setvar "osmode" oldsnap)
)


(defun c:P100 ()
(pipeoffset 0.06)
)
(defun c:P150 ()
(pipeoffset 0.08)
)

(defun c:P225 ()
(pipeoffset 0.152)
)

(defun c:P300 ()
(pipeoffset 0.19)
)

(defun c:P375 ()
(pipeoffset 0.228)
)

(defun c:P450 ()
(pipeoffset 0.265)
)

(defun c:P525 ()
(pipeoffset 0.302)
)

(defun c:P600 ()
(pipeoffset 0.34)
)

(defun c:P675 ()
(pipeoffset 0.34)
)

(defun c:P750 ()
(pipeoffset 0.415)
)

(defun c:P825 ()
(pipeoffset 0.455)
)

(defun c:P900 ()
(pipeoffset 0.49)
)

(defun c:P975 ()
(pipeoffset 0.528)
)

(defun c:P1050 ()
(pipeoffset 0.565)
)

(defun c:P1125 ()
(pipeoffset 0.6)
)

(defun c:P1200 ()
(pipeoffset 0.64)
)

(princ)

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