All the methods in this section draw graphics in the Creo Parametric current window and use the color and linestyle set by calls to pfcBaseSession.SetStdColorFromRGB() and pfcBaseSession.SetLineStyle(). The methods draw the graphics in the Creo Parametric graphics color. The default graphics color is white.
The methods in this section are called using the classpfcDisplay. This class is extended by the pfcBaseSession class. This architecture allows you to call all these methods on any pfcSession object.
Methods Introduced:
|
|
pfcDisplay.SetPenPosition() |
|
|
pfcDisplay.DrawPolyline() |
|
|
pfcDisplay.DrawPolygon2D() |
The method pfcDisplay.SetPenPosition() sets the point at which you want to start drawing a line. The function pfcDisplay.DrawLine() draws a line to the given point from the position given in the last call to either of the two functions. Call pfcDisplay.DrawPolyline() for the start of the polyline, and pfcDisplay.DrawLine() for each vertex. If you use these methods in two-dimensional modes, use screen coordinates instead of solid coordinates.
The method pfcDisplay.DrawCircle() uses solid coordinates for the center of the circle and the radius value. The circle will be placed to the XY plane of the
model.
The method pfcDisplay.DrawPolyline() also draws polylines, using an array to define the polyline.
In two-dimensional models the Display Graphics methods draw graphics at the specified screen coordinates.
The method pfcDisplay.DrawArc2D() draws a polygon in screen coordinates. The method pfcDisplay.DrawArc2D() draws an arc in screen coordinates.
Displaying Text in the Graphics Window
Method Introduced:
The method pfcDisplay.DrawText2D() places text at a position specified in screen coordinates. If you want to add text to a particular position on the solid,
you must transform the solid coordinates into screen coordinates by using the view matrix.
Creo Parametric and therefore are not redrawn when you select View, Repaint. To notify theCreo Parametric of these objects, create them inside the OnDisplay() method of the Display Listener.
Controlling Text Attributes
Properties Introduced:
These properties control the attributes of text added by calls to pfcDisplay.DrawText2D().
You can access the following information:
|
• |
Text height (in screen coordinates) |
|
• |
Width ratio of each character, including the gap, as a proportion of the height |
|
• |
Rotation angle of the whole text, in counterclockwise degrees |
|
• |
Slant angle of the text, in clockwise degrees |
Controlling Text Fonts
Methods and Properties Introduced:
|
|
pfcDisplay.GetFontByName() |
The property pfcDisplay.DefaultFont returns the default Creo Parametric text font. The text fonts are identified in Creo Parametric by names and by integer identifiers. To find a specific font, use the methods pfcDisplay.GetFontById() or pfcDisplay.GetFontByName().