Author Topic: [XDrX-PM(2)]Use PM to dynamically draw memory entities and simulate SPLINE Comma  (Read 750 times)

0 Members and 1 Guest are viewing this topic.

xdcad

  • Bull Frog
  • Posts: 424
Using 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

CALL BACK FUNC:

While the mouse is moving, call CALLBACK continuously to set the FIT of SPLINE.

Code - Auto/Visual Lisp: [Select]
  1.  
  2. (defun _callback (dynpt)
  3. ;;dynpt,The current WCS point coordinates of the mouse
  4. ;|
  5. SPL variables, in-memory SPLINE entities, are not generated to the database, so manipulating it is faster because it does not require the extra burden of displaying it on the screen
  6. |;
  7.     (redraw)
  8.     (xdrx-setpropertyvalue
  9.        spl
  10.        "setfitpoints"
  11.        (reverse (cons dynpt lst));;Set fitting points
  12.      )
  13.      (xdrx-grdraw 1 -1 spl) ;;Display memory entities
  14.   )
  15.  

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));;Set fitting points
  8.      )
  9.      (xdrx-grdraw 1 -1 spl) ;;Display memory entities
  10.    )
  11.    (if (and (setq p1 (getpoint "\nstarting point<exit>:"))
  12.             (setq p2 (getpoint p1 "\nNext point <exit>:"))
  13.        )
  14.      (progn (xdrx-pointmonitor "_callback")
  15.             (setq lst (list p2 p1))
  16.             (setq spl (xdrx-spline-make))
  17. ;|
  18. Create memory DB entity
  19. No APPEND to the database, no additional overhead such as WORLD DRAW, etc., and the operation speed is faster
  20. |;
  21.             (while (setq p3 (getpoint (car lst) "\nnext point<exit>:"))
  22.               (setq lst (cons p3 lst))
  23.             )
  24.             (xdrx-pointmonitor)
  25.             (xdrx-setpropertyvalue spl "removefitpointat" (length lst));;Remove the last fitting point before the last mouse confirmation
  26.             (xdrx-entity-make spl);;Create from memory entity to database
  27.      )
  28.    )
  29.    (princ)
  30. )
=============

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
« Last Edit: November 20, 2023, 05:59:53 PM by xdcad »
The code I wrote uses XDRX-API,which can be downloaded from github.com and is updated at any time.
===================================
[XDrx-Sub Forum]
https://www.theswamp.org/index.php?board=78.0
https://github.com/xdcad/XDrx-API
http://bbs.xdcad.net