Author Topic: [XDrX-Function(17)] point set minimum area rectangle  (Read 251 times)

0 Members and 1 Guest are viewing this topic.

xdcad

  • Bull Frog
  • Posts: 479
[XDrX-Function(17)] point set minimum area rectangle
« on: December 10, 2023, 12:18:55 PM »
min area rectange function:

Code - Auto/Visual Lisp: [Select]
  1. (xdrx_points_minareabox <pts>)
  2. parameter:
  3. pts: point list
  4. return value:
  5. Minimum rectangle four-point coordinate list
  6.  


Code - Auto/Visual Lisp: [Select]
  1. (defun c:tt ()
  2.   (if (setq ss (xdrx-ssget "\nSelect Points<Exit>" '((0 . "point"))))
  3.     (progn
  4.       (setq pts (xdrx-getpropertyvalue ss "position")
  5.             pts (apply 'append pts)
  6.             box (xdrx_points_MinAreaBox pts)
  7.       )
  8.       (xdrx-polyline-make box t)
  9.       (xdrx-setpropertyvalue (entlast) "color" 1)
  10.     )
  11.   )
  12.   (princ)
  13. )
The code I wrote uses XDRX-API,which can be downloaded from github.com and is updated at any time.
===================================
[XDrx-Sub Forum]
https://www.theswamp.org/index.php?board=78.0
https://github.com/xdcad/XDrx-API
http://bbs.xdcad.net