/*********************************************************************************************
 *                                                                                           *
 *                                                                                           *
 *   Copyright 1989-2018 by AutoDesSys, Inc.                                                 *
 *                                                                                           *
 *   This software and its associated documentation contains proprietary,                    *
 *   confidential, and trade secret information of AutoDesSys Inc. and may not be            *
 *   disclosed, copied in any form, or used for any purpose except as specifically           *
 *   permitted in writing by AutoDesSys, Inc.                                                *
 *                                                                                           *
 *   AutoDesSys, Inc. grants permission to use the software to those who purchase            *
 *   a license.  Such a usage will be made according to the terms and conditions             *
 *   specified in the license agreement to which a licensee agrees before installing         *
 *   and commencing usage of the software.  The license agreement can be found               *
 *   on the envelop that contains the software CD.                                           *
 *                                                                                           *
 *   AutoDesSys, Inc. also grants permission to licensees to develop extensions to           *
 *   the software, which can be in the form of scripts or plugins.  The permission           *
 *   includes calling the API and call back functions provided by AutoDesSys, Inc.           *
 *   and accessing information relevant to these functions and the general workings          *
 *   of form.Z, but only up to the point to which AutoDesSys, Inc. has chosen to             *
 *   expose, through its form.Z SDK Manual.  All extensions developed by third               *
 *   parties will include a copy of this copyright note in an easily accessible place or     *
 *   a clear instruction to read this original note by AutoDesSys, Inc.                      *
 *                                                                                           *
 *   All the software distributed under a license, either for the purpose of using it or     *
 *   for the purpose of developing extensions, is distributed AS IS, WITHOUT                 *
 *   WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND                                    *
 *   AutoDesSys, Inc. HEREBY DISCLAIMS ALL SUCH WARRANTIES,                                  *
 *   INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF                                         *
 *   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.                                    *
 *                                                                                           *
 *   formZ, RenderZone, and RadioZity are registered trademarks of AutoDesSys, Inc.          *
 *                                                                                           *
 *   form.Z SDK, Version 8.6.3, Dec 03, 2018                                                 *
 *                                                                                           *
 *                                                                                           *
 *********************************************************************************************/


#ifndef _FORMZ_MODEL_SCRW_API_H
#define _FORMZ_MODEL_SCRW_API_H

#ifdef __cplusplus
extern "C" {
#endif



/****************************************************************

	Screw/Bolt


	Description
		formZ Model Screw objects. This module contains functions to construct and edit 
		Screw objects.
 ****************************************************************/

#include "fz_model_core_api.h"



/****************************************************************

	FZ_OBJT_TYPE_SCREW


	Description
		Unique identifier for the screw object type.
 ****************************************************************/
#define FZ_OBJT_TYPE_SCREW		"\x63\x71\xf3\x4d\xbd\x7b\x49\x6a\xbd\x9c\x1d\x3b\x5f\x94\x5c\xfd"

/****************************************************************

	fz_objt_screw_cnstr_opts_ptr


	Description
		data structure to hold options for the constructions of a screw object. 
		This type is used to pass additional construction options to the 
		function fz_objt_cnstr_screw. The individual fields of 
		this type can be accessed and set via fz_objt_cnstr_screw_opts_get 
		and fz_objt_cnstr_screw_opts_set.

	Availability	5.0.0.0


	See Also
		fz_objt_cnstr_screw, fz_objt_cnstr_screw_opts_get, fz_objt_cnstr_screw_opts_set

 ****************************************************************/
typedef struct	scrw_cnstr_opts_td	*fz_objt_screw_cnstr_opts_ptr;

/****************************************************************

	fz_objt_screw_parm_enum


	Description
		Parameter identifiers for a parametric screw object. Used for the 
		"which" argument of fz_objt_edit_screw_parm_get, fz_objt_edit_screw_parm_set, 
		fz_objt_cnstr_screw_opts_get and fz_objt_cnstr_screw_opts_set.

	Members
		FZ_OBJT_SCREW_PARM_THRD_BY_DIST
			Construction and Editing - Construct thread by distance on (TRUE) or off (FALSE). 
			If set to FALSE, the number of threads are set explicitly using 
			the FZ_OBJT_SCREW_PARM_THREAD_CYCLES parameter. 
			If set to TRUE, the number of threads are calculated by the 
			thread distance (FZ_OBJT_SCREW_PARM_THREAD_DIST parameter).
			Type: fzrt_boolean
			Default Value: FALSE
		FZ_OBJT_SCREW_PARM_HAS_TIP
			Construction and Editing - Screw tip on (TRUE) or off (FALSE).
			Type: fzrt_boolean
			Default Value: TRUE
		FZ_OBJT_SCREW_PARM_HAS_NECK
			Construction and Editing - Screw neck on (TRUE) or off (FALSE).
			Type: fzrt_boolean
			Default Value: TRUE
		FZ_OBJT_SCREW_PARM_HAS_HEAD
			Construction and Editing - Screw head on (TRUE) or off (FALSE).
			Type: fzrt_boolean
			Default Value: TRUE
		FZ_OBJT_SCREW_PARM_CLOCKWISE
			Construction and Editing - Screw threads run clockwise (TRUE) or 
			counterclockwise (FALSE).
			Type: fzrt_boolean
			Default Value: TRUE
		FZ_OBJT_SCREW_PARM_PNTS_PER_CYCLE
			Construction and Editing - # of points per cycle.
			Type: fzrt_int
			Range: 3
			Default Value: 12
		FZ_OBJT_SCREW_PARM_HEAD_TYPE
			Construction and Editing - Screw head type.
			Type: fz_objt_screw_headtype_enum
			Default Value: FZ_OBJT_SCREW_HEAD_TYPE_CONIC
		FZ_OBJT_SCREW_PARM_SLOT_TYPE
			Construction and Editing - Screw slot type.
			Type: fz_objt_screw_slottype_enum
			Default Value: FZ_OBJT_SCREW_SLOT_TYPE_NONE
		FZ_OBJT_SCREW_PARM_GAP_FACTOR
			Construction and Editing - Screw thread gap, as factor of distance between two threads.
			Type: double
			Range: 0.0
			Default Value: 0.5
		FZ_OBJT_SCREW_PARM_THREAD_DIST
			Construction and Editing - Distance between two threads.
			Type: double
			Range: 0.0
			Default Value: English 8.0 in, Metric 20.0 cm

		FZ_OBJT_SCREW_PARM_AXP1
			Editing - Screw axis point 1.
			Type: fz_xyz_td
		FZ_OBJT_SCREW_PARM_AXP2
			Editing - Screw axis point 2.
			Type: fz_xyz_td
		FZ_OBJT_SCREW_PARM_AXP3
			Editing - Screw axis point 3. 
			This point needs to be located off the axis 
			and determines where the treads start.
			Type: fz_xyz_td
		FZ_OBJT_SCREW_PARM_BODY_LENGTH
			Editing - Screw body length.
			Type: double
			Range: 0.0
		FZ_OBJT_SCREW_PARM_BODY_RADIUS
			Editing - Screw body radius.
			Type: double
			Range: 0.0
		FZ_OBJT_SCREW_PARM_NECK_LENGTH
			Editing - Screw neck length.
			Type: double
			Range: 0.0
		FZ_OBJT_SCREW_PARM_NECK_RADIUS
			Editing - Screw neck radius.
			Type: double
			Range: 0.0
		FZ_OBJT_SCREW_PARM_HEAD_LENGTH
			Editing - Screw head length.
			Type: double
			Range: 0.0
		FZ_OBJT_SCREW_PARM_HEAD_RADIUS
			Editing - Screw head radius.
			Type: double
			Range: 0.0
		FZ_OBJT_SCREW_PARM_TIP_FACTOR
			Editing - Screw tip length as a factor of the body length.
			Type: double
			Range: 0.0
		FZ_OBJT_SCREW_PARM_THREAD_DEPTH_FACTOR
			Editing - Screw thread depth factor. 
			Thread depth as a factor of the screw's body radius.
			Type: double
			Range: 0.0
		FZ_OBJT_SCREW_PARM_THREAD_CYCLES
			Editing - Screw number of thread cycles.
			Type: fzrt_int 
			rimin 		1

	Availability	5.0.0.0

	Example Files
		../../../../Scripts/Samples/Utilities/util_objt_cnstr_screw.fsl

	See Also
		fz_objt_cnstr_screw_opts_get, fz_objt_cnstr_screw_opts_set, fz_objt_edit_screw_parm_get,  
		fz_objt_edit_screw_parm_set

 ****************************************************************/
typedef enum fz_objt_screw_parm_enum
{	FZ_OBJT_SCREW_PARM_THRD_BY_DIST = 0,
											
												
	FZ_OBJT_SCREW_PARM_HAS_TIP,
												
	FZ_OBJT_SCREW_PARM_HAS_NECK,
												
	FZ_OBJT_SCREW_PARM_HAS_HEAD,
												
	FZ_OBJT_SCREW_PARM_CLOCKWISE,
												
	FZ_OBJT_SCREW_PARM_PNTS_PER_CYCLE,
												
	FZ_OBJT_SCREW_PARM_HEAD_TYPE,
												
	FZ_OBJT_SCREW_PARM_SLOT_TYPE,
												
	FZ_OBJT_SCREW_PARM_GAP_FACTOR,
												
	FZ_OBJT_SCREW_PARM_THREAD_DIST,
	
	
	FZ_OBJT_SCREW_PARM_AXP1,
												
	FZ_OBJT_SCREW_PARM_AXP2,
												
	FZ_OBJT_SCREW_PARM_AXP3,
												
	FZ_OBJT_SCREW_PARM_BODY_LENGTH,
												
	FZ_OBJT_SCREW_PARM_BODY_RADIUS,
												
	FZ_OBJT_SCREW_PARM_NECK_LENGTH,
												
	FZ_OBJT_SCREW_PARM_NECK_RADIUS,
												
	FZ_OBJT_SCREW_PARM_HEAD_LENGTH,
												
	FZ_OBJT_SCREW_PARM_HEAD_RADIUS,
												
	FZ_OBJT_SCREW_PARM_TIP_FACTOR,
												
	FZ_OBJT_SCREW_PARM_THREAD_DEPTH_FACTOR,
												
	FZ_OBJT_SCREW_PARM_THREAD_CYCLES,
	
	FZ_OBJT_SCREW_PARM_MAX
	
} fz_objt_screw_parm_enum;

/****************************************************************

	fz_objt_screw_headtype_enum


	Description
		Type identifiers for the head of a screw. Used for the 
		FZ_OBJT_SCREW_PARM_HEAD_TYPE parameter of fz_objt_edit_screw_parm_get, 
		fz_objt_edit_screw_parm_set, fz_objt_cnstr_screw_opts_get and fz_objt_cnstr_screw_opts_set.

	Members
		FZ_OBJT_SCREW_HEAD_TYPE_CONIC
			Conic screw head
		FZ_OBJT_SCREW_HEAD_TYPE_SPHERIC
			Spheric screw head
		FZ_OBJT_SCREW_HEAD_TYPE_ROUNDED
			Rounded screw head
		FZ_OBJT_SCREW_HEAD_TYPE_HEX
			Hexagonal screw head
		FZ_OBJT_SCREW_HEAD_TYPE_SQUARE
			Square screw head

	Availability	5.0.0.0

	Example Files
		../../../../Scripts/Samples/Utilities/util_objt_cnstr_screw.fsl

	See Also
		fz_objt_edit_screw_parm_get,fz_objt_edit_screw_parm_set, 
		fz_objt_cnstr_screw_opts_get,fz_objt_cnstr_screw_opts_set, fz_objt_screw_parm_enum

 ****************************************************************/
typedef enum fz_objt_screw_headtype_enum
{	FZ_OBJT_SCREW_HEAD_TYPE_CONIC = 0,
	FZ_OBJT_SCREW_HEAD_TYPE_SPHERIC,
	FZ_OBJT_SCREW_HEAD_TYPE_ROUNDED,
	FZ_OBJT_SCREW_HEAD_TYPE_HEX,
	FZ_OBJT_SCREW_HEAD_TYPE_SQUARE,
	
	FZ_OBJT_SCREW_HEAD_TYPE_MAX
} fz_objt_screw_headtype_enum;

/****************************************************************

	fz_objt_screw_slottype_enum


	Description
		Type identifiers for the slot of a screw. Used for the 
		FZ_OBJT_SCREW_PARM_SLOT_TYPE parameter of fz_objt_edit_screw_parm_get, 
		fz_objt_edit_screw_parm_set, fz_objt_cnstr_screw_opts_get and fz_objt_cnstr_screw_opts_set.

	Members
		FZ_OBJT_SCREW_SLOT_TYPE_NONE
			No slot
		FZ_OBJT_SCREW_SLOT_TYPE_STRAIGHT
			Straight slot
		FZ_OBJT_SCREW_SLOT_TYPE_CROSS
			Cross slot

	Availability	5.0.0.0

	Example Files
		../../../../Scripts/Samples/Utilities/util_objt_cnstr_screw.fsl

	See Also
		fz_objt_edit_screw_parm_get,fz_objt_edit_screw_parm_set, 
		fz_objt_cnstr_screw_opts_get,fz_objt_cnstr_screw_opts_set, 

 ****************************************************************/
typedef enum fz_objt_screw_slottype_enum
{	FZ_OBJT_SCREW_SLOT_TYPE_NONE = 0,
	FZ_OBJT_SCREW_SLOT_TYPE_STRAIGHT,
	FZ_OBJT_SCREW_SLOT_TYPE_CROSS,
	
	FZ_OBJT_SCREW_SLOT_TYPE_MAX
} fz_objt_screw_slottype_enum;

/****************************************************************

	fz_objt_cnstr_screw_opts_init



	Description
		Allocate screw construction options and fill with defaults

	Parameters
		windex  [Input]
			project window index
		opts  [Result]
			construction options

	Returns
		Error codes


	Availability	5.0.0.0

	Example Files
		../../../../Scripts/Samples/Utilities/util_objt_cnstr_screw.fsl

	See Also
		fz_objt_cnstr_screw_opts_finit,fz_objt_cnstr_screw_opts_get,fz_objt_cnstr_screw_opts_set

 ****************************************************************/
typedef fzrt_error_td  (*fz_objt_cnstr_screw_opts_init_func) (
	fzrt_int				windex,
	fz_objt_screw_cnstr_opts_ptr	*opts
	);

/****************************************************************

	fz_objt_cnstr_screw_opts_get



	Description
		Get the value of a screw object's construction option. Note, that 
		only those values in fz_objt_screw_parm_enum are accepted 
		which are tagged for the construction options. See 
		fz_objt_screw_parm_enum for details.

	Parameters
		windex  [Input]
			project window index
		opts  [Input]
			construction options
		which  [Input]
			parameter id
		data  [Result]
			parameter data

	Returns
		Error codes


	Availability	5.0.0.0

	Example Files
		../../../../Scripts/Samples/Utilities/util_objt_cnstr_screw.fsl

	See Also
		fz_objt_cnstr_screw_opts_init,fz_objt_cnstr_screw_opts_finit,fz_objt_cnstr_screw_opts_set

 ****************************************************************/
typedef fzrt_error_td  (*fz_objt_cnstr_screw_opts_get_func) (
	fzrt_int					windex,
	fz_objt_screw_cnstr_opts_ptr		opts,
	fz_objt_screw_parm_enum	which,
	fz_type_td				*data
	);

/****************************************************************

	fz_objt_cnstr_screw_opts_set



	Description
		Set the value of a screw object's construction option. Note, that 
		only those values in fz_objt_screw_parm_enum are accepted 
		which are tagged for the construction options. See 
		fz_objt_screw_parm_enum for details.

	Parameters
		windex  [Input]
			project window index
		opts  [Input]
			construction options
		which  [Input]
			parameter id
		data  [Input]
			parameter data

	Returns
		Error codes


	Availability	5.0.0.0

	Example Files
		../../../../Scripts/Samples/Utilities/util_objt_cnstr_screw.fsl

	See Also
		fz_objt_cnstr_screw_opts_init,fz_objt_cnstr_screw_opts_finit,fz_objt_cnstr_screw_opts_get

 ****************************************************************/
typedef fzrt_error_td  (*fz_objt_cnstr_screw_opts_set_func) (
	fzrt_int					windex,
	fz_objt_screw_cnstr_opts_ptr		opts,
	fz_objt_screw_parm_enum	which,
	fz_type_td				*data
	);

/****************************************************************

	fz_objt_cnstr_screw_opts_finit



	Description
		Frees screw object construction options. The opts pointer 
		is deallocated and returned back as NULL.

	Parameters
		windex  [Input]
			project window index
		opts  [Input, Result]
			options (will become NULL)

	Returns
		Error codes


	Availability	5.0.0.0

	Example Files
		../../../../Scripts/Samples/Utilities/util_objt_cnstr_screw.fsl

	See Also
		fz_objt_cnstr_screw_opts_init,fz_objt_cnstr_screw_opts_get,fz_objt_cnstr_screw_opts_set

 ****************************************************************/
typedef fzrt_error_td  (*fz_objt_cnstr_screw_opts_finit_func) (
	fzrt_int				windex,
	fz_objt_screw_cnstr_opts_ptr	*opts
	);

/****************************************************************

	fz_objt_cnstr_screw



	Description
		Creates a screw or bolt object.

	Parameters
		windex  [Input]
			project window index
		ax_p1  [Input]
			first point on screw axis
		ax_p2  [Input]
			second point on screw axis
		ax_ref  [Input]
			third point. Must be off the axis defined by 
			ax_p1 and ax_p2. This point determines where the threads starts.
		body_length  [Input]
			screw body length. This includes the length of the tip.
			Range: 0.0
		body_radius  [Input]
			screw body radius.
			Range: 0.0
		neck_length  [Input]
			screw neck length.
			Range: 0.0
		neck_radius  [Input]
			screw neck radius.
			Range: 0.0
		head_length  [Input]
			screw head length.
			Range: 0.0
		head_radius  [Input]
			screw head radius.
			Range: 0.0
		tip_factor  [Input]
			Screw tip length as a factor of the body length.
			Range: 0.0
		thrd_depth_factor  [Input]
			Screw thread depth as a factor of the body radius.
			Range: 0.0
		thrd_cycles  [Input]
			Number of thread cycles.
			Range: 1
		scrw_opts  [Input, Optional]
			construction options. For defaults see fz_objt_helix_parm_enum
		obj  [Result]
			new object

	Returns
		Error codes


	Availability	5.0.0.0

	Example Files
		../../../../Scripts/Samples/Utilities/util_objt_cnstr_screw.fsl

	See Also
		fz_objt_edit_screw_parm_set,fz_objt_edit_screw_parm_get

 ****************************************************************/
typedef fzrt_error_td  (*fz_objt_cnstr_screw_func) (
	fzrt_int 					windex,
	fz_xyz_td					*ax_p1,
	fz_xyz_td					*ax_p2,
	fz_xyz_td					*ax_ref,
	double					body_length,
	double					body_radius,
	double					neck_length,
	double					neck_radius,
	double					head_length,
	double					head_radius,
	double					tip_factor,
	double					thrd_depth_factor,
	fzrt_int					thrd_cycles,
	fz_objt_screw_cnstr_opts_ptr		scrw_opts,
	fz_objt_ptr			*obj
	);

/****************************************************************

	fz_objt_edit_screw_parm_get



	Description
		Gets a parameter of a screw object.

	Parameters
		windex  [Input]
			project window index
		obj  [Input]
			object
		which  [Input]
			parameter id
		data  [Result]
			parameter data

	Returns
		Error codes 
		MODEL_ERR_WRONG_OBJT_TYPE	- object passed in is not a screw object


	Availability	5.0.0.0

	Example Files
		../../../../Scripts/Samples/Utilities/util_objt_cnstr_screw.fsl

	See Also
		fz_objt_edit_screw_parm_set,fz_objt_cnstr_screw,fz_objt_edit_parm_regen

 ****************************************************************/
typedef fzrt_error_td  (*fz_objt_edit_screw_parm_get_func) (
	fzrt_int					windex,
	fz_objt_ptr			obj,
	fz_objt_screw_parm_enum	which,
	fz_type_td				*data
	);

/****************************************************************

	fz_objt_edit_screw_parm_set



	Description
		Sets a parameter of a screw object. Note, that the shape of the 
		screw object is not changed until the function fz_objt_edit_parm_regen 
		has been called.

	Parameters
		windex  [Input]
			project window index
		obj  [Input]
			object
		which  [Input]
			parameter id
		data  [Input]
			parameter data

	Returns
		Error codes 
		MODEL_ERR_WRONG_OBJT_TYPE	- object passed in is not a screw object


	Availability	5.0.0.0

	Example Files
		../../../../Scripts/Samples/Utilities/util_objt_cnstr_screw.fsl

	See Also
		fz_objt_edit_screw_parm_get,fz_objt_cnstr_screw,fz_objt_edit_parm_regen

 ****************************************************************/
typedef fzrt_error_td  (*fz_objt_edit_screw_parm_set_func) (
	fzrt_int					windex,
	fz_objt_ptr			obj,
	fz_objt_screw_parm_enum	which,
	fz_type_td				*data
	);
	
#ifdef __cplusplus
}
#endif

#endif
