.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

what's the trick to intersectwith ?

5 REPLIES 5
Reply
Message 1 of 6
mpropst
796 Views, 5 Replies

what's the trick to intersectwith ?

i see references to

Autodesk.AutoCAD.Geometry

 

in other posts but when i try to Import that, no .Geometry namespace is attached to acad

acad2009 vbexpress2008

i was going to try to use that to create point2d or point3d thinking that might be easier than array() as Double.


as far as intersect code:

 

i tried

 

Dim NewPoint(2) As Double

NewPoint = CType(oArc3.IntersectWith(oEnd3, AcExtendOption.acExtendBoth), Double())

 

 

where oArc3 is an arc and oEnd3 is a line which would intersect if they were extended

i'm trying to find the intersection point so i can extend them programaticlly just like if i were to fillet manually

i'm getting what appears to be an empty array as a return.

but i should be getting a valid pointlist

what am i doing wrong?

thanks

mark

 

5 REPLIES 5
Message 2 of 6
mpropst
in reply to: mpropst

this seems strange to me

the returned object from intersect with is a 6 element array!?!?!

 

here's the results of my 'logentry' calls

Get new point intersection arc and line
newcorner Is NOT Nothing
Try to cast to double array
vartype
8197
Ubound
5
NewPoint x
NewPoint y
NewPoint z

 

the code producing the above report is as follows;

Try

      newcorner = oArc3.IntersectWith(oEnd3, AcExtendOption.acExtendBoth)
      If newcorner Is Nothing Then
        m_Util.Logentry("newcorner Is Nothing")
      Else
        m_Util.Logentry("newcorner Is NOT Nothing")
      End If

      m_Util.Logentry("Try to cast to double array")
      NewPoint = CType(newcorner, Double())

      If VarType(NewPoint) <> VariantType.Empty Then
        m_Util.Logentry("vartype")
        m_Util.Logentry(VarType(NewPoint).ToString)

        ' m_Util.Logentry("Ubound ", CStr(UBound(NewPoint)))
        m_Util.Logentry("Ubound ")
        m_Util.Logentry(CStr(UBound(NewPoint)))


        m_Util.Logentry("NewPoint x", CStr(NewPoint(0)))
        m_Util.Logentry("NewPoint y", CStr(NewPoint(1)))
        m_Util.Logentry("NewPoint z", CStr(NewPoint(2)))

      Else
        m_Util.Logentry("empty array returned")

      End If
    Catch ex As Exception

    End Try

 

i'll have to look up that 8197 again, should be array of double I'd think

Message 3 of 6
chiefbraincloud
in reply to: mpropst

I can't say with certainty why your array appears to be empty, but the 6 element array is because you are extending both and therefore there are two intersections.

 

The Geometry Namespace is in acdbMgd.dll

 

It appears you are using the COM API and probably don't have that file referenced.

Dave O.                                                                  Sig-Logos32.png
Message 4 of 6
mpropst
in reply to: chiefbraincloud

ah! I see why the array has 6 elements.

still trying to figure why i'm not getting values in the elements

variable typing with strict on is interesting - having to convert all over the place

i'm assuming it a cast problem or variable type prob, but not seeing it.

would the geom.point type objects be easier in general than arrays of doubles when working with the com model?

thanks

mark

 

Message 5 of 6
adadnet
in reply to: mpropst

hi mark

 

1. try use the .intersectwith(..., tolearance) method;

2. try use projectedintersectwith(..., tolearance) method.

 

the tolerance should help address empty returns due to extreme precision of calculating coords in space, the projected... method might be better suited for your stated task.

 

felix

Message 6 of 6
michael.robertson
in reply to: adadnet

Something else to watch for with IntersectWith methods, when used with "Large" coordinate systems (like state plane systems) you may get erratic results (I get intersections where none exist). This bug is known by Autodesk, I ran into this problem using Civil3D and the solution was I had to transpose the entities I wanted to check so that they were near the origin, check for an intersection, then transpose the intersection points back to the correct place in the coordinate system.

 

Autodesk couldn't really define how "Large" (their term) a coordinate had to be to exhibit this behavior so I perform the transpose routine to all intersection checks.

Mike Robertson
FL. Dept. of Transportation
CADD Applications Developer

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost