gCAD3D 2.35
xa_mod.c File Reference

subModel-managment-functions without GUI More...

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdarg.h>
#include "../ut/func_types.h"
#include "../xa/xa_uid.h"
#include "../gui/gui_types.h"
#include "../ut/ut_geo.h"
#include "../ut/ut_msh.h"
#include "../ut/ut_txt.h"
#include "../ut/ut_txfil.h"
#include "../ut/ut_txTab.h"
#include "../ut/ut_os.h"
#include "../ut/ut_memTab.h"
#include "../ut/ut_cast.h"
#include "../db/ut_DB.h"
#include "../xa/xa_msg.h"
#include "../xa/xa_mem.h"
#include "../xa/xa.h"

Functions

 typedef_MemTab (int)
 
 typedef_MemTab (Point)
 
 typedef_MemTab (Fac3)
 
 typedef_MemTab (EdgeLine)
 
void Mod_chg_CB (char *modNam)
 
int Mod_ck_isMain ()
 
int Mod_mdbi_mdri (long ir)
 
int Mod_mNam_mdb (char *mNam, int *sSiz, int *typ, int imdb)
 
int Mod_mNam_mdr (char *mNam, int *sSiz, int *typ, long irMdl)
 
int Mod_m3_mdr (Mat_4x3 mat1, long irMdl)
 
int Mod_file2model (char *buf, FILE *fpi)
 
int Mod_init__ ()
 
int Mod_mkList (int mode)
 
int Mod_chg_x (char *modNam)
 
int Mod_chg_tit ()
 
int Mod_sav__ (int iCompress, char *filNam, int savActMdl)
 
int Mod_savSubBuf1 (char *modNam, int modSiz)
 
int Mod_sav2file_CB (char *fnam, char *dirNam)
 
int Mod_sav2file__ ()
 
int Mod_LoadSubmodel (char *fnam, char *dirNam)
 
int Mod_LoadFile__ ()
 
int Mod_sav_tmp ()
 
int Mod_init_path ()
 
int Mod_get_path (char *out_path, char *in_path)
 
int Mod_get_ftyp1 (char *fnam)
 
int Mod_get_typ1 (char *txbuf, char *cbuf)
 
int Mod_get_typ2 (char *txbuf)
 
int Mod_get_names ()
 
int Mod_sym_dump ()
 
int Mod_sym_get__ (char *symDir, char *absDir, char *fnam, char *inPath)
 
int Mod_sym_getAbs (char *absDir, char *symDir)
 
int Mod_sym_get1 (char *out_path, char *in_path, int imod)
 
int Mod_sym_get2 (char *out_sym, char *in_path, int imod)
 
int Mod_symOpen_set (char *sym, char *path)
 
int Mod_sym_del (char *sym)
 
int Mod_sym_add (char *sym, char *dir)
 
int Mod_kill__ ()
 
int Mod_load__ (int mode, char *filNam, int dbResiz)
 
int Mod_aload_prc (char *lBuf, int bufSiz, FILE *fpi)
 
int Mod_aload_sm (int mode, char *lBuf, int bufSiz, FILE *fpi)
 
int Mod_del1__ (char *smNam)
 
int Mod_load_allsm ()
 
int Mod_load_sm (int mTyp, char *mnam)
 
int Mod_get_namAll ()
 
int Mod_get_namSub (int parNr, int iLev)
 
int Mod_get_namFil (char *fNam, int parNr, int iLev)
 
int Mod_get_namStore (char *cp, int parNr, int iLev)
 
int Mod_allmod_MS (double d1, double d2, double d3)
 
int Mod_safeName (char *outNam, char *inNam)
 
int Mod_fget_names_1 (TxtTab *mdlTab)
 
int Mod_fget_names_0 (char *mdlNam, TxtTab *mdlTab, TxtTab *surPtab, TxtTab *surMsh)
 
int Mod_fget_names__ (TxtTab *mdlTab, TxtTab *surPtab, TxtTab *surMsh)
 

Variables

Point WC_mod_ori
 der Model-Origin More...
 
int WC_modact_ind
 
int AP_src
 AP_SRC_MEM or AP_SRC_EDI. More...
 
ColRGB AP_defcol
 die DefaultColor des aktiven (sub)Model More...
 
int UI_InpMode
 
static ModelBasMod_father
 
static char sSecEnd [] ="SECTIONEND"
 

Detailed Description

subModel-managment-functions without GUI

=====================================================
List_functions_start:
Mod_load_all unused
Mod_load__ Ein ganz neues Model als MainModel oeffnen;
Mod_load_allsm load Models of mdb_dyn-Records;
Mod_load_sm load a subModel (ED_work_file / ED_Run)
Mod_cre__ create new SubModel
Mod_cre_CB
Mod_ren__ rename Submodel
Mod_ren_CB
Mod_del__ delete Submodel
Mod_chg__ activate other Submodel
Mod_chg_CB load selected SubModel
Mod_chg_x activate internal subModel from modelname
Mod_sav__ save Model+Submodel -> File
Mod_sav2file__ save the active Submodel WC_modact_nam -> permanent File
Mod_file2model save submodel > tmp/Model_<name>
Mod_savSubBuf1 save Submodel in Buffer1 + active Hidelist
Mod_sav_tmp save the active Submodel WC_modact_nam -> TempFile
Mod_LoadFile__ Model als Submodel laden
Mod_ck_isMain check if the active model is the mainmodel
Mod_sym_get__ get symbolic-directory & absolute-path from filename
Mod_sym_get1 get path from symbol; resolv "symbol/fnam" or "fnam"
Mod_sym_get2 get symbol from path
Mod_sym_add register symbolic path
Mod_sym_del delete symbolic path
Mod_symOpen_set register symbolic path
Mod_get_path resolv "symbol/fnam" or "fnam"
Mod_sym_dump dump all symbolic directories
Mod_get_ftyp1 give Modeltyp from Filename
Mod_get_typ1 give modeltyp from definition Line and extract Modelname
Mod_get_typ2 give modeltyp from (complete) Modelname
Mod_get_names scan gesamten APT-Buffer nach Modelnames.
Mod_get_namStore save new BaseModel as mdb_dyn-Record
Mod_kill__ delete all tmp/Model_*
Mod_chg_tit display submodelname im Titlebar
Mod_mkList make list of all Submodels
DB_get_ModRef get referenceModel from refModelNr
Mod_mdbi_mdri get basicModelNr of refModelNr
Mod_m3_mdr get matrix of referenceModel
Mod_mNam_mdr get ModbasName from ModRefNr
Mod_mNam_mdb get ModbasName from basicModelNr
Mod_fget_names__ get lists of all subModels, PTAB-Surfs and MSH-Surfs
Mod_fget_names_0 get all subModels, PTAB-Surfs and MSH-Surfs from file
Mod_get_namAll scan rekursiv die SourceFiles aller basicModels;
Mod_get_namSub scan file of Model mb->mnam for Submodels; add Submodels
Mod_get_namFil scan File fNam and save all Submodelcalls as level iLev
Mod_allmod_MS in all subMods modify ModSiz
List_functions_end:
=====================================================
SEE ALSO:
DB_get_ModRef get Ditto from Index
DB_get_ModBas returns ModelBas from its index
DB_get_ModNr get (basic-) ModelNr from Modelname
DB_list_ModBas Modelnames in korrekter Reihenfolge -> Datei
DB_mdlNam_iBas get the name of a basic-model from its basicModelNr
DB_mdlNam_iRef get Modelname from DB-index of the Modelreference

Function Documentation

typedef_MemTab ( int  )
typedef_MemTab ( Point  )
typedef_MemTab ( Fac3  )
typedef_MemTab ( EdgeLine  )
void Mod_chg_CB ( char *  modNam)
- load new active SubModel
- set WC_modact_nam = new active Modelname
- RUN
int Mod_ck_isMain ( )

Mod_ck_isMain check if the active model is the mainmodel retCode 0 subModel is active 1 the main-model is active

int Mod_mdbi_mdri ( long  ir)
int Mod_mNam_mdb ( char *  mNam,
int *  sSiz,
int *  typ,
int  imdb 
)
int Mod_mNam_mdr ( char *  mNam,
int *  sSiz,
int *  typ,
long  irMdl 
)
int Mod_m3_mdr ( Mat_4x3  mat1,
long  irMdl 
)

Mod_m3_mdr get matrix of referenceModel

int Mod_file2model ( char *  buf,
FILE *  fpi 
)
save submodel > tmp/Model_<name>
Input: buf="SECTION MODEL modelNam"
copy all lines from file fpi into tmp/Model_<name>
irc < 0 = Error;
int Mod_init__ ( )

Bei jedem Init und File/new:

  • clear all tmp/Model_*
  • set WC_modact_nam="" (main)
int Mod_mkList ( int  mode)

make list of all Submodels -> <baseDir>/tmp/Mod.lst mode = 0: mit "-main-" mode = 1: ohne "-main-" Mainmodel wird mit "-main-" in die Liste eingetragen !

int Mod_chg_x ( char *  modNam)

Mod_chg_x activate internal subModel from modelname new Submodelname selected;

  • load new active SubModel
  • set WC_modact_nam = new active Modelname
  • RUN
int Mod_chg_tit ( )

display submodelname im Titlebar

int Mod_sav__ ( int  iCompress,
char *  filNam,
int  savActMdl 
)
save Model+Submodels -> File
Input:
iCompress 0=do not compress; else compress.
filNam outfilename
savActMdl 0=save active model, 1=do not save active model
- savActMdl=0: save the active Submodel WC_modact_nam -> File
- eine aktuelle Liste tmp/Model_* machen
- alle zusammenfuegen; Submodels mit MODEL name/../MODEL END
- mainModel = tmp/Model_; subModels = tmp/Model_*
int Mod_savSubBuf1 ( char *  modNam,
int  modSiz 
)

save Submodel in Buffer1 + active Hidelist –> File tmp/Model_<modNam> used by Step-Import (schreibt mit UTF_add1_line –> UTF_FilBuf1) see also Grp_exp ..

int Mod_sav2file_CB ( char *  fnam,
char *  dirNam 
)
int Mod_sav2file__ ( )

save the active Submodel WC_modact_nam -> permanent File

int Mod_LoadSubmodel ( char *  fnam,
char *  dirNam 
)

Models/load Submodel from File does: AP_dir_open = dirNam

int Mod_LoadFile__ ( )

Model als Submodel laden

int Mod_sav_tmp ( )

save the active Submodel WC_modact_nam -> TempFile

int Mod_init_path ( )
int Mod_get_path ( char *  out_path,
char *  in_path 
)
Input:
in_path pathSymbol/filename" or "filename"
without Symbol: "<bas_dir>dat/filename".
Output:
out_path filename complete (Path + Filename + Filetyp).
RetCod 0 = OK;
-1 = Symbol_not_found
int Mod_get_ftyp1 ( char *  fnam)

Mod_get_ftyp1 give Modeltyp from Filename RetCod=fTyp (see AP_ck_ftyp)

int Mod_get_typ1 ( char *  txbuf,
char *  cbuf 
)

give typ from definition Line and extract (complete) Modelname –> txbuf Input: cbuf definitionLine; zB M20=CTLG "Profile/4x4_60" .. OutPut: RetCod: -1 = internal model MBTYP_INTERN -2 = catalog-model MBTYP_CATALOG -3 = Error

int Mod_get_typ2 ( char *  txbuf)

Mod_get_typ2 give typ from (complete) Modelname (internal or external!) (using filetype of modelname) -3 = Error -2 = catalog-model MBTYP_CATALOG -1 internal model MBTYP_INTERN // M1 = "Submodel1" 0 external/native MBTYP_EXTERN 1-9 external 10-19 Mockup Mtyp_WRL-Mtyp_WRL2 20-29 Image Mtyp_BMP-Mtyp_JPG

int Mod_get_names ( )
scan gesamten APT-Buffer nach Modelnames.
siehe ED_work_END - DYNAMIC_AREA abarbeiten,
int Mod_sym_dump ( )

Mod_sym_dump dump all symbolic directories

int Mod_sym_get__ ( char *  symDir,
char *  absDir,
char *  fnam,
char *  inPath 
)

Mod_sym_get__ get symbolic-directory & absolute-path from filename

int Mod_sym_getAbs ( char *  absDir,
char *  symDir 
)
Mod_sym_getAbs get absoute-direcory from symbolic-directory
symdir must be terminated with '/'
Input:
symDir: eg: "Data"
Output:
absDir: full path (from file xa/dir.lst) Size 128.
RetCod
>= 0 OK; path in out_path; Linenumber of symbol in path.
-1 Symbol from in_path not found in file
int Mod_sym_get1 ( char *  out_path,
char *  in_path,
int  imod 
)
get path from symbol
symdir must be terminated with '/'
Input:
in_path: "<symbol>/<filename>" eg: "Data/Niet1.dat"
imod: 0=get 1=check(no Msg)
Output:
out_path: full path (from file xa/dir.lst) Size 256.
filename not added; use Mod_get_path for path/filename
RetCod
>= 0 OK; path in out_path; Linenumber of symbol in path.
-1 Symbol from in_path not found in file
int Mod_sym_get2 ( char *  out_sym,
char *  in_path,
int  imod 
)
get symbol from path
Input:
in_path: der Pfad (mit "/" am Ende)
imod: 0=get 1=check(no Msg)
Output:
out_sym: das zugehoerige Symbol (aus datei xa/dir.lst)
filename not added; use Mod_get_path for path/filename
RetCod 0 OK; symTxt in out_sym;
-1 in_path not found in file
int Mod_symOpen_set ( char *  sym,
char *  path 
)

Mod_symOpen_set set symbolic path

int Mod_sym_del ( char *  sym)

Mod_sym_del delete symbolic path

int Mod_sym_add ( char *  sym,
char *  dir 
)
Mod_sym_add register symbolic path in File cfg/dir.lst
path comes from AP_dir_open
int Mod_kill__ ( )
  • alle tmp/Model_* loeschen
  • alle tmp/*.tess loeschen

see also OS_file_delete OS_file_delGrp

int Mod_load__ ( int  mode,
char *  filNam,
int  dbResiz 
)
Ein ganz neues Model als MainModel oeffnen;
- alle tmp/Model_* loeschen
- file einlesen - aufteilen -> tmp/Model_*
- Submodel tmp/Model_ (-main-) laden
mode 0 = load new
mode 1 = insert; do not write Title & do not rescale
mode 2 = tmp/Model_ is ready to load (reload)
- dbResiz = 0: increase DB-Size for new objects; 1 = not.
int Mod_aload_prc ( char *  lBuf,
int  bufSiz,
FILE *  fpi 
)
read from fpi and write until SECTIONEND into file tmp/Model_<mdlNam>
lBuf is line "SECTION PROCESS process_<prcNam>"
01234567890123456
add proc to file <tmp>processes.lst
int Mod_aload_sm ( int  mode,
char *  lBuf,
int  bufSiz,
FILE *  fpi 
)
read from fpi and write until SECTIONEND into file tmp/Model_<mdlNam>
lBuf is line "SECTION MODEL <mdlNam>"
mode=0 old version; "MODEL modelname" bis "MODEL END"
mode=1 new version; "SECTION modelname" bis "SECTIONEND"
int Mod_del1__ ( char *  smNam)
int Mod_load_allsm ( )

Load Models of mdb_dyn-Records; Load Models; Reihenfolge=seqNr.

int Mod_load_sm ( int  mTyp,
char *  mnam 
)

ein einzelnes subModel laden mnam zB "Submodel1"; das subModel darf keine noch nicht existierenden subModels enthalten !!

int Mod_get_namAll ( )

scan rekursiv die SourceFiles aller dzt existierenden basicModels; load Submodels as (zusaetzliche) basicModels. basicModels = mdb_dyn-Rec's (DB_StoreModBas) Recurse tru alls Submodels.

int Mod_get_namSub ( int  parNr,
int  iLev 
)

scan file of Model Mod_father->mnam for Submodels; add Submodels as seqNr=iLev

int Mod_get_namFil ( char *  fNam,
int  parNr,
int  iLev 
)

scan File fNam and save all Submodelcalls as level iLev irc = 0 = OK; -1 = Err.

int Mod_get_namStore ( char *  cp,
int  parNr,
int  iLev 
)

save new BaseModel as mdb_dyn-Record Input: cp = line mit "M20=..." basicModelNr of parent (father) == parNr; SourcefileName ist Mod_father->mnam

int Mod_allmod_MS ( double  d1,
double  d2,
double  d3 
)

Mod_allmod_MS in all subMods modify ModSiz

int Mod_safeName ( char *  outNam,
char *  inNam 
)

give back Filename im <base>tmp/<safeName>

int Mod_fget_names_1 ( TxtTab mdlTab)
int Mod_fget_names_0 ( char *  mdlNam,
TxtTab mdlTab,
TxtTab surPtab,
TxtTab surMsh 
)
Find all subModels in modelfile of model <mdlNam>; add to List 'mdlTab'.
Find all PTAB-Surfs; add to List 'surPtab'.
Find all MSH-Surfs; add to List 'surMsh'.
int Mod_fget_names__ ( TxtTab mdlTab,
TxtTab surPtab,
TxtTab surMsh 
)
get lists of all subModels, PTAB-Surfs and MSH-Surfs out of
mainmodel and all subModelfiles

Variable Documentation

Point WC_mod_ori

der Model-Origin

int WC_modact_ind
int AP_src

AP_SRC_MEM or AP_SRC_EDI.

ColRGB AP_defcol

die DefaultColor des aktiven (sub)Model

int UI_InpMode
ModelBas* Mod_father
static
char sSecEnd[] ="SECTIONEND"
static