Author Topic: [XDrX-PlugIn(81)] Number of overlapping line markers  (Read 455 times)

0 Members and 1 Guest are viewing this topic.

xdcad

  • Bull Frog
  • Posts: 479
[XDrX-PlugIn(81)] Number of overlapping line markers
« on: January 06, 2024, 10:21:54 PM »
Code: [Select]
(defun c:XDTB_OLnMark (/      val    ss     lst    ents   mt vx
       vy     box    p1     p2    nums   rootloops
       rootloop      pos    pmid
      )
  (defun _process ()
    (foreach rootloop rootloops
      (setq box (xdrx-points-minareabox
   (xdrx-getpropertyvalue rootloop "vertices")
)
    p1 (car box)
    p2 (cadr box)
    ss (ssget "cp" (xdrx-points-wcs2ucs box) '((0 . "line")))
    nums (sslength ss)
    vx (xdrx-vector-normalize
   (mapcar '- p2 p1)
)
    vy (xdrx-vector-perpvector vx)
    pmid (xdrx-line-midp p1 p2)
    pos (mapcar '+
pmid
(xdrx-vector-product
   vy
   (* h 3.0)
)
)
      )
      (xdrx-text-make
pos
(itoa nums)
#xd-var-global-textheight
(angle p1 p2)
      )
      (xd::text:adjust (entlast))
    )
  )
  (xdrx_begin)
  (if (not #xd-var-global-textheight)
    (setq #xd-var-global-textheight (/ (xd::doc:getpickboxheight) 2.0))
  )
  (if (setq val (getreal (xdrx-string-formatex
   (xdrx-string-multilanguage
     "\n输入文字高度<%.1f>"
     "\nInput TextHeight<%.1f>"
   )
   #xd-var-global-textheight
)
)
      )
    (setq #xd-var-global-textheight val)
  )
  (setq h (/ #xd-var-global-textheight 5.0))
  (if (and
(xdrx_initssget
  (xdrx-string-multilanguage
    "\n选择要查询重叠的直线<退出>:"
    "\nSelect the overlapping straight line to query <Exit>:"
  )
)
(setq ss (xdrx_ssget '((0 . "line"))))
(setq lst (xdrx-entity-getproperty ss "angle" t "ename")
      lst (xd::list:groupbyindex lst 0.001)
)
      )
    (progn
      (xdrx-setvar "mpolygonmode" 0)
      (xdrx-safezoom ss)
      (mapcar
'(lambda (x)
   (setq ents (cdr x))
   (setq mt (xdrx-getproperty ents "tobox" h h h h))
   (setq mp (xdrx-curve->mpolygon mt))
   (if
     (setq
       rootloops (xdrx_getpropertyvalue mp "haschildloop" t)
     )
      (progn
(_process)
      )
   )
   (xdrx-entity-delete mp)
)
lst
      )
    )
  )
  (xdrx-end)
  (princ)
)
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

Hugo

  • Bull Frog
  • Posts: 430
Re: [XDrX-PlugIn(81)] Number of overlapping line markers
« Reply #1 on: January 07, 2024, 04:36:18 AM »
get an error message

xdcad

  • Bull Frog
  • Posts: 479
Re: [XDrX-PlugIn(81)] Number of overlapping line markers
« Reply #2 on: January 07, 2024, 08:56:04 AM »
get an error message

Go download the API updated on January 7 and try it out
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

Hugo

  • Bull Frog
  • Posts: 430
Re: [XDrX-PlugIn(81)] Number of overlapping line markers
« Reply #3 on: January 07, 2024, 09:08:34 AM »
Thanks for the info, I've already installed it