Jump to content

Simple LISP to draw a cross from lower left to upper right corners


Eiler

Recommended Posts

Hi,

 

I havent done much of AutoCAD LISP writing, and certainly not for many years now, but I was trying to figure out how to make a simple function that would draw a cross with 2 diagonal lines, from lower left corner PT1 to upper right corner PT2.

I thought it might be possible to draw a
-pline from PT1(X1,Y1) - PT2(X2,Y2)

-second pline from (X1,Y2) - (X2,Y1)

 

This would save me time drawing different size crosses by letting me draw 2 diagonal line by clicking just two points

could anyone help me with a code for this?
 

Link to comment
Share on other sites

cad64 I think wants like solution for like match a rectang with 2 diagonals.

 

(defun c:xxx ( / pt1 pt2 pt3 pt4)
(setq pt1 (getpoint "\nPick 1st point ") pt2 (getpoint pt1 "\npick 2nd point "))

(setq pt3 (list (car pt2) (cadr pt1))
pt4 (list (car pt1) (cadr pt2)))

(command "line" pt1 pt2 "")
(command "line" pt3 pt4 "")

(princ)
)
(c:xxx)

 

Eiler your turn now.

Edited by BIGAL
  • Like 1
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...