home *** CD-ROM | disk | FTP | other *** search
- /*-------------------------------------------------------------------*/
- /* VCAD2PV.MAC - VersaCAD Applications Program */
- /* */
- /* Create Complex Polygon file (or simple coordinate file */
- /* for Z axis extrusion) from Digitized Points for */
- /* triangulation and translation (3 sided rectangles) to */
- /* a Ray Trace scene description file. */
- /* */
- /* Robert Cleere (CIS 72050,3677) 08/13/91 */
- /*-------------------------------------------------------------------*/
-
- clr (2); /* Erase Message Area */
- gotorc (messline,0); /* Set Cursor to Msg Line */
-
- print ("Create Complex Polygon File");
- beep(2);
-
- print ("\nEnter Filename ? "); /* Get Filename */
- input (File$);
-
- clr (2); /* Erase Message Area */
- gotorc (messline,0); /* Set Cursor to Msg Line */
-
- print ("Create Complex Polygon File");
- print ("\nEnter Constant Z Coordinate ? ");
- beep(2);
- input(z);
-
- clr (2); /* Erase Message Area */
- gotorc (messline,0); /* Set Cursor to Msg Line */
-
- print ("Create 3D Polygon File");
- print ("\nEnter Polygon Description ? ");
- beep(2);
- input(Desc$);
-
- handle = open (3,File$); /* Try to Open File */
-
- if handle == -1 then /* If New File then Create */
-
- {
-
- create (File$); /* Create File */
-
- handle = open (3,File$); /* Open File */
-
- }
-
- fkey(1,2); /* Snap to Object Routine */
- clr(2);
- cmd("O");
-
- clr (2); /* Erase Message Area */
- gotorc (messline,0); /* Set Cursor to Msg Line */
-
- print ("Select Snap Object for Common Polygon Node");
-
- button = 0; /* Hold for Tablet Button */
-
- while button == 0 do tablet(1,x,y,button);
-
- coord(x,y,button); /* Send x,y to Snap/Object */
-
- clr (2); /* Erase Message Area */
- gotorc (messline,0); /* Set Cursor to Msg Line */
-
- print ("Select Common Polygon Node");
-
- button = 0; /* Hold for Tablet Button */
-
- while button == 0 do tablet(1,x,y,button);
-
- xend = x; /* Swap Coord for Line Draw */
- yend = y;
-
- /* Add Common Node to 3D Polygon File */
-
- a$ = str(x); /* Set x to 10 char string */
- len = 10 - strlen (a$);
- strset (x$,' ',len);
- strcat (x$,a$);
-
- a$ = str(y); /* Set y to 10 char string */
- len = 10 - strlen (a$);
- strset (y$,' ',len);
- strcat (y$,a$);
-
- a$ = str(z); /* Set z to 10 char string */
- len = 10 - strlen (a$);
- strset (z$,' ',len);
- strcat (z$,a$);
-
- write (handle,"/*--------------------------------------------*/");
- write (handle,"/* VersaCad 3D Complex Polygon File */");
- write (handle,"/* */");
- write (handle,"/* Created by VCAD2PV - Robert Cleere 1991 */");
- write (handle,"/* */");
- write (handle,"/* ",Desc$," */");
- write (handle,"/*--------------------------------------------*/");
- write (handle,"/* X Coord Y Coord Z Coord */");
- write (handle,"/*--------------------------------------------*/");
-
- write (handle,x$,y$,z$);
-
- NumNode = 1; /* Set Polygon Node Count */
-
- while inp() <> 113 do /* Add Nodes until "q" pressed */
-
- {
-
- NumNode = Numnode+1; /* Inc Surface Node Counter */
-
- fkey(1,2); /* Snap to Object Routine */
- clr(2);
- cmd("O");
-
- clr (2); /* Erase Message Area */
- gotorc (messline,0); /* Set Cursor to Msg Line */
-
- print ("Current Polygon Node Count = ",NumNode);
- print ("\nSelect Snap Object for Next Polygon Point");
-
- button = 0; /* Hold for Tablet Button */
-
- while button == 0 do tablet(1,x,y,button);
-
- coord(x,y,button); /* Send x,y to Snap/Object */
-
- clr (2); /* Erase Message Area */
- gotorc (messline,0); /* Set Cursor to Msg Line */
-
- print ("Select point to Add to Polygon");
- print ("\n(Hold 'q' while picking for Last Polygon Point)");
-
- button = 0; /* Hold for Tablet Button */
-
- while button == 0 do tablet(1,x,y,button);
-
- addobj (10,x,y,xend,yend,0,0); /* Draw Lint to x,y */
-
- xend = x; /* Swap Coord for Line Draw */
- yend = y;
-
- /* Add mid - Node to 3D Polygon File */
-
- a$ = str(x); /* Set x to 10 char string */
- len = 10 - strlen (a$);
- strset (x$,' ',len);
- strcat (x$,a$);
-
- a$ = str(y); /* Set y to 10 char string */
- len = 10 - strlen (a$);
- strset (y$,' ',len);
- strcat (y$,a$);
-
- a$ = str(z); /* Set z to 10 char string */
- len = 10 - strlen (a$);
- strset (z$,' ',len);
- strcat (z$,a$);
-
- write (handle,x$,y$,z$);
-
- }
-
- fkey(1,2); /* Snap to Object Routine */
- clr(2);
- cmd("O");
-
- clr (2); /* Erase Message Area */
- gotorc (messline,0); /* Set Cursor to Msg Line */
-
- print ("Select Snap Object for Last Polygon Node");
-
- button = 0; /* Hold for Tablet Button */
-
- while button == 0 do tablet(1,x,y,button);
-
- coord(x,y,button); /* Send x,y to Snap/Object */
-
- clr (2); /* Erase Message Area */
- gotorc (messline,0); /* Set Cursor to Msg Line */
-
- print ("Select Last Polygon Node");
-
- button = 0; /* Hold for Tablet Button */
-
- while button == 0 do tablet(1,x,y,button);
-
- addobj (10,x,y,xend,yend,0,0); /* Draw Line to x,y */
-
- /* Add Last Node to 3D Polygon File */
-
- a$ = str(x); /* Set x to 10 char string */
- len = 10 - strlen (a$);
- strset (x$,' ',len);
- strcat (x$,a$);
-
- a$ = str(y); /* Set y to 10 char string */
- len = 10 - strlen (a$);
- strset (y$,' ',len);
- strcat (y$,a$);
-
- a$ = str(z); /* Set z to 10 char string */
- len = 10 - strlen (a$);
- strset (z$,' ',len);
- strcat (z$,a$);
-
- write (handle,x$,y$,z$);
-
- write (handle,"/*----------------------------------------*/");
- write (handle,"/* Total Nodes In Polygon = ",NumNode," */");
- write (handle,"/*----------------------------------------*/");
-
- clr(2);
-
- gotorc (messline,0); /* Set Cursor to Msg Line */
-
- close (handle); /* Close 3d Polygon File */