my code
[CommandMethod("testLineCross")] public void testLineCross() { Document doc = AcadApp.DocumentManager.MdiActiveDocument; Editor ed = doc.Editor; Database db = doc.Database; PromptEntityResult per = ed.GetEntity("Line1"); using (Transaction tr = doc.TransactionManager.StartOpenCloseTransaction()) { Line l1 = tr.GetObject(per.ObjectId, OpenMode.ForRead) as Line; per = ed.GetEntity("Line2"); Line l2 = tr.GetObject(per.ObjectId, OpenMode.ForRead) as Line; Point3dCollection ptcol = new Point3dCollection(); l1.IntersectWith(l2, Intersect.ExtendBoth,ptcol, IntPtr.Zero, IntPtr.Zero); if (ptcol.Count > 0) ed.WriteMessage("Intersect"); else ed.WriteMessage("non-intersect"); tr.Commit(); } }
My dwg see the Attachemnts.
why get the intersectPoint?
Version:AutoCAD 2012
Solved! Go to Solution.
Solved by Alexander.Rivilis. Go to Solution.
Line1
from, X=11924.7823 Y=8634.7220 Z= 0.0000
to, X=11926.0027 Y=-9044.7187 Z= 0.0000
Line2
from, X=5170.8647 Y=2737.5595 Z= 0.0000
to, X=18677.5784 Y=2737.5595 Z= 0.0000
using the code:
l1.IntersectWith(l2, Intersect.ExtendBoth,ptcol, IntPtr.Zero, IntPtr.Zero);
but the resulst show ptcol.Count==0.Why can not get the intersect point?
It easy explain:
Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"
Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
I can recommend using this method:
public void IntersectWith( Entity entityPointer, Autodesk.AutoCAD.DatabaseServices.Intersect intersectType, Plane projectionPlane, // !!!!!!!! Point3dCollection points, IntPtr thisGraphicSystemMarker, IntPtr otherGraphicSystemMarker );
Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"
Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Can't find what you're looking for? Ask the community or share your knowledge.