formZ SDK | 5.0 API Reference | Project | Modeling | Objects | Control Objects | Spline
Description
Parameter identifiers for a parametric spline. Used for the "which" argument of and . The parameters of a spline curve are the number of control points, the control points themselves and the closure. The number of control points can only be read, but not set. Control points can be read and set. When reading the control points, an array of fz_xyz_td must be preallocated to be at least "npts" fzrt_int. The array pointer is set in the data argument of . An example how this is done in a plugin and a script is shown below. Setting the control points is done exactly the same way. That is, an array of npts items must be allocated and filled with the coordinate values of the control points. The array pointer is set in the data argument for .
enum fz_objt_spline_parm_enum {
FZ_OBJT_SPLINE_PARM_NPTS,
FZ_OBJT_SPLINE_PARM_CPTS,
FZ_OBJT_SPLINE_PARM_CLOSED,
FZ_OBJT_SPLINE_PARM_MODEL_TYPE,
FZ_OBJT_SPLINE_PARM_SPLINE_TYPE };
Members
FZ_OBJT_SPLINE_PARM_NPTS
Editing - Spline number of control points.
Type: fzrt_int
Range: value >= 3
FZ_OBJT_SPLINE_PARM_CPTS
Editing - Spline control points.
Type: fz_xyz_td*
FZ_OBJT_SPLINE_PARM_CLOSED
Editing - Spline closed on (TRUE) or off (FALSE).
Type: fzrt_boolean
FZ_OBJT_SPLINE_PARM_MODEL_TYPE
Editing - Spline model type.
Type: fz_objt_model_type_enum
FZ_OBJT_SPLINE_PARM_SPLINE_TYPE
Editing - Spline type of the spline object. Possible values are contained in fz_objt_spline_type_enum. They are equivalent to the various drawing tools, that create spline objects : quadratic bezier, cubic bezier, quadratic spline (also called sketch spline), cubic spline and spline through points. Available with version 5.1.0 and later
Type: fz_objt_spline_type_enum
Availability
5.0.0.0
Plugin Example
fz_xyz_td *cpts;
fzrt_int i,npts;
fz_type_td data;
// GET THE NUMBER OF CONTROL POINTS
fz_objt_edit_spline_parm_get(windex,obj,FZ_OBJT_SPLINE_PARM_NPTS,&data);
fz_type_get_int(&data,&npts);
// ALLOCATE THE CONTROL POINTS ARRAY
cpts = (fz_xyz_td*)fzrt_new_ptr(sizeof(fz_xyz_td) * npts);
// SET THE cpts POINTER IN THE data ARGUMENT AND RETRIEVE THE POINTS
fz_type_set_xyz_ptr(&data,&cpts);
fz_objt_edit_spline_parm_get(windex,obj,FZ_OBJT_SPLINE_PARM_CPTS,&data);
// NOW cpts CONTAINS A COPY OF THE CONTROL POINTS
for(i = 0; i < ntps; i++)
{
cpts[i].z += 10.0;
}
// NOW PASS THE cpts BACK TO THE SPLINE OBJECT
fz_objt_edit_spline_parm_set(windex,obj,FZ_OBJT_SPLINE_PARM_CPTS,&data);
// DEALLOCATE THE CONTROL POINTS ARRAY
fzrt_dispose_ptr((fzrt_ptr) cpts);
Script Example
fz_xyz_td cpts[];
fzrt_int i,npts;
// GET THE NUMBER OF CONTROL POINTS
fz_objt_edit_spline_parm_get(windex,obj,FZ_OBJT_SPLINE_PARM_NPTS,npts);
// BY ACESSING THE ARRAY ITEM npts-1, THE ARRAY
// IS ALLOCATED TO AT LEAST npts ITEMS
cpts[npts-1] = {0,0,0};
// RETRIEVE THE POINTS
fz_objt_edit_spline_parm_get(windex,obj,FZ_OBJT_SPLINE_PARM_CPTS,cpts);
// NOW cpts CONTAINS A COPY OF THE CONTROL POINTS
for(i = 0; i < ntps; i++)
{
cpts[i].z += 10.0;
}
// NOW PASS THE cpts BACK TO THE SPLINE OBJECT
fz_objt_edit_spline_parm_set(windex,obj,FZ_OBJT_SPLINE_PARM_CPTS,cpts);
Defined in