Jump to content

Remove Dimension Text Bounding Box


LanloyLisp

Recommended Posts

(DEFUN c:test ()
(setq main (CAR (ENTSEL)) e (tblobjname "block" (cdr (assoc 2 (entget main)))) e1 e)
(while (setq e1 (entnext e1))
  (setq eng (entget e1))
  (if (eq (cdr (assoc 0 eng)) "MTEXT")
    (entmod (subst (cons 41 0.)(assoc 41 eng) eng))
    )
  )
  
  (entupd main)
  (princ)
)

Hi Everyone!

 

It's been a while again.😁.  Is there any way we can remove the bounding box of an MText in a Dimension?  Above code works temporarily, but when the object is moved it goes back to its original form.

Link to comment
Share on other sites

@pkenewell I'm trying to reduce the text's rectangular width of dimensions to keep the background mask highlighting only the text.

image.png.b91000f5b2ea676e0eafcf3b7f7b1fa5.png

Link to comment
Share on other sites

@LanloyLisp Sorry but I don't think that is possible for normal dimensions. If anything - it would require not only customizing the dimension block, but adding a reactor to the dimensions to maintain the customized elements when doing any modification to them. I'm not sure even if the reactor will work because of creating a circular reference.

 

If someone else is willing to attempt that challenge they are welcome to, but It's way more than I have time for.

Link to comment
Share on other sites

No worries pkenewell. It seems the dimension text is constantly changing handles when edited with its own reactor. We'll see if some other CAD masters may have something to suggest.😄

  • Like 1
Link to comment
Share on other sites

In order to display the text box around dimensions someone probably added a negative sign at the front of the Text Offset in the properties palette.

If you remove the negative, the box will go away.

 

And if anyone wants to have a box around their dimensions.... Add a negative sign to the Text offset...

 

Dimension Text Box.png

Link to comment
Share on other sites

Posted (edited)

BTY, overrides are stored in XDATA, here’s a sample in python to clear the overrides.

Though, it’s recommended that you not nuke the whole data. Just clear the inside DSTYLE section

 

docs:

https://help.autodesk.com/view/OARX/2018/ENU/?guid=OREF-Dimension_Style_Overrides

 

should be able to port to lisp

 

import traceback
from pyrx_imp import Rx, Ge, Gi, Db, Ap, Ed

def PyRxCmd_doit() -> None:
    try:
        xd = [(1001, "ACAD"),(1000 , "DSTYLE"), (1002  , "{"),(1002 , "}")]
        db = Db.curDb()
        ids = db.objectIds(Db.Dimension.desc())
        dims = [Db.Dimension(id, Db.OpenMode.kForWrite) for id in ids]
        for dim in dims:
            if dim.hasXData("ACAD"):
                dim.setXData(xd)
    except Exception as err:
        traceback.print_exception(err)

 

Edited by Danielm103
added docs
Link to comment
Share on other sites

image.png.933dd5898703c3c9d59878520f87bd7a.png

@Danielm103 I think modifying the DSTYLE xdata doesn't affect the ruler width shown above.

@troggarf Turning on and off  the text frame doesn't affect it as well.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...