Message 1 of 5
Dim text override from within a block

Not applicable
07-20-2019
05:28 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
I am working on a program that requires the text of a dimension to be overridden from within the block. The problem I'm facing is once the dim has the text overridden the change isn't viewable in the model or paper space. Once I open the block editor the change is shown. I have tried the vla-update, vla-regen methods with no avail. I have attached a shortened example code to show the issue at hand. Please let me know if you have any ideas for a possible solution.
Regards,
Mitch
P.S. I am running Mechanical 2017. Not sure if the Mechanical version is preventing the change.
(defun C:test1 (/ tmp) (setq tmp (getstring "name a block ")) (vl-new-block tmp) (blk_rect_add tmp 0 0 3 4) (blk_dim_add tmp 2 1.5 2 -1.5 2) ) (defun vl-new-block (name / blkColl insertionPnt) (setq blkColl (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-acad-object))) insertionPnt (vlax-3d-point 0 0 0) ) (vla-Add blkColl insertionPnt name) ) (defun blk_rect_add (blkin xcenter ycenter height width / acadObj points doc blk blkColl templ) (setq blkColl (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-acad-object))) l 0 xlist (list + + - -) ylist (list + - - +) xd (* 0.5 width) yd (* 0.5 height) points (vlax-make-safearray vlax-vbDouble '(0 . 11)) ) (foreach point (mapcar '(lambda (x y) (list (x xcenter xd) (y ycenter yd) 0)) xlist ylist) (setq temp (if temp (append temp point) point ) ) ) (vlax-safearray-fill points temp) (vla-put-Closed (vla-AddPolyline (vla-item blkColl blkin) points) :vlax-true) ) (defun blk_dim_add (blkin p1x p1y p2x p2y loc / acadObj points doc blk blkColl l) (setq locx (if (= p1x p2x) (+ loc p1x) (* (+ p1x p2x) 0.5) ) locy (if (= p1y p2y) (+ loc p1y) (* (+ p1y p2y) 0.5) ) point1 (vlax-3D-point p1x p1y 0) point2 (vlax-3D-point p2x p2y 0) location (vlax-3D-point locx locy 0) blk (vla-item (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-acad-object))) blkin) Obj (vla-AddDimAligned blk point1 point2 location) ) (vlax-put-property Obj "TextOverride" "CU TO CU\\N.063\\NTO\\N.057") (print (vlax-get-property Obj "TextOverride")) )