Author Topic: [XDrX-PlugIn(138)] Dimension sum verification  (Read 162 times)

0 Members and 1 Guest are viewing this topic.

xdcad

  • Swamp Rat
  • Posts: 514
[XDrX-PlugIn(138)] Dimension sum verification
« on: April 09, 2024, 10:34:05 PM »

Total dimension verification, taking into account various factors such as manual modification and dimension rounding.

Code: [Select]
(defun c:xdtb_tjdiml (/ #dimclrt #dimdec #dimscale #dimtxsty #dimtxt ss txt val x)
  (xdrx-begin)
  (if (setq ss (xdrx-ssget (xdrx-string-multilanguage "\n选择核查的尺寸标注<退出>:"
      "\nSelect dimensions for verification <Exit>:"
   ) '((0 . "dimen*"))
       )
      )
    (progn
      (setq val 0.0)
      (mapcar
'(lambda (x)
   (xdrx-getpropertyvalue x "dimtxt" "dimscale" "dimtxsty" "dimclrt" "dimdec")
   (cond
     ((/= (setq txt (xdrx-getpropertyvalue x "dimensiontext"))
  ""
      )
       (setq val (+ val (atof txt)))
     )
     (t
       (setq val (+ val (xdrx-math-roundto (xdrx-getpropertyvalue x "measurement")
   (xdrx-getpropertyvalue x "dimrnd")
)
)
       )
     )
   )
)
(xdrx-pickset->ents ss)
      )
      (xdrx-sysvar-push '("dimzin" 0))
      (setq txt (xdrx-text-make '(0 0 0) (setq val (rtos val 2 #dimdec))
(xdrx-getpropertyvalue #dimtxsty "name") (* #dimscale #dimtxt)
)
      )
      (xdrx-setpropertyvalue txt "color" #dimclrt)
      (xdrx-prompt (xdrx-string-multilanguage "\n标注总和:" "\nDimension Total Sum:") val)
      (xd::drag:freemove txt (xd::geom:get9pt txt 2) (+ 1 0) 0 t)
      (xdrx-sysvar-pop)
    )
  )
  (xdrx-end)
  (princ)
)
« Last Edit: April 09, 2024, 10:38:54 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