i have lisp xy and want to take also z value please help regards

i have lisp xy and want to take also z value please help regards

iftikhargulmrd
Enthusiast Enthusiast
790 Views
3 Replies
Message 1 of 4

i have lisp xy and want to take also z value please help regards

iftikhargulmrd
Enthusiast
Enthusiast

(defun run ()
(setq pll (getstring "\nget name of new file (name.ext) :"))
(setq pl (open pll "w"))
(setq e (getstring "\nget no. of first Point :"))
(setq a (atoi e))

(while (setq p (getpoint "\nselect point :"))

(setq v1 (strcat "\n " (itoa a) " "))
(setq d (polar p (/ (* 1 pi) 2) 0.05))
(command "layer" "m" "number" "c" "3" "" "")
(command "text" "m" d 0.03 0.0 a)
(setq num (entlast))
(command "change" num "" layer "" number "")

(command "layer" "m" "point" "c" "1" "" "")
(command "point" p)
(setq pt (entlast))
(command "change" pt "" layer "" point "")
(princ v1 pl)

(setq x (car p))
(setq x (rtos x 2 4))
(setq x (strcat x " "))
(setq v2 x)
(princ v2 pl)

(setq y (cadr p))
(setq y (rtos y 2 4))
(setq y (strcat y " "))
(setq v3 y)
(princ v3 pl)
(setq a (+ a 1))


)
(command "layer" "m" "txt" "c" "5" "" "")
(close pl)
(redraw)
(princ)
)

(defun c:ixy ()
(run)
(setq fil (getstring "\nget name of the file (name.ext) :"))
(setq p1 (getpoint "select insertion point :"))
(setq p2 (polar p1 0.0 30.0))
(setq p3 (polar p1 0.0 100.0))
(setq p4 (polar p1 (/ (* -1 pi) 2) 20.0))
(setq p5 (polar p4 0.0 30.0))
(setq p6 (polar p4 0.0 65.0))
(setq p7 (polar p4 0.0 100.0))
(setq p8 (polar p2 (/ (* -1 pi) 2) 10.0))
(setq p9 (polar p8 0.0 35.0))
(setq p10 (polar p8 0.0 70.0))
(setq p11 (polar p8 (* -1 pi) 15.0))
(setq p12 (polar p8 (/ pi 2) 5.0))
(setq p13 (polar p8 (/ (* -1 pi) 2) 5.0))
(setq p14 (polar p12 0.0 35.0))
(setq p15 (polar p13 0.0 17.5))
(setq p16 (polar p13 0.0 52.5))
(setq p1- (polar p1 (/ (* -1 pi) 2) 2000000000.0))

(command "text" "m" p11 3.0 0.0 "POINT NO.")
(command "text" "m" p14 3.0 0.0 "COORDINATES")
(command "text" "m" p15 3.0 0.0 "X")
(command "text" "m" p16 3.0 0.0 "Y")

(command "line" p1 p4 "")
(setq L14 (entlast))
(command "line" p2 p8 p5 "")
(setq L285 (entlast))
(command "line" p9 p6 "")
(setq L96 (entlast))
(command "line" p3 p10 p7 "")
(setq L3107 (entlast))
(command "line" p1 p2 p3 "")
(command "line" p8 p9 p10 "")
(command "pline" p4 p5 p6 p7 "")
(setq L4567 (entlast))

(setq fill (open fil "r"))
(read-line fill)
(setq new ())
(setq j 0.0)
(setq p44 p4)
(while (setq S (read-line fill))
(setq pt (polar p44 (/ (* -1 pi) 2) (+ 5 j)))
(setq pt1 (polar pt 0.0 15.0))
(setq pt2 (polar pt 0.0 47.5))
(setq pt3 (polar pt 0.0 82.5))

(setq t1 (substr S 1 4))
(setq t2 (substr S 5 16))
(setq t3 (substr S 21 32))

(command "text" "m" pt1 3.0 0.0 t1)
(command "text" "m" pt2 3.0 0.0 t2)
(command "text" "m" pt3 3.0 0.0 t3)

(setq p4 (polar p4 (/ (* -1 pi) 2) 10.0))
(setq p5 (polar p5 (/ (* -1 pi) 2) 10.0))
(setq p6 (polar p6 (/ (* -1 pi) 2) 10.0))
(setq p7 (polar p7 (/ (* -1 pi) 2) 10.0))

(command "offset" (+ j 10.0) (list L4567 p4) p1- "")
(setq new (entlast))

(command "extend" new "" (list L14 P4) "")
(command "extend" new "" (list L285 p5) "")
(command "extend" new "" (list L96 p6) "")
(command "extend" new "" (list L3107 p7) "")
(setq j (+ j 10.0))
)
(close)
)

0 Likes
Accepted solutions (1)
791 Views
3 Replies
Replies (3)
Message 2 of 4

dbhunia
Advisor
Advisor
Accepted solution

The below addition will add "Z" value in your output file

 

(defun run ()
       (setq pll (getstring "\nget name of new file (name.ext) :"))
       (setq pl (open pll "w"))
       (setq e (getstring "\nget no. of first Point :"))
       (setq a (atoi e))
       
       (while (setq p (getpoint "\nselect point :"))
       
              (setq v1 (strcat "\n " (itoa a) "    "))
              (setq d (polar p (/ (* 1 pi) 2) 0.05))    
              (command "layer" "m" "number" "c" "3" "" "")
              (command "text" "m" d 0.03 0.0 a)
              (setq num (entlast))
              (command "change" num "" layer "" number "") 
              
              (command "layer" "m" "point" "c" "1" "" "")
              (command "point" p)
              (setq pt (entlast))
              (command "change" pt "" layer "" point "")   
              (princ v1 pl)
              
              (setq x (car p))
              (setq x (rtos x 2 4)) 
              (setq x (strcat x "             "))
              (setq v2 x)
              (princ v2 pl)
              
              (setq y (cadr p))
              (setq y (rtos y 2 4))
              (setq y (strcat y "          "))
              (setq v3 y)
              (princ v3 pl)
              ; (setq a (+ a 1))
			  
              (setq z (caddr p))
              (setq z (rtos z 2 4))
              (setq z (strcat z "          "))
              (setq v4 z)
              (princ v4 pl)
              (setq a (+ a 1))
 
       )
       (command "layer" "m" "txt" "c" "5" "" "")
       (close pl)
       (redraw)
       (princ)
)

 

Now you add the rest code to get TABLE in drawing

 

 


Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
0 Likes
Message 3 of 4

iftikhargulmrd
Enthusiast
Enthusiast

appreciate brother but its not taking my point z value, there is 3d column on text file but constant value not a point value 

regards

0 Likes
Message 4 of 4

iftikhargulmrd
Enthusiast
Enthusiast

its done now after removing code " ; (setq a (+ a 1))"

 

thanks a lot brother

appreciate  

0 Likes