Author Topic: [XDrX-PlugIn(144)] Dynamically insert SPLINE FIT points  (Read 99 times)

0 Members and 1 Guest are viewing this topic.

xdcad

  • Bull Frog
  • Posts: 493
[XDrX-PlugIn(144)] Dynamically insert SPLINE FIT points
« on: April 16, 2024, 12:32:18 AM »

https://www.cadtutor.net/forum/topic/83389-simple-addremove-fit-points-on-a-spline/

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

The code below, using XDRX - API,
Before trying the forum code, please download and install XDRX - API

xdcad/XDrx-API: Autolisp development library written in ObjectARX (github.com)

https://github.com/xdcad/XDrx-API

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

Code: [Select]
(defun c:xdtb_spldynfit (/ dynpt fitpnt inx lastpnt spl)
  (defun _callback (dynpt)
    (if (not (equal dynpt lastpnt))
      (xdrx-spline-setfitpointat spl inx dynpt)
    )
    (setq lastpnt dynpt)
  )
  (xdrx-begin)
  (xdrx-sysvar-push '("osmode" 512))
  (if (and
(setq spl (car (xdrx-entsel (xdrx-string-multilanguage "\n拾取SPLINE<退出>:" "\nPick Spline<Exit>:")
    '((0 . "spline"))
       )
  )
)
(xdrx-entity-redraw spl 1)
(setq fitpnt (getpoint (xdrx-string-multilanguage "\n点取新增Fit点位置<退出>:" "\nClick to select the new Fit point location<Exit>:")))
(setq inx (xdrx-spline-insertfitpointat spl fitpnt))
      )
    (progn
      (xdrx-entity-redraw spl 4)
      (xdrx-pointmonitor "_callback")
      (getpoint)
      (xdrx-pointmonitor)
    )
  )
  (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