Jump to content

Trouble with repeat command


masboz

Recommended Posts

Dear sir,

 

I have trouble with "repeat" command, my lisp cannot repeat to continous drawing from take *.prn data. Here's the lisp script and *.prn file;

 

(defun c:job ()
 (setvar "dimzin" 1)
 (setvar "blipmode" 1)
 (setvar "cmdecho" 1)

 (setq ssv 20)
 (setq ssh 250)
 (if (equal ssv nil)
   (setq scy 20.0)
   (setq scy ssv)
 )

 (if (equal ssh nil)
   (setq scx 250.0)
   (setq scx ssh)
 )
   (setq    scv (/ 1000 scy)
   sch (/ 1000 scx)
 )
 
(setq fnam1 "/cross/Data/")  
(setq fnam2 "*.prn")

(setq lastLL 2 lastRR 5)
(setq f    (getstring (strcat "\nFile Input Data Cross c:/cross/data/ < " fnam2 " > ? : ")))
(if (/= f "") (setq fnam2 f))
(setq fnam (strcat fnam1 fnam2))
(setq check (findfile fnam))
(while (= check nil) (prompt "\nFile Not Found .....! ")
 (setq    f (getstring (strcat "\nFile Input Data Cross c:/cross/data/ < " fnam2 " > ? : ")))
   (if (/= f "") (setq fnam2 f))
    (setq fnam (strcat fnam1 fnam2))
     (setq check (findfile fnam))
       )                    ; while

(setq n 1)
(setq p0 '(0 0 0))
(repeat 3()

(setq p3 p0)
(setq fp (open fnam "r"))
(setq file (read-line fp))                
(if (= file "") (setq file nil))
(if (= file nil) (setq stop 1) (setq stop 0))
(setq noptk (atof (substr file n 10)))            
(setq file (read-line fp))                
(setq eldat (atof (substr file n 10)))            
(setq file (read-line fp))                
(setq jar0 (atof (substr file n 10)))            
(setq elt1 (atof (substr file (+ n 10 ) 10)))   
(setq tbl (atof (substr file (+ n 30 ) 10)))    
(setq slp (atof (substr file (+ n 40 ) 10)))    

 (setq p01 (polar p0 (* 0.5 pi) (* (- elt1 eldat) scv)))
 (setq p02 (polar p0 (* 0.5 pi) (* (- elt2 eldat) scv)))  
 (command "color" 20 "-linetype" "s" "dashed2" "")
 (command "line" p0 p02 "")  
 (command "color" 20 "-linetype" "s" "continuous" "")
 (command "line" p0 (polar p0 (* 1.5 pi) 50) "")
 (command "color" 7)
 (setq p01tx (polar p0 (* 1.5 pi) 15))
 (setq p02tx (polar p0 (* 1.5 pi) 25))
 (setq p0tx (polar p0 (* 1.5 pi) 35))  
 (setq p50 (polar p0 pi -5))  
 (setq p51 (polar p0 pi 50))
 (setq p52 (polar p51 (* 1.5 pi) 5))
 (setq p53 (polar p52 (* 1.5 pi) 10))
 (setq p54 (polar p53 (* 1.5 pi) 10))
 (setq p55 (polar p54 (* 1.5 pi) 10))
 (setq p56 (polar p55 (* 1.5 pi) 10))
 (setq p57 (polar p0 pi 53))
 (setq p58 (polar p57 (* 1.5 pi) 10))
 (setq p59 (polar p58 (* 1.5 pi) 10))
 (setq p60 (polar p59 (* 1.5 pi) 10))
 (setq p61 (polar p60 (* 1.5 pi) 10))
 (setq p62 (polar p61 (* 1.5 pi) 10))  
 (command "text" "j" "tc" '(-30.0 25.0) "3.5" 0 (strcat "STA." (rtos noptk 2 0)))
 (command "text" "j" "tc" p01tx "2.5" 90 (rtos elt1 2 2))
 (command "text" "j" "tc" p02tx "2.5" 90 (rtos elt2 2 2))
 (command "text" "j" "tc" p0tx "2.5" 90 (rtos slp 2 2))  
 (if (> eldat 0)
 (command "text" "j" "bl" p50 "2.5" 0 (strcat "+" (rtos eldat 2 2) " m"))
 (command "text" "j" "bl" p50 "2.5" 0 (strcat (rtos eldat 2 2) " m"))
 );if
 (command "text" "j" "ml" p52 "2.5" 0 "JARAK         (m)")
 (command "text" "j" "ml" p53 "2.5" 0 "TINGGI ASAL    (m)")
 (command "text" "j" "ml" p54 "2.5" 0 "TINGGI RENCANA (m)")
 (command "text" "j" "ml" p55 "2.5" 0 "TEBAL RENCANA  (m)")
 (command "text" "j" "ml" p56 "2.5" 0 "SLOPE RENCANA  (m)")  
 (command "color" 20 "-linetype" "s" "continuous" "")
 (command "line" p0 p57 "")
 (command "color" 20 "-linetype" "s" "continuous" "")
 (command "line" p58 (polar p58 (* 0.0 pi) 53) "")
 (command "line" p59 (polar p59 (* 0.0 pi) 53) "")
 (command "line" p60 (polar p60 (* 0.0 pi) 53) "")
 (command "line" p61 (polar p61 (* 0.0 pi) 53) "")
 (command "line" p62 (polar p62 (* 0.0 pi) 53) "")  
 (command "line" p57 p62 "")

(setq file (read-line fp))               
(setq jar1 (atof (substr file n  10)))            
(setq elt  (atof (substr file (+ n 10 ) 10)))   
(setq elt3  (atof (substr file (+ n 20 ) 10)))   
(setq tbl1  (atof (substr file (+ n 30 ) 10)))  
(setq slp1  (atof (substr file (+ n 40 ) 10)))  

 (if (= jar1 "")(setq jar1 nil))
 (if (= jar1 nil)(setq stop 1)
   (setq stop 0))
 (while (= stop 0)
   
 (setq jar (- jar1 jar0))
   (setq jar0 jar1)
   (setq p2  (polar p0 0 (* jar sch))
     p21 (polar p2 (* 0.5 pi) (* (- elt eldat) scv)))
 (setq jar3 (- jar1 jar0))
   (setq jar0 jar1)
   (setq p2  (polar p2 0 (* jar3 sch))    
         p22 (polar p2 (* 0.5 pi) (* (- elt3 eldat) scv)))    
   (command "color" 211 "-linetype" "s" "dashed2" "")
   (command "line" p2 p22 "")
   (command "color" 140 "-linetype" "s" "continuous" "")
   (command "line" p01 p21 "")
   (command "color" 140 "-linetype" "s" "dashed2" "")    
   (command "line" p02 p22 "")
   (command "color" 20 "-linetype" "s" "continuous" "")
   (command "line" p0 p2 "")
   (command "color" 20 "-linetype" "s" "continuous" "")
   (command "line"(polar p0 (* 1.5 pi) 10)(polar p2 (* 1.5 pi) 10)"")
   (command "line"(polar p0 (* 1.5 pi) 20)(polar p2 (* 1.5 pi) 20)"")
   (command "line"(polar p0 (* 1.5 pi) 30)(polar p2 (* 1.5 pi) 30)"")
   (command "line"(polar p0 (* 1.5 pi) 40)(polar p2 (* 1.5 pi) 40)"")
   (command "line"(polar p0 (* 1.5 pi) 50)(polar p2 (* 1.5 pi) 50)"")    
   (setq p23 (polar p2 (* 1.5 pi) 50))
   (command "line" p2 p23 "")
   (setq p2tx1    (polar p2 (* 1.5 pi) 15)      
     p2tx3    (polar p0 0 (* (/ jar 2) sch))
     p2tx2    (polar p2tx3 (* 1.5 pi) 5))    
(if (< (* jar sch) 10) 
   (setq sdttx2 90) (setq sdttx2 0))    
   (command "color" 7)
   (command "text" "j" "bc" p2tx1 "2.5" 90 (rtos elt 2 2))      
   (command "text" "j" "mc" p2tx2 "2.5" sdttx2 (rtos jar 2 2))
   
   (setq p2tx4    (polar p2 (* 1.5 pi) 25)
     p2tx6    (polar p0 0 (* (/ jar3 2) sch))
     p2tx5    (polar p2tx6 (* 1.5 pi) 5))        
(if (< (* jar3 sch) 10)
   (setq sdttx5 90) (setq sdttx5 0))
   (command "color" 7)    
   (command "text" "j" "bc" p2tx4 "2.5" 90 (rtos elt3 2 2))   
   
   (setq p2tx7 (polar p2 (* 1.5 pi) 35)
     p2tx6    (polar p0 0 (* (/ jar3 2) sch))
     p2tx5    (polar p2tx6 (* 1.5 pi) 5))      
   (command "color" 7)      
   (command "text" "j" "bc" p2tx7 "2.5" 90 (rtos tbl1 2 2))

   (setq p2tx8    (polar p0 0 (* (/ jar 2) sch))
     p2tx9    (polar p2tx8 (* 1.5 pi) 45))
(if (< (* jar sch) 10)
   (setq sdttx9 90) (setq sdttx9 0))
   (command "color" 7)       
   (command "text" "j" "bc" p2tx9 "2.5" sdttx9 (rtos slp1 2 2))    
   
   (setq p0 p2)
   (setq p01 p21)
   (setq p02 p22)
   
       
(setq file (read-line fp))                
(setq jar1 (atof (substr file n  10)))            
(setq elt  (atof (substr file (+ n 10 ) 10)))    
(setq elt3  (atof (substr file (+ n 20 ) 10)))    
(setq tbl1  (atof (substr file (+ n 30 ) 10))) 
(setq slp1  (atof (substr file (+ n 40 ) 10)))   

   (if    (= jar1 "")(setq jar1 nil))
   (if    (= jar1 nil)(setq stop 1)(setq stop 0)))
 
(setq p0 (polar p3 (* 1.5 pi) 150))
(setq p3 p0)
(setq n (+ n 50))
);repeat  
 
(close fp)
)
;;defun

I don't understand why the repeat command cannot work, may be i missed other command in this script, i hope i have any solution for the script.

I'm sorry if my english not very well, thank you.

cross.rar

Link to comment
Share on other sites

dear Bigal,

I think nothing happens with this rows, the script only reading the first data, and cannot work continous to read the next data. May be i must be try harder to make other oppinion for the command script, i agree about your motivation " a man who never made mistakes never made anything"...:thumbsup:

 

(repeat 3
(setq p3 p0) (setq fp (open fnam "r")) (setq file (read-line fp))                 (if (= file "") (setq file nil)) (if (= file nil) (setq stop 1) (setq stop 0)) (setq noptk (atof (substr file n 10)))             (setq file (read-line fp))                 (setq eldat (atof (substr file n 10)))             (setq file (read-line fp))                 (setq jar0 (atof (substr file n 10)))             (setq elt1 (atof (substr file (+ n 10 ) 10)))    (setq tbl (atof (substr file (+ n 30 ) 10)))     (setq slp (atof (substr file (+ n 40 ) 10)))        (setq p01 (polar p0 (* 0.5 pi) (* (- elt1 eldat) scv)))   (setq p02 (polar p0 (* 0.5 pi) (* (- elt2 eldat) scv)))     (command "color" 20 "-linetype" "s" "dashed2" "")   (command "line" p0 p02 "")     (command "color" 20 "-linetype" "s" "continuous" "")   (command "line" p0 (polar p0 (* 1.5 pi) 50) "")   (command "color" 7)   (setq p01tx (polar p0 (* 1.5 pi) 15))   (setq p02tx (polar p0 (* 1.5 pi) 25))   (setq p0tx (polar p0 (* 1.5 pi) 35))     (setq p50 (polar p0 pi -5))     (setq p51 (polar p0 pi 50))   (setq p52 (polar p51 (* 1.5 pi) 5))   (setq p53 (polar p52 (* 1.5 pi) 10))   (setq p54 (polar p53 (* 1.5 pi) 10))   (setq p55 (polar p54 (* 1.5 pi) 10))   (setq p56 (polar p55 (* 1.5 pi) 10))   (setq p57 (polar p0 pi 53))   (setq p58 (polar p57 (* 1.5 pi) 10))   (setq p59 (polar p58 (* 1.5 pi) 10))   (setq p60 (polar p59 (* 1.5 pi) 10))   (setq p61 (polar p60 (* 1.5 pi) 10))   (setq p62 (polar p61 (* 1.5 pi) 10))     (command "text" "j" "tc" '(-30.0 25.0) "3.5" 0 (strcat "STA." (rtos noptk 2 0)))   (command "text" "j" "tc" p01tx "2.5" 90 (rtos elt1 2 2))   (command "text" "j" "tc" p02tx "2.5" 90 (rtos elt2 2 2))   (command "text" "j" "tc" p0tx "2.5" 90 (rtos slp 2 2))     (if (> eldat 0)   (command "text" "j" "bl" p50 "2.5" 0 (strcat "+" (rtos eldat 2 2) " m"))   (command "text" "j" "bl" p50 "2.5" 0 (strcat (rtos eldat 2 2) " m"))   );if   (command "text" "j" "ml" p52 "2.5" 0 "JARAK         (m)")   (command "text" "j" "ml" p53 "2.5" 0 "TINGGI ASAL    (m)")   (command "text" "j" "ml" p54 "2.5" 0 "TINGGI RENCANA (m)")   (command "text" "j" "ml" p55 "2.5" 0 "TEBAL RENCANA  (m)")   (command "text" "j" "ml" p56 "2.5" 0 "SLOPE RENCANA  (m)")     (command "color" 20 "-linetype" "s" "continuous" "")   (command "line" p0 p57 "")   (command "color" 20 "-linetype" "s" "continuous" "")   (command "line" p58 (polar p58 (* 0.0 pi) 53) "")   (command "line" p59 (polar p59 (* 0.0 pi) 53) "")   (command "line" p60 (polar p60 (* 0.0 pi) 53) "")   (command "line" p61 (polar p61 (* 0.0 pi) 53) "")   (command "line" p62 (polar p62 (* 0.0 pi) 53) "")     (command "line" p57 p62 "")  (setq file (read-line fp))                (setq jar1 (atof (substr file n  10)))             (setq elt  (atof (substr file (+ n 10 ) 10)))    (setq elt3  (atof (substr file (+ n 20 ) 10)))    (setq tbl1  (atof (substr file (+ n 30 ) 10)))   (setq slp1  (atof (substr file (+ n 40 ) 10)))      (if (= jar1 "")(setq jar1 nil))   (if (= jar1 nil)(setq stop 1)     (setq stop 0))   (while (= stop 0)        (setq jar (- jar1 jar0))     (setq jar0 jar1)     (setq p2  (polar p0 0 (* jar sch))       p21 (polar p2 (* 0.5 pi) (* (- elt eldat) scv)))   (setq jar3 (- jar1 jar0))     (setq jar0 jar1)     (setq p2  (polar p2 0 (* jar3 sch))               p22 (polar p2 (* 0.5 pi) (* (- elt3 eldat) scv)))         (command "color" 211 "-linetype" "s" "dashed2" "")     (command "line" p2 p22 "")     (command "color" 140 "-linetype" "s" "continuous" "")     (command "line" p01 p21 "")     (command "color" 140 "-linetype" "s" "dashed2" "")         (command "line" p02 p22 "")     (command "color" 20 "-linetype" "s" "continuous" "")     (command "line" p0 p2 "")     (command "color" 20 "-linetype" "s" "continuous" "")     (command "line"(polar p0 (* 1.5 pi) 10)(polar p2 (* 1.5 pi) 10)"")     (command "line"(polar p0 (* 1.5 pi) 20)(polar p2 (* 1.5 pi) 20)"")     (command "line"(polar p0 (* 1.5 pi) 30)(polar p2 (* 1.5 pi) 30)"")     (command "line"(polar p0 (* 1.5 pi) 40)(polar p2 (* 1.5 pi) 40)"")     (command "line"(polar p0 (* 1.5 pi) 50)(polar p2 (* 1.5 pi) 50)"")         (setq p23 (polar p2 (* 1.5 pi) 50))     (command "line" p2 p23 "")     (setq p2tx1    (polar p2 (* 1.5 pi) 15)             p2tx3    (polar p0 0 (* (/ jar 2) sch))       p2tx2    (polar p2tx3 (* 1.5 pi) 5))     (if (< (* jar sch) 10)      (setq sdttx2 90) (setq sdttx2 0))         (command "color" 7)     (command "text" "j" "bc" p2tx1 "2.5" 90 (rtos elt 2 2))           (command "text" "j" "mc" p2tx2 "2.5" sdttx2 (rtos jar 2 2))          (setq p2tx4    (polar p2 (* 1.5 pi) 25)       p2tx6    (polar p0 0 (* (/ jar3 2) sch))       p2tx5    (polar p2tx6 (* 1.5 pi) 5))         (if (< (* jar3 sch) 10)     (setq sdttx5 90) (setq sdttx5 0))     (command "color" 7)         (command "text" "j" "bc" p2tx4 "2.5" 90 (rtos elt3 2 2))             (setq p2tx7 (polar p2 (* 1.5 pi) 35)       p2tx6    (polar p0 0 (* (/ jar3 2) sch))       p2tx5    (polar p2tx6 (* 1.5 pi) 5))           (command "color" 7)           (command "text" "j" "bc" p2tx7 "2.5" 90 (rtos tbl1 2 2))      (setq p2tx8    (polar p0 0 (* (/ jar 2) sch))       p2tx9    (polar p2tx8 (* 1.5 pi) 45)) (if (< (* jar sch) 10)     (setq sdttx9 90) (setq sdttx9 0))     (command "color" 7)            (command "text" "j" "bc" p2tx9 "2.5" sdttx9 (rtos slp1 2 2))              (setq p0 p2)     (setq p01 p21)     (setq p02 p22)               (setq file (read-line fp))                 (setq jar1 (atof (substr file n  10)))             (setq elt  (atof (substr file (+ n 10 ) 10)))     (setq elt3  (atof (substr file (+ n 20 ) 10)))     (setq tbl1  (atof (substr file (+ n 30 ) 10)))  (setq slp1  (atof (substr file (+ n 40 ) 10)))         (if    (= jar1 "")(setq jar1 nil))     (if    (= jar1 nil)(setq stop 1)(setq stop 0)))    (setq p0 (polar p3 (* 1.5 pi) 150)) (setq p3 p0) (setq n (+ n 50)) );repeat 

Link to comment
Share on other sites

as long as 1st argument is integer, it should work

 ([color="blue"][b]repeat[/b][/color] [color="red"]int[/color] anything bla bla )

 

 

Just share some ideas:

 

1. Localize your variable, also avoid using too many variables it could be confusing & typos :ouch:

LISP is nice for list manipulation, store data in list better. look at this functions: list,car,cdr,nth,assoc,mapcar,foreach,member etc..

 

2. About file checking.. why not getfiled?

 ([color="blue"]while[/color] (not fnam) (setq  fnam  ([color="blue"]getfiled[/color] "\nFile Input Data Cross" "c:/cross/data" "prn" 16))) 

 

3. (setq stop 1 ) ;flag? IMO you can try something like:

   (if (setq str (read-line f)) [color="green"]....[/color] )  (while str [color="green"]....[/color] ) 

 

4. when using command call like: (command "line"...)(command "text"...)

sometimes osmode enabled will be the culprit which the line

drawn snaps to other object

 

FWIW, entmake entity is much faster, effective and without osmode snap issues

 

(defun _line ( p1 p2 co )
 ([b][color="blue"]entmakex[/color][/b] (list '(0 . "LINE")(cons 62 co)(cons 10 p1 )(cons 11 p2 )))
 )

 

;example

[color="green"];single call[/color]
([color="blue"]_line[/color] p1 p2 140 ) 
[color="green"];multiple:[/color]
(mapcar ''((a b)([color="blue"]_line[/color] a b 140)) (list p1 p3 p5 pn)(list p2 p4 p6 pn))

 

p/s: should you restore sysvar?

Edited by hanhphuc
Link to comment
Share on other sites

attachment.php?attachmentid=63520&cid=1&stc=1

 

Also had a quick look , guess there's little more for me to say what hasn't already said by hanhphuc. Just marked the lines were your code error's. Did get some result , enough for me to see it's not my field of work. But localizing your variable names would be my first advise too.

 

(defun c:job  ()
 (setvar "dimzin" 1) (setvar "blipmode" 1) (setvar "cmdecho" 1)
 (setq ssv 20) (setq ssh 250)
 (if (equal ssv nil) (setq scy 20.0) (setq scy ssv))
 (if (equal ssh nil) (setq scx 250.0) (setq scx ssh))
 (setq scv (/ 1000 scy) sch (/ 1000 scx))
 ;(setq fnam1 "/cross/Data/") (setq fnam2 "*.prn") (setq lastLL 2 lastRR 5)
 ;(setq f (getstring (strcat "\nFile Input Data Cross c:/cross/data/ < " fnam2 " > ? : ")))
 ;(if (/= f "") (setq fnam2 f))
 ;(setq fnam (strcat fnam1 fnam2))(setq check (findfile fnam))
 ;(while (= check nil)
  ; (prompt "\nFile Not Found .....! ")
   ;(setq f (getstring (strcat "\nFile Input Data Cross c:/cross/data/ < " fnam2 " > ? : ")))
   ;(if (/= f "") (setq fnam2 f))
   ;(setq fnam (strcat fnam1 fnam2))
   ;(setq check (findfile fnam))
  ; while
 (setq fnam "d:/Temp/Lisp/Cad-tutor/MazBoz/cr.prn")
 (setq n 1) (setq p0 '(0 0 0))
 (repeat 3
   (setq p3 p0)
   (setq fp (open fnam "r"))
   (setq file (read-line fp))
   (if (= file "") (setq file nil))
   (if (= file nil) (setq stop 1) (setq stop 0))
   (setq noptk (atof (substr file n 10)))
   (setq file (read-line fp))
   (setq eldat (atof (substr file n 10)))
   (setq file (read-line fp))
   (setq jar0 (atof (substr file n 10)))
   (setq elt1 (atof (substr file (+ n 10) 10)))
   ;**** elt2 is not set causing error p02
   (setq elt2 (atof (substr file (+ n 10) 10)))
   ;*************************************
   (setq tbl (atof (substr file (+ n 30) 10)))
   (setq slp (atof (substr file (+ n 40) 10)))
   (setq p01 (polar p0 (* 0.5 pi) (* (- elt1 eldat) scv)))
   (setq p02 (polar p0 (* 0.5 pi) (* (- elt2 eldat) scv)))
   (command "color" 20 "-linetype" "s" "dashed2" "")
   (command "line" p0 p02 "")
   (command "color" 20 "-linetype" "s" "continuous" "")
   (command "line" p0 (polar p0 (* 1.5 pi) 50) "")
   (command "color" 7)
   (setq p01tx (polar p0 (* 1.5 pi) 15))
   (setq p02tx (polar p0 (* 1.5 pi) 25))
   (setq p0tx (polar p0 (* 1.5 pi) 35))
   (setq p50 (polar p0 pi -5))
   (setq p51 (polar p0 pi 50))
   (setq p52 (polar p51 (* 1.5 pi) 5))
   (setq p53 (polar p52 (* 1.5 pi) 10))
   (setq p54 (polar p53 (* 1.5 pi) 10))
   (setq p55 (polar p54 (* 1.5 pi) 10))
   (setq p56 (polar p55 (* 1.5 pi) 10))
   (setq p57 (polar p0 pi 53))
   (setq p58 (polar p57 (* 1.5 pi) 10))
   (setq p59 (polar p58 (* 1.5 pi) 10))
   (setq p60 (polar p59 (* 1.5 pi) 10))
   (setq p61 (polar p60 (* 1.5 pi) 10))
   (setq p62 (polar p61 (* 1.5 pi) 10))
   (command "text" "j" "tc" '(-30.0 25.0) "3.5" 0 (strcat "STA." (rtos noptk 2 0)))
   (command "text" "j" "tc" p01tx "2.5" 90 (rtos elt1 2 2))
   (command "text" "j" "tc" p02tx "2.5" 90 (rtos elt2 2 2))
   (command "text" "j" "tc" p0tx "2.5" 90 (rtos slp 2 2))
   (if (> eldat 0)
     (command "text" "j" "bl" p50 "2.5" 0 (strcat "+" (rtos eldat 2 2) " m"))
     (command "text" "j" "bl" p50 "2.5" 0 (strcat (rtos eldat 2 2) " m"))) ;if
   (command "text" "j" "ml" p52 "2.5" 0 "JARAK         (m)")
   (command "text" "j" "ml" p53 "2.5" 0 "TINGGI ASAL    (m)")
   (command "text" "j" "ml" p54 "2.5" 0 "TINGGI RENCANA (m)")
   (command "text" "j" "ml" p55 "2.5" 0 "TEBAL RENCANA  (m)")
   (command "text" "j" "ml" p56 "2.5" 0 "SLOPE RENCANA  (m)")
   (command "color" 20 "-linetype" "s" "continuous" "")
   (command "line" p0 p57 "")
   (command "color" 20 "-linetype" "s" "continuous" "")
   (command "line" p58 (polar p58 (* 0.0 pi) 53) "")
   (command "line" p59 (polar p59 (* 0.0 pi) 53) "")
   (command "line" p60 (polar p60 (* 0.0 pi) 53) "")
   (command "line" p61 (polar p61 (* 0.0 pi) 53) "")
   (command "line" p62 (polar p62 (* 0.0 pi) 53) "")
   (command "line" p57 p62 "")
   (setq file (read-line fp))
   (setq jar1 (atof (substr file n 10)))
   (setq elt (atof (substr file (+ n 10) 10)))
   (setq elt3 (atof (substr file (+ n 20) 10)))
   (setq tbl1 (atof (substr file (+ n 30) 10)))
   (setq slp1 (atof (substr file (+ n 40) 10)))
   (if (= jar1 "")
     (setq jar1 nil))
   (if (= jar1 nil)
     (setq stop 1)
     (setq stop 0))
   (while (= stop 0)
     (setq jar (- jar1 jar0))
     (setq jar0 jar1)
     (setq p2  (polar p0 0 (* jar sch))
           p21 (polar p2 (* 0.5 pi) (* (- elt eldat) scv)))
     (setq jar3 (- jar1 jar0))
     (setq jar0 jar1)
     (setq p2  (polar p2 0 (* jar3 sch))
           p22 (polar p2 (* 0.5 pi) (* (- elt3 eldat) scv)))
     (command "color" 211 "-linetype" "s" "dashed2" "")
     (command "line" p2 p22 "")
     (command "color" 140 "-linetype" "s" "continuous" "")
     (command "line" p01 p21 "")
     (command "color" 140 "-linetype" "s" "dashed2" "")
     (command "line" p02 p22 "")
     (command "color" 20 "-linetype" "s" "continuous" "")
     (command "line" p0 p2 "")
     (command "color" 20 "-linetype" "s" "continuous" "")
     (command "line" (polar p0 (* 1.5 pi) 10) (polar p2 (* 1.5 pi) 10) "")
     (command "line" (polar p0 (* 1.5 pi) 20) (polar p2 (* 1.5 pi) 20) "")
     (command "line" (polar p0 (* 1.5 pi) 30) (polar p2 (* 1.5 pi) 30) "")
     (command "line" (polar p0 (* 1.5 pi) 40) (polar p2 (* 1.5 pi) 40) "")
     (command "line" (polar p0 (* 1.5 pi) 50) (polar p2 (* 1.5 pi) 50) "")
     (setq p23 (polar p2 (* 1.5 pi) 50))
     (command "line" p2 p23 "")
     (setq p2tx1 (polar p2 (* 1.5 pi) 15)
           p2tx3 (polar p0 0 (* (/ jar 2) sch))
           p2tx2 (polar p2tx3 (* 1.5 pi) 5))
     (if (< (* jar sch) 10)
       (setq sdttx2 90)
       (setq sdttx2 0))
     (command "color" 7)
     (command "text" "j" "bc" p2tx1 "2.5" 90 (rtos elt 2 2))
     (command "text" "j" "mc" p2tx2 "2.5" sdttx2 (rtos jar 2 2))
     (setq p2tx4 (polar p2 (* 1.5 pi) 25)
           p2tx6 (polar p0 0 (* (/ jar3 2) sch))
           p2tx5 (polar p2tx6 (* 1.5 pi) 5))
     (if (< (* jar3 sch) 10)
       (setq sdttx5 90)
       (setq sdttx5 0))
     (command "color" 7)
     (command "text" "j" "bc" p2tx4 "2.5" 90 (rtos elt3 2 2))
     (setq p2tx7 (polar p2 (* 1.5 pi) 35)
           p2tx6 (polar p0 0 (* (/ jar3 2) sch))
           p2tx5 (polar p2tx6 (* 1.5 pi) 5))
     (command "color" 7)
     (command "text" "j" "bc" p2tx7 "2.5" 90 (rtos tbl1 2 2))
     (setq p2tx8 (polar p0 0 (* (/ jar 2) sch))
           p2tx9 (polar p2tx8 (* 1.5 pi) 45))
     (if (< (* jar sch) 10)
       (setq sdttx9 90)
       (setq sdttx9 0))
     (command "color" 7)
     (command "text" "j" "bc" p2tx9 "2.5" sdttx9 (rtos slp1 2 2))
     (setq p0 p2)
     (setq p01 p21)
     (setq p02 p22)
     (setq file (read-line fp))
     ;*********************** file error'd (nil) probably reached end of file premature?
     ;probably use (if (setq file (read-line fp)) (progn (setq jar1 ....elt... elt3... etc
     (setq jar1 (atof (substr file n 10)))
     (setq elt (atof (substr file (+ n 10) 10)))
     (setq elt3 (atof (substr file (+ n 20) 10)))
     (setq tbl1 (atof (substr file (+ n 30) 10)))
     (setq slp1 (atof (substr file (+ n 40) 10)))
     (if (= jar1 "")
       (setq jar1 nil))
     (if (= jar1 nil)
       (setq stop 1)
       (setq stop 0)))
   (setq p0 (polar p3 (* 1.5 pi) 150))
   (setq p3 p0)
   (setq n (+ n 50))) ;repeat  
 (close fp))
;;defun

gr. Rlx

Mazboz.jpg

Edited by rlx
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...