Surface Properties
You can enhance your model using Creo TOOLKIT functions that change the surface properties, or set different light sources. The following sections describe these functions in detail.
Functions Introduced:
From Creo Parametric5.0.0.0 onwards, the following functions have been deprecated:
ProSurfaceAppearancepropsGet()
ProSurfaceAppearancepropsSet()
ProSurfaceTextureplacementpropsGet()
ProSurfaceTextureplacementpropsSet()
ProSurfaceTexturepropsGet()
ProSurfaceTexturepropsSet()
The functions described in this section enable you to retrieve and set the surface and texture properties for the first level models in the model hierarchy.
Use the functions ProSurfaceSideAppearancepropsGet() and ProSurfaceSideAppearancepropsSet() to retrieve and set the surface properties on a specified side of the surface for the specified element using the ProSurfaceAppearanceProps data structure.
The data structure is defined as follows:
typedef struct pro_surf_appearance_props
{
double ambient;
double diffuse;
double highlite;
double shininess;
double transparency;
ProVector color_rgb;
ProVector highlight_color;
double reflection;
ProPath name;
ProPath label;
ProPath description;
ProPath keywords;
} ProSurfaceAppearanceProps;
The ProSurfaceAppearanceProps data structure contains the following fields:
ambient—Specifies the indirect, scattered light the model receives from its surroundings. The valid range is 0.0 to 1.0.
diffuse—Specifies the reflected light that comes from directional, point, or spot lights. The valid range is 0.0 to 1.0.
highlite—Specifies the intensity of the light reflected from a highlighted surface area. The valid range is 0.0 to 1.0.
shininess—Specifies the properties of a highlighted surface area. A plastic model would have a lower shininess value, while a metallic model would have a higher value. The valid range is 0.0. to 1.0.
transparency—Specifies the transparency value, which is between 0 (completely opaque) and 1.0 (completely transparent).
color_rgb[3]—Specifies the color, in terms of red, green, and blue. The valid range is 0.0. to 1.0.
highlight_color—Specifies the highlight color, in terms of red, green, and blue. The valid range is 0.0 to 1.0.
reflection—Specifies how reflective the surface is. The valid range is 0 (dull) to 100 (shiny).
keywords—Mandatory field. Specifies how to set the texture on a model surface. If you do not want to set a value for this field, set a NULL string to it.
The input arguments to the function ProSurfaceSideAppearancepropsGet() are:
item—Specifies the ProModelitem object that represents the part, assembly component, subassembly, quilt, or surface.
surface_side—Specifies the direction of the side for the surface or quilt. Pass the value as 0 to specify the side which is along the surface normal. Pass 1 to specify the side opposite to the surface normal.
In cosmetic shade mode, Creo Parametric tessellates each surface by breaking it into a set of connected triangular planes. The function ProSurfaceTessellationGet() invokes this algorithm on a single specified surface and provides the coordinates of the triangle corners and the normal at each vertex. This function tessellates a single surface only.
You can use the function ProTexturePathGet() to retrieve the full path to the texture, decal, or bump map file.
Refer to the Tessellation section of Core: 3D Geometry the section for functions ProPartTessellate() and ProPartTessellationFree().
You can apply textures to the surfaces. Use the function ProSurfaceSideTexturepropsGet() to get the texture properties for the specified side of the surface. Use the function ProSurfaceSideTexturepropsSet() to set the surface texture properties for the specified side of the surface. Both these functions use the ProSurfaceTextureProps data structure to retrieve and set the surface texture properties.
The data structure is defined as follows:
typedef struct pro_surface_texture_props
{
ProCharPath decal;
ProCharPath texture_map;
ProCharPath bump_map;
} ProSurfaceTextureProps;
The ProSurfaceTextureProps data structure contains the following fields:
decal—Specifies the full path to the texture map with the alpha channel (transparency). Otherwise, use NULL.
texture_map—Specifies the full path to the texture map.
bump_map—Specifies the full path to the bump map. A bump map enables you to create bumps on the surface of the texture map.
You can manipulate the placement of the surface textures. Use the function ProSurfaceSideTextureplacementpropsGet() to get the properties related to the placement of surface texture for the specified side of the surface. Use the function ProSurfaceSideTextureplacementpropsSet() to set the placement properties for the specified side of the surface texture. The functions ProSurfaceSideTextureplacementpropsGet() and ProSurfaceSideTextureplacementpropsSet() use the ProSurfaceTexturePlacementProps data structure.
The data structure is defined as follows:
typedef struct pro_surface_texture_placement_props
{

ProTextureProjectionType projection;
ProTextureType texture_type;
ProLineEnvelope local_csys;
double horizontal_offset;
double vertical_offset;
double rotate;
double horizontal_scale;
double vertical_scale;
double bump_height;
double decal_intensity;
ProBoolean flip_horizontal;
ProBoolean flip_vertical;
} ProSurfaceTexturePlacementProps;
The ProSurfaceTexturePlacementProps data structure contains the following fields:
projection—Specifies the projection type—planar, spherical, cylindrical, or box.
texture_type—Specifies the type of texture.
local_csys—Specifies the direction (for planar projection), or the whole coordinate system (which defines the center for the other projection types).
horizontal_offset and vertical_offset—Specifies the percentage of horizontal and vertical shift of the texture map on the surface.
rotate—Specifies the angle to rotate the texture map on the surface.
horizontal_scale and vertical_scale—Specifies the horizontal and vertical scaling of the texture map.
bump_height—Specifies the height of the bump on the surface of the texture map.
decal_intensity—Specifies the alpha or transparency mask intensity on the surface.
flip_horizontal and flip_vertical—Specifies that the texture map on the surface should be flipped horizontally or vertically.
Use the function ProSurfaceAppearanceDefaultPropsGet() to get the default appearance properties of the specified type of surface. The input argument appearance_type is specified by the enumerated data type ProDefaultAppearanceType. The output argument appearance_properties is specified by the data structure ProSurfaceAppearanceProps.
這是否有幫助?