increase by one or two

increase by one or two

Anonymous
Not applicable
514 Views
25 Replies
Message 1 of 26

increase by one or two

Anonymous
Not applicable
lets say I have about 10 finish floor elevations, all different i.e.: FF =
54.5 (just text) and I needed to go back and raise the whole site by one
foot (add 1 to the text) i.e. FF = 55.5 is there a way to do that?
0 Likes
515 Views
25 Replies
Replies (25)
Message 2 of 26

Anonymous
Not applicable
You could use find and replace but I am sure that's what you want.

"Jon Baker" wrote in message
news:315131483E5B4F5421A793B4406A1F96@in.WebX.maYIadrTaRb...
> lets say I have about 10 finish floor elevations, all different i.e.: FF =
> 54.5 (just text) and I needed to go back and raise the whole site by one
> foot (add 1 to the text) i.e. FF = 55.5 is there a way to do that?
>
0 Likes
Message 3 of 26

Anonymous
Not applicable
Here's a VBA routine that will do that. You may need to tweak the settings
to get the final format you want.
To set it up: In AutoCAD hit 'ALT-F11' to enter the VBA editor. Select
'Insert>Module'. Copy and paste this code into the module. Switch back to
AutoCAD. Hit 'ALT-F8'. Highlight the line with 'ad_Add10'. Click 'Run'.

'-- Begin Routine --
Sub ad_Add10()
Dim TextObj As AcadObject
Dim basePnt As Variant
Dim objSelected As Integer

objSelected = 1
Do While objSelected = 1
On Error GoTo exitsub
ThisDrawing.Utility.GetEntity TextObj, basePnt, "Select Text to
Update>> "
If TextObj.ObjectName = "AcDbText" Or TextObj.ObjectName =
"AcDbMText" Then
TextObj.TextString = _
ThisDrawing.Utility.RealToString(Val(TextObj.TextString) + 10#,
acDecimal, 1)
TextObj.TextString = "FF=" & TextObj.TextString
TextObj.TextString = TextObj.TextString & "'"
End If
TextObj.Update
Loop
exitsub:
End Sub
'-- End Routine --

-- Walter -- http://www.ActiveDwg.com
0 Likes
Message 4 of 26

Anonymous
Not applicable
Oops, change the '10#' to '1#'.

-- Walter -- http://www.ActiveDwg.com
0 Likes
Message 5 of 26

Anonymous
Not applicable
Dear Walter,

Along these lines, is anything available to sequence the alphabet? Say I
array grid bubbles of "A" and want to change subsequent "A's" to "B" "C"
"D", etc.... I don't necessarily want a "grid" lisp routine (although
that's something I need also) but more importantly I need the above
solution. I have an integer routine but I am no code writer so I don't know
how to change it up to accept letters.

Thanks for any suggestions!..............................Pat

Walter wrote in message ...
|Here's a VBA routine that will do that. You may need to tweak the settings
|to get the final format you want.
|To set it up: In AutoCAD hit 'ALT-F11' to enter the VBA editor. Select
|'Insert>Module'. Copy and paste this code into the module. Switch back to
|AutoCAD. Hit 'ALT-F8'. Highlight the line with 'ad_Add10'. Click 'Run'.
|
|'-- Begin Routine --
|Sub ad_Add10()
| Dim TextObj As AcadObject
| Dim basePnt As Variant
| Dim objSelected As Integer
|
| objSelected = 1
| Do While objSelected = 1
| On Error GoTo exitsub
| ThisDrawing.Utility.GetEntity TextObj, basePnt, "Select Text to
|Update>> "
| If TextObj.ObjectName = "AcDbText" Or TextObj.ObjectName =
|"AcDbMText" Then
| TextObj.TextString = _
| ThisDrawing.Utility.RealToString(Val(TextObj.TextString) + 10#,
|acDecimal, 1)
| TextObj.TextString = "FF=" & TextObj.TextString
| TextObj.TextString = TextObj.TextString & "'"
| End If
| TextObj.Update
| Loop
|exitsub:
|End Sub
|'-- End Routine --
|
|-- Walter -- http://www.ActiveDwg.com
|
0 Likes
Message 6 of 26

Anonymous
Not applicable
Pat,
Here's one way to do it. I know there's an easier way, but give this a try
and tweak it as needed.

'--Begin Routine--
Sub ad_Add1Alpha()
Dim TextObj As AcadObject
Dim basePnt As Variant
Dim objSelected As Integer

objSelected = 1
Do While objSelected = 1
On Error GoTo exitsub
ThisDrawing.Utility.GetEntity TextObj, basePnt, "Select Text to
Update>> "
If TextObj.ObjectName = "AcDbText" Or TextObj.ObjectName =
"AcDbMText" Then
Select Case TextObj.TextString
Case "A"
TextObj.TextString = "B"
Case "B"
TextObj.TextString = "C"
Case "C"
TextObj.TextString = "D"
Case "D"
TextObj.TextString = "E"
Case "E"
TextObj.TextString = "F"
Case "F"
TextObj.TextString = "G"
Case "G"
TextObj.TextString = "H"
Case "H"
TextObj.TextString = "I"
Case "I"
TextObj.TextString = "J"
Case "J"
TextObj.TextString = "K"
Case "K"
TextObj.TextString = "L"
Case "L"
TextObj.TextString = "M"
Case "M"
TextObj.TextString = "N"
Case "N"
TextObj.TextString = "O"
Case "O"
TextObj.TextString = "P"
Case "P"
TextObj.TextString = "Q"
Case "Q"
TextObj.TextString = "R"
Case "R"
TextObj.TextString = "S"
Case "S"
TextObj.TextString = "T"
Case "T"
TextObj.TextString = "U"
Case "U"
TextObj.TextString = "V"
Case "V"
TextObj.TextString = "W"
Case "W"
TextObj.TextString = "X"
Case "X"
TextObj.TextString = "Y"
Case "Y"
TextObj.TextString = "Z"
Case "Z"
TextObj.TextString = "A"
End Select
End If
TextObj.Update
Loop
exitsub:
End Sub
'--End Routine--

-- Walter -- http://www.ActiveDwg.com
0 Likes
Message 7 of 26

Anonymous
Not applicable
walter, are you GOD??
0 Likes
Message 8 of 26

Anonymous
Not applicable
Of course not (and you better duck, God WILL get you for saying that)...
Just trying to put the available tools to their best use...

-- Walter -- http://www.ActiveDwg.com
0 Likes
Message 9 of 26

Anonymous
Not applicable
hey you may not THE God, but one of the liittler ones sounds good...
0 Likes
Message 10 of 26

Anonymous
Not applicable
If you will consider third party apps, check out this product:

http://www.4d-technologies.com/text_specialist

The Text Counter (TX_TC) command will allow self-incrementing text and
self-incrementing block attributes to be created.

The Text Processor command will allow selected text to be incremented,
decremented, or processed in various ways.

e-mail me if you have any questions.

Regards
Rakesh

Jon Baker wrote:

> lets say I have about 10 finish floor elevations, all different i.e.: FF =
> 54.5 (just text) and I needed to go back and raise the whole site by one
> foot (add 1 to the text) i.e. FF = 55.5 is there a way to do that?

Rakesh Rao

Four Dimension Technologies, Singapore-India
Advanced AutoCAD customization for the Engineering/Mapping/GIS/AEC
Work smart NOT hard - Get your GeoTools @ www.4d-technologies.com/geotools
0 Likes
Message 11 of 26

Anonymous
Not applicable
Dearest Walter,

I'm not a programmer so I'm afraid I'm not sure how to utilize this utility.
Is this an autolisp routine or Visual Basic? I was looking for the "defun
c:xx" line so I don't know how to execute this. A2ki said it loaded
successfully but I don't know what to type at the command prompt.

Will you please walk me one step further?

Your dummy,
Pat

Walter wrote in message ...
|Pat,
|Here's one way to do it. I know there's an easier way, but give this a try
|and tweak it as needed.
|
|'--Begin Routine--
|Sub ad_Add1Alpha()
| Dim TextObj As AcadObject
| Dim basePnt As Variant
| Dim objSelected As Integer
|
| objSelected = 1
| Do While objSelected = 1
| On Error GoTo exitsub
| ThisDrawing.Utility.GetEntity TextObj, basePnt, "Select Text to
|Update>> "
| If TextObj.ObjectName = "AcDbText" Or TextObj.ObjectName =
|"AcDbMText" Then
| Select Case TextObj.TextString
| Case "A"
| TextObj.TextString = "B"
| Case "B"
| TextObj.TextString = "C"
| Case "C"
| TextObj.TextString = "D"
| Case "D"
| TextObj.TextString = "E"
| Case "E"
| TextObj.TextString = "F"
| Case "F"
| TextObj.TextString = "G"
| Case "G"
| TextObj.TextString = "H"
| Case "H"
| TextObj.TextString = "I"
| Case "I"
| TextObj.TextString = "J"
| Case "J"
| TextObj.TextString = "K"
| Case "K"
| TextObj.TextString = "L"
| Case "L"
| TextObj.TextString = "M"
| Case "M"
| TextObj.TextString = "N"
| Case "N"
| TextObj.TextString = "O"
| Case "O"
| TextObj.TextString = "P"
| Case "P"
| TextObj.TextString = "Q"
| Case "Q"
| TextObj.TextString = "R"
| Case "R"
| TextObj.TextString = "S"
| Case "S"
| TextObj.TextString = "T"
| Case "T"
| TextObj.TextString = "U"
| Case "U"
| TextObj.TextString = "V"
| Case "V"
| TextObj.TextString = "W"
| Case "W"
| TextObj.TextString = "X"
| Case "X"
| TextObj.TextString = "Y"
| Case "Y"
| TextObj.TextString = "Z"
| Case "Z"
| TextObj.TextString = "A"
| End Select
| End If
| TextObj.Update
| Loop
|exitsub:
|End Sub
|'--End Routine--
|
|-- Walter -- http://www.ActiveDwg.com
|
0 Likes
Message 12 of 26

Anonymous
Not applicable
Pat,
It's VBA(Visual Basic for Applications).
To set it up: In AutoCAD hit 'ALT-F11' to enter the VBA editor. Select
'Insert>Module'. Copy and paste this code (between '--Begin Routine--' and
'--End Routine--') into the module. Switch back to AutoCAD. Hit 'ALT-F8'.
Highlight the line with 'ad_Add1Alpha'. Click 'Run'.

'--Begin Routine--
Sub ad_Add1Alpha()
Dim TextObj As AcadObject
Dim basePnt As Variant
Dim objSelected As Integer

objSelected = 1
Do While objSelected = 1
On Error GoTo exitsub
ThisDrawing.Utility.GetEntity TextObj, basePnt, "Select Text to
Update>> "
If TextObj.ObjectName = "AcDbText" Or TextObj.ObjectName =
"AcDbMText" Then
Select Case TextObj.TextString
Case "A"
TextObj.TextString = "B"
Case "B"
TextObj.TextString = "C"
Case "C"
TextObj.TextString = "D"
Case "D"
TextObj.TextString = "E"
Case "E"
TextObj.TextString = "F"
Case "F"
TextObj.TextString = "G"
Case "G"
TextObj.TextString = "H"
Case "H"
TextObj.TextString = "I"
Case "I"
TextObj.TextString = "J"
Case "J"
TextObj.TextString = "K"
Case "K"
TextObj.TextString = "L"
Case "L"
TextObj.TextString = "M"
Case "M"
TextObj.TextString = "N"
Case "N"
TextObj.TextString = "O"
Case "O"
TextObj.TextString = "P"
Case "P"
TextObj.TextString = "Q"
Case "Q"
TextObj.TextString = "R"
Case "R"
TextObj.TextString = "S"
Case "S"
TextObj.TextString = "T"
Case "T"
TextObj.TextString = "U"
Case "U"
TextObj.TextString = "V"
Case "V"
TextObj.TextString = "W"
Case "W"
TextObj.TextString = "X"
Case "X"
TextObj.TextString = "Y"
Case "Y"
TextObj.TextString = "Z"
Case "Z"
TextObj.TextString = "A"
End Select
End If
TextObj.Update
Loop
exitsub:
End Sub
'--End Routine--

-- Walter -- http://www.ActiveDwg.com --
0 Likes
Message 13 of 26

Anonymous
Not applicable
Walter, thanks so much for the VB lesson! BUT there is a syntax error (see
the isolated text below beginning with |Update>>"). It shows up in red in
VB. Can you determine the problem?

Warmest regards..................................Pat

Walter wrote in message ...
|Pat,
|It's VBA(Visual Basic for Applications).
|To set it up: In AutoCAD hit 'ALT-F11' to enter the VBA editor. Select
|'Insert>Module'. Copy and paste this code (between '--Begin Routine--' and
|'--End Routine--') into the module. Switch back to AutoCAD. Hit 'ALT-F8'.
|Highlight the line with 'ad_Add1Alpha'. Click 'Run'.
|
|'--Begin Routine--
|Sub ad_Add1Alpha()
| Dim TextObj As AcadObject
| Dim basePnt As Variant
| Dim objSelected As Integer
|
| objSelected = 1
| Do While objSelected = 1
| On Error GoTo exitsub
| ThisDrawing.Utility.GetEntity TextObj, basePnt, "Select Text to

|Update>> "
| If TextObj.ObjectName = "AcDbText" Or TextObj.ObjectName =
|"AcDbMText" Then

| Select Case TextObj.TextString
| Case "A"
| TextObj.TextString = "B"
| Case "B"
| TextObj.TextString = "C"
| Case "C"
| TextObj.TextString = "D"
| Case "D"
| TextObj.TextString = "E"
| Case "E"
| TextObj.TextString = "F"
| Case "F"
| TextObj.TextString = "G"
| Case "G"
| TextObj.TextString = "H"
| Case "H"
| TextObj.TextString = "I"
| Case "I"
| TextObj.TextString = "J"
| Case "J"
| TextObj.TextString = "K"
| Case "K"
| TextObj.TextString = "L"
| Case "L"
| TextObj.TextString = "M"
| Case "M"
| TextObj.TextString = "N"
| Case "N"
| TextObj.TextString = "O"
| Case "O"
| TextObj.TextString = "P"
| Case "P"
| TextObj.TextString = "Q"
| Case "Q"
| TextObj.TextString = "R"
| Case "R"
| TextObj.TextString = "S"
| Case "S"
| TextObj.TextString = "T"
| Case "T"
| TextObj.TextString = "U"
| Case "U"
| TextObj.TextString = "V"
| Case "V"
| TextObj.TextString = "W"
| Case "W"
| TextObj.TextString = "X"
| Case "X"
| TextObj.TextString = "Y"
| Case "Y"
| TextObj.TextString = "Z"
| Case "Z"
| TextObj.TextString = "A"
| End Select
| End If
| TextObj.Update
| Loop
|exitsub:
|End Sub
|'--End Routine--
|
|-- Walter -- http://www.ActiveDwg.com --
|
0 Likes
Message 14 of 26

Anonymous
Not applicable
Pat,
Victim of line wrap.

The:
Update>> "

should be on the same line as:
TextObj, basePnt, "Select Text to

to read:
TextObj, basePnt, "Select Text to Update>> "

Also:
"AcDbMText" Then

should be on the same line as:
Or TextObj.ObjectName =

to read:
Or TextObj.ObjectName = "AcDbMText" Then

-- Walter -- http://www.ActiveDwg.com
0 Likes
Message 15 of 26

Anonymous
Not applicable
I was looking through here and came across this thread. I am studying VB at
school to utilize it in AutoCAD so I thought I'd give it a try. I got the same
message as you. Here's the fix:

Put your curser at the left of the red line that is out of alignment (not
indented) and backspace it until it goes up to the previous line with one space
after the last word in that line. If the red goes away you did it correctly.
VB looks at each line as a command. Because of the word wrap in the email,
part of that line was dropped down to the next line. Hope this helps. There
are alot of other cool programs on the activedwg website also.

Tim

Pat Schultz wrote:

> Walter, thanks so much for the VB lesson! BUT there is a syntax error (see
> the isolated text below beginning with |Update>>"). It shows up in red in
> VB. Can you determine the problem?
>
> Warmest regards..................................Pat
>
> Walter wrote in message ...
> |Pat,
> |It's VBA(Visual Basic for Applications).
> |To set it up: In AutoCAD hit 'ALT-F11' to enter the VBA editor. Select
> |'Insert>Module'. Copy and paste this code (between '--Begin Routine--' and
> |'--End Routine--') into the module. Switch back to AutoCAD. Hit 'ALT-F8'.
> |Highlight the line with 'ad_Add1Alpha'. Click 'Run'.
> |
> |'--Begin Routine--
> |Sub ad_Add1Alpha()
> | Dim TextObj As AcadObject
> | Dim basePnt As Variant
> | Dim objSelected As Integer
> |
> | objSelected = 1
> | Do While objSelected = 1
> | On Error GoTo exitsub
> | ThisDrawing.Utility.GetEntity TextObj, basePnt, "Select Text to
>
> |Update>> "
> | If TextObj.ObjectName = "AcDbText" Or TextObj.ObjectName =
> |"AcDbMText" Then
>
> | Select Case TextObj.TextString
> | Case "A"
> | TextObj.TextString = "B"
> | Case "B"
> | TextObj.TextString = "C"
> | Case "C"
> | TextObj.TextString = "D"
> | Case "D"
> | TextObj.TextString = "E"
> | Case "E"
> | TextObj.TextString = "F"
> | Case "F"
> | TextObj.TextString = "G"
> | Case "G"
> | TextObj.TextString = "H"
> | Case "H"
> | TextObj.TextString = "I"
> | Case "I"
> | TextObj.TextString = "J"
> | Case "J"
> | TextObj.TextString = "K"
> | Case "K"
> | TextObj.TextString = "L"
> | Case "L"
> | TextObj.TextString = "M"
> | Case "M"
> | TextObj.TextString = "N"
> | Case "N"
> | TextObj.TextString = "O"
> | Case "O"
> | TextObj.TextString = "P"
> | Case "P"
> | TextObj.TextString = "Q"
> | Case "Q"
> | TextObj.TextString = "R"
> | Case "R"
> | TextObj.TextString = "S"
> | Case "S"
> | TextObj.TextString = "T"
> | Case "T"
> | TextObj.TextString = "U"
> | Case "U"
> | TextObj.TextString = "V"
> | Case "V"
> | TextObj.TextString = "W"
> | Case "W"
> | TextObj.TextString = "X"
> | Case "X"
> | TextObj.TextString = "Y"
> | Case "Y"
> | TextObj.TextString = "Z"
> | Case "Z"
> | TextObj.TextString = "A"
> | End Select
> | End If
> | TextObj.Update
> | Loop
> |exitsub:
> |End Sub
> |'--End Routine--
> |
> |-- Walter -- http://www.ActiveDwg.com --
> |
0 Likes
Message 16 of 26

Anonymous
Not applicable
This is NEAT!! Thanks, both of you. I will look into taking a VB course.
Our company bought a suite of 100 courses at our local college, mostly
on-line. VB is one (albeit it's an advanced but I will try to get a basic
course into the lineup). I appreciate your lesson and help very much.
Thanks Walter!!

Sincerely..............................Pat!

Pat Schultz wrote in message
<866EC9FA6A9BAA5C9FBEBB37734333AC@in.WebX.maYIadrTaRb>...
|Walter, thanks so much for the VB lesson! BUT there is a syntax error (see
|the isolated text below beginning with |Update>>"). It shows up in red in
|VB. Can you determine the problem?
|
|Warmest regards..................................Pat
|
|Walter wrote in message ...
||Pat,
||It's VBA(Visual Basic for Applications).
||To set it up: In AutoCAD hit 'ALT-F11' to enter the VBA editor. Select
||'Insert>Module'. Copy and paste this code (between '--Begin Routine--' and
||'--End Routine--') into the module. Switch back to AutoCAD. Hit 'ALT-F8'.
||Highlight the line with 'ad_Add1Alpha'. Click 'Run'.
||
||'--Begin Routine--
||Sub ad_Add1Alpha()
|| Dim TextObj As AcadObject
|| Dim basePnt As Variant
|| Dim objSelected As Integer
||
|| objSelected = 1
|| Do While objSelected = 1
|| On Error GoTo exitsub
|| ThisDrawing.Utility.GetEntity TextObj, basePnt, "Select Text to
|
||Update>> "
|| If TextObj.ObjectName = "AcDbText" Or TextObj.ObjectName =
||"AcDbMText" Then
|
|| Select Case TextObj.TextString
|| Case "A"
|| TextObj.TextString = "B"
|| Case "B"
|| TextObj.TextString = "C"
|| Case "C"
|| TextObj.TextString = "D"
|| Case "D"
|| TextObj.TextString = "E"
|| Case "E"
|| TextObj.TextString = "F"
|| Case "F"
|| TextObj.TextString = "G"
|| Case "G"
|| TextObj.TextString = "H"
|| Case "H"
|| TextObj.TextString = "I"
|| Case "I"
|| TextObj.TextString = "J"
|| Case "J"
|| TextObj.TextString = "K"
|| Case "K"
|| TextObj.TextString = "L"
|| Case "L"
|| TextObj.TextString = "M"
|| Case "M"
|| TextObj.TextString = "N"
|| Case "N"
|| TextObj.TextString = "O"
|| Case "O"
|| TextObj.TextString = "P"
|| Case "P"
|| TextObj.TextString = "Q"
|| Case "Q"
|| TextObj.TextString = "R"
|| Case "R"
|| TextObj.TextString = "S"
|| Case "S"
|| TextObj.TextString = "T"
|| Case "T"
|| TextObj.TextString = "U"
|| Case "U"
|| TextObj.TextString = "V"
|| Case "V"
|| TextObj.TextString = "W"
|| Case "W"
|| TextObj.TextString = "X"
|| Case "X"
|| TextObj.TextString = "Y"
|| Case "Y"
|| TextObj.TextString = "Z"
|| Case "Z"
|| TextObj.TextString = "A"
|| End Select
|| End If
|| TextObj.Update
|| Loop
||exitsub:
||End Sub
||'--End Routine--
||
||-- Walter -- http://www.ActiveDwg.com --
||
|
0 Likes
Message 17 of 26

Anonymous
Not applicable
' Why not use something like the following
' (apologies, have not read entire thread)
'
'

' ...
' Other code
' ...
'
' Assuming you wish to maintain case ...

Dim AscCode as Integer
AscCode = Asc(TextObj.TextString)

Select Case AsciiCode
Case 97 to 121, 65 to 89
' a - y, A - Y
TextObj.TextString = Chr(AsciiCode + 1)
Case 122, 90
' z, Z
TextObj.TextString = Chr(AsciiCode - 25)
Case else
' not an alpha character, need to
' write code for this scenario
end select

' ...
' Other code
' ...

' Would certainly reduce
' the amount of code
'
' sorry I butted in
'
'

"Walter" wrote in message
news:CDFAF8DA1049F526EFAAF2E73A6A6723@in.WebX.maYIadrTaRb...
> Pat,
> Here's one way to do it. I know there's an easier way, but give this a try
> and tweak it as needed.
>
> '--Begin Routine--
> Sub ad_Add1Alpha()
> Dim TextObj As AcadObject
> Dim basePnt As Variant
> Dim objSelected As Integer
>
> objSelected = 1
> Do While objSelected = 1
> On Error GoTo exitsub
> ThisDrawing.Utility.GetEntity TextObj, basePnt, "Select Text to
> Update>> "
> If TextObj.ObjectName = "AcDbText" Or TextObj.ObjectName =
> "AcDbMText" Then
> Select Case TextObj.TextString
> Case "A"
> TextObj.TextString = "B"
> Case "B"



> Case "Z"
> TextObj.TextString = "A"
> End Select
> End If
> TextObj.Update
> Loop
> exitsub:
> End Sub
> '--End Routine--
>
> -- Walter -- http://www.ActiveDwg.com
>
0 Likes
Message 18 of 26

Anonymous
Not applicable
Your welcome.
And look at Michael's code. He shows you the 'easier way' I couldn't put my
finger on Friday...

-- Walter -- http://www.ActiveDwg.com
0 Likes
Message 19 of 26

Anonymous
Not applicable
Yep. I knew there was an easier way...
Thanks for the follow-up.

-- Walter -- http://www.ActiveDwg.com
0 Likes
Message 20 of 26

Anonymous
Not applicable
Michael, Thanks, you're not a budinski ! ! However, I cannot run your
routine. I snagged our resident VB guy to try to finish out the routine but
he doesn't know AutoCAD objects and was unable to help me. Could you please
add the prefixes and suffixes so all I have to do is cut & paste and F11 &
F8? Your help is most welcome!

Much appreciated..............................Pat

Michael Puckett wrote in message
<16716218E0562E7F8CC0A73BD4EFA83F@in.WebX.maYIadrTaRb>...
|' Why not use something like the following
|' (apologies, have not read entire thread)
|'
|'
|
| ' ...
| ' Other code
| ' ...
| '
| ' Assuming you wish to maintain case ...
|
| Dim AscCode as Integer
| AscCode = Asc(TextObj.TextString)
|
| Select Case AsciiCode
| Case 97 to 121, 65 to 89
| ' a - y, A - Y
| TextObj.TextString = Chr(AsciiCode + 1)
| Case 122, 90
| ' z, Z
| TextObj.TextString = Chr(AsciiCode - 25)
| Case else
| ' not an alpha character, need to
| ' write code for this scenario
| end select
|
| ' ...
| ' Other code
| ' ...
|
|' Would certainly reduce
|' the amount of code
|'
|' sorry I butted in
|'
|'
|
|"Walter" wrote in message
|news:CDFAF8DA1049F526EFAAF2E73A6A6723@in.WebX.maYIadrTaRb...
|> Pat,
|> Here's one way to do it. I know there's an easier way, but give this a
try
|> and tweak it as needed.
|>
|> '--Begin Routine--
|> Sub ad_Add1Alpha()
|> Dim TextObj As AcadObject
|> Dim basePnt As Variant
|> Dim objSelected As Integer
|>
|> objSelected = 1
|> Do While objSelected = 1
|> On Error GoTo exitsub
|> ThisDrawing.Utility.GetEntity TextObj, basePnt, "Select Text to
|> Update>> "
|> If TextObj.ObjectName = "AcDbText" Or TextObj.ObjectName =
|> "AcDbMText" Then
|> Select Case TextObj.TextString
|> Case "A"
|> TextObj.TextString = "B"
|> Case "B"
|
|
|
|> Case "Z"
|> TextObj.TextString = "A"
|> End Select
|> End If
|> TextObj.Update
|> Loop
|> exitsub:
|> End Sub
|> '--End Routine--
|>
|> -- Walter -- http://www.ActiveDwg.com
|>
|
0 Likes