How AcDb3dSolids are drawn when using a custom derived AcGiWorldDraw

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:

  1. AcDb3dSolid::WorldDraw() is called, the solid geometry history worldDraw is called (internal AcDbShHistory::worldDraw()).
  2. 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())
  3. 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()


Comments

2 responses to “How AcDb3dSolids are drawn when using a custom derived AcGiWorldDraw”

  1. Audun Opdal Avatar
    Audun Opdal

    Thank you for posting this.
    I can’t find the acgisamp project in the ObjectARX 2014 download. Where do I find it?

  2. I see the shell example in ObjectARX SDK. We have to create the list of vertices and faces and send it to the shell api.
    As in block we can add comple solid using boolean operations, isn’t there any easy way to create complex 3D custom entity using boolean operation where we simple add 3D solid primitives and do boolean on them ?
    Is there any sample on similar path ?

Leave a Reply to Audun OpdalCancel reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading