TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: cadpoobah on May 30, 2014, 02:42:26 PM
-
All,
I would like to create/find a utility that will let me select a cell in a table and have it add a "strikethrough" to all the text (in any cells) in that entire row.
I've found a few vla- functions for working with cells and table text but nothing that would lead me to manipulating the strikethrough property.
Ultimately, it would act as a toggle; unstriking rows that had been "striken" and vice versa.
Any leads?
Thanks!
-
Don't know about newer version of Autocad but as
of 2012 Strikethrough was not available.
You can have underline or Overline.
ymg
-
As of Version 2013 Strikethrough is available,
(setq myvar "\\KAll this will be strikehrough\\k")
ymg
-
Give this a try :)
(defun c:strike (/ _togglestrike i o p row ss txt)
(defun _togglestrike (string)
(if (wcmatch string "{\\K*")
(substr string 4 (- (strlen string) 4))
(strcat "{\\K" string "}")
)
)
(setq i -1)
(if (and (setq ss (ssget "_X" (list (cons 0 "acad_table") (cons 410 (getvar 'ctab)))))
(setq ss (mapcar 'vlax-ename->vla-object (mapcar 'cadr (ssnamex ss))))
)
(if (and (setq p (getpoint "\nPick a Cell: "))
(vl-some '(lambda (x)
(and (eq :vlax-true
(vla-hittest
x
(vlax-3d-point (trans p 1 0))
(vlax-3d-point (trans (getvar 'viewdir) 1 0))
'row
'col
)
)
(setq o x)
)
)
ss
)
)
(repeat (vla-get-columns o)
(and (vlax-invoke o 'getcellvalue row (setq i (1+ i)))
(/= "" (setq txt (vla-gettext o row i)))
(vla-settext o row i (_togglestrike txt))
)
)
(princ "\nCell not detected!")
)
(princ "\nNo Tables found!")
)
(princ)
)
-
Ronjonp,
Good show !
I believe it would be a good idea to turn the cell selection
into a function returning row and column.
ymg
-
I believe it would be a good idea to turn the cell selection
into a function returning row and column.
Search for 'LM:getcell' :lol:
EDIT: Or as another example: http://www.theswamp.org/index.php?topic=37154.msg448331#msg448331
-
Nice job as usual Lee :kewl:
-
Lee,
ASMI had something very similar in https://autocadtips.wordpress.com/2012/02/27/autolisp-copy-text-to-table-cells/ (https://autocadtips.wordpress.com/2012/02/27/autolisp-copy-text-to-table-cells/)
So did Lee Ambrosius here http://hyperpics.blogs.com/beyond_the_ui/2012/07/create-a-table-and-select-a-cell-to-change-with-autolisp-and-activex.html (http://hyperpics.blogs.com/beyond_the_ui/2012/07/create-a-table-and-select-a-cell-to-change-with-autolisp-and-activex.html)
Could not find getcell. But it is easy enough to derive from what we got.
ymg
-
Nice job as usual Lee :kewl:
Thanks Ron, you too :-)