Author Topic: [XDrX-PlugIn(151)] Exploded Hatch and kept Hatch lines as continuous polyline  (Read 172 times)

0 Members and 1 Guest are viewing this topic.

xdcad

  • Swamp Rat
  • Posts: 505
https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-explode-a-hatch-into-polylines/m-p/12711700

============



Normally, after the Hatch is exploded, the Hatch lines are "broken" straight lines. The following code turns them into continuous polylines.

Code: [Select]
(defun c:xdtb_haexplode (/ ss a)
  (xdrx-begin)
  (xd::doc:getdouble
    (xdrx-string-multilanguage "\n缝隙容差" "\nGap tolerance")
    "#xd-var-global-gap-tol"
    0.1
  )
  (xdrx-sysvar-push
    (list "DistanceTol" #xd-var-global-gap-tol)
  )
  (if (setq ss (xdrx-ssget
(xdrx-string-multilanguage
   "\n选择要炸开的填充<退出>:"
   "\nSelect The Hatch to explode<Exit>:"
)
'((0 . "hatch"))
       )
      )
    (progn
      (mapcar '(lambda (x)
(setq a (xdrx-entity-explode t ss))
(xdrx-curve-join a)
       )
      (xdrx-ss->ents ss)
      )
      (xdrx-prompt
(xdrx-string-formatex
  (xdrx-string-multilanguage
    "\n炸开了 %d 个填充,并保持填充线为连续的多段线."
    "\nExploded %d Hatch and kept Hatch lines as continuous polylines."
  )
  (sslength ss)
)
      )
    )
  )
  (xdrx-sysvar-pop)
  (xdrx-end)
  (princ)
)
« Last Edit: April 19, 2024, 04:30:44 AM by xdcad »
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