int cvxRootActivate
(
vxLongName Name      /* I: root object name */
)
/*
DESCRIPTION:
Activates the specified root object in the active file for editing. 
Returns 1 if function fails; 0 if it succeeds.
*/
________________________________________________________________________________

int cvxRootActivate2
(
vxLongName File,      /* I: root object file */
vxLongName Name      /* I: root object name */
)
/*
DESCRIPTION:
Activates the root object specified by "File" and "Root" as the
target object and backs up information about the current target 
object to an internal stack (up to 16 calls deep).  

When this function is called with "File=NULL" and "Root=NULL", 
the last target object on the stack is restored.  The calling 
application MUST reliably pair calls to this function to set 
and restore target objects.

When this function is called with "File="*" and "Name=NULL",
the stack is cleared.

for example:
...(coding)
cvxRootActivate2(File,Name);
...(coding)
...(when no code is needed to execute in the current environment, the interface closure file needs to be called again)
cvxRootActivate2(NULL,NULL);
...(coding)

NOTE:
If cvxRootActivate2(NULL,NULL) is not called,unpredictable errors can occur.

Returns 1 if function fails; 0 if it succeeds.
*/
________________________________________________________________________________

int cvxRootActivateLoadAsmCtx
(
vxLongName File, /* I: root object file */
vxLongName Name, /* I: root object name */
int isLoad       /* I: 1 is load assembly context data, 0 is not load */
)
/*
DESCRIPTION:
Activates the root object specified by "File" and "Name" as the
target object and backs up information about the current target
object to an internal stack (up to 16 calls deep).

When this function is called with "File=NULL" and "Name=NULL",
the last target object on the stack is restored.
When this function is called with "File="*" and "Name=NULL",
the stack is cleared.

The calling application MUST reliably pair calls to this function to set
and restore target objects.

for example:
...(coding)
cvxRootActivateLoadAsmCtx(File,Name,1);
...(coding)
...(when no code is needed to execute in the current environment, the interface closure file needs to be called again)
cvxRootActivateLoadAsmCtx(NULL,NULL,1);
...(coding)

NOTE:
If cvxRootActivateLoadAsmCtx(NULL,NULL,) is not called,unpredictable errors can occur.
cvxRootActivateLoadAsmCtx(File,Name,0) and cvxRootActivate2(File,Name) have the same function.

Returns 1 if function fails; 0 if it succeeds.
*/
________________________________________________________________________________

int cvxRootAdd
(
evxRootType Type,         /* I: root object type */
vxLongName Name,          /* I: root object name */
const char *Template    /* I: optional template object name (or NULL) */
)
/*
DESCRIPTION:
Creates and inserts a root object of the specified type 
in the active file.   It becomes the active object for
editing.  

Note: User need to call cvxRootExit() after one root
object is added if inserts two root objects at the
same time, for example:

   err1 = cvxRootAdd(VX_ROOT_PART, "Part001", NULL);
   cvxRootExit();
   err2 = cvxRootAdd(VX_ROOT_PART, "Part002", NULL);

An optional template object name may be input for a part,
sheet or plan.  If it is specified, the new root object 
is a copy of the template object.  It is assumed that 
the template object resides in the template file registered 
with cvxRootTemplateFile() before this function is called.

Returns 1 if function fails; 0 if it succeeds.
*/
________________________________________________________________________________

int cvxRootAdd2
(
evxRootType Type,         /* I: root object type */
vxLongName Name,          /* I: root object name */
const char *Template,    /* I: optional template object name (or NULL) */
char *Description         /* I: optional object description (or NULL) */
)
/*
DESCRIPTION:
The function is same as cvxRootAdd but add a parameter Description to add
description for part
Returns 1 if function fails; 0 if it succeeds.
*/
________________________________________________________________________________

int cvxRootAdd2Bg
(
evxRootType Type,    /* I: root object type (presently only VX_ROOT_PART is supported) */
vxLongName Name    /* I: part name */
)
/*
DESCRIPTION:
Adds a root object into the "background" of the active file -- that is, the new root object
is not displayed in the file's root object list. If a root object with the input name already 
exists in the active file, a new root object is not added.

Presently, this function only supports part objects (Type = VX_ROOT_PART).

Returns 1 if error, 2 if a root object with the specified name already exists, or 0 if success.
*/
________________________________________________________________________________

int cvxRootAtItemGet
(
vxLongName file,     /* I: object file name (file[0]=0 or NULL for active file) */
vxLongName root,     /* I: root object name (root[0]=0 or NULL for active target object) */
evxAtItemId itemId,  /* I: item id */
svxAttribute *at     /* I/O: part item attribute */
)
/*
DESCRIPTION:
Outputs an attribute from a specified root.

The itemId includes the following items of evxAtItemId:
   VX_AT_USER
   VX_AT_NAME
   VX_AT_NUMBER
   VX_AT_DESIGNER
   VX_AT_MANAGER
   VX_AT_SUPPLIER
   VX_AT_KEYWORD
   VX_AT_DESCRIPT
   VX_AT_START
   VX_AT_END

When itemId is VX_AT_USER, the name of the user-defined attribute
must be assigned to at->label before calling this function. For all
other itemId values, at->label can be an empty string (at->label[0]=0)
when this function is called.

If the specified file is not already open, this function will open
it to access the attribute, and will then close the file. If you
want to keep the file open, use the cvxFileKeep function, before
calling this function, to set a flag that prevents cvxRootAtItemGet
and cvxRootAtItemSet from closing the files that they open. (Files
that are already open before cvxRootAtItemGet or cvxRootAtItemSet
is called are never closed by these functions.) Keeping files open
is a more efficient way to access multiple attributes in a file, but
you must remember to call cvxFileKeep again to reset the flag after
you have finished your calls to cvxRootAtItemGet and cvxRootAtItemSet,
and you also become responsible for closing the files, for example by
using one of the cvxFileClose or cvxFileSave functions.

Returns 1 if function fails; 0 if it succeeds.
*/
________________________________________________________________________________

int cvxRootAtItemSet
(
vxLongName file,     /* I: object file name (file[0]=0 or NULL for active file) */
vxLongName root,     /* I: root object name (root[0]=0 or NULL for active target object) */
evxAtItemId itemId,  /* I: item id */
svxAttribute *at     /* I: part item attribute */
)
/*
DESCRIPTION:
Sets an attribute value in a specified root.

The itemId includes the following items of evxAtItemId:
   VX_AT_USER
   VX_AT_NAME
   VX_AT_NUMBER
   VX_AT_DESIGNER
   VX_AT_MANAGER
   VX_AT_SUPPLIER
   VX_AT_KEYWORD
   VX_AT_DESCRIPT

When itemId is VX_AT_USER, the name of the user-defined attribute
must be assigned to at->label before calling this function. For all
other itemId values, at->label can be an empty string (at->label[0]=0)
when this function is called.

If the specified file is not already open, this function will open
it to access the attribute, and will then close the file. If you
want to keep the file open, use the cvxFileKeep function, before
calling this function, to set a flag that prevents cvxRootAtItemGet
and cvxRootAtItemSet from closing the files that they open. (Files
that are already open before cvxRootAtItemGet or cvxRootAtItemSet
is called are never closed by these functions.) Keeping files open
is a more efficient way to access multiple attributes in a file, but
you must remember to call cvxFileKeep again to reset the flag after
you have finished your calls to cvxRootAtItemGet and cvxRootAtItemSet,
and you also become responsible for closing the files, for example by
using one of the cvxFileClose or cvxFileSave functions.

Returns 1 if function fails; 0 if it succeeds.
*/
________________________________________________________________________________

int cvxRootCopy
(
vxLongName SourceFile,   /* I: name of file to copy from */
vxLongName SourceName,  /* I: name of root object in source file */
vxLongName DestFile,      /* I: name of file to copy to */
vxLongName DestName,      /* I: name to assign copied root object */
int Overwrite,            /* I: 0 = upgrade DestName to avoid naming conflict,
                        **      1 = prompt before overwriting existing object.
                        **     -1 = automatically overwrite existing object.
                        */
int UpdateUid            /* I: 1 to make UID's of copied geometry unique, else 0 */
)
/*
DESCRIPTION:
Copies the specified root object from "SourceFile" to "DestFile".
Both files must already exist and must reside in one of the 
directories specified in "vxpaths" (see cvxPathAdd() and
cvxPathSearchFirst()).

Normally, when a root object is copied, the unique id's in the copied
object are the same as the original object.  When "UpdateUid=1", the
the unique id's of the copied object are updated so they are different 
from the original object.  You should input "UpdateUid=0", unless you 
have a specific purpose for generating copies with different unique id's.
In normal usage, ZW3D is able to differentiate entities in a copied object 
from the original object without changing unique id's.

Returns 1 if function fails; 0 if it succeeds.
*/
________________________________________________________________________________

int cvxRootCustomDataDel
(
vxLongName   file,    /* I: ZW3D or VX file name (file[0]=0 or NULL for active file) */
vxLongName   objName  /* I: root object name (objName[0]=0 or NULL for active object) */
)
/*
DESCRIPTION:
Delete user custom data from a existing root object of an existing ZW3D or VX file.
Returns 1 if error; 0 if success.
*/
________________________________________________________________________________

int cvxRootCustomDataGet
(
vxLongName   file,       /* I: ZW3D or VX file name (file[0]=0 or NULL for active file) */
vxLongName   objName,    /* I: root object name (objName[0]=0 or NULL for active object) */
char**   data,       /* O: customization data */
int*     dataLength  /* O: length of customization data */
)
/*
DESCRIPTION:
Get user custom data from a existing root object of an existing ZW3D or VX file.
The list referenced by "**data" is allocated by this function and must
be deallocated by the calling procedure by cvxMemFree() function.  A NULL 
pointer is output if no data is found.

Returns 1 if error; 0 if success.
*/
________________________________________________________________________________

int cvxRootCustomDataSet
(
vxLongName   file,       /* I: ZW3D or VX file name (file[0]=0 or NULL for active file) */
vxLongName   objName,    /* I: root object name (objName[0]=0 or NULL for active object) */
char     *data,      /* I: customization data */
int      dataLength  /* I: length of customization data */
)
/*
DESCRIPTION:
Set user custom data to a specific root object of an existing ZW3D or VX file.
Program will overwrite existing custom data if root object already has custom data.

Returns 1 if error; 0 if success.
*/
________________________________________________________________________________

int cvxRootDel
(
vxLongName Name      /* I: root object name */
)
/*
DESCRIPTION:
Deletes the specified root object from the active file.
Returns 1 if function fails; 0 if it succeeds.
*/
________________________________________________________________________________

void cvxRootExit (void)
/*
DESCRIPTION:
Exits the active root object to either the parent object
or the parent file.
*/
________________________________________________________________________________

int cvxRootId
(
vxLongName Name,         /* I: root object name */
int *idRoot,            /* O: root object id */
evxRootType *Type         /* O: root object type */
)
/*
DESCRIPTION:
Gets the database id of the specified root object (Name) in
the active file.  "idRoot = 0" is output if root object is
not found.

Returns 0 if root object is found; 1 if not found.
*/
________________________________________________________________________________

void cvxRootInqActive
(
char *Name,         /* O: name of active root object */
int nBytes         /* I: string size of root object name */
)
/*
DESCRIPTION:
Outputs the name of the active root object.
Outputs "Name[0]=0" if there is not an active root object.
*/
________________________________________________________________________________

int cvxRootInqAsm
(
char *Name,      /* O: name of top root object in assembly*/
int nBytes      /* I: string size of root object */
)
/*
DESCRIPTION:
Outputs the name of the top root object in assembly.
Outputs "Name[0]=0" if error.
*/
________________________________________________________________________________

int cvxRootInqMod
(
int *mod      /* O: 1 if active root object has been modified */
)
/*
DESCRIPTION:
Outputs 1 if the active root object has been modified since it was
last activated, otherwise outputs 0.

Returns 1 if function fails; 0 if it succeeds.

See also cvxRootInqModSinceRegen() and cvxFileIsModified().
*/
________________________________________________________________________________

int cvxRootInqModByName
(
vxLongName fileName,       /* I: Z3/VX file name (fileName[0]=0 or NULL for active file) */
vxLongName rootName,       /* I: root object name (rootName[0]=0 or NULL for active object) */
int *Mod                   /* O: 1 if active root object has been modified */
)
/*
DESCRIPTION:
Outputs 1 if the specified root object has been modified since it was
last activated, otherwise outputs 0.

Returns 1 if function fails; 0 if it succeeds.

See also cvxRootInqModSinceRegen() and cvxFileIsModified().
*/
________________________________________________________________________________

int cvxRootInqModSinceRegen
(
int *mod      /* O: 1 if active root object has been modified since last regen */
)
/*
DESCRIPTION:
Outputs 1 if the active root object has been modified since it was
regenerated, otherwise outputs 0.

Returns 1 if function fails; 0 if it succeeds.

See also cvxRootInqMod() and cvxFileIsModified().
*/
________________________________________________________________________________

int cvxRootInqSheetMetal
(
vxLongName file,     /* I: file name (file[0]=0 or NULL for active file) */
vxLongName part,     /* I: part name (part[0]=0 or NULL for active part) */
int *shtMetal        /* O: whether there is sheet metal in the part (1: exist; 0: NOT exist)  */
)
/* 
DESCRIPTION:
Check that whether there is sheet metal in specified part.

Returns:
1 - function fails or if the specified root obj is not a part
0 - the root object is a valid part.
*/
________________________________________________________________________________

int cvxRootInqSymbol
(
vxLongName file,     /* I: file path (pass in NULL if undefined) */
int *iCount,         /* O: number of symbol names */
vxLongName**names    /* O: list of symbol names */
)
/*
DESCRIPTION:
If "file" is input as NULL, this function gets a list of the symbol names in the active file.

If the path of a valid ZW3D file is input via "file", this function gets a 
list of symbol names in the specified file.

The list referenced by "**names" is allocated by this function and must
be deallocated by the calling procedure.  A NULL pointer is output if 
no data is found.

Returns 1 if function fails; 0 if it succeeds.
*/
________________________________________________________________________________

int cvxRootIsAsm
(
vxLongName File,   /* I: part file name (File[0]=0 or NULL for active file) */
vxLongName Part,   /* I: part name (Part[0]=0 or NULL for active part) */
int *isAsm      /* O: 1 = Assembly; 0 = Part */
)
/*
DESCRIPTION:
Get the type of part root object: part or assembly.

Returns:
1 - function fails or if the specified root obj is neither a part nor assembly
0 - the root object is a valid part or assembly.
*/
________________________________________________________________________________

int cvxRootList
(
vxLongName File,      /* I: optional ZW3D file path (pass in NULL if undefined) */
int *Count,            /* O: no. of root objects output via "Names" */
vxLongName **Names   /* O: list of root object names */
)
/*
DESCRIPTION:
if "File" is input as NULL, this function gets a list of the names of all 
the root objects in the active file.

If the path of a valid ZW3D file is input via "File", this function gets a 
list of the root objects in the specified file.

The list referenced by "**Names" is allocated by this function and must
be deallocated by the calling procedure.  A NULL pointer is output if 
no data is found.

Returns 1 if function fails; 0 if it succeeds.
*/
________________________________________________________________________________

evxPreviewMode cvxRootPreviewGet(void)
/*
DESCRIPTION:
Returns 1 if a graphical root object preview is enabled.
Otherwise, returns 0.
*/
________________________________________________________________________________

void cvxRootPreviewSet
(
evxPreviewMode Mode,      /* I: preview mode */
vxLongName File,         /* I: file (NULL if VX_PREVIEW_OFF) */
vxLongName Object         /* I: object (NULL if VX_PREVIEW_OFF) */
)
/*
DESCRIPTION:
Displays the specified preview for the specified root object.
*/
________________________________________________________________________________

int cvxRootRename
(
vxLongName Name,      /* I: name of root object to rename (in active file) */
vxLongName NewName,    /* I: new name for root object */
int Update            /* I: 1 to update references by name, else 0 */
)
/*
DESCRIPTION:
Renames a root object in the active file.  If "Update" is input 
as a non-zero value, references to "Name" in the active file are 
changed to "NewName".

It's also can be used to rename the 2d sketch block in the active file.

Returns 1 if function fails; 0 if it succeeds.
*/
________________________________________________________________________________

int cvxRootRename2
(
vxLongName Name,      /* I: name of root object to rename (in active file) */
vxLongName NewName,    /* I: new name for root object */
char *Descript,      /* I: new description for root object (NULL if undefined) */
int Update            /* I: 1 to update references by name, else 0 */
)
/*
DESCRIPTION:
Renames a root object in the active file and assigns the specified
description to it (if defined).  If "Update" is input as a non-zero 
value, references to "Name" in the active file are changed to "NewName".
Passing in a blank string for "Descript" will clear the current
description associated with the specified root object.

Returns 1 if function fails; 0 if it succeeds.
*/
________________________________________________________________________________

int cvxRootRenameMulti
(
 int Count,               /* I: the number of names in each input array */
 vxLongName *FileName,     /* I: array of "Count" file names to rename */
 vxLongName *RootName,    /* I: array of "Count" root object names to rename */
 vxLongName *NewFileName,  /* I: array of "Count" new file names, may be NULL */
 vxLongName *NewRootName, /* I: array of "Count" new root object names, may be NULL */
 int fDelOriginal         /* I: 1 to delete original files after renaming, 0 to keep them */
 )
 /*
 DESCRIPTION:
 Rename the given files and/or root objects.  The BinName and RootName arrays of original names are required,
 where the BinName array contains Count file names, optionally including the paths to those files, and the 
 RootName array contains Count names of the root objects to be renamed in those files.  The new file names 
 and new object names are given by the NewBinName and NewRootName arrays, which are optional.  Either 
 NewBinName or NewRootName may be NULL if there should be no changes to file names or root object names, 
 respectively.  If NewBinName and NewRootName are both NULL, this function does nothing.

 In the active file and files referenced by the active file, references to the given names are updated to 
 use the new names.

 Renaming a root object with this function clears the object's description.  Refer to cvxRootRename2 
 for a function that can assign a description to a root object while renaming it.

 When files are renamed, a new copy of each file is saved using the new name rather than actually changing 
 the name of the original file.  If the fDelOriginal argument is 1, this function deletes the original files 
 for which new files have been created.  If fDelOriginal is 0, the original files are preserved.

 Return 0 if all renames are successful, otherwise return 1 if an error occurs.  If an error does occur, 
 some files and objects might be renamed and others might still have their original names when this function returns.
 */
________________________________________________________________________________

void cvxRootTemplateFile
(
vxLongName File  /* I: template object file name (NULL for default name) */
)
/*
DESCRIPTION:
Registers the specified object file name as the file from 
which cvxRootIns() retrieves template objects.  The file
should reside in one of the active search directories
(see cvxPathAdd()).  Input NULL or a blank string to
use the default template file name (defined in config).
*/
________________________________________________________________________________

int cvxRootVarGet
(
vxLongName Name,            /* I: root object name */
svxVariable   *Variable   /* I/O: variable data */
)
/*
DESCRIPTION:
Searches the specified root object in the active file
for the variable named "Variable->Name".

The value of the specified variable is output via 
"Variable->Value" in database units (mm, deg).
The "isDistance" parameter is not set by this function.

If "Variable->Name" is a string variable, the associated 
text is output via "Variable->Expression".  Strings longer 
than 256 bytes are truncated.  

NOTE that "Variable->Expression" is not used to output the 
expression that defines a variable.  It is used to output 
text associated with a "string" variable.

Returns 1 if function fails; 0 if it succeeds.
*/
________________________________________________________________________________

int cvxRootVarSet
(
vxLongName Name,            /* I: root object name */
int Count,               /* I; number of variables */
svxVariable *Variables,   /* I: list of variables */
int Working                /* I: 1 to display "Working..." message, else 0 */
)
/*
DESCRIPTION:
Updates the variables (e.g. dimensions, parameters) specified 
by "Variables" in the specified root object within the active
file.  The root object is then regenerated.

You can disable the object regeneration normally performed by
this function by inputing "Working = -1".

A field of a history operation's input data is identified by a
variable name encoded as follows (brackets included):

      

Part attributes may be modified using the following variable names,
with the new attribute value or data assigned to the "Expression" field
of the "svxVariable" data structure.

      part_number, part_class, part_designer, part_cost, part_supplier
      part_description, part_keyword, part_manager, part_material

User-defined data stored in a part's attributes can be modified
using a variable name composed from "part_" and a user-data label.
For example, if an item of user data were labeled "my_data", the
corresponding variable name would be "part_my_data".  The new user
data would be defined via the "Expression" field of the "svxVariable"
data structure.

The part "density" attribute is modified via the variable name "part_density".
The new density (kg/mm3) is defined via the "Value" field of the "svxVariable"
data structure.

The color of all faces in a part may be modified via the "part_color"
variable with "Expression" set to "Aluminum", "Brass", "Bronze", "Copper",
"Silver", "Steel", "Stainless", "Gold", "Gray", "Red", "Green", "Blue",
"Brown", "Orange" or RGB values (0-255) encoded as "R.G.B" (e.g. 136.255.0).

Custom variables :
Expression format of string type :"\"str\"";
Expression format of point type :"Point(1,2,3)";
Expression format of vector type :"Vector(1,2,3)";

If the type of variable is set to 0,then the sub_type must be set,else ignore.
If the sub_type of variable is set to 1 or 2,then the unit_type must be set,else ignore.

evxUnitType for length unit and evxAngUnitType for angle unit.

Returns 1 if function fails; 0 if it succeeds.
*/
________________________________________________________________________________

void cvxRootVisibility
(
vxLongName Name,  /* I: root object name */
int Visible         /* I: 1 to show; 0 to hide */
)
/*
DESCRIPTION:
If "Visible = 0", suppress display of the specified 
root object in the root object browser.

If "Visible = 1", enable display of the specified
root object in the root object browser.

If is assumed "Name" identifies a valid root object
in the active file.
*/
________________________________________________________________________________