Author Topic: [XDrX-PlugIn(122)] Coping part of Polyline  (Read 234 times)

0 Members and 1 Guest are viewing this topic.

xdcad

  • Swamp Rat
  • Posts: 505
[XDrX-PlugIn(122)] Coping part of Polyline
« on: April 03, 2024, 09:57:35 AM »
Saw an application on cadtutor.net,

https://www.cadtutor.net/forum/topic/77002-coping-part-of-polyline/#comment-614215

It can be easily implemented using setinterval in the AcGe geometry library. XDRX-API encapsulates a specialized function, xdrx-curve-setinterval

In addition to the interactive part, the following code solves the problem with just one function

Code: [Select]
(defun c:xdtb_plcpypart (/ wid e e1 p1 p2 p3)
  (xdrx-begin)
  (xdrx-sysvar-push '("osmode" 544))
  (if (and (setq wid (getreal (xdrx-string-multilanguage "\n多段线宽度<退出>:" "\nPolyline Width<exit>:")))
   (setq e (car (xdrx-entsel
  (xdrx-string-multilanguage
    "\n拾取多段线<退出>:"
    "\nPick Polyline<Exit>"
  )
  '((0 . "*polyline"))
)
   )
   )
   (setq p1 (getpoint (xdrx-string-multilanguage
"\n起始点<退出>:"
"\nStart Point<Exit>:"
      )
    )
   )
   (cond
     ((xdrx-curve-isclosed e)
      (setq p2 (getpoint (xdrx-string-multilanguage
   "\n中间点<退出>:"
   "\nThe Middle Point<Exit>:"
)
       )
      )
     )
     (t
      t
     )
   )
   (setq p3 (getpoint (xdrx-string-multilanguage
"\n结束点<退出>:"
"\nThe End Point<Exit>:"
      )
    )
   )
      )
    (progn
      (and (setq e1 (xdrx-curve-setinterval e p1 p3 p2))
   (xdrx-entity-make e1)
   (xdrx-setpropertyvalue (entlast) "constantwidth" wid "color" 1))
    )
  )
  (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

dieptp

  • Mosquito
  • Posts: 6
Re: [XDrX-PlugIn(122)] Coping part of Polyline
« Reply #1 on: April 18, 2024, 03:53:08 AM »
Greate one, thank mate! How could I using it with current snap options?

xdcad

  • Swamp Rat
  • Posts: 505
Re: [XDrX-PlugIn(122)] Coping part of Polyline
« Reply #2 on: April 18, 2024, 04:50:21 AM »
Greate one, thank mate! How could I using it with current snap options?

Specifically what you want to do, you can take a screenshot of the example below.
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