| Author |
Message |
mblewis
Guest
|
Posted:
Thu Dec 16, 2004 11:08 pm Post subject:
MText entity causes loop |
|
|
the following code is based on suggestion by R. Robert Bell
to get attribute tagstrings from BlockDef:
Public Sub Stdz_Malform_Tagnames2()
' BlockDefinition objects
' this Sub selects & modifies BlockDefinition objects, _
not BlockReference objects
On Error GoTo ERR_HAND
Dim oMyBlock As AcadBlock
Set oMyBlock = ThisDrawing.Blocks.Item(myTBlock)
Dim oEnt As AcadEntity
For Each oEnt In oMyBlock
If TypeOf oEnt Is AcadAttribute Then
oEnt.TagString = "MyNewTag"
End If ' AcadAttribute
Next oEnt
Exit Sub
ERR_HAND:
Resume
End Sub
PROBLEM: when oEnt is MText entity, endless loop results when "Next oEnt" is processed; execution causes error which triggers On Error which executes Resume which returns to "Next oEnt" which......
have set Watch on oEnt and when this trap occurs, oEnt Type=AcadEntity/lAcadMText in Watches box.
any suggestions for avoiding this debilitating loop?
marklewis
|
|
| Back to top |
|
 |
fantum
Guest
|
Posted:
Thu Dec 16, 2004 11:52 pm Post subject:
Re: MText entity causes loop |
|
|
| Click on the word "Resume" in the code window and press the F1 key on your keyboard. |
|
| Back to top |
|
 |
mblewis
Guest
|
Posted:
Fri Dec 17, 2004 12:03 am Post subject:
Re: MText entity causes loop |
|
|
nice touch, fantum.
will add "Next" after Resume to break outta loop.
duh, why didn't i think of that? sometimes it takes others to correctly align the mirror for us to see the obvious.
marklewis
|
|
| Back to top |
|
 |
R. Robert Bell
Guest
|
Posted:
Fri Dec 17, 2004 9:01 pm Post subject:
Re: MText entity causes loop |
|
|
What purpose do you have the error handler in there for anyway?
<hint> Look at your function description. Ask yourself "Is it doing too
much?" </hint>
--
R. Robert Bell
"mblewis" <nospam@address.withheld> wrote in message
news:5388368.1103220524687.JavaMail.jive@jiveforum2.autodesk.com...
the following code is based on suggestion by R. Robert Bell
to get attribute tagstrings from BlockDef:
Public Sub Stdz_Malform_Tagnames2()
' BlockDefinition objects
' this Sub selects & modifies BlockDefinition objects, _
not BlockReference objects
On Error GoTo ERR_HAND
Dim oMyBlock As AcadBlock
Set oMyBlock = ThisDrawing.Blocks.Item(myTBlock)
Dim oEnt As AcadEntity
For Each oEnt In oMyBlock
If TypeOf oEnt Is AcadAttribute Then
oEnt.TagString = "MyNewTag"
End If ' AcadAttribute
Next oEnt
Exit Sub
ERR_HAND:
Resume
End Sub
PROBLEM: when oEnt is MText entity, endless loop results when "Next oEnt" is
processed; execution causes error which triggers On Error which executes
Resume which returns to "Next oEnt" which......
have set Watch on oEnt and when this trap occurs, oEnt
Type=AcadEntity/lAcadMText in Watches box.
any suggestions for avoiding this debilitating loop?
marklewis |
|
| Back to top |
|
 |
mblewis
Guest
|
Posted:
Mon Jan 03, 2005 6:14 pm Post subject:
Re: MText entity causes loop |
|
|
back from vacating....
purpose for ErrorHandler?
during code trials, to catch any anomalies i didn't thinkof. usually eliminate after code proven.
in this specific case, it helped me to see endless loop caused by this Sub. |
|
| Back to top |
|
 |
|
|
|
|