PDA

View Full Version : Polyline that when drawn applies slope


rvzenteno
2008-12-02, 05:53 PM
Hello:

I've been looking for an Idea or a LSP that as it draws a polyline it applies slope in 3D (Z coor.) at a specific rate like 1% (1/8" ever 12") or variations to it. Has any body come across this or has coded something similar. I would appreciate it greatly.

Thank you.

Roberto

lpseifert
2008-12-02, 07:49 PM
disregard....

kennet.sjoberg
2008-12-03, 12:01 AM
you could try this
Ehhh. . . Maybe you too . . . slope in 3D (Z coor.)

: ) Happy Computing !

kennet

rvzenteno
2008-12-04, 06:04 PM
Here is what I put together.

(defun c:pll (/ point1 point2 percent)

(defun Deg2Rad (A) (* pi (/ A 180.0)))

(setq percent (geststring (strcat "\nPleast Type slope: 1/8\"=.125 1/4\"=.250")))
(cond ;conditional to check which slope needs to be applied
(and (= percent ".125"))
(setq percent ".125")
(and (= percent ".25"))
(setq percent ".25")
(T (alert "No slope entered")) ;end of COND
)
(setq point1(getpoint (strcat "\nFirst Point:"))) ; This is the first Point
(setq point2 (getpoint (strcat "\nSecond Point:"))) ; This is the 2nd Point
;that will need to be modified
(setq dist1 (getdist point1 point2))
; Here I need to take the total distance of point1 to point2
; then multiply the Total Distance by the PERCENT
; then modify the Z Coordinate of point2 in radians
; Convert the data to Radians.

(command "-line" point1 point2 "")) ; then run the line command
; there should be a While that keeps this routine runing
;until cancelled or finished.
))


Any Help with this would be great.

Thank you.

kennet.sjoberg
2008-12-04, 10:38 PM
This is a kind of a tricky task, you know who comes first. . the hen or the egg?

I don’t think it is possible to let a reactor take action inside a not completed Command and let it change the Z-coordinate of the last picked point in a not completed polyline command.

So my suggestion is to first draw an lwpolyline, that start at the first picked xyZ point.

Then let the program create an 3Dpolyline at the same xy point as the lwpolyline, but with calculated Z coordinates started from the first picked xyZ point, and with the slope*distance value to the next vertex.

When completed, erase the lwpolyline.

: ) Happy Computing !

kennet

lpseifert
2008-12-05, 12:14 AM
quick and dirty, not extensively tested

(defun c:test (/ pt1 pt2 % len z2 pt2a)
(setq % (/ (getreal "Enter percent slope: ") 100)
pt1 (getpoint "Select first point: "))
(while
(setq pt2 (getpoint "Select next point: " pt1)
len (distance (list (car pt1) (cadr pt1))
(list (car pt2) (cadr pt2))
)
z2 (+ (caddr pt1) (* len %))
pt2a (list (car pt2) (cadr pt2) z2)
)
(command "line" pt1 pt2a "")
(setq pt1 pt2a)
)
(princ)
)

rvzenteno
2008-12-05, 06:06 AM
As "Bill Engvall" would Say You guys are"AWESOME" This is exactly what I was looking for.

Thank you, Thank you, thank you.:):):):D:D