Jump to content

i write easy lisp code that drawed 2 rectangle with selected 4 points but get error??


hamidciv

Recommended Posts

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 by hamidciv
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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)
)

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...