text.sml
See other examples
and scripts with XML...
# text.sml
# demonstrate creating and reading a text CAD element
clear();
string format$ = "%7d %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f \n";
# create a new file or open existing file
cad C;
GetOutputCAD(C);
# write some text
numeric baseX1 = 100, baseY1 = 100, baseX2 = 200, baseY2 = 100, height = 100;
numeric rotation = 0, xScale = 1.0, shear = 0;
# since rotation = 0 we will use both basepoints
string text$ = "CAD text string 1";
CADWriteText(C, 1, text$, baseX1, baseY1, baseX2, baseY2, height, rotation, xScale, shear);
# the elements are always appended to end of block
# so get number of elements - last element will be our text
numeric lastelem = CADNumElements(C, 1);
# now read data for most recently added element
text$ = CADReadText(C, 1, lastelem, baseX1, baseY1, baseX2, baseY2, height, rotation, xScale, shear);
print("write and read CAD text");
print("element baseX1 baseY1 baseX2 baseY2 height ", "rotation xScale shear");
printf(format$, lastelem, baseX1, baseY1, baseX2, baseY2, height, rotation, xScale, shear);
print("Text: ", text$);
# now use rotation and one base point
baseX1 = 100;
baseY1 = 500;
baseX2 = 0; # don't care
baseY2 = 0; # don't care
height = 100;
rotation = 45;
xScale = 1.0;
shear = -40; # angle text backwards
text$ = "CAD text string 2 - rotated and sheared";
CADWriteText(C, 1, text$, baseX1, baseY1, baseX2, baseY2, height, rotation, xScale, shear);
lastelem = CADNumElements(C, 1);
# now read data for most recently added element
text$ = CADReadText(C, 1, lastelem, baseX1, baseY1, baseX2, baseY2, height, rotation, xScale, shear);
printf(format$, lastelem, baseX1, baseY1, baseX2, baseY2, height, rotation, xScale, shear);
print("Text: ", text$);
CloseCAD(C);
©MicroImages, Inc. 2013 Published in the United States of America
11th Floor - Sharp Tower, 206 South 13th Street, Lincoln NE 68508-2010 USA
Business & Sales: (402)477-9554 Support: (402)477-9562 Fax: (402)477-9559
Business info@microimages.com
Support support@microimages.com
Web webmaster@microimages.com
|