hamidciv Posted September 24, 2014 Posted September 24, 2014 (edited) hi dear :(i write lisp code that drawing 2 rectangle with 4 points, but get error, please check my code and tell me Where is the problem? thanks i solved in my code but cant modify lispp code in here , unfortunately Hang Up. 2rectangle.LSP Edited September 24, 2014 by hamidciv Quote
mostafa badran Posted September 24, 2014 Posted September 24, 2014 Firstly you need to know how can you draw one rectangle, then applied what you learn to 2 rectangle, this is a simple code to learn how to draw rectangle, try to study this code (defun c:drawrec (/ LEN P1 P2 POINT WIDTH) (setq len (getdist "\nEnter Length: ")) (setq Width (getdist "\nEnter Width: ")) (setq point (getpoint "\nSpecify point: ")) (setq p1 point p2 (list (+ (car point) len) (+ (cadr point) Width)) ) (command "rectang" p1 p2) (princ) ) HTH M Badran Quote
hamidciv Posted September 24, 2014 Author Posted September 24, 2014 thanks my problem solved with use while function. Quote
Lee Mac Posted September 24, 2014 Posted September 24, 2014 Perhaps the following will help: (defun c:testr ( / i l p ) (setq i 1) (while (and (< i 5) (setq p (getpoint (strcat "\nPoint " (itoa i) ": ")))) (setq l (cons p l) i (1+ i) ) ) (if (= 5 i) (repeat 2 (command "_.rectang" "_non" (car l) "_non" (cadr l)) (setq l (cddr l)) ) ) (princ) ) Quote
hamidciv Posted September 25, 2014 Author Posted September 25, 2014 dear lee mac my goal exactly the same very thanks for help me Quote
Recommended Posts
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.