home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 March / VPR9703A.ISO / VPR_DATA / DOGA / SOURCES / POLYEDIT.LZH / MACRO / MODEL.M < prev    next >
Text File  |  1996-07-02  |  3KB  |  125 lines

  1. var private file ;
  2. var private i = 1, ele[3], uv[2][2];
  3. var private temp, suf_flag = OFF, atr_flag = OFF;
  4.  
  5. Bunkai(GetArg( 0 ), ele );
  6. model_dir = ele[0];
  7.  
  8. if( MACHINE == "WINDOWS" )
  9.     Child( model_dir+"exec_bin "+model_dir+"agcv_mdl.bin 8000 8100" );
  10. if( atoi(Modelrc("Input_left")) != 0 )
  11.     InputMode( MOUSE_LEFT, MOUSE_RIGHT );
  12. else
  13.     InputMode( MOUSE_RIGHT, MOUSE_LEFT );
  14. MakeButton();
  15. StatusInit();
  16. if( buttondisp_flag == OFF )
  17.     ButtonArea( 0 );
  18. else
  19.     ButtonArea(BUTTONAREA);
  20. SetZoom( -zoomsize );
  21. SetGrid( mesh_grid, mouse_grid );
  22. PersAngle(pers_deg);
  23. DefaultPers();
  24. ControlEvent( _InputVertex );
  25. AttrEvent( _AttrEvent );
  26. ObjEvent( _ObjEvent );
  27. CanCloseEvent( QuitModel );
  28.  
  29. while ( GetArg( i ) != "" )
  30. {
  31.     file = GetArg( i );
  32.     if( ( substr( file, 1 ) == "-" ) | ( substr( file, 1 ) == "/" ) )
  33.     {
  34.         temp = toupper(substr( file, ((-1)*(!file)+1)));
  35.         if( temp == "V" )
  36.             housendisp_flag = ON;
  37.     }
  38.     else if ( toupper(substr( file, -4 )) == ".ATR" )
  39.     {
  40.         AttrReadFile( file );
  41.         if( access( file ) == TRUE )
  42.         {
  43.             UpdateAttribute();
  44.             atr_flag = ON;
  45.         }
  46.     }
  47.     else
  48.     {
  49.         file = MakeFile( file, "suf" );
  50.         if( access( file ) == TRUE )
  51.         {
  52.             ReadFile( file );
  53.             file = substr( file, !file-4 ) + ".atr" ;
  54.             if ( access( file ) )
  55.                 AttrReadFile( file );
  56.             SelectAll( FALSE );
  57.             suf_flag = ON;
  58.             atr_flag = ON;
  59.         }
  60.         else
  61.         {
  62.             Warning();
  63.             Message( file+"が見つかりません" );
  64.         }
  65.     }
  66.     i++ ;
  67. }
  68. if( atr_flag == OFF )
  69. {
  70.     AttrAppend( default_atrname, default_atrcode );
  71.     AttrFile( 0, default_atrfile );
  72.     if( EXPERT != TRUE )
  73.     {
  74.         AttrMap( 0, TRUE );
  75.         AttrMapFile( 0, MAPPINGFILE );
  76.         uv[0] = {0,0};
  77.         uv[1] = {MAPWIND-1, MAPWIND-1};
  78.         SetAttrMapWind( 0, uv[0], uv[1] );
  79.         uv[0] = {0,0};
  80.         uv[1] = {UVmax,UVmax};
  81.         SetAttrMapSize( 0, uv[0], uv[1] );
  82.     }
  83. }
  84.  
  85. if( suf_flag == OFF )
  86. {
  87.     ObjAppend( default_objname, default_filename );
  88.     UpdateObject();
  89. }
  90.  
  91. if( housendisp_flag == ON )
  92.     VisibleVector( vecvisible_len );
  93. if( tendisp_flag == ON )
  94.     VisibleVertex( 1 );
  95. if( houkoudisp_flag == ON )
  96.     VisiblePolyVector( houkouvisible_len );
  97. DrawFrontOnly( uradisp_flag );
  98. DrawInvisible( drawinvisible_flag );
  99. UpdateAll();
  100. Polygon();
  101.  
  102. function main()
  103. {
  104.     var    key;
  105.     while ( TRUE )
  106.     {
  107.         if( WaitEvent())
  108.             CallKeyEvent(" ");
  109.         else if( KeyCode() == 0 )
  110.         {
  111.             if( ( ShiftStat() & 1 ) == 1 )
  112.             {
  113.                 cur = Cursor();
  114.                 TrimCursor( fix_vertex, MouseWindow());
  115.                 Cursor( cur );
  116.             }
  117.         }
  118.         else
  119.         {
  120.             cur = Cursor();
  121.             CallKeyEvent();
  122.         }
  123.     }
  124. }
  125.