
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello
I am new to autolisp and when i copy on zoom extent it is multiplying coping distance 2 ot 3 times
Below is code
(defun c:bar(/ br1 br2 bar1 bar2 dis ang spac ddd cnt pcnt)
(setq smd (getvar "osmode"))
(command "osnap" "cen")
(setq br1 (car (entsel "\n WELCOME please Pick the starting bar...")))
(setq br2 (car (entsel "\n AND NOW Pick the ending bar.....")))
(setq bar1 (cdr (assoc 10 (entget br1))))
(setq bar2 (cdr (assoc 10 (entget br2))))
; x coordinates bar1
(setq x1 (strcat (rtos (car bar1) 2 3) ))
; Y coordinates bar1
(setq y1 (strcat (rtos (cadr bar1) 2 3) ))
(setq dis1 (distance bar1 bar2))
(setq ang (angle bar1 bar2))
(setq spac (getint "\n Enter the spaces.."))
;(setq dis1 (* dis 1000))
(setq nob (/ dis1 spac))
(setq nob2 (fix (+ nob 1)))
(setq ddd (/ dis1 nob2))
;(setq ddd (/ ddd 1000))
(command "zoom" "e")
(setq cnt 1)
(while (< cnt nob2)
(setq pcnt (polar bar1 ang (* cnt ddd)))
;(command "._delay" 10)
(command "copy" br1 "" bar1 pcnt)
(setq cnt (+ 1 cnt))
)
;(print ddd)
(command "osmode" smd)
);;
;(command "osnap" "end"
Thanks
Solved! Go to Solution.