Community
Hi dear.
First edit object, then add strike-through old text of dimension, conclude new text and old text.
Solved! Go to Solution.
Solved by EnM4st3r. Go to Solution.
like this?
(defun c:strikedim (/ correctent-p textent text dimdata dimdata-1 dimdata-13 dimdata-14)
(defun correctent-p (ent /)
(if ent
(and (= (cdr (assoc 0 (entget (car ent)))) "MTEXT")
(if (= (type (car (nth 3 ent))) 'ENAME)
(= (cdr (assoc 0 (entget (car (nth 3 ent))))) "DIMENSION")
nil
)
)
nil
)
)
(while (not (correctent-p textent))
(setq textent (nentsel "\nSelect the Dimension text: "))
)
(setq text (vla-get-textstring (vlax-ename->vla-object (car textent)))
dimdata (entget (car (nth 3 textent))) ;save original dimension data
dimdata-13 (append '(13) (getpoint "\nFirst Dimension Point: "))
dimdata-14 (append '(14) (getpoint "\nSecond Dimension Point: "))
dimdata-1 (cons 1 (strcat "<> {\\K" text "}"))
dimdata (subst dimdata-13 (assoc 13 dimdata) dimdata) ; replace with new data
dimdata (subst dimdata-14 (assoc 14 dimdata) dimdata)
dimdata (subst dimdata-1 (assoc 1 dimdata) dimdata)
)
(entmod dimdata)
(princ)
(princ)
)
i dont know how you would implement that into one lisp,
but I can just remove those steps so it literally just strikes the dimension:
(defun c:strikedim (/ correctent-p textent text dimdata dimdata-1)
(defun correctent-p (ent /)
(if ent
(and (= (cdr (assoc 0 (entget (car ent)))) "MTEXT")
(if (= (type (car (nth 3 ent))) 'ENAME)
(= (cdr (assoc 0 (entget (car (nth 3 ent))))) "DIMENSION")
nil
)
)
nil
)
)
(while (not (correctent-p textent))
(setq textent (nentsel "\nSelect the Dimension text: "))
)
(setq text (vla-get-textstring (vlax-ename->vla-object (car textent)))
dimdata (entget (car (nth 3 textent))) ;save original dimension data
dimdata-1 (cons 1 (strcat "<> {\\K" text "}")) ;set strike-text
dimdata (subst dimdata-1 (assoc 1 dimdata) dimdata) ;apply strike-text
)
(entmod dimdata)
(princ)
)
Can't find what you're looking for? Ask the community or share your knowledge.