INFORMACION GENERAL PARA LA ELABORACION Y PRESENTACION DE LA COMPROBACION DE GASTOS POR CONCEPTO
M. Gasto telefónico (aplica sólo para los proyectos de Fortalecimiento de la equidad de género en la población indígena y Coinversión para el Fortalecimiento de Liderazgos Femeninos Indígenas)
5. De los requisitos de comprobación de los comprobantes fiscales y no fiscales
Information about a part (like its name, property, material, thickness, position, etc) can reside as comments into the header section of a CAD file in the form of keywords. Using a special ANSA_TRANSL script, these keywords are read and the related information is passed directly into ANSA. In its simpler form, such an ANSA_TRANSL does not have a user_functions section and all the translation process is handled through the CAD translation section.
A cad header can be read with the function GetNextFileLine. The syntax accepts a string argument where each line of the header is going to be stored after a succesful call of the function. Usually it is used together with a while statement.
IGES header example
MODEL : SPACE MOBILE S 1 PART NUMBER : 1234567 S 2 TITLE : LEFT FLOOR BEAM S 3 PROP ID : 456 S 4 VERSION : A S 5 THICKNESS : 1.5 S 6 MAT ID : 7892 S 7 MAT NAME : St 50 BH S 8 POSITION : L S 9 VERSION : B S 10 THICKNESS : 1.2 S 11 S 12 S 13 HEADER Section NAME : CH-CBN-OUTER-L PID : 21 THICKNESS: 1.5 MATERIAL : MATS1_STEEL MID : 2 . . . . CAD File DATA Section 01234567891 . . . 123 . 1 ANSA_TRANSL
TRANSLATIONS : " "="_"; /* Translate spaces to underscores */
SEPARATORS = "=:,;"; /* Everything that will separate Words or Numbers*/
/* Guess Attributes File Name */ if(i=match_string(FILENAME,".")) { /* Replace Extension with .attr */ attr_filename=FILEPATH%FILENAME(:i-1)%".attr"; }
/* Open Log File for Appending */ fd_log=fopen("ANSA_TRANSL.log","a+"); /* Log Attributes File Name */ if(fd_log) i=write(fd_log,"Reading :"%attr_filename);
1H,,1H;,,57H/usr/people/CAD_data2/STELIOS_TEST/INTERFACES/header.iges,7HG 1 ANSA9.x,3H1.2,32,36,6,306,15,,1.,2,2HMM,1,1.,13H991109.153539,0.001, G 2 10000.,,,9,1,13H991109.153539; G 3 126 1 0 0 0 0 0 000000001D 1 126 0 0 8 0 0 0BSPLINE 1D 2 126,12,2,0,0,0,0,0.,0.,0.,0.25,0.25,0.375,0.375,0.5,0.5,0.75, 1P 1 0.75,0.875,0.875,1.,1.,1.,1.,1.,1.,0.707107,1.,0.707107,1.,1., 1P 2 1.,0.707107,1.,0.707107,1.,406.539,1057.63,-6.75,401.539, 1P 3 1057.63,-6.75,396.539,1057.63,-6.75,396.539,1050.88,-6.75, 1P 4 396.539,1050.88,0.,396.539,1050.88,6.75,396.539,1057.63,6.75, 1P 5 401.539,1057.63,6.75,406.539,1057.63,6.75,406.539,1050.88,6.75, 1P 6 406.539,1050.88,0.,406.539,1050.88,-6.75,406.539,1057.63,-6.75, 1P 7 0.5,0.75,0.,0.,0.; 1P 8 S 13G 3D 2P 8 T 1
The above HEADER is easy to be extracted using only the following 2 lines as global code:
while(GetNextFileLine(in_line)) Print(in_line);
Besides the header section of a CAD file, information about a part can also be given through standard text files, the so called attribute files. In this case, for each CAD file that is opened into ANSA, ANSA_TRANSL will read the corresponding attribute file and retrieve information about the specific part. This information is then assigned to the related fields within ANSA.
Suppose that the attribute file has the form:
SUBSTRUCTURE = LEFT TITLE = B PILLAR MODULE ID = 999 PID = 100
PROPERTY NAME = B_PILLAR_999 THICKNESS = 0.97
MID = 1000
MATERIAL NAME = MAT1_STEEL ORIGIN = 0.,-100.,0. X_AXIS = 1.,0.,0. Y_AXIS = 0.,1.,0. Z_AXIS = 0.,1.,0.
The ANSA_TRANSL that could be used in order to read the attribute file and assign the values to every imported cad file is the following:
/*---*/ /*---Informations are written in ANSA_TRANSL.log---*/ /*---*/ /*---*/ def CAD_Translate(){
{
SEPARATORS = "=:,;"; /* Separator of Words or Numbers*/
Attributes File (TXT File) NAME : FRONT_DOOR_LT PID : 21 THICKNESS: 1.5 MATERIAL : MATS1_STEEL MID : 2 . . . . keyword_1 . . . . keyword_2 . . . . CAD File DATA Section 01234567891 . . . 123 . 1 01234567. 01234567. . . 2 567891. 567891 01234567 3 ANSA_TRANSL
TRANSLATIONS : " "="_"; /* Translate spaces to underscores */
SEPARATORS = "=:,;"; /* Everything that will separate Words or Numbers*/
/* Guess Attributes File Name */ if(i=match_string(FILENAME,".")) { /* Replace Extension with .attr */ attr_filename=FILEPATH%FILENAME(:i-1)%".attr"; }
/* Open Log File for Appending */ fd_log=fopen("ANSA_TRANSL.log","a+"); /* Log Attributes File Name */ if(fd_log) i=write(fd_log,"Reading :"%attr_filename); else print("Reading :"%attr_filename); /* Open Attributes File for Reading */ if(attr_filename && attr_fd=fopen(attr_filename,"r")) {
if(i = MatchString(FILENAME,".")) {
/* Replace Extension with .attr */
attr_filename=FILEPATH%FILENAME(:i-1)%".attr"; }
/* Open Log File for Appending */ fd_log = Fopen("ANSA_TRANSL.log","a+"); /* Log Attributes File Name */
if(fd_log)
Write(fd_log,"Reading :"%attr_filename); else
Print("Reading :"%attr_filename); /* Open Attributes File for Reading */ attr_fd = Fopen(attr_filename,"r"); if(attr_filename && attr_fd) {
/* Loop throught all lines in Attributes File */ while(Read(attr_fd,in_line))
{
/* Look for a "SUBSTRUCT = ...." line */ if(MatchString(in_line,"SUBSTRUCT")) { m = TokenizeString(in_line,"=",0); sub_ass_name = GetString(m[1]); NewGroup(sub_ass_name,0); }
/* Look for a "TITLE = ...." line */ else if(MatchString(in_line,"TITLE")) {
m = TokenizeString(in_line,"=",0); pdm_id = GetString(m[1]);
}
/* Look for a "MODULE ID = ...." line */ else if(MatchString(in_line,"MODULE ID")) {
m = TokenizeString(in_line,"=",0); module_id = GetInt(m[1]);
}
/* Look for a "PROPERTY NAME = ...." line */ else if(MatchString(in_line,"PROPERTY NAME")) {
m = TokenizeString(in_line,"=",0); property_name = GetString(m[1]); }
/* Look for a "PID = ...." line */ else if(MatchString(in_line,"PID")) {
m = TokenizeString(in_line,"=",0); property_id = GetInt(m[1]); }
/* Look for a "MATERIAL NAME = ...." line */ else if(MatchString(in_line,"MATERIAL NAME")) {
m = TokenizeString(in_line,"=",0); material_name = GetString(m[1]); }
/* Look for a "MID = ...." line */ else if(MatchString(in_line,"MID")) {
m = TokenizeString(in_line,"=",0); material_id = GetInt(m[1]); }
/* Look for a "THICKNESS = ...." line */ else if(MatchString(in_line,"THICKNESS")) {
m = TokenizeString(in_line,"=",0); thickness = GetFloat(m[1]);
}
/* Look for an "ORIGIN = ...." line */ else if(MatchString(in_line,"ORIGIN")) {
/* Read X,Y,Z Origin Coordinates */ m = TokenizeString(in_line,"=,",0); PART_COORD_SYS_X = GetFloat(m[1]); PART_COORD_SYS_Y = GetFloat(m[2]); PART_COORD_SYS_Z = GetFloat(m[3]); }
/* Look for a "X_AXIS = ...." line */ else if(MatchString(in_line,"X_AXIS")) {
/* Read DX,DY,DZ of X Axis Vector */ m = TokenizeString(in_line,"=,",0); PART_COORD_SYS_DX1 = GetFloat(m[1]); PART_COORD_SYS_DY1 = GetFloat(m[2]); PART_COORD_SYS_DZ1 = GetFloat(m[3]); }
/* Look for a "Y_AXIS = ...." line */ else if(MatchString(in_line,"Y_AXIS")) {
/* Read DX,DY,DZ of Y Axis Vector */ m = TokenizeString(in_line,"=,",0); PART_COORD_SYS_DX2 = GetFloat(m[1]); PART_COORD_SYS_DY2 = GetFloat(m[2]); PART_COORD_SYS_DZ2 = GetFloat(m[3]); }
/* Look for a "Z_AXIS = ...." line */ else if(MatchString(in_line,"Z_AXIS")) {
/* Read DX,DY,DZ of Z Axis Vector */ m = TokenizeString(in_line,"=,",0); PART_COORD_SYS_DX3 = GetFloat(m[1]); PART_COORD_SYS_DY3 = GetFloat(m[2]); PART_COORD_SYS_DZ3 = GetFloat(m[3]); } } } else {
/* Warn user if Attributes File does not Exist */ if(fd_log)
Write(fd_log,"Warning : No Attributes File"); else
Print("Warning : No Attributes File"); }
if(!pdm_id) {
/* Warn user if No PDM data in Attributes File */ if(fd_log)
Write(fd_log,"Warning : NO PDM Id"); else
Print("Warning : NO PDM Id"); }
/* Construct PART name to the taste of user */ if(i = MatchSeparators(FILENAME)) { if(pdm_id) name = FILENAME(:i-1)%"_"%pdm_id; else name = FILENAME(:i-1); } else { if(pdm_id) name = FILENAME%"_"%pdm_id;
else
name = FILENAME; }
/* Finally Assign PART Atributes to ANSA Registers */ PART_NAME = pdm_id; PART_ID = module_id; PART_PROPERTY_ID = property_id; PART_PROPERTY_NAME = property_name; PART_PROPERTY_THICKNESS = thickness; PART_MATERIAL_ID = material_id; PART_MATERIAL_NAME = material_name; }
The key functions for reading this file is the MatchString and TokenizeString which were discussed in
Section 4.2.2. It is clear that the use of registers made the code more compact and easy to read since it
was avoided the use of other built in functions which could do the same actions in a more ‘complicated’ way.
VDA-FS header example
The sample vda file contains in its start section the information describing the part that is supposed to be in this file. The information is formatted in such way that cooperates with the sample ANSA_TRANSL file. The most important information is:
T-SNR :8165630 T-KOGR :4115 T-LRKZ ;R T-SDKZ ; T-EBEZ :XYZ T-TNAME:CSAULE OUTER ==================== V-MATNR;10163 V-MATNO;DIN EN 10163 V-MATNA;St14 V-MATDI; 0.
In this case the sample ANSA_TRANSL script file has the appropriate format in order to import the information needed from the sample vda file. Follow the same check steps as for the iges file case.
VDAFS = HEADER / 35 00000010 ************************************************************************00000020 VDAFS VERSION : 2.0 00000030 --- ANGABEN UEBER DEN ABSENDER ---00000040 SENDERFIRMA : BETA 00000050 ANSPRECHPARTNER : 00000060 TELEFON : 00000070 ADRESSE : 00000080 ERZEUGENDES SYSTEM : ANSA V9 R0 00000090 ERZEUGUNGSDATUM : 00000100 SENDE-FILENAME : 00000110 --- ANGABEN UEBER DAS TEIL ---00000120 PROJEKT : xx 00000130 OBJEKTKENNUNG : 00000140 VARIANTE : xx 00000150 VERTRAULICHKEIT : xx 00000160 GUELTIGKEITSDATUM : 00000170 --- ANGABEN UEBER/FUER DEN EMPFAENGER ---00000180 EMPFAENGERFIRMA : xx 00000190 EMPFAENGERNAME : xx 00000200 ************************************************************************00000210 TOLERANZ : XXXXX MM 00000220 WINKELTOLERANZ : XXXXX GRAD 00000230 ************************************************************************00000240 T-SNR :8165630 00000290 T-KOGR :4115 00000300 T-LRKZ ;R 00000310 T-SDKZ ; 00000320
T-EBEZ :XYZ 00000330 T-TNAME:CSAULE OUTER 00000380 ========================================================================00000640 V-MATNR;10163 00000770 V-MATNO;DIN EN 10163 00000780 V-MATNA;St14 00000790 V-MATDI; 0.8 00000810 ************************************************************************00001600 SET1 = BEGINSET 00000250 ANSA_TRANSL file for VDA-FS header example
def CAD_Translate(){ SEPARATORS = ":;"; version = "A"; while(GetNextFileLine(in_line)) { if(i = MatchString(in_line,"V-VERSI")) { if(j = MatchSeparators(in_line(i:))) { cur_version = GetString(in_line(j+i:)); if(cur_version>version) version = cur_version; } } else if(MatchString(in_line,"Modelfile:")) { if(GetNextFileLine(in_line)) { serial_number = GetInt(in_line(:7)); } else break; }
else if(!position && (i = MatchString(in_line,"T-LRKZ"))) {
if(j = MatchSeparators(in_line(i:))) position = GetString(in_line(j+i:)); }
else if(!name && (i = MatchString(in_line,"T-TNAME"))) {
if(j = MatchSeparators(in_line(i:))) name = GetString(in_line(j+i:)); }
else if(!serial_number && (i = MatchString(in_line,"T-SNR"))) {
if(j = MatchSeparators(in_line(i:))) serial_number = GetInt(in_line(j+i:)); }
else if(!model_name && (i = MatchString(in_line,"T-EBEZ"))) {
if(j = MatchSeparators(in_line(i:))) model_name = GetString(in_line(j+i:)); }
else if(!status && (i = MatchString(in_line,"D-DOALT"))) {
if(j = MatchSeparators(in_line(i:))) status = GetString(in_line(j+i:)); }
else if(version == cur_version) {
if(i = MatchString(in_line,"V-MATDI")) {
if(j = MatchSeparators(in_line(i:))) thickness = GetFloat(in_line(j+i:)); }
else if(i = MatchString(in_line,"V-MATNR")) {
if(j = MatchSeparators(in_line(i:))) material_id = GetInt(in_line(j+i:)); }
else if(i = MatchString(in_line,"V-MATNA")) {
if(j = MatchSeparators(in_line(i:))) material_name =
GetString(in_line(j+i:)); } } } if(!serial_number) { i = MatchString(FILENAME,"."); serial_number = GetInt(FILENAME(:i-1)); }
if(!name) name = FILENAME; if(!version) version = "A"; if(!position) position = "L"; if(!serial_number) property_id = 1;
if(!model_name) model_name = "U"; if(!status) status = "U"; if(!thickness) hickness = 1.5; if(!material_id) material_id = 1;
if(!material_name) material_name = "Default Material MAT1"; if(serial_number && !symmetry_number) symmetry_number = serial_number; PART_NAME = name ; PART_VERSION = version; PART_MODEL_NAME = model_name ; PART_ID = serial_number ; SYMMETRY_PART_ID = symmetry_number ; PART_PROPERTY_NAME = version%"_"%status%"_"%serial_number%"_"%position%"_"%name ; PART_PROPERTY_ID = property_id ; SYMMETRY_PART_PID_OFFSET= 0; PART_PROPERTY_THICKNESS = thickness ; PART_MATERIAL_NAME = material_name ; PART_MATERIAL_ID = material_id ; }