Author Topic: [XDrX-PlugIn(9)] SSGET that supports keywords,callback (Topology Zone Creation)  (Read 942 times)

0 Members and 1 Guest are viewing this topic.

xdcad

  • Swamp Rat
  • Posts: 527
The following code will demonstrate

1. Modify the prompt string of SSGET
2. Enter keyword B in SSGET, enter the callback function, and modify the current filling settings without exiting SSGET.



Code - Auto/Visual Lisp: [Select]
  1. ;|
  2. xdrx-initssget
  3. Parameters: 1: ssget prompt string
  4.        2: Keywords
  5.        3: Prompt string when removing an object
  6.        4: Callback function
  7. |;
  8.            (xdrx-initssget
  9.              "\nPick the curve to be created [Fill Mode(B)]<Exit>:"
  10.              "B" "" "_keyword"
  11.            )
  12.            (setq ss (xdrx-ssget '((0 . "*line,arc,circle,ellipse,spline,*polyline"))))
  13.  


Code - Auto/Visual Lisp: [Select]
  1. (defun c:tt ()
  2. ;|
  3.     Selection set callback function, after entering keyword B, enter processing
  4. |;
  5.   (defun _keyword (key)
  6.     (cond
  7.       ((= key "B")
  8.        (if (= #xd_var_region_hatch 0)
  9.          (setq #xd_var_region_hatch 1)
  10.          (setq #xd_var_region_hatch 0)
  11.        )
  12.       )
  13.     )
  14.     (_prompt)
  15.   )
  16.   (defun _prompt()
  17.     (xdrx_initget "B")
  18.     (xdrx_prompt
  19.       "\nCurrent settings: *** REGION FILL Mode: "
  20.       (if
  21.         (= #xd_var_region_hatch 0)
  22.          "YES ***"
  23.          "NO ***"
  24.       )
  25.     )
  26.   )
  27.   (if (not #xd_var_region_hatch)
  28.     (setq #xd_var_region_hatch 0)
  29.   )
  30.   (while (and
  31.            (_prompt)
  32. ;|
  33. xdrx-initssget
  34. Parameters: 1: ssget prompt string
  35.        2: Keywords
  36.        3: Prompt string when removing an object
  37.        4: Callback function
  38. |;
  39.            (xdrx-initssget
  40.              "\nPick the curve to be created [Fill Mode(B)]<Exit>:"
  41.              "B" "" "_keyword"
  42.            )
  43.            (setq ss (xdrx-ssget '((0 . "*line,arc,circle,ellipse,spline,*polyline"))))
  44.          )
  45.     (progn
  46.       (if (setq ss (xdrx-geom-searchregions ss t))
  47.                                         ;Construct closed regions
  48.         (progn
  49.           (xdrx-begin)
  50.           (if (= #xd_var_region_hatch 0)
  51.             (progn
  52.               (mapcar '(lambda (x)
  53.                          (setq e   (xdrx-hatch-make x) ; Create hatch
  54.                                clr (xdrx-math-rand 1 50)
  55.                                         ;1-50 random number
  56.                          )
  57.                          (xdrx-entity-setcolor e clr) ;Set color
  58.                        )
  59.                       (xdrx-pickset->ents ss)
  60.               )
  61.             )
  62.           )
  63.           (xdrx-end)
  64.         )
  65.       )
  66.     )
  67.   )
  68.   (princ)
  69. )
  70.  
« Last Edit: November 26, 2023, 10:31:23 PM by xdcad »
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