AcCoreConsole and IntersectWith Woes

AcCoreConsole and IntersectWith Woes

larry.daubenspeck
Advocate Advocate
421 Views
3 Replies
Message 1 of 4

AcCoreConsole and IntersectWith Woes

larry.daubenspeck
Advocate
Advocate

Has anyone had any luck using:

     Entity1.IntersetWith(Entity2, Intersect.OnBothOperands, pts3d, IntPtr.Zero, IntPtr.Zero)

within the AcCoreConsole?  In my case, Entity1 is a line and Entity2 is an arc.  I know they intersect without having to extend either one, and Z-values for both entities are 0.000000.  Even within a Try-Catch phrase, it craps out with no indication as to why it failed.

Albert Szilvasy?

Larry Daubenspeck
Software Programmer
Draper, Inc.
0 Likes
422 Views
3 Replies
Replies (3)
Message 2 of 4

jwhite
Advocate
Advocate

I've seen similar results using vla-intersectwith in lisp routines. We've even copied the offending objects 100 units over and then it works. It is definitely inconsistent. I've starting using algebraic methods to determine intersections to avoid the issue. It could also be that the two entities have different z-values. The properties box uses the current drawing precision for display so a z-value of 0.001 may display as 0. To make sure, select both objects and set the z-value to zero.

0 Likes
Message 3 of 4

larry.daubenspeck
Advocate
Advocate

Thanks.  Yes, Z-values for both entities are zeroes out as far as I can take them.  Might have to resort to the algebraic method as well.  Very frustrating!

Larry Daubenspeck
Software Programmer
Draper, Inc.
0 Likes
Message 4 of 4

larry.daubenspeck
Advocate
Advocate

Finally solved this.  The two intersecting entities were first created and returned from independent functions (DrawLine and DrawArc).   Inside these "Draw" functions, I had borrowed heavily from sample code I found in the Help section.  That code does most of the actual work inside a "Using..." phrase.  The entity being returned (a Line or Arc in this case) was tested for being "Nothing."  But even though it passed the "nothing" test, they still weren't liked by the IntersectWith function for some reason.  When the "Using" phrase ends, the scope ends, things get cleaned up, disposed, or whatever.  What I found is that by replacing the "Using" phrase with a "With" phrase, the returned entity was suddenly liked by the IntersectWith function.  Problem solved.

Larry Daubenspeck
Software Programmer
Draper, Inc.
0 Likes