Author Topic: [XDrX-PlugIn(160)] extend or cut curve with circle  (Read 194 times)

0 Members and 1 Guest are viewing this topic.

xdcad

  • Swamp Rat
  • Posts: 505
[XDrX-PlugIn(160)] extend or cut curve with circle
« on: May 02, 2024, 11:47:44 AM »

https://www.cadtutor.net/forum/topic/67785-how-to-extend-or-cut%EF%BC%9F/

Code: [Select]
(defun c:xdtb_cirextend (/ box clone ints nearpt pnt r ss ss1 strepnts x y z)
  (xd::doc:getdouble (xdrx-string-multilanguage "\n圆半径" "\nCircle Radius")
     "#mradius" 10.0
  )
  (if (setq ss (xdrx-ssget (xdrx-string-multilanguage "\n选择圆<退出>:" "\nSelect Circle<Exit>:")
   '((0 . "circle"))
       )
      )
    (progn
      (mapcar
'(lambda (x)
   (setq r (xdrx-getpropertyvalue x "radius")
box (xdrx-entity-box x)
box (xd::pnts:close box)
   )
   (setq clone (xdrx-object-clone x))
   (xdrx-setpropertyvalue x "radius" #mradius)
   (if (setq ss1 (ssget "f" box '((0 . "*polyline,line"))))
     (progn
       (mapcar
'(lambda (y)
    (setq strepnts (xdrx-entity-getstretchpoint y))
    (if (setq pnt (vl-some '(lambda (z)
      (if (xdrx-point-ison z clone)
z
      )
    ) strepnts
  )
)
      (progn
(if (setq ints (xdrx-entity-intersectwith y x 1))
  (progn
    (setq nearpt (xdrx-points-nearpt pnt ints))
    (xdrx-entity-movestretchpointex y pnt
    (mapcar
      '-
      nearpt
      pnt
    )
    )
  )
)
      )
    )
  )
(xdrx-ss->ents ss1)
       )
     )
   )
   (xdrx-entity-delete clone)
)
(xdrx-ss->ents ss)
      )
    )
  )
  (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