increase by one or two

increase by one or two

Anonymous
Not applicable
541 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
542 Views
25 Replies
Replies (25)
Message 21 of 26

Anonymous
Not applicable
Dumb last minute changes before I posted it - I had renamed the variable
AsciiCode to AscCode, but not everywhere. As I merely penned it and never ran it
I didn't catch the dumb error. There may still be dumb errors because I still
haven't run it.

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

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

"Pat Schultz" wrote in message
news:12EE787D359EA75DA349AC27A1A2BB15@in.WebX.maYIadrTaRb...
> 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
Message 22 of 26

Anonymous
Not applicable
Well then, mine did have at least one advantage...

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

Anonymous
Not applicable
Like, it actually worked? 🙂

"Walter" wrote in message
news:f03bcc6.20@WebX.maYIadrTaRb...
> Well then, mine did have at least one advantage...
>
> -- Walter -- http://www.ActiveDwg.com
>
0 Likes
Message 24 of 26

Anonymous
Not applicable
Sorry, Still won't run. . Could you please add the prefixes and suffixes
(i.e. Sub...etc... and End Sub, etc... Loop, etc.. so all I have to do is
cut & paste and F11 & F8? I am not a VB guy but want to start learning.

Thanks so much! (If I can't get this one running I'll use Walter's. It
does work. I don't care how long the code is but I want to see the
difference between the 2 routines.).......................Pat

Michael Puckett wrote in message
<57CD777F7D14C161D2ACDCF6D0165971@in.WebX.maYIadrTaRb>...
|Dumb last minute changes before I posted it - I had renamed the variable
|AsciiCode to AscCode, but not everywhere. As I merely penned it and never
ran it
|I didn't catch the dumb error. There may still be dumb errors because I
still
|haven't run it.
|
| Dim AscCode as Integer
| AscCode = Asc(TextObj.TextString)
|
| Select Case AscCode
| Case 97 to 121, 65 to 89
| ' a - y, A - Y
| TextObj.TextString = Chr(AscCode + 1)
| Case 122, 90
| ' z, Z
| TextObj.TextString = Chr(AscCode - 25)
| Case else
| ' not an alpha character, need to
| ' write code for this scenario
| end select
|
|"Pat Schultz" wrote in message
|news:12EE787D359EA75DA349AC27A1A2BB15@in.WebX.maYIadrTaRb...
|> 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
Message 25 of 26

Anonymous
Not applicable
Here's Michael's updated code that works. Again, watch the line wrap:

Sub Add1Alpha()
Dim AscCode As Integer
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
AscCode = Asc(TextObj.TextString)
Select Case AscCode
Case 97 To 121, 65 To 89
' a - y, A - Y
TextObj.TextString = Chr(AscCode + 1)
Case 122, 90
' z, Z
TextObj.TextString = Chr(AscCode - 25)
Case Else
' not an alpha character, need to
' write code for this scenario
End Select
End If
Loop
exitsub:
End Sub

-- Walter -- http://www.ActiveDwg.com --

Pat Schultz wrote in message
news:795D308F4EC486C8D95ABFEDA287C9F2@in.WebX.maYIadrTaRb...
> Sorry, Still won't run. . Could you please add the prefixes and suffixes
> (i.e. Sub...etc... and End Sub, etc... Loop, etc.. so all I have to do is
> cut & paste and F11 & F8? I am not a VB guy but want to start learning.
>
> Thanks so much! (If I can't get this one running I'll use Walter's. It
> does work. I don't care how long the code is but I want to see the
> difference between the 2 routines.).......................Pat
>
> Michael Puckett wrote in message
> <57CD777F7D14C161D2ACDCF6D0165971@in.WebX.maYIadrTaRb>...
> |Dumb last minute changes before I posted it - I had renamed the variable
> |AsciiCode to AscCode, but not everywhere. As I merely penned it and never
> ran it
> |I didn't catch the dumb error. There may still be dumb errors because I
> still
> |haven't run it.
> |
> | Dim AscCode as Integer
> | AscCode = Asc(TextObj.TextString)
> |
> | Select Case AscCode
> | Case 97 to 121, 65 to 89
> | ' a - y, A - Y
> | TextObj.TextString = Chr(AscCode + 1)
> | Case 122, 90
> | ' z, Z
> | TextObj.TextString = Chr(AscCode - 25)
> | Case else
> | ' not an alpha character, need to
> | ' write code for this scenario
> | end select
> |
> |"Pat Schultz" wrote in message
> |news:12EE787D359EA75DA349AC27A1A2BB15@in.WebX.maYIadrTaRb...
> |> 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
Message 26 of 26

Anonymous
Not applicable
Thanks Walter.

"Walter" wrote in message
news:37C1A705F74CDB968A834482909A5497@in.WebX.maYIadrTaRb...
> Here's Michael's updated code that works. Again, watch the line wrap:
>
> Sub Add1Alpha()
> Dim AscCode As Integer
> 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
> AscCode = Asc(TextObj.TextString)
> Select Case AscCode
> Case 97 To 121, 65 To 89
> ' a - y, A - Y
> TextObj.TextString = Chr(AscCode + 1)
> Case 122, 90
> ' z, Z
> TextObj.TextString = Chr(AscCode - 25)
> Case Else
> ' not an alpha character, need to
> ' write code for this scenario
> End Select
> End If
> Loop
> exitsub:
> End Sub
>
> -- Walter -- http://www.ActiveDwg.com --
0 Likes