<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Trapping Invalid Input error in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/trapping-invalid-input-error/m-p/314134#M58667</link>
    <description>Thanks Mark,&lt;BR /&gt;
&lt;BR /&gt;
This will keep the program from crashing which was one of my objectives.  It's hard for me to tell yet but I don't think the AddRegion method is returning any regions. I'm having to wait for one of my users to submitt a drawing that generates an Invalid input condition because I can't seem to generate the condition on purpose for testing.&lt;BR /&gt;
&lt;BR /&gt;
When creating regions within AutoCAD, the invalid loops are rejected but all the good one are created. So far it looks like when my app tries to use the AddRegion method when an Invalid input condition exists, the loops that are good are still not returned.  With the large number of potential loops being generated, It would slow down the app substancially if I were to try and loop through all the entities submitted to the AddRegion method to try and issolate the bad loop.&lt;BR /&gt;
&lt;BR /&gt;
Any ideas on how to get the AddRegion method to return the loops that are good when the Invalid input condition exists?</description>
    <pubDate>Tue, 16 Dec 2003 17:39:04 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2003-12-16T17:39:04Z</dc:date>
    <item>
      <title>Trapping Invalid Input error</title>
      <link>https://forums.autodesk.com/t5/vba-forum/trapping-invalid-input-error/m-p/314132#M58665</link>
      <description>I have been working on a VB6 app for AutoCAD 2002 that takes lines which cross an area both horizontally and vertically much like grid, and then breaks the lines at the intersections and forms regions from the lines.  Occasionally the AddRegion method will generate an Invalid Input error and cause the program to halt.  If I take the same set of lines that generates the Invalid Input error and manually build regions from these line entities in AutoCAD then most of the regions are created and the command line shows that X number of regions were rejected.&lt;BR /&gt;
&lt;BR /&gt;
My question is, how can I trap the Invalid Input error and keep the app from crashing, create most of the regions, and possibly provide a message box that alerts the user that X number of regions were not created.&lt;BR /&gt;
&lt;BR /&gt;
The statement that generates the Invalid Input error is:&lt;BR /&gt;
&lt;BR /&gt;
reglist = ModSpace.AddRegion(regTemp1)&lt;BR /&gt;
&lt;BR /&gt;
with regTemp1 containing anywhere from a few up to thousands of line entities.</description>
      <pubDate>Mon, 08 Dec 2003 10:16:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/trapping-invalid-input-error/m-p/314132#M58665</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-12-08T10:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: Trapping Invalid Input error</title>
      <link>https://forums.autodesk.com/t5/vba-forum/trapping-invalid-input-error/m-p/314133#M58666</link>
      <description>generally&lt;BR /&gt;
On error resume next&lt;BR /&gt;
reglist = ModSpace.AddRegion(regTemp1)&lt;BR /&gt;
If err then&lt;BR /&gt;
    err.clear&lt;BR /&gt;
    ...do whatever in case of error&lt;BR /&gt;
    Debug.print regTemp1 &amp;amp; " created error"&lt;BR /&gt;
    ...maybe&lt;BR /&gt;
    collectionOfErrorConditions.Add regTemp1&lt;BR /&gt;
    ... or whatever&lt;BR /&gt;
    Else&lt;BR /&gt;
    ...do in case no err&lt;BR /&gt;
end if&lt;BR /&gt;
&lt;BR /&gt;
Debug.print "There were " &amp;amp; collectionOfErrorConditions.Count &amp;amp; " errors"&lt;BR /&gt;
Debug.print "The data causing errors was: "&lt;BR /&gt;
for i = 1 to collectionOfErrorConditions.Count&lt;BR /&gt;
    Debug.Print collectionOfErrorConditions.Item(i)&lt;BR /&gt;
next&lt;BR /&gt;
&lt;BR /&gt;
etc....&lt;BR /&gt;
&lt;BR /&gt;
just an idea&lt;BR /&gt;
&lt;BR /&gt;
"SBLoe" &lt;BRUCE.LOE&gt; wrote in message&lt;BR /&gt;
news:f1a455d.-1@WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; I have been working on a VB6 app for AutoCAD 2002 that takes lines which&lt;BR /&gt;
cross an area both horizontally and vertically much like grid, and then&lt;BR /&gt;
breaks the lines at the intersections and forms regions from the lines.&lt;BR /&gt;
Occasionally the AddRegion method will generate an Invalid Input error and&lt;BR /&gt;
cause the program to halt. If I take the same set of lines that generates&lt;BR /&gt;
the Invalid Input error and manually build regions from these line entities&lt;BR /&gt;
in AutoCAD then most of the regions are created and the command line shows&lt;BR /&gt;
that X number of regions were rejected.&lt;BR /&gt;
&amp;gt; My question is, how can I trap the Invalid Input error and keep the app&lt;BR /&gt;
from crashing, create most of the regions, and possibly provide a message&lt;BR /&gt;
box that alerts the user that X number of regions were not created.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; The statement that generates the Invalid Input error is:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; reglist = ModSpace.AddRegion(regTemp1)&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; with regTemp1 containing anywhere from a few up to thousands of line&lt;BR /&gt;
entities.&lt;BR /&gt;
&amp;gt;&lt;/BRUCE.LOE&gt;</description>
      <pubDate>Mon, 08 Dec 2003 14:47:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/trapping-invalid-input-error/m-p/314133#M58666</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-12-08T14:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: Trapping Invalid Input error</title>
      <link>https://forums.autodesk.com/t5/vba-forum/trapping-invalid-input-error/m-p/314134#M58667</link>
      <description>Thanks Mark,&lt;BR /&gt;
&lt;BR /&gt;
This will keep the program from crashing which was one of my objectives.  It's hard for me to tell yet but I don't think the AddRegion method is returning any regions. I'm having to wait for one of my users to submitt a drawing that generates an Invalid input condition because I can't seem to generate the condition on purpose for testing.&lt;BR /&gt;
&lt;BR /&gt;
When creating regions within AutoCAD, the invalid loops are rejected but all the good one are created. So far it looks like when my app tries to use the AddRegion method when an Invalid input condition exists, the loops that are good are still not returned.  With the large number of potential loops being generated, It would slow down the app substancially if I were to try and loop through all the entities submitted to the AddRegion method to try and issolate the bad loop.&lt;BR /&gt;
&lt;BR /&gt;
Any ideas on how to get the AddRegion method to return the loops that are good when the Invalid input condition exists?</description>
      <pubDate>Tue, 16 Dec 2003 17:39:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/trapping-invalid-input-error/m-p/314134#M58667</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-12-16T17:39:04Z</dc:date>
    </item>
  </channel>
</rss>

