Author Topic: [XDrX-Function(40)] Supports dynamic click Hatching of gap tolerances  (Read 169 times)

0 Members and 2 Guests are viewing this topic.

xdcad

  • Swamp Rat
  • Posts: 504
Code: [Select]
(defun c:tt (/ box dynpt e1 e2 edge hch minl old-edge patten scale ss)
  (defun *error* (msg)
    (xdrx_pointmonitor)
    (xdrx-entity-delete old-edge edge (xdrx-getpropertyvalue hch "assocobjids") hch)
  )
  (defun _callback (dynpt)
    (defun _equal (e1 e2)
      (equal (xdrx-getpropertyvalue e1 "area" "length" "numverts") (xdrx-getpropertyvalue e2 "area" "length"
  "numverts"
   )
      )
    )
    (if (and
  (setq edge (xdrx-geom-bpoly dynpt ss))
  (not (_equal edge old-edge))
)
      (progn
(xdrx-entity-delete old-edge (xdrx-getpropertyvalue hch "assocobjids") hch)
(setq old-edge edge
      hch (xdrx_hatch_make old-edge)
)
(xdrx_hatch_setpattern hch patten)
(xdrx_hatch_setscale hch scale)
(xdrx-entity-delete (xdrx-getpropertyvalue hch "assocobjids"))
      )
    )
  )
  (setq patten "grass"
scale 1.0
  )
  (xdrx-begin)
  (xd::doc:getdouble
    (xdrx-string-multilanguage
      "\n输入缝隙容差"
      "\nInput Gap Tolerance"
    )
    "#xd-var-global-gap-tol"
    (xd::doc:getpickboxheight)
  )
  (xdrx-sysvar-push (list "boextlen" #xd-var-global-gap-tol))
  (if (setq ss (xdrx-ssget (xdrx-string-multilanguage "\n选择曲线<退出>:" "\nSelect Curves<Exit>:") '
   ((0 . "*line,arc,ellipse,circle"))
       )
      )
    (progn
      (setq box (xdrx-entity-box ss)
    minl (apply
   'min
   (xdrx-getpropertyvalue (xdrx-getpropertyvalue box "allLineSegs") "length")
)
    scale (XD::Hatch:GetSclByGap patten (/ minl 20.0))
      )
      (xdrx-pointmonitor "_callback")
      (getpoint (xdrx-string-multilanguage "\n拾取内部点:" "\nPick internal point:"))
      (xdrx-pointmonitor)        ; (*error* nil)
    )
  )
  (xdrx-sysvar-pop)
  (xdrx-end)
  (princ)
)
The code I wrote uses XDRX-API,which can be downloaded from github.com and is updated at any time.
===================================
https://github.com/xdcad
https://sourceforge.net/projects/xdrx-api-zip/
http://bbs.xdcad.net