coordinates lisp draw the line instied of point please guide,,, regards

coordinates lisp draw the line instied of point please guide,,, regards

iftikhargulmrd
Enthusiast Enthusiast
1,913 Views
10 Replies
Message 1 of 11

coordinates lisp draw the line instied of point please guide,,, regards

iftikhargulmrd
Enthusiast
Enthusiast

;----------------------------------------------------------------------------
;CONVERT GRAD TO RADIAN
(DEFUN GTR (a)
(* PI (/ a 200.0))
)
;----------------------------------------------------------------------------
;CONVERT RADIAN TO GRAD
(DEFUN RTG (a)
(/ (* a 200.0) PI)
)
;----------------------------------------------------------------------------
;CONVERTS RECTANGULAR COORDINATES (X,Y) TO POLAR COORDINATES (r,@)
(DEFUN AZDS (DE DN)
(SETQ X (SQRT (+ (EXPT DE 2) (EXPT DN 2))))
(SETQ Y (ATAN (/ DN DE)))
)
;----------------------------------------------------------------------------
(DEFUN AAZZ (A)
(SETQ GH (* PI 2)
HG (/ PI 2)
X (+ (- GH A) HG)
X (IF (> X GH) (- X GH) X)
)
)
;----------------------------------------------------------------------------
;CONVERTS POLAR COORDINATES (r,@) TO RECTANGULAR COORDINATES (X,Y)
(DEFUN DALTA (BE HD)
(SETQ X (* (SIN BE) HD))
(SETQ Y (* (COS BE) HD))
)
;----------------------------------------------------------------------------
;AS POLAR FUNCTION
(DEFUN COO (PO BE HD)
(LIST (+ (* (SIN BE) HD) (NTH 0 PO))
(+ (* (COS BE) HD) (NTH 1 PO))
)
)
;----------------------------------------------------------------------------

(defun c:txt()
(setvar "AUNITS" 2)
(setvar "ANGBASE" (/ PI 2))
(setvar "ANGDIR" 1)

(setq h (getdist "\nEnter height of text:")
GH (* PI 2)
HG (/ PI 2)
HA (GTR 100.0)
VA (GTR 200.0)
ds1 (* 6.0 H)
ds2 (* 9.0 H)
ds3 (* 1.2 H)
dsV (* 3.0 H)
DSN (/ DSV 2.0)
VA0 (GTR 0.0)
bs (getpoint "\nEnter Base point for table:")
no (getint "\nEnter point no.:")
b (getpoint "\nEnter start point:")
lm 0.0
bs1 (COO bs ha ds1)
bs2 (COO bs ha (+ ds1 H H ds2))
bs3 (COO bs ha (+ ds2 (* 20 H) ds3))
)
(command "layer" "n" "table" "c" "7" "table"
"n" "line" "c" "1" "line"
"n" "no" "c" "3" "no" ""
)

(setq f (open "d:\\Coordinates XYZ.txt" "w"))
(while b
(setq st (COO bs va (* dsV lm))
st1 (COO bs1 va (* dsV lm))
st2 (COO bs2 va (* dsV lm))
st3 (COO bs3 va (* dsV lm))
BH (COO B VA0 DSN)
)
(command "layer" "s" "table" "")
(command "text" st h (rtG ha) no)
(command "text" st1 h (rtG ha) (rtos (car b) 2 3))
(command "text" st2 h (rtG ha) (rtos (cadr b) 2 3))
(command "text" st3 h (rtG ha) (rtos (caddr b) 2 3))
(write-line (strcat (rtos no 2 3) " " (rtos (car b) 2 3) " " (rtos (cadr b) 2 3) " " (rtos (caddr b) 2 3) ) f)
;;; (write-line (rtos (cadr b) 2 3) f)
;;; (write-line (rtos (caddr b) 2 3) f)

(command "layer" "s" "no" "")
(command "text" bH h (rtG ha) no)

(SEtq lm (+ lm 1)
NO (+ NO 1)
c (getpoint "\nEnter next point:")
)

(command "layer" "s" "line" "")
(command "pline" B "w" "0.0" "0.0" c "")
(setq b c)
)
(close f)
(command "layer" "s" "table" "")
(SETQ STL (COO ST (+ VA (/ HG 2)) (/ DSV 2)))
(SETQ STL1 (COO STL HA (* H 40)))
(COMMAND "LINE" STL STL1 "")
(COMMAND "ARRAY" STL "" "R" (FIX (+ 1 LM)) "" DSV)
)
(princ "\n < idtl > loaded:")
(princ)

0 Likes
1,914 Views
10 Replies
Replies (10)
Message 2 of 11

CodeDing
Advisor
Advisor

@iftikhargulmrd ,

 

1) What is your question? Please explain.

2) Can you post an image of your work area BEFORE you run the command and AFTER you run it so we can see also?

3) Copy & Paste your command history after you run the command. Often times this will provide valuable feedback as to what is going wrong.

 

Best,

~DD

0 Likes
Message 3 of 11

iftikhargulmrd
Enthusiast
Enthusiast

instead to draw the line to mark nod

0 Likes
Message 4 of 11

Sea-Haven
Mentor
Mentor

A quick fix not tested

 

change 
bs3 (COO bs ha (+ ds2 (* 20 H) ds3))
)
to
bs3 (COO bs ha (+ ds2 (* 20 H) ds3))
)
(command "point" b)

change (command "pline" B "w" "0.0" "0.0" c "") to (command "Point" c)

 

 

0 Likes
Message 5 of 11

dbhunia
Advisor
Advisor
Accepted solution

Change as below...

 


@iftikhargulmrd wrote:

;----------------------------------------------------------------------------
;CONVERT GRAD TO RADIAN
(DEFUN GTR (a)
(* PI (/ a 200.0))
)
;----------------------------------------------------------------------------
;CONVERT RADIAN TO GRAD
(DEFUN RTG (a)
(/ (* a 200.0) PI)
)
;----------------------------------------------------------------------------
;CONVERTS RECTANGULAR COORDINATES (X,Y) TO POLAR COORDINATES (r,@)
(DEFUN AZDS (DE DN)
(SETQ X (SQRT (+ (EXPT DE 2) (EXPT DN 2))))
(SETQ Y (ATAN (/ DN DE)))
)
;----------------------------------------------------------------------------
(DEFUN AAZZ (A)
(SETQ GH (* PI 2)
HG (/ PI 2)
X (+ (- GH A) HG)
X (IF (> X GH) (- X GH) X)
)
)
;----------------------------------------------------------------------------
;CONVERTS POLAR COORDINATES (r,@) TO RECTANGULAR COORDINATES (X,Y)
(DEFUN DALTA (BE HD)
(SETQ X (* (SIN BE) HD))
(SETQ Y (* (COS BE) HD))
)
;----------------------------------------------------------------------------
;AS POLAR FUNCTION
(DEFUN COO (PO BE HD)
(LIST (+ (* (SIN BE) HD) (NTH 0 PO))
(+ (* (COS BE) HD) (NTH 1 PO))
)
)
;----------------------------------------------------------------------------

(defun c:txt()
(setvar "AUNITS" 2)
(setvar "ANGBASE" (/ PI 2))
(setvar "ANGDIR" 1)

(setq h (getdist "\nEnter height of text:")
GH (* PI 2)
HG (/ PI 2)
HA (GTR 100.0)
VA (GTR 200.0)
ds1 (* 6.0 H)
ds2 (* 9.0 H)
ds3 (* 1.2 H)
dsV (* 3.0 H)
DSN (/ DSV 2.0)
VA0 (GTR 0.0)
bs (getpoint "\nEnter Base point for table:")
no (getint "\nEnter point no.:")
b (getpoint "\nEnter start point:")
lm 0.0
bs1 (COO bs ha ds1)
bs2 (COO bs ha (+ ds1 H H ds2))
bs3 (COO bs ha (+ ds2 (* 20 H) ds3))
)
(command "layer" "n" "table" "c" "7" "table"
"n" "line" "c" "1" "line"
"n" "no" "c" "3" "no" ""
)

(command "layer" "s" "line" "");;; set the Layer as current.
(command "Point" b)

(setq f (open "d:\\Coordinates XYZ.txt" "w"))
(while b
(setq st (COO bs va (* dsV lm))
st1 (COO bs1 va (* dsV lm))
st2 (COO bs2 va (* dsV lm))
st3 (COO bs3 va (* dsV lm))
BH (COO B VA0 DSN)
)
(command "layer" "s" "table" "")
(command "text" st h (rtG ha) no)
(command "text" st1 h (rtG ha) (rtos (car b) 2 3))
(command "text" st2 h (rtG ha) (rtos (cadr b) 2 3))
(command "text" st3 h (rtG ha) (rtos (caddr b) 2 3))
(write-line (strcat (rtos no 2 3) " " (rtos (car b) 2 3) " " (rtos (cadr b) 2 3) " " (rtos (caddr b) 2 3) ) f)
;;; (write-line (rtos (cadr b) 2 3) f)
;;; (write-line (rtos (caddr b) 2 3) f)

(command "layer" "s" "no" "")
(command "text" bH h (rtG ha) no)

(SEtq lm (+ lm 1)
NO (+ NO 1)
c (getpoint "\nEnter next point:")
)

(command "layer" "s" "line" "")
;(command "pline" B "w" "0.0" "0.0" c "")

(command "Point" c);;; @Sea-Haven also said this.
(setq b c)
)
(close f)
(command "layer" "s" "table" "")
(SETQ STL (COO ST (+ VA (/ HG 2)) (/ DSV 2)))
(SETQ STL1 (COO STL HA (* H 40)))
(COMMAND "LINE" STL STL1 "")
(COMMAND "ARRAY" STL "" "R" (FIX (+ 1 LM)) "" DSV)
)
(princ "\n < idtl > loaded:")
(princ)


 


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

iftikhargulmrd
Enthusiast
Enthusiast
Accepted solution

appreciate booth of you brothers,

but one issue first number is not mark the nod   

Regards

0 Likes
Message 7 of 11

dbhunia
Advisor
Advisor
Accepted solution

But it is working for me.....

 

Watch this....

 

 



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

iftikhargulmrd
Enthusiast
Enthusiast

Sir can you please upload same lisp which you use

I think do mothing wrong

regrads

0 Likes
Message 9 of 11

Sea-Haven
Mentor
Mentor
Accepted solution

Just me

 

(command "layer" "s" "line" "")

(setvar 'clayer line)

0 Likes
Message 10 of 11

dbhunia
Advisor
Advisor
Accepted solution

Just Your's....

 

@Sea-Haven  you can do that, but throughout the code @iftikhargulmrd 's approach is

(command "layer" "s" "line" "")

So I just followed his way.......

 

 


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

iftikhargulmrd
Enthusiast
Enthusiast
Accepted solution

Thanks A LOT BOROTHER

 

0 Likes