Jump to content

Change multiple Dimensions measured text into normal text?


apsonwane

Recommended Posts

Is it possible to change measured text in multiple dimentions to normal text in one command, so that when objects are scaled or streched, dimention text value dosn't change anymore?

 

In short I am looking to convert dimention to number text.

 

Thanks in advance,

 

Ashish

Link to comment
Share on other sites

Check this out .

 

(defun c:Test (/ ss str)
 (if
   (and
     (setq str (getstring T "\n Enter Text:"))
     (setq ss (ssget "_:L" '((0 . "*DIMENSION"))))
   )
    (command "_.DimEdit" "_New" str ss "")
 )
 (princ)
)

 

Tharwat

Link to comment
Share on other sites

I don't understand why you would want to do such a thing? :?

 

This would accomplish the task...

 

(defun c:test ( / ss i e )
 (if (setq ss (ssget "_:L" '((0 . "*DIMENSION"))))
   (repeat (setq i (sslength ss))
     (entupd
       (cdr
         (assoc -1
           (entmod
             (subst
               (cons 1
                 (LM:GetDimensionString (setq e (ssname ss (setq i (1- i)))))
               )
               (assoc 1 (setq e (entget e))) e
             )
           )
         )
       )
     )
   )
 )
 (princ)
)

(defun LM:GetDimensionString ( dim / dl db ds )
 (if
   (and
     (wcmatch (cdr (assoc 0 (setq dl (entget dim)))) "*DIMENSION")
     (setq db (tblobjname "BLOCK" (cdr (assoc 2 dl))))
   )
   (while (and (setq db (entnext db)) (not ds))
     (if (eq "MTEXT" (cdr (assoc 0 (setq dl (entget db)))))
       (setq ds (cdr (assoc 1 dl)))
     )
   )
 )
 ds
)

Link to comment
Share on other sites

you could...*shudder* *gasp* *swallow* explode the dimension....
I was going to suggest that but decided I didn't want a moderator telling me off. :whistle:
Link to comment
Share on other sites

Thanks Le Mac once again. :)

This is exactly what I was looking for.:D

The reson why I need this is, I always need to enlarge some portion of drawing in same sheet where I scale that portion of drawing keeping same dimention values.

 

Cheers,

Ashish

Link to comment
Share on other sites

Thanks Le Mac once again. :)

This is exactly what I was looking for.:D

The reson why I need this is, I always need to enlarge some portion of drawing in same sheet where I scale that portion of drawing keeping same dimention values.

 

Cheers,

Ashish

 

That's why paper space layouts and "annotative scaling" was introduced so that you would not have to go through that. Why aren't you using the features built into 2010 to your advantage? You might as well be using AutoCAD release 9.

Link to comment
Share on other sites

(defun c:test  (/ selset Units DimValue DimValue DimPrec)
     (vl-load-com)
     (if (ssget '((0 . "DIMENSION")))
           (progn
                 (vlax-for
                        Text  (setq selset
                                         (vla-get-activeselectionset
                                               (vla-get-activedocument
                                                     (vlax-get-acad-object))))
                       (setq Units (vla-get-UnitsFormat text)
                             DimValue (vla-get-measurement text)
                                  DimPrec  (vla-get-PrimaryUnitsPrecision
                                               text)
                             )
                       (vla-put-TextOverride
                             text
                             (if (or (= Units 3)
                                     (= Units 4))
                                   (rtos DimValue
                                         4
                                         DimPrec)
                                   (rtos DimValue
                                         2
                                         DimPrec)
                                   )
                             )
                       )
                 (vla-delete selset)
                 )
           )
     )

 

Not thouroughly tested

Link to comment
Share on other sites

That's why paper space layouts and "annotative scaling" was introduced so that you would not have to go through that.

 

That is correct :)

Link to comment
Share on other sites

Not thouroughly tested

 

Be aware that by using that method you will also have to account for DimPrefix, DimSuffix, Display of Alternate Units (and position [before/after primary]), AltPrefix, AltSuffix, AltUnits, AltPrecision, Tolerance Display, Tolerance types/justifications - oh, and not to mention any other MText formatting that the user has applied.

 

o:)

Link to comment
Share on other sites

Be aware that by using that method you will also have to account for DimPrefix, DimSuffix, Display of Alternate Units (and position [before/after primary]), AltPrefix, AltSuffix, AltUnits, AltPrecision, Tolerance Display, Tolerance types/justifications - oh, and not to mention any other MText formatting that the user has applied.

 

o:)

Or anything the user just manually typed in, in addition to the .
Link to comment
Share on other sites

Be aware that by using that method you will also have to account for DimPrefix, DimSuffix, Display of Alternate Units (and position [before/after primary]), AltPrefix, AltSuffix, AltUnits, AltPrecision, Tolerance Display, Tolerance types/justifications - oh, and not to mention any other MText formatting that the user has applied.

 

o:)

 

I totally agree with those mentioned above, there's way too much factors to consider alright.

 

:D

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...