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

AcDbEntity and AcGeCircArc2d intersection

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
karl.sch1983
560 Views, 4 Replies

AcDbEntity and AcGeCircArc2d intersection

Hello friends, as the subject suggests I am having trouble getting intersection points. I have a AcDbEntity which is input by the use through acedEntSel. Then I instantiate a AcGeCircArc2d and set the center and radius on this object. How do I invoke intersection between these 2 objects. The intersectwith method when invoked on AcDbEntity needs another AcDbEntity and similarly AcGeCircArc2d needs another AcGeCircArc2d. I am guessing that a cast is needed somewhere but I am unable to get the right syntax. Googling has not helped. Kindly advise. Thanks a lot in advance.

AcGeCircArc2d geCir;
geCir.setCenter(geCtr);
geCir.setRadius(r);

geCir2.intersectWith(//this needs a AcGeCircArc2d
ent.intersectWith(//Similarly this needs a AcDbEntity. In my case the AcDbEntity is a line entity
4 REPLIES 4
Message 2 of 5

So you have check intersection between AcDbCircle and AcDbLine or AcGeCircArc2d and AcGeLineSeg2d (or AcGeCircArc3d and AcGeLineSeg3d)

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | 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
Expert Elite Member

Message 3 of 5

My goal is to find a point on the given line (line already exists in the database as the user selects it in AutoCAD). I do not want to create another arc or circle entity as I don't need it. I simply need the intersection point of the existing line and a theoretical arc (this is not the final arc and it is merely a construction arc to determine the result intersection point). Therefore, I did not construct a new arc and simply created a AcGeCircArc2d. As I understand one should use these entities for all the geometric calculations. Are you saying that I should create an AcDbArc and then intersect that with the AcDbEntity, get my resulting intersection point and then delete the AcDbArc which was used in determining the intersection? Something like this

 

 

AcDbArc* tmpArc;
tmpArc->center(ctr);
tmpArc->radius(r);
ent->intersectWith(tmpArc, Intersect::kOnBothOperands, intPts);
// do necessary calculations and then delete tmpArc

 

I am trying to avoid creating the AcDbArc and simply use a AcGeCircArc2D for my calculation, so I do not have to unnecessarily create an AcDbArc and then delete it later. I might as well not create it. Is this not possible?

 

 

Message 4 of 5


@karl.sch1983 wrote:

 

I am trying to avoid creating the AcDbArc and simply use a AcGeCircArc2D for my calculation, so I do not have to unnecessarily create an AcDbArc and then delete it later. I might as well not create it. Is this not possible?

 

 


So you can create AcGeLineSeg3d from AcDbLine. Method getAcGeCurve can help you.

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | 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
Expert Elite Member

Message 5 of 5

Thanks for pointing out that method. For some reason it still gives me an error. See below

 

int intPt;
AcGePoint2d pt1, pt2;
AcGeCircArc2d geCir;
geCir.setCenter(geCtr);
geCir.setRadius(r);

AcDbLine* tmpLine = nullptr;
ent->cast(tmpLine);

AcGeCurve3d* pGeCurve;
tmpLine->getAcGeCurve(pGeCurve);

geCir.intersectWith(pGeCurve, intPt, pt1, pt2);//this statement has squiggly line and the error points out that pGeCurveis an AcGeCurve3d and it needs AcGeCircArc2D.

So how do I get AcGeCircArc2D from AcGeCurve3d?

 

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

Post to forums  

Autodesk Design & Make Report

”Boost