Author Topic: Pond Slope Indicator  (Read 3262 times)

0 Members and 1 Guest are viewing this topic.

DanB

  • Bull Frog
  • Posts: 367
Pond Slope Indicator
« on: August 10, 2004, 09:18:38 AM »
I don't understand LISP enough to write my own Code, but I have cut and copied and altered existing code to perform to my liking. I came across a LISP that I wanted to better meet our needs at the office. I would like this LISP to Select the Upper Slope Point, the Lower Slope Point, stretch the line to both points, and draw the Solid Triangle aligned with the line. The text above should be user input of slope ratio (i.e. 4:1). The variable "usserr1" is set by our Company Script routines that run a drawing setup for varying scales (i.e. 30, 40, 50 scales). Any assistance or just a push in the right direction as always is much appreciated.

Dan


Code: [Select]


;;
;; SI - slope indicator symbol for ponds and such
;;

(defun rtd (a)
(* (/ a 3.14159) 180)
)

(defun c:si3 (/ osm tst cmd sz pt1 pt2 pt3 ang ang2 sht ratio)
(setq osm (getvar "osmode"))
(setq tst (getvar "textstyle"))
(setq cmd (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setq sz (getvar "userr1")
(setq ratio (getstring "\nEnter Slope (4:1): "))
(setq pt1 0)
(while (/= pt1 nil)
(setq pt1 (getpoint "\nPick UPPER Slope: "))
(if (/= pt1 nil)
(progn
(setq pt2 (getpoint pt1 "\nPick LOWER Slope: "))
(setvar "osmode" 0)
(setq ang (angle pt1 pt2))
(command "solid" (polar pt1 (+ ang (/ pi 2.0)) (* 0.045 sz))
(polar pt1 (+ ang (+ pi (/ pi 2.0))) (* 0.045 sz))
(polar pt1 ang (* 0.09 sz)) "" "")
(setq pt3 (list (car pt2)(cadr pt1)))
(setq ang2 (angle pt1 pt3))
(command "pline" pt1 "w" "0" "" pt2 "")
(setq sht (cdr (assoc 40 (tblsearch "style" tst))))
(if (<= sht 0)
(if (> ang2 0)
 (command "text" "j" "bc" (polar pt1 ang (/ (distance pt1 pt2) 2)) (getvar "textsize") (rtd (+ pi ang)) ratio)
 (command "text" "j" "bc" (polar pt1 ang (/ (distance pt1 pt2) 2)) (getvar "textsize") (rtd ang) ratio)
)
(if (> ang2 0)
 (command "text" "j" "bc" (polar pt1 ang (/ (distance pt1 pt2) 2)) (rtd (+ pi ang)) ratio)
 (command "text" "j" "bc" (polar pt1 ang (/ (distance pt1 pt2) 2)) (rtd ang) ratio)
)
)
)
)
)
(setvar "cmdecho" cmd)
(setvar "osmode" osm)
(PRINC)
)


Sorry Dan, had to change your text. I couldn't read in green. Daron

DanB

  • Bull Frog
  • Posts: 367
Pond Slope Indicator
« Reply #1 on: August 10, 2004, 03:09:26 PM »
Bummer, not one reply yet. I still recieve error: malformed list on input when I load this. Any help at all? Did I do something wrong in my post?

Dan

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Pond Slope Indicator
« Reply #2 on: August 10, 2004, 03:14:31 PM »
hang on Dan I'm looking at it right now.
TheSwamp.org  (serving the CAD community since 2003)

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Pond Slope Indicator
« Reply #3 on: August 10, 2004, 03:39:53 PM »
what's giving you the error is this line;
Code: [Select]
(setq sz (getvar "userr1")) <-- missing paren

but that's the not the big problem as I see it. Your 'if' statement makes no sense to me.

Code: [Select]

(if (<= sht 0)
            (if (> ang2 0) <-- this is the same as
             ............
            )
            (if (> ang2 0)<-- this
             ............
            )
            )
TheSwamp.org  (serving the CAD community since 2003)

daron

  • Guest
Pond Slope Indicator
« Reply #4 on: August 10, 2004, 03:56:57 PM »
Not necessarily wrong, Dan. I just couldn't read it being green. I, as well as others, use a board style with a blue background. Instead of changing the color of the code text, try using the code tag. It'll color code it per board style and make it more readable if you have it pre-formatted.