Download

 

! ***************** MyPart1 ****************************

!

! +++

! Reference sample that creates an entity and passes the

! reference to another module.

!

!

! 2006-03-11 Gunnar Liden

! ---

!************************************************************

 

!sdesce Reference sample: Create entity and pass reference

 

 

GLOBAL GEOMETRY MODULE MyPart1();

 

! Internal variables

 

  REF lin_id;    ! Global reference to created line

 

BEGINMODULE

 

! +++

! Create an entity with identity #10

! ---

   

  LIN_FREE(#10, VEC(0.0, 0.0, 0.0), VEC(200.0, 100.0, 0.0));

 

 

! +++

! Convert identity #10 to a global reference

! ---

 

  lin_id := GLOBAL_REF(#10); 

 

 

! +++

! Pass the global identity to MyPart2

! ---

 

  PART(#5, MyPart2(lin_id));

 

 

ENDMODULE

 

! ***************** MyPart2 ****************************

!

! +++

! Reference sample that passes a global identity to

! a general module that calculates the length

!

!

! 2006-03-11 Gunnar Liden

! ---

!************************************************************

 

!sdesce Reference sample: Pass global identity to a called module

 

 

GLOBAL GEOMETRY MODULE MyPart2(

REF lin_id   >"@t2 Select line");

 

 

! Internal variables

 

  FLOAT  line_length;

 

BEGINMODULE

 

 

! +++

! Pass the global identity to MyPart3 that calculates and

! returns the length of the line

! ---

 

  PART(#8, MyPart3(lin_id, line_length));

 

 

ENDMODULE

 

! ***************** MyPart3 ****************************

!

! +++

! General module for the calculation of a line length

!

! 2006-03-11 Gunnar Liden

! ---

!************************************************************

 

!sdesce Reference sample: Calculate and return line length

 

 

GLOBAL GEOMETRY MODULE MyPart3(

REF lin_id;             ! Identity of input line

VAR FLOAT line_length); ! Output line length

 

 

! Internal variables

 

 

BEGINMODULE

 

 

! +++

! Calculate the length

! ---

 

  line_length := ARCL(lin_id);

 

 

! +++

! List input and output data on screen

! ---

 

  LST_INI("Output from MyPart3");

  LST_LIN("Length of line "+RSTR(lin_id)+" is "+STR(line_length,5,1));

  LST_EXI();

 

 

ENDMODULE

 

! ***************** MyPart4 ****************************

!

! +++

! Reference sample that passes a global identity to

! a general module that calculates the length

!

!

! 2006-03-11 Gunnar Liden

! ---

!************************************************************

 

!sdesce Reference sample: Pass global identity to a called module

 

 

GLOBAL GEOMETRY MODULE MyPart4(

REF lin_id   >"@t2 Select line");

 

 

! Internal variables

 

  FLOAT  line_length;

 

BEGINMODULE

 

 

! +++

! Pass the global identity to MyPart3 that calculates and

! returns the length of the line

! ---

 

  PART(#3, MyPart3(lin_id, line_length));

 

 

ENDMODULE