I have a custom entity named GcDbPipede that inherits from AcDbCurve, primarily to implement the functionality of a line. In order to respond to the EXTEND command, I have overridden functions such as subIntersectWith and extend. When I use the EXTEND command on this object, there are no issues when extending it to intersect with AcDbLine, or when it intersects and extends with AcDbLine and AcDbPolyline for the first time. However, there is a bug when it comes to intersecting and extending with the other side. I can't figure out the reason. I have attached my code, and I hope someone kind-hearted can help me.
Solved! Go to Solution.
Solved by tbrammer. Go to Solution.
Why did you derive your custom entity GcDbPipe from AcDbCurve and not directly from AcDbLine?
Since its only data mebembers are startpoint and endpoint it is just a line.
So, GcDbPipe::subIntersectWith(..) works probably best like this:
Acad::ErrorStatus GcDbPipe::subIntersectWith(
const AcDbEntity* ent, AcDb::Intersect intType, AcGePoint3dArray& points,
Adesk::GsMarker thisGsMarker, Adesk::GsMarker otherGsMarker) const
{
assertReadEnabled();
AcDbLine* pPipeLine = new AcDbLine(); // replaces 'this'
pPipeLine->setStartPoint(m_start);
pPipeLine->setEndPoint(m_end);
pPipeLine->setNormal(this->normal());
// Note that I swapped pPipeLine <==> ent and kept intType.
Acad::ErrorStatus es = pPipeLine->intersectWith(ent, intType, points, thisGsMarker, otherGsMarker);
delete pPipeLine;
return es;
}
I didn't dive very deep into your code. Does it serve a special purpose or is it just to experiment with custom entities and the way how AutoCAD calls methods during commands like EXTEND?
It is often preferable to use overrules instead of custom entities. Your drawing remains usable with plain AutoCAD even without your ObjectEnabler.
Can't find what you're looking for? Ask the community or share your knowledge.