gCAD3D 2.35
xa.c File Reference

main application functions; not depending on GUI. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <stdarg.h>
#include "../ut/ut_cast.h"
#include "../ut/ut_geo.h"
#include "../ut/ut_txt.h"
#include "../ut/ut_txfil.h"
#include "../ut/ut_err.h"
#include "../ut/ut_os.h"
#include "../ut/gr_types.h"
#include "../gui/gui__.h"
#include "../ut/func_types.h"
#include "../db/ut_DB.h"
#include "../ut/ut_txTab.h"
#include "../xa/xa_uid.h"
#include "../xa/xa_ui.h"
#include "../xa/xa_sele.h"
#include "../xa/xa_msg.h"
#include "../xa/xa.h"
#include "../xa/xa_mem.h"


#define extern


 UtxTab_NEW (AP_TxTab1)
int AP_typ_typChar (char typChar)
int AP_tmr_CB__ (void *data)
int AP_mdl_modified_ck ()
int AP_mdl_modified_reset ()
int AP_mdl_modified_set ()
int AP_mdlbox_invalid_ck ()
int AP_mdlbox_invalid_set ()
int AP_mdlbox_invalid_reset ()
int AP_dump_statPg (char *txt)
int AP_errText_set (char *txt)
int AP_errStat_reset (int mode)
int AP_stat_file (int mode, FILE *fp1)
void AP_deb_stat (int mode)
void AP_deb_print (char *format,...)
int AP_errStat_set (int stat)
int AP_errStat_get ()
int AP_sysStat_get ()
int AP_Mod_open (int mode, char *fNam, char *dNam, char *title, char *sf)
int AP_open__ (char *fNam, char *dNam, char *title, int mode)
int AP_save_ex (int mode)
int AP_save__ (int mode, char *fTyp)
int AP_src_new (int mode)
int AP_src_mod_ed (long lNr)
int AP_APT_sysed ()
int AP_SRC_mem_edi ()
int AP_SRC_edi_mem ()
int AP_APT_clean ()
int AP_obj_delCk1 (long *lNr)
long AP_cre_defHdr (int typ, int istart)
int AP_cut_defHdr (int *typ, long *dbi, char *cbuf)
int AP_init__ ()
int AP_testdll__ (int mode)
int AP_tmr_init ()
int AP_defLoad (int mode)
int AP_Init1 ()
int AP_Init2 (int dbMode)
int AP_Init_planes ()
int AP_exit__ ()
int AP_defaults_write ()
int AP_defaults_dir ()
int AP_SetCol__ (ColRGB *cSel)
int APcol_actColTra (ColRGB *newCol)
int APcol_actCol__ (ColRGB *cSel)
int AP_SetCol3i (int cr, int cg, int cb, int mode)
int AP_colSel (ColRGB *cSel)
int AP_defaults_read ()
int AP_DllLst_write ()
int AP_get_dir_open (char *cbuf)
int AP_get_fnam_symDir (char *cbuf)
int AP_get_modnam (char *cbuf)
int AP_set_dir_open (char *newDir)
int AP_set_dir_save (char *newDir)
int AP_set_modsiz (double newssiz)
int AP_work__ (char *cmd, char *cmd1)
int AP_exec_dll (char *cbuf)
int AP_ck_ftyp (char *ftyp)
int AP_i2ftyp (char *ftyp, int ift)
int AP_decode_fnam (char *fNam, char *path, char *fnTot)
int AP_split_fnam (int imod, char *cbuf)
int AP_Mod_load (int mode)
int AP_debug__ (char *module_info)
int AP_search_init ()
long AP_hili_obj (char *cbuf)
int AP_vec_txt (Vector *vco, char *p1)
int AP_get_nxtVec (int mode)
int AP_test__ ()
int AP_Get_scale (double *scl)
int AP_Set_scale (double scl)
int AP_Get_Setup (char *cbufo, char *ctyps)
int AP_Set_ConstPl_Z (char *cbuf)
int AP_Get_ConstPl_vz (Vector *vc)
char * AP_Get_ConstPl_Z (int typ)
int AP_PT2EyeBp (char *plnTyp, Point *p1, Point *p2, Point *p3, Vector *vcs)
int AP_PT2EyePln (Point *pt, char *plnTyp, Point *p1, Point *p2, Point *p3, Vector *vcs)
int ACT_ck_act (long dli)
void GR_tmpSym (int typ, Point *pt1)


int UI_InpMode
int UI_block_inp
int ED_lnr_act
int APT_line_act
int UP_level
int APT_obj_stat
char UI_fnamFilt [80]
int SRC_ato_anz
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! More...
int * SRC_ato_typ =NULL
double * SRC_ato_tab =NULL
int SRC_ato_SIZ
 size of aus_typ & aus_tab More...
int WC_modact_ind = -1
Point WC_mod_ori
 der Model-Origin More...
Plane WC_sur_act
 the active construction-plane More...
double WC_sur_Z = 0.0
 active Z-value of WC_sur_sur; More...
int WC_sur_ind = 0
 Der Index auf die ActiveConstrPlane. More...
Mat_4x3 WC_sur_mat
 TrMat of ActiveConstrPlane. More...
Mat_4x3 WC_sur_imat
 inverse TrMat of ActiveConstrPlane More...
char WC_ConstPl_Z [16]
 ConstPl-Z-axis (DZ, ...R20 ... More...
int AP_src = AP_SRC_EDI
 AP_SRC_MEM or AP_SRC_EDI. More...
double AP_txsiz = 3.5
 Notes-Defaultsize. More...
double AP_txdimsiz = 2.5
 Dimensions-Text-Defaultsize. More...
int AP_txNkNr = 2
 Nachkommastellen. More...
ColRGB AP_actcol
 the active color .. More...
ColRGB AP_defcol
 die DefaultColor des aktiven (sub)Model More...
int WC_stat_bound = OFF
 ON OFF; Draw boundary of Flächen J/N. More...
int AP_argNr
char ** AP_argv
double AP_scale
int AP_ED_cPos =0
 die aktuelle CharPos im Edi. More...
char AP_ED_oNam [64]
 objectName of active Line More...

Detailed Description

main application functions; not depending on GUI.

AP_get_fnam_symDir get filename of symbolic directories (dir.lst)
AP_stat__ get/set AP_stat
AP_debug__ stop in debug
AP_test__ "Ctl shift T"
AP_dump_statPg dump active subModel, active lineNr
AP_mdl_modified_ck check if model is modified
AP_mdl_modified_set set model is modified
AP_mdl_modified_reset set model is unmodified
AP_mdlbox_invalid_ck check if modelbox is valid
AP_mdlbox_invalid_set set modelbox not valid
AP_mdlbox_invalid_reset set modelbox = valid
AP_ck_ftyp get filetyp(int) (Model|Mockup|Image)
AP_i2ftyp get filetyp(txt)
AP_APT_sysed modify line ED_lnr_act with system-editor
AP_SRC_mem_edi copy Editor --> memory (if necessary)
AP_SRC_edi_mem copy memory --> Editor
AP_src_new clear src-Memory, reset Undo, Hide, View-Plane, ConstrPlane
AP_src_mod_ed modify line in memory with system-editor
AP_APT_clean remove deleted lines
AP_obj_delCk1 check if line has depending lines
AP_cre_defHdr create new free ObjHeader
AP_cut_defHdr extract header
AP_lNr_inc increment AP_ED_lNr
AP_lNr_get returns AP_ED_lNr
AP_typ_2_bastyp give basictyp from typ (SURRU -> Typ_SUR; Typ_CVBSP -> Typ_CV)
AP_cmp_typ check if types identical;
AP_typ_typChar make typ from typChar ("P" -> Typ_PT)
AP_typChar_typ make typChar from typ (Typ_PT -> 'P')
AP_vec_txt give vector from Textvec
AP_get_nxtVec returns DB-index of next|previous Vector
AP_hili_obj hilite obj
AP_Get_ConstPl_Z returns ConstrPln or its Z-vec
ACT_ck_act check and activate activity.
APcol_actColTra set new active colour and transparency
APcol_actCol__ set new active colour
Col_set_3db colour from 3 doubles
Col_set__ create colour from red,green,blue
Col_DL_Att get pointer -> Color out of DL_Att INLINE
Col_set_vsym set style, symbolic|shaded
AP_SetCol__ set default color
AP_SetCol3i set color
AP_colSel select color
AP_DllLst_write write list of plugins
AP_save_ex save model at exit model
AP_save__ save model
AP_work__ work startparameters
AP_defLoad load DefaultModel
AP_defaults_write defaults -> tmp/xa.rc
AP_defaults_dir defaultdirs -> xa/dir.lst
AP_defaults_read read defaults aus <base>/tmp/xa.rc
AP_Get_Setup read line out of gCAD3D.rc

Macro Definition Documentation

#define extern

Function Documentation

UtxTab_NEW ( AP_TxTab1  )
int AP_typ_typChar ( char  typChar)
AP_typ_typChar make typ from typChar ("P" -> Typ_PT)
Error: returns Typ_Error
AP_typChar_typ make typChar from typ (Typ_PT -> 'P')
int AP_tmr_CB__ ( void *  data)
int AP_mdl_modified_ck ( )
AP_mdl_modified_ck check if model is modified
0 = model is unmodified
1 = model is modified
int AP_mdl_modified_reset ( )

AP_mdl_modified_reset set model is unmodified

int AP_mdl_modified_set ( )

AP_mdl_modified_set set model is modified

int AP_mdlbox_invalid_ck ( )
AP_mdlbox_invalid_ck check if modelbox is valid
0 = modelbox is valid
1 = modelbox is not valid
int AP_mdlbox_invalid_set ( )

AP_mdlbox_invalid_set set modelbox not valid (not initialized)

int AP_mdlbox_invalid_reset ( )

AP_mdlbox_invalid_reset set modelbox = valid

int AP_dump_statPg ( char *  txt)
int AP_errText_set ( char *  txt)
int AP_errStat_reset ( int  mode)
reset errors
mode 0=reset only temporary errors (from CAD in temp-mode)
mode 1=reset
int AP_stat_file ( int  mode,
FILE *  fp1 

write|read AP_box_pm1,2 AP_stat-bits mdl_modified and mdl_box_valid

void AP_deb_stat ( int  mode)
mode 1 start debug; open debugfile;
0 end debug; close debugfile
print into debugfile with "printd"
debugfile = <tmpdir>debug.dat = ~/gCAD3D/tmp/debug.dat
void AP_deb_print ( char *  format,

print-formatted in debug-mode

int AP_errStat_set ( int  stat)
raise error
0 = default = OK;
1 = Error - raise error; set AP_stat.errStat=1;
2 = DB_allocCDAT; rerun.
int AP_errStat_get ( )
int AP_sysStat_get ( )
int AP_Mod_open ( int  mode,
char *  fNam,
char *  dNam,
char *  title,
char *  sf 
AP_Mod_open open file, with directorySelect, filter, waiting.
1 set AP_dir_open, AP_sym_open; do not set WC_modnam
2 do not modify AP_dir_open, AP_sym_open, WC_modnam
title of window
sf filtertext
retCode 0=OK, -1=Cancel, -2=fSiz/dSiz too small
int AP_open__ ( char *  fNam,
char *  dNam,
char *  title,
int  mode 
int AP_save_ex ( int  mode)
int AP_save__ ( int  mode,
char *  fTyp 
int AP_src_new ( int  mode)

clear src-Memory, reset Undo, Hide, View-Plane, ConstrPlane. mode 0=inital (during startup) 1=new model

int AP_src_mod_ed ( long  lNr)
zeile im mem modifizieren; mit dem SystemEditor.
see also ED_sysed__
int AP_APT_sysed ( )
int AP_SRC_mem_edi ( )
int AP_SRC_edi_mem ( )
int AP_APT_clean ( )
int AP_obj_delCk1 ( long *  lNr)
long AP_cre_defHdr ( int  typ,
int  istart 
create ObjHeader zB "P20="
wc3-Source: ED_add_objInd
int AP_cut_defHdr ( int *  typ,
long *  dbi,
char *  cbuf 
extract header from Definitionline
see also APED_dbo_oid
cbuf Definitionline
typ, dbi
int AP_init__ ( )
int AP_testdll__ ( int  mode)
int AP_tmr_init ( )
int AP_defLoad ( int  mode)

load DefaultModel tmp/Model Input: mode 0 load tmp/Model mode 2 load tmp/Model_* (reload) see also AP_Mod_load

int AP_Init1 ( )

init DL, ED, WC

int AP_Init2 ( int  dbMode)

clear DB & DL

dbMode 0: komplettes Init (alles) 1: alles ausser basicModels initialisieren 2: nur dyn-objects resetten

int AP_Init_planes ( )
init View-Plane and ConstrPlane
int AP_exit__ ( )
int AP_defaults_write ( )

defaults -> cfg/xa.rc

int AP_defaults_dir ( )

defaultdirs -> cfg/dir.lst

int AP_SetCol__ ( ColRGB cSel)
set defaultColour to new colour
int APcol_actColTra ( ColRGB newCol)
APcol_actColTra set new active colour and transparency
see also APcol_actCol__ (clears transparency)
int APcol_actCol__ ( ColRGB cSel)
APcol_actCol__ set new active colour
get ColRGB from r,g,b: Col_set__
see also UI_colSel
int AP_SetCol3i ( int  cr,
int  cg,
int  cb,
int  mode 
cr red part of colour; 0-255
cg green part of colour; 0-255
cb blue part of colour; 0-255
mode 1 set defaultColour to new colour
int AP_colSel ( ColRGB cSel)
define default-color
int AP_defaults_read ( )

read defaults from <base>/tmp/xa.rc

int AP_DllLst_write ( )
int AP_get_dir_open ( char *  cbuf)
int AP_get_fnam_symDir ( char *  cbuf)

AP_get_fnam_symDir get filename of list of symbolic directories

int AP_get_modnam ( char *  cbuf)
int AP_set_dir_open ( char *  newDir)

sets AP_dir_open & AP_sym_open from newDir

int AP_set_dir_save ( char *  newDir)
int AP_set_modsiz ( double  newssiz)
int AP_work__ ( char *  cmd,
char *  cmd1 
int AP_exec_dll ( char *  cbuf)

start DLL Input: name of the dll without directory & filetyp

int AP_ck_ftyp ( char *  ftyp)
returns ftyp as int; 0=native=Mtyp_Gcad, 1=Mtyp_DXF, 2=Mtyp_Iges, ..
see also AP_i2ftyp ((int) -> (text))
int AP_i2ftyp ( char *  ftyp,
int  ift 
returns ftyp as text from int
txt-> i m. AP_ck_ftyp
int AP_decode_fnam ( char *  fNam,
char *  path,
char *  fnTot 

separate -> AP_dir_open & WC_modnam;

int AP_split_fnam ( int  imod,
char *  cbuf 
separate -> AP_dir_open|AP_dir_save & WC_modnam;
returns filetyp as int
imod 1=open, 2=save
int AP_Mod_load ( int  mode)
load Model from file <AP_dir_open><WC_modnam>
mode 0 = load neu
mode 1 = insert; do not write Title & do not rescale
int AP_debug__ ( char *  module_info)
stop here in debug-mode; in core; with Alt-X
in .gdbinit (gCAD3D.gdb); must start with: "gdb gCAD3D.exe -x gCAD3D.gdb"
module_info text in which plugin/dll the stop occurs
Purpose: eg set "watch <varnam>" after startup is done (saves time)
int AP_search_init ( )
long AP_hili_obj ( char *  cbuf)
hilite Obj from cbuf = DefLn od Header; eg "L25=..."
see also UI_hili_actLn IE_cad_Inp_disp
cbuf = Definitionline (eg "M20=")
RetCode: -2 object does not have a dispListobj (vector, variable, ..)
-1 Error; objID not found in DL
>= 0 the DL-index of the obj hilited
int AP_vec_txt ( Vector vco,
char *  p1 
give vector-struc from vector-text (only Standardvectors & planes)
int AP_get_nxtVec ( int  mode)
int AP_test__ ( )
int AP_Get_scale ( double *  scl)
int AP_Set_scale ( double  scl)
int AP_Get_Setup ( char *  cbufo,
char *  ctyps 

get line from gCAD3D.rc

int AP_Set_ConstPl_Z ( char *  cbuf)
int AP_Get_ConstPl_vz ( Vector vc)
char* AP_Get_ConstPl_Z ( int  typ)
typ = 0 returns the active ConstrPln as Text; zB "RZ" or "R22"
typ = Typ_VC returns the Z-vec of the active ConstrPln as Text
int AP_PT2EyeBp ( char *  plnTyp,
Point p1,
Point p2,
Point p3,
Vector vcs 
int AP_PT2EyePln ( Point pt,
char *  plnTyp,
Point p1,
Point p2,
Point p3,
Vector vcs 
int ACT_ck_act ( long  dli)
check if selected obj is connected to interactivity and activate activity.
1=obj has activity, but interactivity is not active
0=Yes, interactivity performed;
-1=No, normal object.
void GR_tmpSym ( int  typ,
Point pt1 

Variable Documentation

int UI_InpMode
int UI_block_inp
int ED_lnr_act
int APT_line_act
int UP_level
int APT_obj_stat
char UI_fnamFilt[80]
int SRC_ato_anz


int* SRC_ato_typ =NULL
used for objTypes in APT_decode_ausdr
in IE: memspc55
double* SRC_ato_tab =NULL
used for objData in APT_decode_ausdr
in IE: memspc54
int SRC_ato_SIZ

size of aus_typ & aus_tab

int WC_modact_ind = -1
Point WC_mod_ori

der Model-Origin

Plane WC_sur_act

the active construction-plane

die aktive Plane

double WC_sur_Z = 0.0

active Z-value of WC_sur_sur;

int WC_sur_ind = 0

Der Index auf die ActiveConstrPlane.

Index auf die ActiveConstrPlane.

Mat_4x3 WC_sur_mat

TrMat of ActiveConstrPlane.

TrMat of ActiveConstrPlane only if (WC_sur_ind > 0)

Mat_4x3 WC_sur_imat

inverse TrMat of ActiveConstrPlane

char WC_ConstPl_Z[16]

ConstPl-Z-axis (DZ, ...R20 ...

int AP_src = AP_SRC_EDI


double AP_txsiz = 3.5


double AP_txdimsiz = 2.5



int AP_txNkNr = 2


ColRGB AP_actcol

the active color ..

ColRGB AP_defcol

die DefaultColor des aktiven (sub)Model

int WC_stat_bound = OFF

ON OFF; Draw boundary of Flächen J/N.

int AP_argNr
char** AP_argv
double AP_scale
int AP_ED_cPos =0

die aktuelle CharPos im Edi.

char AP_ED_oNam[64]

objectName of active Line