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

The custom line entity has overridden the subIntersectWith and extend functions, but there is a bug in the EXTEND command.

1 REPLY 1
SOLVED
Reply
Message 1 of 2
yzgeqiping
192 Views, 1 Reply

The custom line entity has overridden the subIntersectWith and extend functions, but there is a bug in the EXTEND command.

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.01.png02.png03.png04.png

1 REPLY 1
Message 2 of 2
tbrammer
in reply to: yzgeqiping

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.


Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

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

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report