More scripts: C A D

Syntax Highlighing:

comments, key words, predefined symbols, class members & methods, functions & classes
# ellipse.sml
# demonstrate creating and reading an ellipse CAD element
cad C;
GetOutputCAD(C); # create a new file or open existing file
# write an ellipse
numeric xin = 1000, yin = 2000, xSize = 500, ySize = 300, rotation = 45;
CADWriteEllipse(C, 1, xin, yin, xSize, ySize, rotation);
# the elements are always appended to end of block
# so get number of elements - last element will be our ellipse
numeric lastelem = CADNumElements(C, 1);
# now read ellipse data for most recently added element
numeric xCenter, yCenter;
CADReadEllipse(C, 1, lastelem, xCenter, yCenter, xSize, ySize, rotation);
print("write and read CAD ellipse");
print("element  xCenter  yCenter    xSize    ySize rotation");
printf("%7d %8.2f %8.2f %8.2f %8.2f %8.2f \n", lastelem, xCenter, yCenter, xSize, ySize, rotation);