A record is accessed by the use of an arithmetic function @() as special case of an arithmetic expression:
@(position+offset) or @(no,position+offset)
Reads from the database the next record, which passes the @KEY-filter which is modified for the second case by ‘’no’’ at the position of the last defined KEY. The value of the expression is the stored data with the name ‘’position’’ or if position is a number the value at the position relative to the last selection value of the filter. The value 0 and negative values will therefore yield the integer values within the selection keys. An access to the index of an array can be done via ‘’offset’’.
The access function will start at the current position. If you access a value with the same or
a lower position, CDBASE will read the next record. If the end-of-file condition is
encountered an error will occur if you have used the form
@(position), while for
loop is used once and the function jumps to the beginning.
You may also specify two state variables. If these variables have been defined non negative, the result values will be saved there and error messages will not appear:
CDB_LENfor the actual length of the record
CDB_IERfor the error-flag (0=OK, 1=record to short, 2=end of file, 3=key not defined
This is required to prevent the program to enter an infinite loop.
To get the effective Iy-value of cross section 5 from the actual project-database, you enter:
@KEY SECT_EFF 5 LET#5 @(IY)
To use shell forces of the nodes 101 and 102 of group 2 of load case 12 you enter:
@CDB PROJECT1 @KEY QUAD_NFO 12 2 ! Selector Group 2 LET#101 @(101,MXX) ! moment m-xx LET#102 @(102,MYY) ! moment m-yy
To get all support forces of nodes with last digit 0 as loads you may enter:
LET#CDB_IER 0 @CDB PROJECT1 @KEY N_DISP 12 LOOP ! All records LET#10 @NR,@PX,@PY,@PZ IF (#CDB_IER < 2)&(#10 <> 0) ! End or header IF 0==MOD(#10,10) ! Last digit 0 LOAD #10 PX #11 #12 #13 ENDIF ENDIF ENDLOOP #CDB_IER < 2 ! To terminate the loop
To get the section number of the beam 101 (As we have to read two different cases alternate, we can not use the predefined literals):
LET#CDB_IER 0 @CDB PROJECT1 ! 4 Integer-Keys @KEY 100 0 -1 -1 -1 -1 LET#NR 0 ! ALL records LOOP ! 1. and 2. Integer LET#10 @(-3),@(-2) IF #10 ! New BEAM LET#NR #10 ELSE IF #NR==101 LET#Q #11 ENDIF ENDIF ENDLOOP #CDB_IER < 2 ! To terminate the loop
For text elements saved in the database, a proper treatment is only possible if the data structure is known. Respective by using the names defined in the cdbase.chm:
@KEY LC_CTRL 101 ! Action and designation of load case 101 LET#ACT LIT(@ITYP) LET#TXT LIT(@RTEX) ! Designation of material 1 @KEY MAT 1 LET#MATTXT LIT(@TITLE)
Works only with the corresponding
Illegal names result in a CADINP error message
+++++ error no. 10132 in program SOF_VAR Improper number/expression type 502 (illegal operator/CDB-Item-Name).
Recall of the same name results in reading the following line!
Calling a name of the previous line results also in reading the following line.
Very important is the sequence of names inside the structure.
@KEY N_DISP 1 LET#UX @UX LET#NR @NR ! NR - belongs to the following node and not to UX
@KEY N_DISP 1 LET#NR @NR LET#UX @UX ! NR and UX - belong to the same node
Using an OFFSET you can get access to array, (e.g. nodal coordinates)
With an OFFSET you may call the following value beginning with the current position.
The input of
@Name+0are the same
Using an OFFSET the command has to be inside brackets
@KEY NODE LET#NR @NR LET#X @XYZ LET#Y @(XYZ+1) LET#Z @(XYZ+2)
The 1. integer (mostly the element NR) can be used as additional selection string, like
Ascending numbers NR can be used only.
Internally CADINP starts only once a rewind (sequential reading from the beginning)
@KEY NODE LET#NR3 @(3,NR) LET#NR2 @(2,NR) LET#NR1 @(1,NR)
This results in a CADINP error:
+++++ error no. 10126 in program SOF_VAR CDB-Record does not exist or end reached 20/ 0: 1
Example: for a correct input sequence
@KEY NODE @KEY NODE LET#NR1 @(1,NR) LET#NR2 @(2,NR) LET#NR3 @(3,NR)