Author Topic: [XDrX-PM(3)]Use PM dynamically Drag to Generate fishbone lines  (Read 1092 times)

0 Members and 1 Guest are viewing this topic.

xdcad

  • Swamp Rat
  • Posts: 527
[XDrX-PM(3)]Use PM dynamically Drag to Generate fishbone lines
« on: November 20, 2023, 06:08:41 PM »
Use point monitor to dynamically draw memory entities and drag to generate fishbone lines

sing the input point manager (point monitor) allows you to monitor the mouse movement process and do what you want to do through callback functions, such as dynamic dragging, displaying tooltip strings, etc.


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

Demonstrates the method of displaying memory entities during dynamic dragging

Using ARX's ViewportDraw, the screen refreshes to display entities, which is fast

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

Code - Auto/Visual Lisp: [Select]
  1. (defun c:tt ()
  2.    (defun _callback (dynpt)
  3.      (redraw)
  4.      (xdrx-setpropertyvalue
  5.        spl
  6.        "setfitpoints"
  7.        (reverse (cons dynpt lst))
  8.        ;;Set fitting points
  9.      )
  10.      (setq pts (xdrx-getpropertyvalue spl "getpointsatdist" 500.0))
  11.      (mapcar '(lambda (x)
  12.                 (setq v (xdrx-getpropertyvalue spl "firstderiv" x)
  13.                       v1 (xdrx-vector-perpvector v)
  14.                       p1 (mapcar '+ x (xdrx-vector-product v1 500.0))
  15.                       p2 (mapcar '- x (xdrx-vector-product v1 500.0))
  16.                       pts1 (cons (list p1 p2) pts1)
  17.                 )
  18.                 (xdrx-grdraw 7 -1 p1 p2)
  19.               )
  20.              (cdr pts)
  21.      )
  22.      (setq tf t)
  23.      (xdrx-grdraw 1 -1 spl)
  24.      ;;Display memory entities
  25.    )
  26.    (if (and (setq p1 (getpoint "\nstarting point<exit>:"))
  27.             (setq p2 (getpoint p1 "\nNext point <exit>:"))
  28.        )
  29.      (progn (xdrx-pointmonitor "_callback")
  30.             (setq lst (list p2 p1))
  31.             (setq spl (xdrx-spline-make))
  32.             ;;Create in-memory DB entity
  33.             (while (setq p3 (getpoint (car lst) "\nnext point<exit>:"))
  34.               (setq lst (cons p3 lst))
  35.               (setq nums (xdrx-getpropertyvalue spl "numfitpoints"))
  36.               (setq tf nil)
  37.             )
  38.             (xdrx-pointmonitor)
  39.             (if (> (xdrx-getpropertyvalue spl "numfitpoints") nums)
  40.               (xdrx-setpropertyvalue spl "removefitpointat" (length lst))
  41.             )
  42.             ;;Remove the last fitting point before the last mouse confirmation
  43.             (setq pts (xdrx-getpropertyvalue spl "getpointsatdist" 500.0))
  44.             (mapcar '(lambda (x)
  45.                        (setq v (xdrx-getpropertyvalue spl "firstderiv" x)
  46.                              v1 (xdrx-vector-perpvector v)
  47.                              p1 (mapcar '+ x (xdrx-vector-product v1 500.0))
  48.                              p2 (mapcar '- x (xdrx-vector-product v1 500.0))
  49.                              pts1 (cons (list p1 p2) pts1)
  50.                        )
  51.                        (xdrx-line-make p1 p2)
  52.                      )
  53.                     (cdr pts)
  54.             )
  55.             (redraw)
  56.             (xdrx-entity-make spl)
  57.  
  58.             ;;Create from memory entity to database
  59.      )
  60.    )
  61.    (princ)
  62. )

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

The above LISP code uses the XDRX-API, which can be downloaded from https://github.com/xdcad/XDrx-API and is updated at any time.

The XDRX API encapsulates AcDb, AcEd, AcGe, AcBr... C++ library, using C++ methods to develop LISP programs.Thousands of Lisp functions are available.
Modify message

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