x-box

x-box

martin_leiter
Advocate Advocate
908 Views
4 Replies
Message 1 of 5

x-box

martin_leiter
Advocate
Advocate

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rectangular-with-cross-lines/m-p/137...

Hallo, hab dies gefunden. Es passt für mich sehr gut.
Nur kann ich es im UCS nicht verwenden. Es funktioniert nur im WKS.
Was muß ich hier umstellen damit es klappt?
Bitte um Hilfe!
Danke!
Liebe Grüße Martin

0 Likes
Accepted solutions (1)
909 Views
4 Replies
Replies (4)
Message 2 of 5

ВeekeeCZ
Consultant
Consultant
Accepted solution

Try it like this.

 

(defun c:xbox (/ makeblock pt1 pt3)
  (defun makeblock (cornerpointlist / pt1 pt2 pt4 pt4 blockname)
    (setq
      pt1 (nth 0 cornerpointlist)
      pt3 (nth 1 cornerpointlist)
      pt2 (trans (list (car pt1) (cadr pt3)) 1 0)
      pt4 (trans (list (car pt3) (cadr pt1)) 1 0)
      pt1 (trans pt1 1 0)
      pt3 (trans pt3 1 0))
    ;entmake block
    (entmake (list '(0 . "BLOCK") '(2 . "*anon") '(70 . 1) (cons 10 pt1)))
    (entmake (list '(0 . "LINE") '(8 . "0") (cons 10 pt1) (cons 11 pt2)))
    (entmake (list '(0 . "LINE") '(8 . "0") (cons 10 pt2) (cons 11 pt3)))
    (entmake (list '(0 . "LINE") '(8 . "0") (cons 10 pt3) (cons 11 pt4)))
    (entmake (list '(0 . "LINE") '(8 . "0") (cons 10 pt4) (cons 11 pt1)))
    (entmake (list '(0 . "LINE") '(8 . "0") (cons 10 pt1) (cons 11 pt3)))
    (entmake (list '(0 . "LINE") '(8 . "0") (cons 10 pt2) (cons 11 pt4)))
    (setq blockname (entmake '((0 . "ENDBLK"))))
    ;entmake insert
    (entmake (list '(0 . "INSERT") (cons 2 blockname) (cons 10 pt1))))
  
  (initget 1)
  (setq pt1 (getpoint "\nDesignate one corner: "))
  (initget 1)
  (setq pt3 (getcorner pt1 "\nDesignate opposite corner: "))
  (makeblock (list pt1 pt3))
  (princ))
0 Likes
Message 3 of 5

martin_leiter
Advocate
Advocate

Hello,
Many thanks! It works!

Greetings Martin

0 Likes
Message 4 of 5

rbischoffatsr
Participant
Participant

Draws single polyline rectangle with X by picking two points.

 

(defun c:xbox (/ P1 P2 P3 P4)

;set rectangle points
(setq P1 (getpoint "\nPick corner: "))
(setq P3 (getcorner P1 "\nPick opposite corner: "))
(setq P2 (list (car P1) (cadr P3)))
(setq P4 (list (car P3) (cadr P1)))

(command ".PLINE" P1 P2 P3 P4 P2 P3 P1 P4 "")

(princ))

0 Likes
Message 5 of 5

Kent1Cooper
Consultant
Consultant

@rbischoffatsr wrote:

Draws single polyline rectangle with X by picking two points.

....

(command ".PLINE" P1 P2 P3 P4 P2 P3 P1 P4 "")

....


[That really doesn't address the question, which is about making a routine written for the World Coordinate System work in a different UCS.]

Kent Cooper, AIA
0 Likes