vla-put-TextOverride within a block
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I'm currently running into an issue while trying to do a dimension override within a block and I've made a very basic test scenario with an attached .dwg file with the block. The scenario is a block called "Test" which is a single line segment with one vertex at (0,0) and the other at (20,0). The code below adds a dimension in the "Test" block and overrides the text to include the string "<>\\XThis is a test override.". The issue is that this override does not appear in model space and is only visible within the block editor. I've tried as many ways as I can think of to try and update the block but nothing seems to be successful. I've tried doing a vla-regen (which is included in this code sample), using the REDRAW/REGENALL commands, and even doing WBLOCK and inserting it to a new drawing. Nothing seems to work which has lead me to here to see if anyone might have some additional knowledge on this issue. The only other case I could find regarding this issue was a post from 2019 here: https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/dim-text-override-from-within-a-bloc... where the exact same issue was occurring and there wasn't an exact resolution for it.
(defun c:dim-override-test (/ ACAD_Object ACAD_Document ACAD_Blocks)
(vl-load-com)
(setq ACAD_Object (vlax-get-acad-object)
ACAD_Document (vla-get-ActiveDocument ACAD_Object)
ACAD_Blocks (vla-get-Blocks ACAD_Document)
)
(vla-StartUndoMark ACAD_Document)
(vla-put-TextOverride
(vla-AddDimRotated
(vla-item ACAD_Blocks
(vla-get-effectivename
(vlax-ename->vla-object
(ssname (ssget "X" (list (cons 2 "Test"))) 0)
);vlax-ename->vla-object
);vla-get-effectivename
);vla-item
(vlax-3d-point 0 0 0)
(vlax-3d-point 20 0 0)
(vlax-3d-point 0 5 0)
0
);vla-AddDimRotated
"<>\\XThis is a test override."
);vla-put-TextOverride
(vla-Regen ACAD_Document acALLViewports)
(vla-EndUndoMark ACAD_Document)
(princ)
)