User's Guide > Drawings > Draft Entity Data
Draft Entity Data
Functions Introduced:
ProDtlentitydataAlloc()
ProDtlentitydataFree()
ProDtlentitydataIdGet()
ProDtlentitydataCurveGet()
ProDtlentitydataCurveSet()
ProDtlentitydataColorGet()
ProDtlentitydataColorSet()
ProDtlentitydataFontGet()
ProDtlentitydataFontSet()
ProDtlentitydataWidthGet()
ProDtlentitydataWidthSet()
ProDtlentitydataViewGet()
ProDtlentitydataViewSet()
ProDtlentitydataIsConstruction()
ProDtlentitydataConstructionSet()
ProDtlentitydataIsPeriodic()
ProDtlentitydataPeriodicSet()
ProDrawingDraftToDraftent()
The opaque data structure which describes the contents of a draft entity is called ProDtlentitydata.
The only lower-level opaque data structure contained by ProEntitydata is ProCurvedata which is also used for other 2D and 3D geometry, especially Import Features, and is described elsewhere.
The functions ProDtlentitydataAlloc() and ProDtlentitydataFree() allocate and free an opaque entity data structure.
Functions ProDtlentitydataCurveGet() and ProDtlentitydataCurveSet() get and set the geometry of the entity in the form of a ProCurvdata object.
ProDtlentitydataColorGet() and ProDtlentitydataColorSet() get and set the color of the draft entity. The visible data structure ProColor, declared in ProDtlitem.h, can specify the color in three ways:
By color index, that is, by choosing one of colors predefined in , represented by the values of ProColortype in ProToolkit.h.
By choosing the default color for this type of detail item. (For entities, the default is PRO_COLOR_DRAWING and for notes the default is PRO_COLOR_LETTER.)
By specifying the three RGB color values.
If do you do not call ProDtlentitydataColorSet() when creating a new entity, the color will be set to be the default color for draft entities.
ProDtlentitydataFontGet() and ProDtlentitydataFontSet() get and set the line style font which determines the line style used to display the entity. The values are those which appear in the Line Font selector in the Modify Line Style dialog in . If you do not call ProDtlentitydataFontSet() when creating an entity, the font will be SOLIDFONT.
ProDtlentitydataWidthGet() and ProDtlentitydataWidthSet() get and set the line width of the draft entity. The value -1.0 indicates that the entity should have the default width for entities currently set for the drawing. If you do not call ProDtlentitydataWidthSet() when creating a new entity, the width is -1.0.
ProDtlentitydataViewGet() and ProDtlentitydataViewSet() get and set the drawing view to which the entity will be attached. If an entity is attached to a view, it moves whenever the user moves that view. Entities not attached to a model view must be assigned to the drawing sheet background view instead.
ProDtlentitydataIsConstruction() and ProDtlentitydataConstructionSet() get and set the flag that controls whether the entity is created normal or as a construction entity.
The function ProDtlentitydataIsPeriodic() checks if the draft identity is marked as periodic. The output argument is_periodic is a Boolean. The value PRO_B_TRUE indicates that the draft entity is periodic.
The function ProDtlentitydataPeriodicSet() marks the draft entity to be periodic. The input arguments are as follows:
data—The draft entity data.
periodic—Specify the value PRO_B_TRUE if the draft entity is to be periodic.
Use the function ProDrawingDraftToDraftent() to convert a selection of type draft to draft entity in the specified drawing. The input arguments follow:
p_draw—Specifies the drawing that owns the draft entity.
p_sel_draft—A ProSelection object that represents the selection of type as draft.
The output argument r_p_sel_draft_ent returns the handle to the converted selection using the ProSelection object. The converted selection is managed by the function that calls the function ProDrawingDraftToDraftent().
Example 9: Create a Draft Line with Predefined Color
The sample code in the file UgDtlentityExamples.c located at <creo_toolkit_loadpoint>/protk_appls/pt_userguide/ptu_drawing shows a utility that creates a draft line in one of the colors predefined in .
這是否有幫助?