AcRxObject AcGiCommonDraw AcGiViewportDraw
class AcGiViewportDraw : public AcGiCommonDraw;
acgi.h
The AcGiViewportDraw class is a container class that provides the ability to generate different geometry for different viewports. During entity regeneration, an entity's viewportDraw() method is only called if the entity's worldDraw() method returns Adesk::kFalse.
The default constructor creates new AcGiViewportGeometry, AcGiSubEntityTraits, and AcGiViewport objects, all of which are accessible via functions in the AcGiViewportDraw object.
An object of class AcGiViewportDraw is passed into the AcDbEntity::viewportDraw() function.
The AcGiViewportDraw class provides functions that return references to objects of other key AcGi classes. From AcGiViewportDraw, you can obtain objects of the following classes:
Class | Usage |
---|---|
AcGiSubEntityTraits | Setting drawing attributes (color, linetype, etc.) and selection markers. |
AcGiViewportGeometry | Drawing model coordinate geometry (arcs, polylines, etc.); getting current transforms. |
An example of an entity that should use the AcGiViewportDraw is a cylinder represented by just using two circles and two lines. The two circles could be drawn in the entity's worldDraw() method, but where the lines should be drawn depends on the viewpoint of each viewport and hence should be calculated and drawn in the entity's viewportDraw() method. Here the circles' world coordinate geometry is the same for all views but the lines will have to be generated to line up with the circles to produce the right appearance given each viewport's possibly different vantage point of the cylinder.
![]() | ![]() |
Right appearance |
Wrong appearance |
AcGiViewportGeometry, AcGiSubEntityTraits, AcGiWorldDraw, AcDbEntity::viewportDraw