by Fenton Webb
It is possible to create your own custom WorldDraw and ViewportDraw classes (in ObjectARX they are called AcGiWorldDraw and AcgiViewprtDraw). By doing this, you can essentially override the low level draw routines that AutoCAD uses and replace them with your own functions which can be used to work out the primitive geometrical object data that is being drawn.
A good example of how this works can be found in the ObjectARX sample called acgisamp.
If you are wondering how AcDb3dSolids (Solid3d in .NET) draw themselves, and which primitive draw functions inside of your custom AcGiWorldDraw are called and when, here’s the answer:
- AcDb3dSolid::WorldDraw() is called, the solid geometry history worldDraw is called (internal AcDbShHistory::worldDraw()).
- From the internal AcDbShHistory::worldDraw() each node in the solid 3d history is obtained and the primative objects are called one by one via their worldDraw() (internal AcDbShPrimitive::WorldDraw())
- From the internal AcDbShPrimitive::WorldDraw() the body of the primitive is drawn by drawing each graphics representation in turn... The order is:
For a regen type of kAcGiHideOrShadeCommand or kAcGiShadedDisplay
1) Draws the face edges depending on the edge type, Line or Tessellated yields a geometry.polyline(), Circle or Arc yields a geometry.circle() or geometry.circularArc()
2) Draws the wire edges depending on the edge type as in (1)
3) Draws the body points using geometry.polypoint()
For a regen type of kAcGiStandardDisplay, kAcGiSaveWorldDrawForR12 or kAcGiSaveWorldDrawForProxy
1) Draws the face edges depending on the edge type, Line or Tessellated yields a geometry.polyline(), Circle or Arc yields a geometry.circle() or geometry.circularArc()
2) Draws the wire edges depending on the edge type as in (1)
3) If SPLFRAME=1 then the spline and spline-fit polylines are drawn using geometry.polyline()
4) Draw the iso line edges, if necessary , depending on the edge type as in (1)
5) Draws the body points using geometry.polypoint()