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

IntersectWith issue (possible bug)

6 REPLIES 6
Reply
Message 1 of 7
ahmed.felix
538 Views, 6 Replies

IntersectWith issue (possible bug)

IntersectWith() is only working with the first segment of a polyline. Anybody knows why is this?

Reproducing the problem: draw a circle, then draw a polyline over it (both of them manually in AutoCAD) and get the intersections (programatically). If it's a multiple segment polyline it will only return the intersections where the circle crossed the first segment regardles of how many intersections with the polyline really exist.
6 REPLIES 6
Message 2 of 7
Anonymous
in reply to: ahmed.felix

It works for me using 07. What version are you using - post your code.

wrote in message news:5483877@discussion.autodesk.com...
IntersectWith() is only working with the first segment of a polyline.
Anybody knows why is this?

Reproducing the problem: draw a circle, then draw a polyline over it (both
of them manually in AutoCAD) and get the intersections (programatically). If
it's a multiple segment polyline it will only return the intersections where
the circle crossed the first segment regardles of how many intersections
with the polyline really exist.
Message 3 of 7
ahmed.felix
in reply to: ahmed.felix

Dim objDrawingSpace As New DrawingSpace.DrawingSpace
Dim entObject1 As Entity
Dim entObject2 As Entity
Dim acadDB As Database = HostApplicationServices.WorkingDatabase
Dim acadTrans As Transaction = acadDB.TransactionManager.StartTransaction

entObject1 = objDrawingSpace.GetEntity("Select Object 1", acadTrans)
entObject2 = objDrawingSpace.GetEntity("Select Object 2", acadTrans)

Dim colIntersection As New Point3dCollection

entObject1.IntersectWith(entObject2 , Intersect.OnBothOperands, colIntersection, 1, 1)

MsgBox(colIntersection.Count)

objDrawingSpace.GetEntity is a function that just prompts a message to the command line and returns the object selected by the user. I've tried different scenarios, like a drawing a line and then drawing a polyline zigzagging over it, still returns only 1 intersection even though there were really 10. I'm using Autocad 2006 and Visual Studio 2005
Message 4 of 7
Anonymous
in reply to: ahmed.felix

Use 0, 0 instead of 1, 1 for your graphics markers. 0 is the default - none
used.
wrote in message news:5490211@discussion.autodesk.com...
Dim objDrawingSpace As New DrawingSpace.DrawingSpace
Dim entObject1 As Entity
Dim entObject2 As Entity
Dim acadDB As Database = HostApplicationServices.WorkingDatabase
Dim acadTrans As Transaction =
acadDB.TransactionManager.StartTransaction

entObject1 = objDrawingSpace.GetEntity("Select Object 1", acadTrans)
entObject2 = objDrawingSpace.GetEntity("Select Object 2", acadTrans)

Dim colIntersection As New Point3dCollection

entObject1.IntersectWith(entObject2 , Intersect.OnBothOperands,
colIntersection, 1, 1)

MsgBox(colIntersection.Count)

objDrawingSpace.GetEntity is a function that just prompts a message to the
command line and returns the object selected by the user. I've tried
different scenarios, like a drawing a line and then drawing a polyline
zigzagging over it, still returns only 1 intersection even though there were
really 10. I'm using Autocad 2006 and Visual Studio 2005
Message 5 of 7
ahmed.felix
in reply to: ahmed.felix

Thanks! It works now. The problem was exactly that, I didn't know what the graphics markers meant or were for, and since everything else seemed to be working fine I assumed 1,1 was ok.
Message 6 of 7
pellacad
in reply to: ahmed.felix

Paul and Ahmed,

Why would this line of code...

Dim colIntersection As New Autodesk.AutoCAD.Geometry.Point3dCollection

...generate this error...

"The specified module could not be found."

I am supremely stuck.
Message 7 of 7
pellacad
in reply to: ahmed.felix

Why would this code not be recognized in my program (when I try to copy and use the above sub.)

"Dim objDrawingSpace As New DrawingSpace.DrawingSpace"

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