View Full Version : Slope Listing
backtothefuture4
2008-03-17, 02:37 PM
Does anyone have a routine the yields the slope of a line, such as X:12 or similar?
sufferinyankeebastid
2008-03-17, 09:36 PM
Maybe this'll git'r'done. If the line is drawn between pitches, returns the closest (lower in case of a tie).
(defun rpitch ( / ss ent temp ang plist)
(princ "\nPick slope line: ") (setq ss (ssget ":S" '((0 . "LINE"))))
(if (and ss (setq ent (ssname ss 0)) (setq ent (entget ent)))
(progn
(setq ang (angle (cdr (assoc 10 ent)) (cdr (assoc 11 ent))))
(foreach a (list pi (/ pi 2)) (if (> ang a) (setq ang (- (* a 2) ang))))
(if (<= 2.5 (setq ang (* (/ 180 pi) ang)) 46.5)
(progn
(setq plist '(4 9.5 14 18.5 22.5 26.5 30.5 33.75 37 40 42.5 45))
(while (and (< 1 (length plist)) (apply '> (mapcar 'abs
(list (- (car plist) ang) (- (cadr plist) ang)))))
(setq plist (cdr plist))
)
(setq temp (itoa (- 13 (length plist))))
)
)
)
)
(if (= (type temp) 'STR) (strcat temp ":12") "")
)
backtothefuture4
2008-03-19, 01:37 PM
Thank you for the reply, only trouble is I'm getting "Unknown Command", attached is the Lisp file, do you see anything wrong?
sufferinyankeebastid
2008-03-19, 05:08 PM
Use parentheses at the command-line: (rpitch), or change the defun
(defun c:rpitch ( / ss ent temp ang plist)
Tom Beauford
2008-03-19, 05:57 PM
Try this one attached. It returns distance, bearing and slope.
backtothefuture4
2008-03-26, 01:40 PM
When running (rpitch) "" is returned.
Can DST be modified to provide the slope as 1/4"=12 or 1/4":12 ?
Tom Beauford
2008-03-26, 02:05 PM
Can DST be modified to provide the slope as 1/4"=12 or 1/4":12 ?
I'm sure it could, but I don't know much about Architectural scales. Try adding this line after the (cond ((equal (abs slope) (/ 0.25 12) 0.001)(setq slope "1/4\"=12")) If that works you should be able to come up with the rest of the Architectural scales yourself.
backtothefuture4
2008-03-27, 01:32 PM
Tom:
Thanks for the suggestion, it did not have an effect that I could see.
Ron
Tom Beauford
2008-03-27, 03:12 PM
Tom:
Thanks for the suggestion, it did not have an effect that I could see.
Ron
Added lines for Architectural scale & debug in dst.lsp above. I now get the following at the command line:
Command: DST
Pick First Point
Pick Next Point
slope = 0.0208333
Bearing= E, Dist= 48' Delta elev= 1 Slope= 1/4"=1'
Pick Next Point
slope = -0.0500432
Bearing= N 73d37'59" W, Dist= 19.98' Delta elev= -1 Slope= 20:1
Pick Next Point
slope = 0.0
Bearing= S 78d56'51" W, Dist= 29.37'
Pick Next Point
redraw
Command:
Try the modified dst.lsp and let me know what shows on the comand line for a line that's supposed to be 1/4"=1'. Trying, but like I said before "I don't know much about Architectural scales."
Terry Cadd
2008-04-03, 01:02 AM
Does anyone have a routine the yields the slope of a line, such as X:12 or similar?
Here's a function relating to Slope and Bevel dimensions that may be of interest to those who use Bevel dimensions in Mechanical layouts.
Bevel.lsp creates Bevel Dimensions. The dialog function c:BVS, for Bevel Settings, allows the user to customize various Bevel settings. The command functions c:BV and c:Bevel draw a Bevel Dimension. Included is the programming function BV to draw a Bevel. The function Bevel calculates the bevel based upon the radian angle of slope.
http://web2.airmail.net/terrycad/Images/Bevel.jpg
http://web2.airmail.net/terrycad/LISP/Bevel.lsp
http://web2.airmail.net/terrycad/LISP/Bevel.dcl
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.