Jump to content

Recommended Posts

Posted

Hello

 

I'm wondering if somebody can help me with this one.

 

I have a 2d drawing of a land survey and each point has a piece of numeric text showing the height of that point. I would like to shift all the text values up by 10 metres i.e. text reading 19.57 now reads 29.57 etc...

There are several hundred points and the only way I know how to do this at present is by hand or using something like topoGX to create a new model from 2d plan.

Does anyone know a simpler and quicker way of doing this. I am using AutoCAD 2006 and we also have AutoCAD 2008LT

 

Many thanks

 

Tom

 

Tom Goodliffe

Anglia Land Surveys Ltd

Posted

are oyou moving the text in the Z plane or just adding 10 to the value of the text?

 

it would be a relatively trivial task in LISP to add 10 to the value (I am sure a suitable author will be along) and the problem would only be selection. Are all the points alone on one layer or do you want to pick by hand?

Posted

Thanks for your reply. We don't need to move the z values (these are zero), just the text label. The text is on several layers but it would be more than acceptable to move all onto one layer for ease. Would really appreciate some help however trivial to save my calculator batteries (and sanity)!

 

Many thanks

 

Tom

Posted

Maybe something like this:

 

[b][color=BLACK]([/color][/b]defun c:add2txt [b][color=FUCHSIA]([/color][/b]/ r ss i en ed[b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]initget 5[b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]setq r [b][color=NAVY]([/color][/b]getdist [color=#2f4f4f]"\nDistance To Change:   "[/color][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]while [b][color=NAVY]([/color][/b]not ss[b][color=NAVY])[/color][/b]
        [b][color=NAVY]([/color][/b]princ [color=#2f4f4f]"\nSelect TEXT To Change:   "[/color][b][color=NAVY])[/color][/b]
        [b][color=NAVY]([/color][/b]setq ss [b][color=MAROON]([/color][/b]ssget [b][color=GREEN]([/color][/b]list [b][color=BLUE]([/color][/b]cons 0 [color=#2f4f4f]"TEXT"[/color][b][color=BLUE])[/color][/b]
                              [b][color=BLUE]([/color][/b]if [b][color=RED]([/color][/b]getvar [color=#2f4f4f]"CTAB"[/color][b][color=RED])[/color][/b]
                                  [b][color=RED]([/color][/b]cons 410 [b][color=PURPLE]([/color][/b]getvar [color=#2f4f4f]"CTAB"[/color][b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b]
                                  [b][color=RED]([/color][/b]cons 67 [b][color=PURPLE]([/color][/b]- 1 [b][color=TEAL]([/color][/b]getvar [color=#2f4f4f]"TILEMODE"[/color][b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]setq i [b][color=NAVY]([/color][/b]sslength ss[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]while [b][color=NAVY]([/color][/b]not [b][color=MAROON]([/color][/b]minusp [b][color=GREEN]([/color][/b]setq i [b][color=BLUE]([/color][/b]1- i[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
        [b][color=NAVY]([/color][/b]setq en [b][color=MAROON]([/color][/b]ssname ss i[b][color=MAROON])[/color][/b]
              ed [b][color=MAROON]([/color][/b]entget en[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
        [b][color=NAVY]([/color][/b]entmod [b][color=MAROON]([/color][/b]subst [b][color=GREEN]([/color][/b]cons 1 [b][color=BLUE]([/color][/b]rtos [b][color=RED]([/color][/b]+ r [b][color=PURPLE]([/color][/b]atof [b][color=TEAL]([/color][/b]cdr [b][color=OLIVE]([/color][/b]assoc 1 ed[b][color=OLIVE])[/color][/b][b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
                       [b][color=GREEN]([/color][/b]assoc 1 ed[b][color=GREEN])[/color][/b] ed[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]prin1[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b]

-David

Posted

Another Method (automatic):

 

Specify layer name of text where indicated:

 

(defun c:txtadd (/ dis ss)
 (vl-load-com)
 (if (and (setq dis (getdist "\nSpecify Distance: "))
          (setq ss (ssget "_X" (list (cons 0 "*TEXT")
                                     (cons 8 "[b][color=Red]layername[/color][/b]")
                                     (cons 410 (getvar "CTAB"))))))
   (foreach x (mapcar 'vlax-ename->vla-object
                      (mapcar 'cadr (ssnamex ss)))
     (vla-put-TextString x
       (rtos
         (+ dis
            (distof (vla-get-TextString x)))))))
 (princ))

Posted

Thank you thank you thank you

 

That has saved me hours

 

Tom

Posted

i wanna play too...

 

(defun c:TextAdd (/ #ChangeValue #SSList #TextValue)
 (vl-load-com)
 (cond
   ;; state amount to change values by and select text
   ((and (setq #ChangeValue (getreal "\nValue to increase/decrease text by: "))
         (setq #SSList (AT:SS->List (ssget ":L"
                                           (list (cons 0 "TEXT,MTEXT")
                                                 (if
                                                   (eq 2 (getvar "cvport"))
                                                    (cons 410 "Model")
                                                    (cons 410 (getvar "ctab"))
                                                 ) ;_ if
                                           ) ;_ list
                                    ) ;_ ssget
                                    T
                       ) ;_ AT:SS->List
         ) ;_ setq
    ) ;_ and
    ;; have value amount and selection set, time to modify
    (mapcar
      '(lambda (x)
         ;; skip if text has no numbers
         (or (zerop (setq #TextValue (atof (vla-get-textstring x))))
             (vla-put-textstring x
                                 (vl-princ-to-string
                                   (+ #TextValue #ChangeValue)
                                 ) ;_ vl-princ-to-string
             ) ;_ vla-put-textstring
         ) ;_ or
       ) ;_ lambda
      #SSList
    ) ;_ mapcar
   )
 ) ;_ cond
 (princ)
) ;_ defun

oh, and you'll need this subroutine:

;;; Convert selection set to list of ename or vla objects
;;; #Selection - SSGET selection set
;;; #VLAList - T for vla objects, nil for ename
;;; Alan J. Thompson, 04.20.09
(defun AT:SS->List (#Selection #VlaList / #List)
 (and #Selection
      (setq #List (vl-remove-if
                    'listp
                    (mapcar 'cadr (ssnamex #Selection))
                  ) ;_ vl-remove-if
      ) ;_ setq
      (if #VlaList
        (setq #List (mapcar 'vlax-ename->vla-object #List))
      ) ;_ if
 ) ;_ and
 #List
) ;_ defun

Posted
(I am sure a suitable author will be along)
thought so :D
Posted
i wanna play too...

 

Not another one like the TILEMODE thread.... :P

Posted
Not another one like the TILEMODE thread.... :P

 

lol

 

........

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