box.sml

  Download

More scripts: C A D

Syntax Highlighing:

comments, key words, predefined symbols, class members & methods, functions & classes
            
# box.sml
# demonstrate creating and reading a box CAD element
clear();
class CAD C;
# define array to hold element list
array numeric elemlist[10];
# create a new file or open existing file
GetOutputCAD(C);
numeric llX, llY, urX, urY;
llX = 2000; # define lower left x, y
llY = 2000;
urX = 2500; # define upper right x, y
urY = 2050;
numeric rotation;
for rotation = 0 to 180 step 20 {
	CADWriteBox(C, 1, llX, llY, urX, urY, rotation);
	}
# now read out the box values
numeric numElem = CADNumElements(C, 1);
numeric numBoxes = CADGetElementList( C, 1, "Box", elemlist );
printf("number of elements: %4d number of boxes: %4d \n", numElem, numBoxes);
print("box list:\n");
numeric elem;
for elem = 1 to numBoxes {
	CADReadBox(C, 1, elemlist[elem], llX, llY, urX, urY, rotation);
	printf("%4d %4d %6.2f %6.2f %6.2f %6.2f %6.2f\n", elem, elemlist[elem], llX, llY, urX, urY, rotation);
	}
CloseCAD(C);