Cadastrophic
12th May 2005, 03:03 am
I tried using this lisp which inserts A-A section arrows. The last command in the string confuses me; "enter first section callout:"
Can anyone please explain what I should be doing at this command?
SECT.LSP Section Arrows
(defun C:SECT ()
(setvar "fillmode" 1)
(setvar "mirrtext" 0)
(setq CHDIMSCL "N")
(setq CHDIMTXT "N")
(setq OP1 (getstring
"\n draw section cut (H)orizontal or (V)ertical "
) ;_ end of getstring
) ;_ end of setq
(setq OP1 (strcase OP1))
(if (= OP1 "V")
(progn
(setq OP (getstring "\n draw arrows (L)eft or (R)ight "))
(setq OP (strcase OP))
) ;_ end of progn
) ;_ end of if
(if (= OP1 "H")
(progn
(setq OP (getstring "\n draw arrows (U)up or (D)own "))
(setq OP (strcase OP))
) ;_ end of progn
) ;_ end of if
(setq PTS (getpoint "\n pick first arrow starting point"))
(setq P PTS)
(setq PTS2 (getpoint "\n pick second arrow starting point"))
(setq COUT1 (getstring "\n enter first sect callout: "))
(if (= COUT1 "")
(setq COUT1 "A")
) ;_ end of if
(setq P2 PTS2)
(setq COUT1 (strcase COUT1))
(setq COUT2 (getstring "\n enter second sect callout: "))
(if (= COUT2 "")
(setq COUT2 "A")
) ;_ end of if
(setq COUT2 (strcase COUT2))
;DIMSCALE
(setq SCAL (getvar "dimscale"))
(if (= SCAL NILL)
(setq SCAL DEFSCAL)
) ;_ end of if
(princ "\n DIMSCALE is set to <")
(princ SCAL)
(princ ">; Change DIMSCALE Y/N <")
(princ CHDIMSCL)
(setq CHDIMSCL (getstring ">: "))
(setq CHDIMSCL (strcase CHDIMSCL))
(if (= CHDIMSCL "Y")
(progn
(princ "\ Enter new DIMSCALE setting <")
(setq DIMSCL (getreal ">: "))
(setvar "dimscale" DIMSCL)
(setq SCAL (getvar "dimscale"))
) ;_ end of progn
) ;_ end of if
(setq SCL (* 1.0 SCAL))
(setq PTY (cadr PTS))
(setq PTX (car PTS))
(setq PT2Y (cadr PTS2))
(setq PT2X (car PTS2))
(if (= OP1 "H")
(progn
(if (< PTX PT2X)
(progn
(setq PTS P2)
(setq PTS2 P)
) ;_ end of PROGN
) ;_ end of IF
) ;_ end of progn
) ;_ end of if
(if (= OP1 "V")
(progn
(if (> PTY PT2Y)
(progn
(setq PTS P2)
(setq PTS2 P)
) ;_ end of PROGN
) ;_ end of IF
) ;_ end of progn
) ;_ end of if
(setq PTY (cadr PTS)) ;y coor starting point
(setq PTX (car PTS)) ;x coor starting point
(setq PT2Y (cadr PTS2))
(setq PT2X (car PTS2))
(if (= OP1 "V")
(setq MID (/ (- PT2Y PTY) 2))
) ;_ end of if
(if (= OP1 "H")
(setq MID (/ (- PT2X PTX) 2))
) ;_ end of if
(setq TXTSZ (* SCL 0.25))
(setq SF (* SCL 0.375))
(if (= OP1 "V")
(progn
(setq MIRRY1 (list PTX (+ PTY MID)))
(setq MIRRY2 (list (+ PTX 1.0) (+ PTY MID)))
) ;_ end of progn
) ;_ end of if
(if (= OP1 "H")
(progn
(setq MIRRY1 (list (+ PTX MID) PTY))
(setq MIRRY2 (list (+ PTX MID) (+ PTY 1.0)))
) ;_ end of progn
) ;_ end of if
(setq LTAIL (- PTX SF)) ;tail length
(setq TAIL (list LTAIL PTY)) ;end point of tail
(setq TAILX (car TAIL))
(setq TAILY (cadr TAIL))
(setq LARR (- TAILX SF)) ;length of arrow
(setq ARR (list LARR TAILY 0)) ;arrow end point
(setq ARRY (cadr ARR)) ;y coord at end point of arrow
(setq ARRX (car ARR)) ;x coord at end point of arrow
(setq TLOC (- ARRX SF))
(setq TLOC (+ TLOC 0.25))
(setq TLOCP (list TLOC ARRY)) ;ver text location
(if (= OP "U")
(progn
(setq TLOC (+ PTY SF SF SF))
(setq TLOCP (list (+ PTX (/ SF 5.5)) TLOC)) ;hor text location
) ;_ end of progn
) ;_ end of if
(if (= OP "D")
(progn
(setq TLOC (- PTY SF SF SF))
(setq TLOCP (list (+ PTX (/ SF 5.5)) TLOC)) ;hor text location
) ;_ end of progn
) ;_ end of if
(setq SF1 (* SCL 0.3375))
(setq TAILY (cadr TAIL)) ;y coor at end point of tail
(setq TAILX (car TAIL)) ;x coor at end point of tail
(if (< PTY PT2Y)
(setq VLTAIL (+ TAILY SF))
) ;_ end of if
(if (> PTY PT2Y)
(setq VLTAIL (- TAILY SF))
) ;_ end of if
(setq LTAILX (+ TAILX SF1))
(if (= OP "D")
(setq VLTAIL (- TAILY SF))
) ;_ end of if
(if (= OP "U")
(setq VLTAIL (+ TAILY SF))
) ;_ end of if
(setq VTAILX (list LTAILX TAILY))
(setq VTAIL (list LTAILX VLTAIL))
(setq W1 (* (/ 1.875 10.0) SCL))
(setq W2 (* (/ 0.75 10.0) SCL))
(command "pline" TAIL "w" W1 0 ARR "") ;arrow
(if (= OP "U")
(command "rotate" "l" "" VTAILX -90 "")
) ;_ end of if
(if (= OP "D")
(command "rotate" "l" "" VTAILX 90 "")
) ;_ end of if
(if (= OP "L")
(command "mirror" "l" "" MIRRY1 MIRRY2 "n")
) ;_ end of if
(if (= OP1 "H")
(command "mirror" "l" "" MIRRY1 MIRRY2 "n")
) ;_ end of if
(if (= OP "R")
(progn
(command "mirror" "l" "" VTAILX VTAIL "y")
(command "mirror" "l" "" MIRRY1 MIRRY2 "n")
) ;_ end of progn
) ;_ end of if
(command "pline" PTS "w" W2 W2 TAIL "") ;horz tail
(if (= OP "L")
(command "mirror" "l" "" MIRRY1 MIRRY2 "n")
) ;_ end of if
(if (= OP1 "H")
(command "mirror" "l" "" MIRRY1 MIRRY2 "n")
) ;_ end of if
(if (= OP "R")
(progn
(command "mirror" "l" "" VTAILX VTAIL "y")
(command "mirror" "l" "" MIRRY1 MIRRY2 "n")
) ;_ end of progn
) ;_ end of if
(command "pline" VTAILX "w" W2 W2 VTAIL "")
(if (= OP "L")
(command "mirror" "l" "" MIRRY1 MIRRY2 "n")
) ;_ end of if
(if (= OP1 "H")
(command "mirror" "l" "" MIRRY1 MIRRY2 "n")
) ;_ end of if
(if (= OP "R")
(progn
(command "mirror" "l" "" VTAILX VTAIL "y")
(command "mirror" "l" "" MIRRY1 MIRRY2 "n")
) ;_ end of progn
) ;_ end of if
(if (/= COUT1 "")
(progn
(command "text" "j" "mr" TLOCP TXTSZ "" COUT1)
(command "mirror" "l" "" MIRRY1 MIRRY2 "Y")
(if (= OP "R")
(command "mirror" "l" "" VTAILX VTAIL "y")
) ;_ end of if
(command "text" "j" "mr" TLOCP TXTSZ "" COUT2)
(if (= OP "R")
(command "mirror" "l" "" VTAILX VTAIL "y")
) ;_ end of if
) ;_ end of progn
) ;_ end of if
(setvar "plinewid" 0)
(redraw)
(princ)
) ;_ end of defun
(princ " loaded.. start command with SECT")
Can anyone please explain what I should be doing at this command?
SECT.LSP Section Arrows
(defun C:SECT ()
(setvar "fillmode" 1)
(setvar "mirrtext" 0)
(setq CHDIMSCL "N")
(setq CHDIMTXT "N")
(setq OP1 (getstring
"\n draw section cut (H)orizontal or (V)ertical "
) ;_ end of getstring
) ;_ end of setq
(setq OP1 (strcase OP1))
(if (= OP1 "V")
(progn
(setq OP (getstring "\n draw arrows (L)eft or (R)ight "))
(setq OP (strcase OP))
) ;_ end of progn
) ;_ end of if
(if (= OP1 "H")
(progn
(setq OP (getstring "\n draw arrows (U)up or (D)own "))
(setq OP (strcase OP))
) ;_ end of progn
) ;_ end of if
(setq PTS (getpoint "\n pick first arrow starting point"))
(setq P PTS)
(setq PTS2 (getpoint "\n pick second arrow starting point"))
(setq COUT1 (getstring "\n enter first sect callout: "))
(if (= COUT1 "")
(setq COUT1 "A")
) ;_ end of if
(setq P2 PTS2)
(setq COUT1 (strcase COUT1))
(setq COUT2 (getstring "\n enter second sect callout: "))
(if (= COUT2 "")
(setq COUT2 "A")
) ;_ end of if
(setq COUT2 (strcase COUT2))
;DIMSCALE
(setq SCAL (getvar "dimscale"))
(if (= SCAL NILL)
(setq SCAL DEFSCAL)
) ;_ end of if
(princ "\n DIMSCALE is set to <")
(princ SCAL)
(princ ">; Change DIMSCALE Y/N <")
(princ CHDIMSCL)
(setq CHDIMSCL (getstring ">: "))
(setq CHDIMSCL (strcase CHDIMSCL))
(if (= CHDIMSCL "Y")
(progn
(princ "\ Enter new DIMSCALE setting <")
(setq DIMSCL (getreal ">: "))
(setvar "dimscale" DIMSCL)
(setq SCAL (getvar "dimscale"))
) ;_ end of progn
) ;_ end of if
(setq SCL (* 1.0 SCAL))
(setq PTY (cadr PTS))
(setq PTX (car PTS))
(setq PT2Y (cadr PTS2))
(setq PT2X (car PTS2))
(if (= OP1 "H")
(progn
(if (< PTX PT2X)
(progn
(setq PTS P2)
(setq PTS2 P)
) ;_ end of PROGN
) ;_ end of IF
) ;_ end of progn
) ;_ end of if
(if (= OP1 "V")
(progn
(if (> PTY PT2Y)
(progn
(setq PTS P2)
(setq PTS2 P)
) ;_ end of PROGN
) ;_ end of IF
) ;_ end of progn
) ;_ end of if
(setq PTY (cadr PTS)) ;y coor starting point
(setq PTX (car PTS)) ;x coor starting point
(setq PT2Y (cadr PTS2))
(setq PT2X (car PTS2))
(if (= OP1 "V")
(setq MID (/ (- PT2Y PTY) 2))
) ;_ end of if
(if (= OP1 "H")
(setq MID (/ (- PT2X PTX) 2))
) ;_ end of if
(setq TXTSZ (* SCL 0.25))
(setq SF (* SCL 0.375))
(if (= OP1 "V")
(progn
(setq MIRRY1 (list PTX (+ PTY MID)))
(setq MIRRY2 (list (+ PTX 1.0) (+ PTY MID)))
) ;_ end of progn
) ;_ end of if
(if (= OP1 "H")
(progn
(setq MIRRY1 (list (+ PTX MID) PTY))
(setq MIRRY2 (list (+ PTX MID) (+ PTY 1.0)))
) ;_ end of progn
) ;_ end of if
(setq LTAIL (- PTX SF)) ;tail length
(setq TAIL (list LTAIL PTY)) ;end point of tail
(setq TAILX (car TAIL))
(setq TAILY (cadr TAIL))
(setq LARR (- TAILX SF)) ;length of arrow
(setq ARR (list LARR TAILY 0)) ;arrow end point
(setq ARRY (cadr ARR)) ;y coord at end point of arrow
(setq ARRX (car ARR)) ;x coord at end point of arrow
(setq TLOC (- ARRX SF))
(setq TLOC (+ TLOC 0.25))
(setq TLOCP (list TLOC ARRY)) ;ver text location
(if (= OP "U")
(progn
(setq TLOC (+ PTY SF SF SF))
(setq TLOCP (list (+ PTX (/ SF 5.5)) TLOC)) ;hor text location
) ;_ end of progn
) ;_ end of if
(if (= OP "D")
(progn
(setq TLOC (- PTY SF SF SF))
(setq TLOCP (list (+ PTX (/ SF 5.5)) TLOC)) ;hor text location
) ;_ end of progn
) ;_ end of if
(setq SF1 (* SCL 0.3375))
(setq TAILY (cadr TAIL)) ;y coor at end point of tail
(setq TAILX (car TAIL)) ;x coor at end point of tail
(if (< PTY PT2Y)
(setq VLTAIL (+ TAILY SF))
) ;_ end of if
(if (> PTY PT2Y)
(setq VLTAIL (- TAILY SF))
) ;_ end of if
(setq LTAILX (+ TAILX SF1))
(if (= OP "D")
(setq VLTAIL (- TAILY SF))
) ;_ end of if
(if (= OP "U")
(setq VLTAIL (+ TAILY SF))
) ;_ end of if
(setq VTAILX (list LTAILX TAILY))
(setq VTAIL (list LTAILX VLTAIL))
(setq W1 (* (/ 1.875 10.0) SCL))
(setq W2 (* (/ 0.75 10.0) SCL))
(command "pline" TAIL "w" W1 0 ARR "") ;arrow
(if (= OP "U")
(command "rotate" "l" "" VTAILX -90 "")
) ;_ end of if
(if (= OP "D")
(command "rotate" "l" "" VTAILX 90 "")
) ;_ end of if
(if (= OP "L")
(command "mirror" "l" "" MIRRY1 MIRRY2 "n")
) ;_ end of if
(if (= OP1 "H")
(command "mirror" "l" "" MIRRY1 MIRRY2 "n")
) ;_ end of if
(if (= OP "R")
(progn
(command "mirror" "l" "" VTAILX VTAIL "y")
(command "mirror" "l" "" MIRRY1 MIRRY2 "n")
) ;_ end of progn
) ;_ end of if
(command "pline" PTS "w" W2 W2 TAIL "") ;horz tail
(if (= OP "L")
(command "mirror" "l" "" MIRRY1 MIRRY2 "n")
) ;_ end of if
(if (= OP1 "H")
(command "mirror" "l" "" MIRRY1 MIRRY2 "n")
) ;_ end of if
(if (= OP "R")
(progn
(command "mirror" "l" "" VTAILX VTAIL "y")
(command "mirror" "l" "" MIRRY1 MIRRY2 "n")
) ;_ end of progn
) ;_ end of if
(command "pline" VTAILX "w" W2 W2 VTAIL "")
(if (= OP "L")
(command "mirror" "l" "" MIRRY1 MIRRY2 "n")
) ;_ end of if
(if (= OP1 "H")
(command "mirror" "l" "" MIRRY1 MIRRY2 "n")
) ;_ end of if
(if (= OP "R")
(progn
(command "mirror" "l" "" VTAILX VTAIL "y")
(command "mirror" "l" "" MIRRY1 MIRRY2 "n")
) ;_ end of progn
) ;_ end of if
(if (/= COUT1 "")
(progn
(command "text" "j" "mr" TLOCP TXTSZ "" COUT1)
(command "mirror" "l" "" MIRRY1 MIRRY2 "Y")
(if (= OP "R")
(command "mirror" "l" "" VTAILX VTAIL "y")
) ;_ end of if
(command "text" "j" "mr" TLOCP TXTSZ "" COUT2)
(if (= OP "R")
(command "mirror" "l" "" VTAILX VTAIL "y")
) ;_ end of if
) ;_ end of progn
) ;_ end of if
(setvar "plinewid" 0)
(redraw)
(princ)
) ;_ end of defun
(princ " loaded.. start command with SECT")