Author Topic: eliminate the dia symbol  (Read 4068 times)

0 Members and 1 Guest are viewing this topic.

andrew_nao

  • Guest
eliminate the dia symbol
« on: February 17, 2011, 09:59:29 AM »
when dimensioning circles, the dimensions come in as mtext
(i hate mtext) so i wrote this to explode the mtext however, it leaves behind the diameter symbol in the text. (I asked this at the autodesk forum but ill ask here also as this place gets faster responses.) is there a way to eliminate or suppress that symbol from the text?

Code: [Select]
(defun C:EXPDIM ( / ss xy pt1 pt2 C ent elist )
(Command "_dimdiameter" pause "" pause "exit")
(setq xy (getvar "lastpoint"))
(setq pt1 (list (- (car xy) 0.50)(- (cadr xy) 0.50)))
(setq pt2 (list (+ (car xy) 0.50)(+ (cadr xy) 0.50)))
(setq ss (ssget "c" pt1 pt2))
(if ss
 (progn
   (setq ent (ssname ss 0))
   (setq elist (entget ent))
   (if (= (cdr (assoc 0 elist)) "MTEXT")
    (command "explode" ent)
   ); if
 ); progn
); if
(princ)
); function

hmspe

  • Bull Frog
  • Posts: 367
Re: eliminate the dia symbol
« Reply #1 on: February 17, 2011, 01:29:21 PM »
How are the diameter symbols being inserted?  It could be %%c or it could be a unicode entry.  If you print elist you can look at the string.  On a quick test here I get   
(1 . "THIS IS A %%C TEST")   
or   
(1 . "THIS IS A {\\fISOCPEUR|b0|i0|c0|p34;ɸ} TEST")

%%C seems to carry forward to the text entity after you explode an mtext entity provided that the font has a character assigned for %%c.  For unicode you could get the string then use wcmatch to search for "{" and "}", then either trim that section out or use strcat to add %%C instead.  I would probably delete the mtext and entmake a text entity in its place.  Post back if you need sample code.

"Science is the belief in the ignorance of experts." - Richard Feynman

fixo

  • Guest
Re: eliminate the dia symbol
« Reply #2 on: February 17, 2011, 02:22:40 PM »
Something like code below may works too
Code: [Select]
(defun C:demo1 ()
  (vl-load-com)
  (command "_dimdiameter" pause "")
  (setq objdim
(vlax-ename->vla-object (entlast)))
  (vla-put-textoverride
    objdim

    (rtos (vla-get-measurement objdim) 2 (getvar 'dimdec))
    )

  (vla-update objdim)
  (princ)
  )

OR

Code: [Select]

(defun C:demo2 ()
  (command "_dimdiameter" pause "")
  (setq elist (entget (entlast)))
  (entmod
    (subst (cons 1 (rtos (cdr (assoc 42 elist)) 2 (getvar 'dimdec)))
   (assoc 1 elist)
   elist))
  (entupd (entlast))
  (princ)
  )

ronjonp

  • Needs a day job
  • Posts: 7533
Re: eliminate the dia symbol
« Reply #3 on: February 17, 2011, 02:23:55 PM »
I do not use dimensions much so 'scuse my ignorance  :-P but ... I get a dimension object with no separate mtext? Is this a dimstyle setting?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: eliminate the dia symbol
« Reply #4 on: February 17, 2011, 02:38:54 PM »
I do not use dimensions much so 'scuse my ignorance  :-P but ... I get a dimension object with no separate mtext? Is this a dimstyle setting?
I use dimensions quite a bit and I only get dimensions....unless some *#&$(*SDF(*SDYF(S*&^S(D*F&  (*S&DF(*S&DF(*Sf decides to explode them.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: eliminate the dia symbol
« Reply #5 on: February 17, 2011, 02:42:07 PM »
What about this for an actual dimension?

Code: [Select]
(defun foo (ent / data ass)
  (if (eq (type ent) 'ENAME)
    (entupd
      (cdr (assoc
             -1
             (entmod
               (subst (cons 1 (rtos (cdr (setq ass (assoc 42 (setq data (entget ent))))))) ass data)
             )
           )
      )
    )
  )
)
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

ronjonp

  • Needs a day job
  • Posts: 7533
Re: eliminate the dia symbol
« Reply #6 on: February 17, 2011, 02:53:31 PM »
I do not use dimensions much so 'scuse my ignorance  :-P but ... I get a dimension object with no separate mtext? Is this a dimstyle setting?
I use dimensions quite a bit and I only get dimensions....unless some *#&$(*SDF(*SDYF(S*&^S(D*F&  (*S&DF(*S&DF(*Sf decides to explode them.
:-D  Yeah ... exploding dimensions just sounds messy.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

ronjonp

  • Needs a day job
  • Posts: 7533
Re: eliminate the dia symbol
« Reply #7 on: February 17, 2011, 02:55:22 PM »
What about this for an actual dimension?

Code: [Select]
(defun foo (ent / data ass)
  (if (eq (type ent) 'ENAME)
    (entupd
      (cdr (assoc
             -1
             (entmod
               (subst (cons 1 (rtos (cdr (setq ass (assoc 42 (setq data (entget ent))))))) ass data)
             )
           )
      )
    )
  )
)

Works here.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: eliminate the dia symbol
« Reply #8 on: February 17, 2011, 02:58:44 PM »
Oops, I didn't see Fixo has already posted solutions (Vanilla and VLISP).
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

paulmcz

  • Bull Frog
  • Posts: 202
Re: eliminate the dia symbol
« Reply #9 on: February 17, 2011, 04:29:19 PM »
When I need to eliminate diameter symbol, I set dimpost to <>. When I need it back, I set dimpost to "."(without quotations)

when dimensioning circles, the dimensions come in as mtext
(i hate mtext) so i wrote this to explode the mtext however, it leaves behind the diameter symbol in the text. (I asked this at the autodesk forum but ill ask here also as this place gets faster responses.) is there a way to eliminate or suppress that symbol from the text?

Code: [Select]
(defun C:EXPDIM ( / ss xy pt1 pt2 C ent elist )
(Command "_dimdiameter" pause "" pause "exit")
(setq xy (getvar "lastpoint"))
(setq pt1 (list (- (car xy) 0.50)(- (cadr xy) 0.50)))
(setq pt2 (list (+ (car xy) 0.50)(+ (cadr xy) 0.50)))
(setq ss (ssget "c" pt1 pt2))
(if ss
 (progn
   (setq ent (ssname ss 0))
   (setq elist (entget ent))
   (if (= (cdr (assoc 0 elist)) "MTEXT")
    (command "explode" ent)
   ); if
 ); progn
); if
(princ)
); function
« Last Edit: February 17, 2011, 04:34:44 PM by paulmcz »

cmwade77

  • Swamp Rat
  • Posts: 1449
Re: eliminate the dia symbol
« Reply #10 on: February 17, 2011, 05:24:09 PM »
I do not use dimensions much so 'scuse my ignorance  :-P but ... I get a dimension object with no separate mtext? Is this a dimstyle setting?
I use dimensions quite a bit and I only get dimensions....unless some *#&$(*SDF(*SDYF(S*&^S(D*F&  (*S&DF(*S&DF(*Sf decides to explode them.
:-D  Yeah ... exploding dimensions just sounds messy.

Yeah, I keep telling my users to NEVER explode dimensions, they can be edited if needed, but do not explode them, causes a mess for the future. They do have a tendency to do it anyway.

ronjonp

  • Needs a day job
  • Posts: 7533
Re: eliminate the dia symbol
« Reply #11 on: February 17, 2011, 05:28:11 PM »
I do not use dimensions much so 'scuse my ignorance  :-P but ... I get a dimension object with no separate mtext? Is this a dimstyle setting?
I use dimensions quite a bit and I only get dimensions....unless some *#&$(*SDF(*SDYF(S*&^S(D*F&  (*S&DF(*S&DF(*Sf decides to explode them.
:-D  Yeah ... exploding dimensions just sounds messy.

Yeah, I keep telling my users to NEVER explode dimensions, they can be edited if needed, but do not explode them, causes a mess for the future. They do have a tendency to do it anyway.

Modify this to only include EXPLODE and run it on startup to grab all dims  :-D

http://www.theswamp.org/index.php?topic=6463.msg79131#msg79131

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

andrew_nao

  • Guest
Re: eliminate the dia symbol
« Reply #12 on: February 18, 2011, 08:59:06 AM »
When I need to eliminate diameter symbol, I set dimpost to <>. When I need it back, I set dimpost to "."(without quotations)

nice this worked perfectly

cmwade77

  • Swamp Rat
  • Posts: 1449
Re: eliminate the dia symbol
« Reply #13 on: February 21, 2011, 12:03:31 PM »
I do not use dimensions much so 'scuse my ignorance  :-P but ... I get a dimension object with no separate mtext? Is this a dimstyle setting?
I use dimensions quite a bit and I only get dimensions....unless some *#&$(*SDF(*SDYF(S*&^S(D*F&  (*S&DF(*S&DF(*Sf decides to explode them.
:-D  Yeah ... exploding dimensions just sounds messy.

Yeah, I keep telling my users to NEVER explode dimensions, they can be edited if needed, but do not explode them, causes a mess for the future. They do have a tendency to do it anyway.

Modify this to only include EXPLODE and run it on startup to grab all dims  :-D

http://www.theswamp.org/index.php?topic=6463.msg79131#msg79131

Very nice indeed, my users would kill me, but I love it.  :lmao: