Author Topic: [XDrX-PlugIn(74)] TABLE delete columns  (Read 350 times)

0 Members and 1 Guest are viewing this topic.

xdcad

  • Swamp Rat
  • Posts: 514
[XDrX-PlugIn(74)] TABLE delete columns
« on: January 01, 2024, 04:58:49 AM »
Code: [Select]
(defun c:XDTB_TABLEDELCol (/ tbl xdir p1 p2 cols col1 col2 start nums)
  (xdrx-begin)
  (xdrx-sysvar-push '("osmode" 0))
  (if (and (setq tbl (car (xdrx-entsel
    (xdrx-string-multilanguage
      "\n选择表格<退出>:"
      "Select Table<Exit>:"
    )
    '((0 . "*table"))
  )
     )
   )
   (setq xdir (xdrx-getpropertyvalue tbl "xdirection"))
   (setq p1 (getpoint "\nPick the starting Column to delete<Exit>:"))
   (setq p2 (xd::doc:getcorner
      p1
      "\nPick the Ending Column to delete<Exit>:"
      8
      xdir
    )
   )
   (setq p2 (cadr p2))
   (setq
     col1 (xdrx-table-hittest
    tbl
    (trans (car p2) 1 0)
    '(0 0 1)
    1.0
    1.0
  )
   )
   (setq col2 (xdrx-table-hittest
tbl
(trans (cadr p2) 1 0)
'(0 0 1)
1.0
1.0
      )
   )
      )
    (progn
      (setq cols  (vl-sort (list (cadr col1) (cadr col2)) '<)
    start (car cols)
    nums  (1+ (- (cadr cols) (car cols)))
      )
      (xdrx-table-deletecolumns tbl start nums)
      (xdrx-prompt
(xdrx-string-formatex
  (xdrx-string-multilanguage
    "\n表格删除了 %d 列."
    "\nTable deleted %d Columns"
  )
  nums
)
      )
    )
  )
  (xdrx-sysvar-pop)
  (xdrx-end)
  (princ)
)
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