Cad Library Functions

 

CdAddGeom CdAddGeomList CdBinActivate CdBlankObj
CdBlockCreate CdDispRedraw CdDraw CdDtmCreate
CdDxAddTo CdDxReadF CdDxWriteF CdEchoDel
CdEchoDraw CdEchoEnd CdErase CdInstPartII_Mat
CdLine3Create CdNameInUse CdNrbGet CdObjAddTo
CdObjEdit CdObjGetMat CdObjGetName CdObjSetMat
CdObjSetName CdPrjClear CdTargActivate CdTargAddFtr
CdTargAddTo CdTargLyrGetNum CdTargLyrIsUsed CdTargLyrNum
CdTargLyrStatus CdTargObjAct CdTargPathAct CdTargUpdBrep
CdTargUpdTt CdTtTouch CdTxtEdit CdTxtEditor
CdXnBegin CdXnEnd TtUpdAttrib VxAsgnObjToLyr
VxInpAng VxInpBox VxInpDir VxInpDst
VxInpDstList VxInpEnt VxInpGeom VxInpGeomEnt
VxInpInt VxInpLine VxInpListIdx VxInpNum
VxInpNumList VxInpOh VxInpPnt VxInpPntList
VxInpTtRef VxInpTtRefs VxInpVal VxLogDir
VxLogNum VxLogPnt

 

 


 CdBinActivate

int CdBinActivate(OmName, int, int *)
OmName name i
name for new bin 
int confirm i
1-get user confirmation, else 0 
int *created o
1-new bin created, 0-existing bin activated, or
-1-no bin created or activated 

Description

   Make the specified bin the target bin for new objects.  If the bin
   doesn't exist, create a new bin with the specified name and activate it.
   If "confirm=1", confirm that the user wants to create the new bin
   before actually doing it. If the user says not to create the bin,
   return without error.


  The input name may be modified by this function (it might append an   extension to it).
  If you want to force CdBinActivate() to search a specified directory   for "name", use DmPathActive() to log the directory you want searched   first -- or call DmPathSet() with the directory name.
  If VgInteract is false, then the user is not prompted for anything,   including the case where the file is out of sync with it's source file.   In this case, simply remove the out of sync file and return. Some error   messages are also suppressed in this case. This is used for QA testing.     Return 1 if error, else 0.

Memory-Management

 

Caveats

 

 Top


 CdBlankObj

int CdBlankObj(VsObjHandle *, int, int, int *)
VsObjHandle *oh i
object handle 
int option i
0-blank, 1-unblank, -1-swap visibility 
int disable_xn i
1-disable transaction logging, else 0 
int *modified o
1 if object visibility modified, else 0 

Description

Blank, unblank, or swap the visibility of the specified object (oh).
This function assumes the proper object-to-world transform is set 
up to, but not including, the transform of the specified object (oh).
Undo-redo transaction logging is disabled if "disable_xn=1".


This function will not modify the visibility of any object whose layer is OFF, based on the flags stored in the active layer visibility table (VgLyrVisibility). Return 1 if error, else 0.

Memory-Management

 

Caveats

 

 Top


 CdBlockCreate

int CdBlockCreate(OmName , VsObjHandle *)
OmName name i
block name 
VsObjHandle *oh o
object handle 

Description

Create an empty block object and output a handle to it.  
Return 1 if error, else 0.

Memory-Management

 

Caveats

 

 Top


 CdDispRedraw

void CdDispRedraw(void)

 

Description

Redraw view(s) if display update isn't disabled and if a redraw
isn't going to be forced at the end of the current transaction (VgInRedraw=1).
Traversal of the active input form is disabled.
Return 1 if error, else 0.

Memory-Management

 

Caveats

 

 Top


 CdDraw

void CdDraw(VsObjHandle *)
VsObjHandle *oh i
object handle 

Description

Draw the specified object and log the appropriate display transaction.
It is assumed the object's bin is active and that the display context
and pipeline are up-to-date for the object's path.

Memory-Management

 

Caveats

 

 Top


 CdDtmCreate

int CdDtmCreate(int,OmName,VsMat3 *,VsWireAt *,int,VsObjHandle *)
int dsp_mode i
0-display XY axes, 1-display rectangle 
OmName name i
name 
VsMat3 *mat i
transformation matrix (identity if NULL) 
VsWireAt *at i
wire attributes 
int idx_data i
data object (VDATA) 
VsObjHandle *oh o
object handle 

Description

Create a VDTM object and output a handle to it.  
Return 1 if error, else 0.


OBJECT_REVISION: If the new fields in your object need to be initialized at creation time to something other than zero, you must do so below.

Memory-Management

 

Caveats

 

 Top


 CdDxAddTo

int CdDxAddTo(void *, VsDxEnt *)
void *dx i
data exchange info (VsDxInfo *) 
VsDxEnt *ent i
entity data 

Description

Add the specified entity to the active target object.
Return 1 if fatal error, else 0.

Memory-Management

 

Caveats

 

 Top


 CdDxReadF

int CdDxReadF(VsDxInfo*,short,int(*)(VsDxInfo*))
VsDxInfo *dx i
data exchange info 
short class i
target object class 
int (*(CBFnc))(VsDxInfo*) i
non-native callback function 

Description

Read the file specified by "dx->path" using the translation method specified in
"dx->method".


Translator-specific options are passed into this function via "dx->options". If a file,object name is specified in "dx->object", activate/create it and read the data into this object whether or not a file or object is currently active. If no file,object name is specified, but there is an active object, read the data into this active object.
If no file,object name is specified, and there is no active object, create a new file and object of the specified class (VPART, VSHEET, VPROF) and read the data into this object.  The names of the new file and object will be based on the fileName being imported.
If there is an active object and the specified file,object name is a different object but in the same file, activate/create the object name in this file and

Memory-Management

 

Caveats

 

 Top


 CdDxWriteF

int CdDxWriteF(OmName,OmName,VsDxInfo *,int,int(*)(VsDxInfo*))
OmName bin_name i
root bin name 
OmName obj_name i
root object name 
VsDxInfo *dx i
data exchange info 
int opt i
options 
int (*(CBFnc))(VsDxInfo*) i
non-native callback function 

Description

Write the specified root object to the specified file (dx->path)
in the specified format (dx->method).   


If "dx->path" doesn't contain a directory name , the output file is placed in the current directory.
If "dx->path" doesn't contain a file name, a file name is composed from the object name.
If "obj_name[0]=0", the active target object is written.  Otherwise, the specified object is written.
Components of the specified object will be written if "dx->flg & V_DX_TravComp". Translator-specific options are passed into this function via "dx->options". Messages should be logged using "dx->log()".

Memory-Management

 

Caveats

 

 Top


 CdEchoDel

void CdEchoDel(VsObjHandle *)
VsObjHandle *oh_echo i
pointer to form's echo object handle 

Description

Erase, then delete, the specified echo object.
The echo object should be flagged as highlighted in its attribute 
bundle(s) so that it does not rely on inheriting its display attributes 
from the global context.


The input handle is zero'd after the echo object is deleted. This function assumes all echos are contained in the PRJ_BIN. This function saves and restores the active bin.
This function has no return value.  If an error occurs, it is reported before this function returns.

Memory-Management

 

Caveats

 

 Top


 CdEchoDraw

void CdEchoDraw(VsObjHandle *)
VsObjHandle *oh_echo i
pointer to form's echo object handle 

Description

Draw the specified echo object.
The echo object should be flagged as highlighted in its attribute 
bundle(s) so that it does not rely on inheriting its display 
attributes from the global context.


This function has no return value.  If an error occurs, it is reported before this function returns.
This function assumes the bin containing the echo object is active when this it is called.

Memory-Management

 

Caveats

 

 Top


 CdEchoEnd

void CdEchoEnd(VsObjHandle *)
VsObjHandle *oh_echo i
pointer to form's echo object handle 

Description

Erase, then delete, the specified echo object.
The echo object should be flagged as highlighted in its attribute 
bundle(s) so that it does not rely on inheriting its display attributes 
from the global context.


The input handle is zero'd after the echo object is deleted. This function assumes all echos are contained in the PRJ_BIN. This function saves and restores the active bin.
This function has no return value.  If an error occurs, it is reported before this function returns.

Memory-Management

 

Caveats

 

 Top


 CdErase

void CdErase(VsObjHandle *)
VsObjHandle *oh i
object handle 

Description

Erase the specified object and log the appropriate display transaction.
It is assumed the object's bin is active and that the display context
and pipeline are up-to-date for the object's path.

Memory-Management

 

Caveats

 

 Top


 CdInstPartII_Mat

int CdInstPartII_Mat(char*,VsMat3*)
char *sPart i
part specification as "file,part" or "part" 
VsMat3 *zMat i
transformation matrix that locates part 

Description

Instance the specified part at the specified location.

Memory-Management

 

Caveats

 

 Top


 CdLine3Create

int CdLine3Create(VsLine *, VsWireAt *, VsObjHandle *)
VsLine *gm i
3D line geometry 
VsWireAt *at i
line attributes 
VsObjHandle *oh o
handle to new object 

Description

Create a 3D line object.
If "at=NULL", the object's attribute bundle is zero'd.
Return 1 if error, else 0.


OBJECT_REVISION: If the new fields in your object need to be initialized at creation time to something other than zero, you must do so below.

Memory-Management

 

Caveats

 

 Top


 CdNameInUse

int CdNameInUse(OmName, int)
OmName name i
name to check 
int log_err i
1-log error messages, else 0 

Description

   If the specified name is already in-use in the specified target,
   or has a bad syntax, return 1.  Otherwise, return 0.


  Error messages are logged if the name has a bad syntax or is in-use.   Components are not traversed during the name search.

Memory-Management

 

Caveats

 

 Top


 CdNrbGet

int CdNrbGet(VsObjHandle *, int, int, int, VsGeomEnt *)
VsObjHandle *oh i
object for which NURBS data is desired  
int instance i
1-instance NURBS data if possible, else 0 
int force_3d i
1-retrieve 2D curves in 3D format, else 0 
int transform i
transform to apply to NURBS data 
VsGeomEnt *ent o
NURBS data 

Description

Attempt to retrieve NURBS data for the specified object.  If the data
is retrieved successfully, "ent->type" will be set to V_CURVE or 
V_SURFACE and "ent->geom" will point to a "VsNurbCurv" or "VsNurbSurf"
structure allocated by this function.  If the data could not be 
retrieved, "ent->geom" will be set to NULL (no error message is logged).
If "instance=1", this function will attempt to reference the NURBS 
variable-length data directly from the object database.  If it cannot
reference the data directly, it will return a copy.


If "instance=0", a copy of the NURBS data is always made. If "transform=0", no transform is applied to the geometry. If "transform=1", the geometry is transformed from its local space to world space.
If "transform=2", the geometry is transformed from its local space to the space of the active target object (VgTargObj). If "transform=3", the geometry is transformed from world space to object space.
If "transform=4", the geometry is transformed from target space to object space.
If the NURBS data is instanced, the object bin associated with "oh" should remain designated as one of the target bins (PRJ_BIN, SRC_BIN,...). Otherwise, the instanced NURBS data could be swapped out of memory. Use "CdNrbFree()" to properly free/unlock the NURBS data associated with "ent".
Return 1 if error, else 0.

Memory-Management

 

Caveats

 

 Top


 CdObjAddTo

int CdObjAddTo(VsObjHandle *, VsObjHandle *)
VsObjHandle *oh i
child object handle 
VsObjHandle *poh i
parent object handle 

Description

Add the specified child object (oh) to the specified parent object (poh).
Return 1 if error, else 0.

Memory-Management

 

Caveats

 

 Top


 CdObjEdit

int CdObjEdit(VsTargObj *, int, int, OmName)
VsTargObj *trg i
spec. for new target object 
int create_obj i
1-create new object, 0-use existing object 
int no_bin_specified i
1-user did not specify an object bin, else 0 
OmName template i
optional name of template for new objects 

Description

Create or activate a new target object.  If an object is being created
from within a parent object, it is added to the parent object directly
or via a "component" object reference.  If an object is being activated
from within a parent object, it is instanced into the parent object via
a "component" object.


This input data structure (trg) contains a bin name (bin), an object name (name), a pick-path (path) and an object class id (class). If only "name" is specified, the user is requesting 1) creation of a new bin if "VgTargObj->bin" is not specified or 2) creation of a new root object of type "class" if "VgTargObj->bin" is specified, or 3) creation of a new object of type "class" to be added as a sub-object of the active target object.  The sub-object is added to the active target object via a component object, where appropriate.
If "bin" and "name" are specified, "create_obj=0" and no "path" is specified, the user is activating an existing root object as the new target object for edits.  If a parent object is active, the object is instanced into the parent object via a component record. If "bin" and "name" are specified, "create_obj=1" and no "path" is specified, the user is creating a new root object and activating it for edits.  If there is a parent object, the new object is added to the parent object via a component object, where appropriate. If "bin", "name" and "path" are specified, the user is activating the last object in "path" as the target object for edits.
The bin that contains the target object for edits should be activated as TRG_BIN.  When "path" is specified, TRG_BIN is not necessarily the same as the root bin (bin) because a path may pass from one bin to another.
If "name" is set to an asterisk character (*), an un-named object of the specified class is created, unless it is a root object, in which case an error message is logged telling the user that root objects require valid names. Return 1 if error, else 0.

Memory-Management

 

Caveats

 

 Top


 CdObjGetMat

int CdObjGetMat(int , VsMat3 *)
int idx_obj i
object index 
VsMat3 *mat o
transformation matrix 

Description

If the specified index is less than 1 or the associated object doesn't
have a transform, the identity matrix is output. 
Return 1 if error, else 0.

Memory-Management

 

Caveats

 

 Top


 CdObjGetName

void CdObjGetName(VsObjHandle *, OmName )
VsObjHandle *oh i
object handle 
OmName name o
object name 

Description

Get the name of the specified object.  If the object doesn't have 
a name, put the object index in the output string.  If the object
cannot be located, put "invalid #" in the output string.
If the object index is less than zero, output a blank string.

Memory-Management

 

Caveats

 

 Top


 CdObjSetMat

int CdObjSetMat(VsObjHandle *, VsMat3 *)
VsObjHandle *oh i
object handle 
VsMat3 *mat i
transformation matrix 

Description

Set the specified object's transformation matrix.
Return 1 if error, else 0.

Memory-Management

 

Caveats

 

 Top


 CdObjSetName

int CdObjSetName(VsObjHandle *, OmName)
VsObjHandle *oh i
object handle 
OmName name i
object name 

Description

Set the name of the specified object. 
Return 1 if error, else 0.

Memory-Management

 

Caveats

 

 Top


 CdPrjClear

int CdPrjClear(int )
int confirm i
1-get user confirmation before proceeding, else 0 

Description

Clear the active project.
Return 1 if error, else 0.

Memory-Management

 

Caveats

 

 Top


 CdTargActivate

int CdTargActivate(void)

 

Description

   Make sure there is an active target object, make sure the path of
   the target object is active and make sure TRG_BIN is active.
   Return 1 if there is a problem, else 0.

Memory-Management

 

Caveats

 

 Top


 CdTargAddFtr

int CdTargAddFtr(int,char *,int,VsObjHandle *,VsObjHandle *)
int idx_in i
input VDATA object (located in PRJ_BIN) 
char *name i
optional feature name (or "") 
int cnt i
count of objects associated with feature 
VsObjHandle *list i
list of objects associated with feature 
VsObjHandle *oh_ftr o
feature handle 

Description

   Add/Regen the feature object defined by "idx_in" and "name" in the
   target object.


  Output a handle to the new/regen'd feature object.   Return 1 if error, else 0.

Memory-Management

 

Caveats

 

 Top


 CdTargAddTo

int CdTargAddTo(VsObjHandle *, int )
VsObjHandle *oh i
object handle 
int idx_data i
index of VDATA object (-1 if not defined) 

Description

   Add the specified object to the active target object.
   Return 1 if error, else 0.

Memory-Management

 

Caveats

 

 Top


 CdTargLyrGetNum

int CdTargLyrGetNum(OmName, int *)
OmName name i
layer name 
int *num o
layer number 

Description

Get the number of the layer object associated with the specified layer name.
Only layers of the active target object are searched.


If no layer corresponding to the specified layer number is found, "num = -1" is output.  No error message is logged. Return 1 if error, else 0.

Memory-Management

 

Caveats

 

 Top


 CdTargLyrIsUsed

int CdTargLyrIsUsed(int)
int num i
layer number 

Description

Return the status of the specified layer.  If the layer doesn't 
exist or there is an error, return "status = -1."  If the layer 
is empty, return "status=0." If the layer exists and is not empty, 
return "status=1."

Memory-Management

 

Caveats

 

 Top


 CdTargLyrNum

int CdTargLyrNum(uchar *layer)
uchar *layer o
layer number that isn't being used 

Description

Output the number (0-255) of a layer that is not in-use within the
target object.
Return 1 if error, else 0.

Memory-Management

 

Caveats

 

 Top


 CdTargLyrStatus

int CdTargLyrStatus(OmName, int *)
OmName name i
layer name 
int *status o
layer status (see DESCRIPTION) 

Description

Get the status of the specified layer.  If the layer doesn't exist,
output "status = -1."  If the layer is empty, output "status=0."
If the layer exists and is not empty, output "status=1."
Return 1 if error, else 0.

Memory-Management

 

Caveats

 

 Top


 CdTargObjAct

int CdTargObjAct(VsTargObj *, VsTargObj *)
VsTargObj *new_targ i
new target object data 
VsTargObj *old_targ o
old target object data 

Description

Activate the target specified by "new_targ".  Output information 
about the old target via "old_targ" if "old_targ != NULL". 


This function does not update the GUI menus to reflect the change in target object.  Call CdGuiUpdate() after calling this function if you want the menus updated. Return 1 if error, else 0.

Memory-Management

 

Caveats

 

 Top


 CdTargPathAct

int CdTargPathAct(VsPickPath *, VsPickPath *)
VsPickPath *new_ppath i
new target path 
VsPickPath *old_ppath o
old target path (ignored if input as NULL) 

Description

Activate the last target object in the specified path (new_ppath) and 
output the path of the active target object.  It is assumed that the
new target path begins in the same root bin as the active target path
unless the new target path has a root bin name encoded in it.  In 
that case, the original target path should have a root bin name 
encoded in it also, in order for it to re-activate the original
root bin properly.


If "old_path" is input as NULL, the old target path is not output. This function does not update the GUI menus to reflect the change in target object.  Call CdGuiUpdate() after calling this function if you want the menus updated. Return 1 if error, else 0.

Memory-Management

 

Caveats

 

 Top


 CdTargUpdBrep

int CdTargUpdBrep(void)

 

Description

   Update the target object's B-rep from the active topology table.
   An undo-redo operation is logged indicating that the topology table
   and object database where modified during the current transaction.
   That way, if the database's b-rep is undone, the active topology
   table is cleared, so that it is re-synched with the database the
   next time it is used.


  This function assumes the target path is active.   Return 1 if error, else 0.

Memory-Management

 

Caveats

 

 Top


 CdTargUpdTt

int CdTargUpdTt(VsApplTopTable **)
VsApplTopTable **tt o
pointer to active topology table 

Description

   Activate the target object path and update the active topology table
   from the target object.  Output a pointer to the active topology table.
   This function assumes the target object has a valid VBREP object as a 
   sub-object.


  Return 1 if error, else 0.

Memory-Management

 

Caveats

 

 Top


 CdTtTouch

int CdTtTouch(void)

 

Description

Log an undo-redo operation that indicates that the active
topology table will be modified by subsequent operations.
Return 1 if error, else 0.

Memory-Management

 

Caveats

 

 Top


 CdTxtEdit

void CdTxtEdit(char *, int)