(defun DTR (A) (* pi (/ A 180.0)))
(defun C:PI (/ PNT1 PNT2 D A ET HD L1 L2 L3 L4 OTM OSM)
(setvar "CMDECHO" 0)
(setq OTM (getvar "ORTHOMODE"))
(setvar "ORTHOMODE" 0)
(setq OSM (getvar "osmode"))
(setvar "OSMODE" 0)
(setq
PNT1 (getpoint "\nPick Start of Pipe: ")
)
(setq PNT2 (getpoint PNT1 "\nPick End of Pipe: "))
(setq
D (getdist "\nEnter Pipe Width: ")
) ;In Engineering Units (ie. 2.5 etc.)
(initget "Manhole Endsection Inlet None")
(setq choice (getkword "\nAdd to start of line, [Manhole Endsection Inlet]
<None> "))
(cond
((or (null choice) (= choice "None"))
;; do nothing
)
(T ; insert a block
(command "-insert"
choice ; block name
p1 ; insert point
"" ; x scale
"" ; y scale
"" ; rotation angle
)
)
)
(setq HD (/ D 2))
(setq A (angle PNT1 PNT2))
(command "Pline" PNT1 PNT2 "")
(setq ET (entlast))
(setq L1 (polar PNT1 (- A (DTR 90)) HD))
(setq
L2 (polar PNT2 (- A (DTR 90)) HD)
)
(setq L3 (polar PNT1 (+ A (DTR 90)) HD))
(setq
L4 (polar PNT2 (+ A (DTR 90)) HD)
)
;;after this line
(setq et (entlast))
;; add this
(setq vlist (cdrs 10 (entget et))
pst (car vlist)
pend (car (reverse vlist))
)
;;************************************************************************
;;;(cdrs 10 (entget (car (entsel "\nSelect a polyline"))))
;;;returns something like this:
;;;((259.943 -252.219) (214.182 -140.305) (254.223 -92.925) (215.0 -21.0386)
;;; (253.406 41.8621) (215.817 112.115))
;;;Micheal Puckett
(defun cdrs (key lst / pair rtn)
(while (setq pair (assoc key lst))
(setq rtn (cons (cdr pair) rtn)
lst (cdr (member pair lst))
)
)
(reverse rtn)
)
(command "pline" L1 L2 "")
(command "pline" L3 L4 "")
(command
"Change" ET "" "P" "LT" "hidden" "" ""
) ;change linetype to suit
(command "Pedit" ET "W" D "" "")
(setvar "ORTHOMODE" OTM)
(setvar "OSMODE" OSM)
(command "Redraw")
) ;end pipe.lsp
so far i have the code somewhat compiled... now i get a
C:PI
Command: pi
Pick Start of Pipe:
Pick End of Pipe:
Enter Pipe Width: 1
Add to start of line, [Manhole Endsection Inlet] <None> ; error: no function
definition: CDRS
still plugin with it though