Author Topic: [XDrX-PlugIn(20)] An application of SSGET with keywords (polyline dimensioning)  (Read 1000 times)

0 Members and 1 Guest are viewing this topic.

xdcad

  • Swamp Rat
  • Posts: 527
In the SSGET process, modify the dimension settings through keywords




Code - Auto/Visual Lisp: [Select]
  1. (defun c:tt ()
  2.   (if (not #dis)
  3.     (setq #dis 10.0)
  4.   )
  5.   (defun _setdis (keyword)
  6.     (cond
  7.       ((= keyword "SE")
  8.        (if (setq dis (getreal
  9.                        (xdrx_prompt
  10.                          "\nPlease enter the distance of the second dimension line<"
  11.                          #dis
  12.                          ">:"
  13.                          t
  14.                        )
  15.                      )
  16.            )
  17.          (setq #dis dis)
  18.        )
  19.       )
  20.       ((= keyword "BE")
  21.        (setq #align1 (xdrx_yesorno "\nIs the base point aligned:" 1))
  22.        (if (= #align1 1)
  23.          (setq #align t)
  24.          (setq #align nil)
  25.        )
  26.       )
  27.     )
  28.     (xdrx_prompt
  29.       "\nCurrent Settings: Base Point Alignment ("
  30.       (if #align
  31.         "Y"
  32.         "N"
  33.       )
  34.       ")/Second-dimensional distance ("
  35.       #dis
  36.       ")"
  37.     )
  38.   )
  39.   (xdrx_begin)
  40.   (xdrx_prompt
  41.     "\nCurrent settings: base point alignment ("
  42.     (if #align
  43.       "Y"
  44.       "N"
  45.     )
  46.     ")/Second-dimensional distance ("
  47.     #dis
  48.     ")"
  49.   )
  50.   (xdrx_initssget
  51.     "\nSelect the polyline to be marked [Base Point Alignment(BE)/Second Dimension(SE)]<Exit>:"
  52.     "BE SE"
  53.     ""
  54.     "_setdis"
  55.     ""
  56.    )
  57.   (if (and
  58.         (setq ss (xdrx_ssget '((0 . "*polyline"))))
  59.         (setq pt (getpoint "\nDimension line position<exit>:"))
  60.       )
  61.     (progn
  62.       (mapcar
  63.         '(lambda (x)
  64.            (xd::dim:makerotwithPnts
  65.              (xdrx_getpropertyvalue x "vertices")
  66.              (trans pt 1 0)
  67.              #align
  68.              #dis
  69.            )
  70.          )
  71.         (xdrx_pickset->ents ss)
  72.       )
  73.     )
  74.   )
  75.   (xdrx_end)
  76.   (princ)
  77. )
« Last Edit: November 29, 2023, 01:22:46 AM 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