- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello there,
I wrote the following lsp to make a grid of vertical lines and bounding box with an input stp.
My problem is the lines not in correct position,lthough I printed point coordinates p3, p4 to make sure calculations are correct. they appear to be so.
here is my lsp. Any help??
thank you
;------------------------------------------
(defun hpromptr (textq default_value)
(setq tmp (getreal ( strcat "\n" textq "[" (rtos default_value) "]" )))
(if (= tmp nil) (setq tmp default_value))
(setq tmp tmp)
)
;-------------------------------------------
;-------------------------------------------
;-------------------------------------------
;-------------------------------------------
(defun c:ooo(/ i nw xd stp p1 p2 p3 p4 w width
x1 y1 x2 y2 pp)
; (hinit)
; (hlayer "_Grid")
(setq stp (hpromptr "Step:" 100.0 ))
(setq w (hpromptr "Fram Width:" 0.1))
(setq p1 (getpoint "\nPick first point: "))
(setq p2 (getcorner p1 "\nPick second point: "))
(command "rectang" "w" w p1 p2)
(command "rectang" "w" w p1 p2)
(setq width (- (car p2) (car p1)))
(setq nw (fix (/ width stp)))
(p nw)
(setq xd (car p1))
(setq i 0)
(setq y1 (cadr p1))
(setq y2 (cadr p2))
(repeat nw
(setq pp (+ xd stp))
(setq xd pp)
(setq p3 (list pp y1 0.0))
(setq p4 (list pp y2 0.0))
(command "line" p3 p4 "")
)
; (hprev_layer)
; (hend)
)
Solved! Go to Solution.