Login| Sign Up| Help| Contact|

Patent Searching and Data


Title:
STEREOLITHOGRAPHIC CURL REDUCTION
Document Type and Number:
WIPO Patent Application WO/1989/010801
Kind Code:
A1
Abstract:
An improved stereolithography system for generating a three-dimensional object by creating a cross-sectional pattern of the object to be formed at a selected surface (23) of a fluid medium (22) capable of altering its physical state in response to appropriate synergistic stimulation by impinging radiation, particle bombardment or chemical reaction, information defining the object being structurally specified to reduce curl, stress and distortion in the ultimately formed object, the successive adjacent laminae, representing corresponding successive adjacent cross-sections of the object, being automatically formed and integrated together to provide a step-wise laminar buildup of the desired object, whereby a three-dimensional object is formed and drawn from a substantially planar surface of the fluid medium during the forming process. A stereolithographic distortion known as curl is defined, and several techniques to eliminate or reduce curl are described, including dashed line, bent line, secondary structure, rivets, and multi-pass techniques.

Inventors:
HULL CHARLES WILLIAM (US)
SPENCE STUART T (US)
LEWIS CHARLES W (US)
VINSON WAYNE B (US)
FREED WAYNE S (US)
SMALLEY DENNIS ROLLETTE (US)
Application Number:
PCT/US1989/001558
Publication Date:
November 16, 1989
Filing Date:
April 17, 1989
Export Citation:
Click for automatic bibliography generation   Help
Assignee:
3D SYSTEMS INC (US)
International Classes:
B29C67/00; B29C35/08; B44B1/00; G03F7/00; G03F7/20; G06F17/50; B29K105/24; (IPC1-7): B05D3/08; B29C35/08
Foreign References:
US4139654A1979-02-13
US4575330A1986-03-11
US4801477A1989-01-31
Download PDF:
Claims:
83Claims
1. An improved stereolithography system, comprising: first means for providing tailored object defining data with respect to a threedimensional object to be formed, said tailored data specifying the structural aspects of said object for reduction of stress and curl; and second means responsive to said tailored data for automatically forming said threedimensional object.
2. An improved stereolithography system as set forth in claim 1, wherein said tailored data specifies a dashed line to provide isolation of pulling effects.
3. An improved stereolithography system as set forth in claim 1, wherein said tailored data specifies a line with short segments at angles to each other to provide isolation of pulling effects.
4. An improved sterεolithography system as set forth in claim 1, wherein said tailored data a specifies lines that do not adhere to a layer below and are held togethεr by other structure, whereby pulling effects are reduced.
5. An improved stereolithography system as set forth in claim 1, wherein said tailored data specifies stereolithographically genεrated rivets to hold parts together.
6. An improved stereolithography system as set forth in claim 1, wherein said tailored data specifies parts in the form of rails. 84 .
7. An improved stereolithography system as set forth in claim 1, wherein said tailored data specifies structure including both rails and rivεts.
8. An improved stereolithography system as set forth in claim 1, wherein said tailored data specifiεs lines that are as fully reacted as possible prior to exposure that extends the gel point to a lower layer.
9. A method for improved stεrεolithography, comprising the steps of: providing tailored object defining data with respect to a threedimensional object to be formed, said tailored data specifying the structure of said object for reducing stress and curl; and utilizing said tailored data to stereolithographic ally form said threedimensional object.
10. A method for improved stereolithography as set forth in claim 9, wherein said step of providing includes data which specifies a dashed line to provide isolation of pulling effects.
11. An improved stereolithography system as set forth in claim 9, .wherein said step of providing includes data which specifies a line with short segments at angles to each other to provide isolation of pulling effects.
12. An improved stereolithography system as set forth in claim 9, wherein said step of providing includes data which specifies lines that do not adhere to a layer below and are held together by other structure, whereby pulling effects are reduced.
13. An improved stereolithography system as set forth in claim 9, wherein said step of providing includes 85 data which specifiεs stεreolithographically generated rivets to hold parts together.
14. An improved stereolithography system as set forth in claim 9, wherein said step of providing includes data which specifies parts in the form of rails.
15. An improved stereolithography system as set forth in claim 9,. wherein said step of providing includes data which specifies structure including both rails and rivets.
16. An improved stereolithography system as set forth in claim 9, wherεin said stεp of providing includεs data which spεcifies lines that are as fully reacted as possible prior to exposure that extends the gel point to a lower layer.
17. An improved sterεolithographic apparatus of thε typε for tracing a UV light beam along a line at the surface of a liquid resin at a sufficient exposure so that the line cures and adheres to a cured line placed below the surface, the improvement comprising tracing a dashed line at the surface having alternating solid portions and breaks, wherein the line is not exposed at the breaks, but is exposed at the solid portions to adhere to the line below at the solid portions.
18. The apparatus of claim 17 wherein the dashes are subsequently filled in with liquid resin and cured at a lower exposure than the rest of the line.
19. An improved stereolithographic apparatus of the type for tracing a UV light beam along a line at the surface of a liquid resin at a sufficient exposure to cure and adhere the line to a cured line placed below the surface, the improvement comprising tracing a bent line 86 having alternating solid portions and gaps, wherεin thε gaps are each connected by a repeated geometrical structure other than a straight line, and wherein the line is not exposed at the gaps, but is exposed at the solid portions and connecting geometrical structure to adhere to the line below at these portions.
20. The apparatus of claim 19 wherein the gaps are subsequently filled in with liquid resin and cured at a lower exposure than the rest of the line.
21. An improved stereolithographic apparatus of the type for tracing a UV light beam along parallel lines at the surface of a liquid resin at a sufficient exposure so that the lines cure and adhere to cured parallel lines placed below the surface, the improvement comprising tracing the lines at a lower εxposurε so that they do not adhere to the lines below, tracing even lower exposure support lines which connect parallel lines at each layer, and then exposing portions of the support linεs at a sufficiεnt exposure to adhere to the support lines below.
22. An improved stereolithographic apparatus of the type for tracing a UV light beam along parallel lines at the surface of a liquid resin at a sufficient exposure so that the lines cure and adhere to cured parallel lines placed below the surface, the improvement comprising tracing the lines at a lower exposure so they do not adhere to the lines below, tracing even lower exposure support lines which connect to a line and which overlap at least a portion of the support lines connected to parallel lines at the same layer, and then exposing the overlapping portions of the support lines at a sufficiεnt exposure so that they adhere.
23. An improved stereolithographic apparatus of the type for tracing a UV light beam along a line at the 87 surface of a liquid resin of a sufficient exposure so that the line cures and adheres to a cured line placed below the surface, the improvement comprising tracing the line through more than one pass of the UV light beam with an incremental exposure for each pass such that the line does not adhere to the line below on the first pass, but does adhere on a subsequent pass.
24. The apparatus of claim 23 wherein the line is traced with two passes.
25. The apparatus of claim 23 wherein the line is traced with more than two passes.
26. The apparatus of claim 23 wherein the incremental exposure at each pass is uniform.
27. The apparatus of claim 23 wherein the incremental exposure at each pass can be, but need not be, different.
28. The apparatus of claim 23 wherein the line is divided up into shorter segments, and wherein the line is traced by successively tracing each segment with more than one pass before proceeding on to the next segment.
29. The apparatus of claim 28 wherein the lines for a layer are boundary lines representing the perimeter of a cross section of a part, or cross hatch lines represent¬ ing the interior of a cross section of a part and which connect the boundary lines, wherein the boundary lines are exposed to adhere to lines below on a single pass, and wherein the cross hatch lines are exposed to adhere to lines below on more than one pass.
30. The apparatus of claim 28 wherein the lines for a layer are boundary lines representing the perimeter of 68 a cross section of a part, or cross hatch lines represent¬ ing the interior of a cross section of a part and which connect the boundary lines, wherein boundary lines are exposed to adhere to lines below on two passes, and wherεin the cross hatch lines are exposed to adhere to lines below on morε than two passεs.
31. The apparatus of claim 23 whεrein the lines traced at a layer represent a cross section of a part, and selected lines of the layer which correspond to a critical area of the part susceptiblε to curl are traced at more than one pass.
32. The apparatus of claim 23 wherein the line is curεd to within a gap of approximatεly 15 mils to thε linε below on the first pass, and subsequent passes decrease this gap by approximately 12 mils per pass.
33. An improved stereolithographic apparatus of the type for tracing a line at the surface of a liquid resin with a UV laser beam at a sufficient exposure so that it adheres to an alreadycured line placed below the surface, the improvement comprising riveting the line by tracing the line at a lower exposure so it does not adhere to the line below, and then subsequently curing through one or more passes of the UV laser beam selected portions of the line called rivets at an incremental exposure for each pass sufficient to cause adherence to the line below at the rivets.
34. The apparatus of claim 33 wherein the line has a width, and the rivets are circles having a diameter greater than the width of the line.
35. The apparatus of claim 33 wherein the line has a width, and the rivets are circles having a diameter approximately equal to or less than the width of the line. 89 .
36. The apparatus of claim 33 wherein the line has a width, and the rivets are circles having a centεr, wherein the center of the circles are offset from the center of the line.
37. The apparatus of claim 33 wherein lines traced at a layer are boundary lines representing the perimetεr of a cross section of a part, or cross hatch lines representing the interior of the cross section which connect the boundary lines, and wherein only the cross hatch lines are riveted.
38. The apparatus of claim 37 wherein the part has a direction of probable distortion, and the higher exposurε portions of the cross hatch lines are also line segments placed approximately perpendicular to the direction of probable distortion.
39. The apparatus of claim 37 wherein only the Crosshatch lines representing a critical volume or area of the part particularly susceptible to curl are riveted.
40. The apparatus of claim 33 wherein the rivets are cured to achieve adhesion to the layer below in two passes.
41. The apparatus of claim 33 wherein the rivets are cured to achieve adhesion to the layer below in more than two passes.
42. The apparatus of claim 37 wherein each cross hatch vector is riveted over its length to within a specified distance from where the cross hatch line intersects a boundary line. 01 *& 90.
43. An improved stereolithographic apparatus of the type for building parts by tracing layers of a part at the surface of a liquid resin at a sufficient exposure so that the layer adheres to an alreadycurved layer placed below the surface, the improvement comprising building a part known as a quarter cylinder having stacked, curved layers, wherein a portion of the quarter cylinder extending in from one end is built on support posts, and wherein a portion of the quarter cylinder extending in from the other end is unsupported, which layers are cured at a particular cure depth, and then measuring the curl factor of the part, defined as the ratio of the hεight of the quarter cylinder at the supported end, divided by the height of the part at the unsupported end.
44. The apparatus of claim 43 wherein quarter cylinders are built with layers having different cure depths, and for each cure depth, the curl factor is measured and plotted versus the cure depth.
45. The apparatus of claim 44 wherein quarter cylinders are built using any of the curl reduction techniques of dashed lines, bent lines, secondary structure, multipass, rivets, or any combination thereof, and for each technique, the curl factor is measured and plotted versus the cure depth.
46. The apparatus of claim 45 wherein the effect on sneer and horizontal curl of each technique is measured and evaluated.
47. An improved stereolithographic method of the type for tracing a line at the surface of a liquid resin with a UV laser beam at a sufficient exposure so that the line adheres to an alreadycured line placed below the surface, the improvement comprising the step of tracing the line to reduce or eliminate curl. 91 .
48. The method of claim 47 wherein a dashed line is traced at the surface, the dashed line having alternating solid portions and breaks, wherein the line is not exposed at the breaks, but is exposed at the solid portions to adhere to the line below at these portions.
49. The method of claim 47 wherein a bent line is traced at the surface having alternating solid portions and gaps, wherein the gaps are each connected by a repeated geometrical structure other than a straight line, and wherein the line is not exposed at the gaps, but is exposed at the solid portions and connecting geometrical structure to adhere to the line below at these portions.
50. The method of claim 47 wherein parallel lines are traced at the surface at a lower exposure so that the lines do not adhere to parallel lines below the surface, support lines are traced at even lower exposure to connect parallel lines at each layer, and then portions of the support lines are exposed at a sufficient exposure to adhere to support lines below.
51. The method of claim 47 wherein parallel lines are traced at the surface at a lower exposure so that the lines do not adhere to parallel lines below the surface, support lines are traced at even lower exposure to connect to a parallel line at a layer, which support lines overlap a portion of a support line connected to a parallel line at that layer, and then exposing the overlapping portions of the support lines so they adhere.
52. The method of claim 47 wherein the line is traced with more than one pass of the UV light beam with an incremental exposure for each pass such that the line does not adhere to the line below on the first pass but does adhere on a subsequent pass. 92 .
53. The method of claim 52 wherεin thε line is traced with two passes.
54. The method of claim 52 wherein the line is traced with more than two passes.
55. The mεthod of claim 52 wherein the incremental exposure at each pass can be, but need not be, different.
56. The method of claim 52 wherein the line is divided up into shorter segments, and wherein the line is traced by successively tracing each segment with more than one pass before proceeding on to the next segment.
57. The method of claim 56 wherein the lines for a layer are boundary lines representing the perimεter of a cross section of a part, or cross hatch lines representing the interior of a cross section of a part and which connect the boundary lines, wherein only the cross hatch lines are exposεd to adhεre to lines below on more than one pass.
58. The method of claim 52 wherεin thε line is riveted by tracing the line at a lower exposure so it does not adhere to the line below, and then subsequently curing through one or more passes of the UV laser beam selected portions of the line called rivets at an incremental exposure for each pass sufficient to cause adherence to the line below at these portions.
59. The method of claim 58 wherein lines traced at a layer are boundary lines representing the perimeter of a cross section of a part, or Crosshatch lines which connect the boundary lines, and wherein only the cross hatch lines are riveted. 93 .
60. The method of claim 59 wherein only the cross hatch lines representing a critical volume or area of the part particularly susceptible to curl are riveted.
61. The method of claim 47 further comprising the step of measuring the impact on vertical curl, horizontal curl, and sneer by any of the curl reduction techniques such as dashed lines, bent lines, multipass, riveting, secondary structure, and any combination thereof.
62. The method of claim 61 wherein the measuring step comprises the substeps of: building guarter cylinders using a particular curl reduction technique at various cure depths; measuring the curl factor for each quarter cylinder; and plotting the curl factor versus cure depth for that particular technique.
63. The method of claim 62 further comprising the substep of measuring and evaluating the effects of sneer and horizontal curl on the quarter cylinders.
Description:
DESCRIPTION

Stereolithographic Curl Reduction

Background of the Invention

1. Cross Reference to Related Applications

This application is related to U.S. Patent Application Serial Nos. 182,830; 182,823; 183,015; 182,801; 183,016; 183,014; and 183,012; filed April 18, 1988, all of which are hereby fully incorporated by reference herein as though set forth in full. Continuations-in-part of U.S. Patent Application Serial Nos. 182,830; 183,016; 183,014; and 183,012 were filed on November 8, 1988, all of which are hereby fully incorpor¬ ated by reference herein as though set forth in full. The Serial Nos. for the above-mentioned continuations-in-part are, respectively, 269,801; 268,816; 268,337; 268,907 (all for Ser. No. 182,830); 268,429 (for Ser. No. 183,016); 268,408 (for Ser. No. 183,014); and 268,428 (for Ser. No. 183,012). A continuation of U.S. Patent Application S.N. 269,801 was filed on March 31, 1989, which is hereby fully incorporated by reference herein as though set forth in full. The Lyon & Lyon D t. No. for the above-mentioned continuation is 186/195. A continuation-in-part applica¬ tion of U.S. Patent Application S.N. 182,823 was filed on April 14, 1989, which is hereby fully incorporated by reference herein as though set forth in full. The Lyon & Lyon Docket Number for the above-mentioned continuation- in-part is 186/166.

2. Cross Reference to Attached Appendices

The following appendices are affixed to this application, and are hereby fully incorporated by reference herein as though set forth in full: Appendix A: 3D Systems, Inc., SLA-1 Beta Site

Stereolithography System Users Manual and Service Manual, November, 1987

Appendix B: 3D Systems, Inc., Beta Release, SLA-1

Software Manual, First Draft, October, 1987

Appendix C: Software Listing, Version 2.62 Appendix Er Non-3D Systems Software Vendors as of,

April 13, 1988

Appendix I: Technical Papers, 3D Systems, Inc.,

CAD/CAM Stereolithography Interface Specification, December 1, 1987 Appendix J: Program Listing - Quarter Cylinder

3. Field of the Invention

This invention relates generally to improvements in methods and apparatus for forming three-dimensional objects from a fluid medium and, more particularly, to a new and improved stereolithography system involving the application of enhanced data manipulation and lithographic techniques to production of three-dimensional objects, whereby such, objects " can be formed more rapidly, reliably, accurately and economically, and with reduced stress and curl.

It is common practice in the production of plastic parts and the like to first design such a part and then painstakingly produce a prototype of the part, all involving considerable time, effort and expense. The design is then reviewed and, oftentimes, the laborious process is again and again repeated until the design has been optimized. After design optimatization, the next step is production. Most production plastic parts are injection molded. Since the design time and tooling costs are very high, plastic parts are usually only practical in high volume production. While other processes are avail¬ able for the production of plastic parts, including direct

TITUTE SHEET

machine work, vacuum-forming and direct forming, such methods are typically only cost effective for short run production, and the parts produced are usually inferior in quality to molded parts. Very sophisticated techniques have been developed in the past for generating three-dimensional objects within a fluid medium which is selectively cured by beams of radiation brought to selective focus at prescribed intersection points within the three-dimensional volume of the fluid medium. Typical of such three-dimensional systems are those described in U.S. Pat. Nos. 4,041,476; 4,078,229; 4,238,840 and 4,288,861. All of these systems rely upon the buildup of synergistic energization at selected points deep within the fluid volume, to the exclusion of all other points in the fluid volume. Unfortunately, however, such three-dimensional forming systems face a number of problems with regard to resolu¬ tion and exposure control. The loss of radiation intensity and image forming resolution of the focused spots as the intersections move deeper into the fluid medium create rather obvious complex control situations. Absorption, diffusion, dispersion and diffraction all contribute to the difficulties of working deep within the fluid medium on an economical and reliable basis. In recent years, "stereolithography" systems, such as those described in U.S. Pat. No. 4,575,330 entitled "Apparatus For Production Of Three-Dimensional Objects By Stereolithography", which is hereby fully incorporated by reference herein as though set forth in full, have come into use. Basically, stereolithography is a method for automatically building complex plastic parts by success¬ ively printing cross-sections of photopolymer (such as liquid plastic) on top of each other until all of the thin layers are joined together to form a whole part. With this technology, the parts are literally grown in a vat of liquid plastic. This method of fabrication is extremely

powerful for quickly reducing design ideas to physical form and for making prototypes.

Photocurable polymers change from liquid to solid in the presence of light and their photospeed with ultra- violet light (UV) is fast enough to make them practical model building materials. The material that is not polymerized when a part is made is still usable and remains in the vat as successive parts are made. An ultraviolet laser generates a small intense spot of UV. This spot is moved across the liquid surface with a galvanometer mirror X-Y scanner. The scanner is driven by computer generated vectors or the like. Precise complex patterns can be rapidly produced with this technique.

The laser scanner, the photopolymer vat and the elevator along with a controlling computer combine together to form a stereolithography apparatus, referred to as "SLA". An SLA is programmed to automatically make a plastic part by drawing a-cross section at a time, and building the part up layer by layer. Stereolithography represents an unprecedented way to quickly make complex or simple parts without tooling. Since this technology depends on using a computer to generate its cross sectional patterns, there is a natural data link to CAD/CAM. However, such systems have encountered difficulties relating to shrinkage, stress, curl and other distortions, as well as resolution, accuracy and difficulties in producing certain object shapes.

Objects made using stereolithography tend to distort when the materials used change densi.ty between the liquid state and the solid state. Density change causes material shrinkage or expansion, and this generates stress as a part is formed in a way to "curl" lower layers or adjacent structure, giving an overall distortion. Materials with less density change exhibit less curl, but many materials that are otherwise useful for stereolithography have high shrinkage. The "curl" effect limits the accuracy of the

object formation by stereolithography. This invention provides ways to eliminate or reduce the "curl" effect.

Material shrinkage is a common problem with polymer materials, and with fabrication methods (such as plastic molding) that use these materials. However, stereolitho¬ graphy is a new technology, and the problems associated with distortion due to shrinkage have not been widely addressed. The other main approaches to reducing object distortion taken by the inventors have been to use photopolymer materials that have less shrinkage and produce less stress, or materials that are less rigid and are less capable of propagating strain.

These other methods are somewhat effective, but have disadvantages. The earliest way to achieve low shrinkage in a photopolymer was to use oligomeric materials with high initial equivalent weights. These materials shrink less because there is less new bond formation per unit volume in the photo-initiated polymer reaction. However, these high equivalent weight materials generally have higher molecular weights and much higher viscosity at a given temperature than the lower molecular weight materials. The high viscosity leads to slow leveling of the liquid surface. The high viscosity can be overcome by using increased process temperature, but higher temperatures limit the liquid lifetime.

The shrinkage in photopolymers is due to the shrinkage in the formation of the acrylic bonds. Photopolymers can be made by reacting other functional groups than acrylics, but they have substantially less reactivity than the acrylic bonded materials, resulting in generally inadequate speeds of solid material formation.

Materials that are somewhat flexible when formed usually produce objects with less distortion, since they cannot transmit strain long distances through the object. However, this property is a disadvantage if the goal is to make stiff objects. Some materials are soft when formed, and then harden when post cured with higher levels of

radiation or other means. These are useful materials for stereolithography. The whole subject of materials that produce less distortion, because of the way they make the transition from liquid to solid, is currently being studied. However, materials do not currently exist which produce distortion free parts.

There continues to be a long existing need in the design and production arts for the capability of rapidly and reliably moving from the design stage to the prototype stage and to ultimate production, particularly moving directly from the computer designs for such, plastic parts to virtually immediate prototypes and the facility for large scale production on an economical and automatic basis. Accordingly, those concerned with the development and production of three-dimensional plastic objects and the like have long recognized the desirability for further improvement in more rapid, reliable, economical and automatic means which would facilitate quickly moving from a design stage to the prototype stage and to production, while avoiding the complicated focusing, alignment and exposure problems of the prior art three-dimensional production systems. The present invention clearly fulfills all of these needs.

Summary of the Invention

The present invention provides a new and improved stereolithography system for generating a three- dimensional object by forming successive, adjacent, cross-sectional laminae of that object at the face of a fluid medium capable of altering its physical state in response to appropriate synergistic stimulation, informa¬ tion defining the object being specially processed to reduce curl, stress and distortion, and increase resolu¬ tion, strength and accuracy of reproduction, the successive laminae being automatically integrated as they are formed to define the desired three-dimensional object.

Basically, and in general terms, this invention relates to a system for reducing or eliminating the effect of "curl" distortion in stereolithography. The term "curl" is used to describe an effect similar to that found when applying coatings to such things as paper. When a sheet is coated with a substance that shrinks, it curls up toward the coating. This is because the coating both shrinks and sticks to the sheet, and exerts a pulling force on the top but not on the bottom of the sheet. A sheet of paper has insufficient restraining force to resist the pulling, and most coatings will curl paper. The same thing happens when a photopolymer is cured on top of a thin sheet of already cured photo-polymer.

In a presently preferred embodiment, by way of example and not necessarily by way of limitation, the present invention harnesses the principles of computer generated graphics in combination with stereolithography, i.e., the application of lithographic techniques to the production of three-dimensional objects, to simultaneously execute computer aided design (CAD) and computer aided manufacturing (CAM) in producing three-dimensional objects directly from computer instructions. The invention can be applied for the purposes of sculpturing models and proto¬ types in a design phase of product development, or as a manufacturing system, or even as a pure art form.

The data base of a CAD system can take several forms. One form consists of representing the surface of an object as a mesh of triangles. These triangles completely form the inner and outer surfaces of the object. This CAD representation commonly also includes a unit length normal vector for each triangle. The normal points away from the solid which the triangle is bounding.

"Stereolithography" is a method and apparatus for making solid objects by successively "printing" thin layers of a curable material, e.g., a UV curable material, one on top of the other. A programmed movable spot beam of UV light shining on a surface or layer of UV curable

liquid is used to form a solid cross-section of the object at the surface of the liquid. The object is then moved, in a programmed manner, away from the liquid surface by the thickness of one layer, and the next cross-section is then formed and adhered to the immediately preceding layer defining the object. This process is continued until the entire object is formed.

Essentially all types of object forms can be created with the technique of the present invention. Complex forms are more easily created by using the functions of a computer to help generate the programmed commands and to then send the program signals to the stereolithographic object forming subsystem.

Of course, it will be appreciated that other forms of appropriate synergistic stimulation for a curable fluid medium, such as particle bombardment (electron beams and the like) , chemical reactions by spraying materials through a mask or by ink jets, or impinging radiation other than ultraviolet light, may be used in the practice of the invention without departing from the spirit and scope of the invention.

Stereolithography is a three-dimensional printing process which uses a moving laser beam to build parts by solidifying successive layers of liquid plastic. This method enables a designer to create a design on a CAD system and build an accurate plastic model in a few hours. In a presently preferred embodiment, by way of example and not necessarily by way of limitation, the stereolitho¬ graphic process is composed of the following steps. First, the solid model is designed in the normal way on the CAD system, without specific reference to the stereolithographic process. A copy of the model is made for stereolithographic processing. In accordance with the invention, as subsequently described in more detail, objects can be designed with structural configurations that reduce stress and curl in the ultimately formed object.

In accordance with the invention, when a stereo¬ lithography line which is part of a vertical or horizontal formation is drawn with breaks in the line instead of a solid line, a/k/a the "dashed line" technique, the pulling force normally transmitted along the vector is eliminated, and the curl effect is reduced. When a stereolithography line which is part of a vertical or horizontal formation is drawn with bends in the line instead of a straight line, a/k/a the "bent-line" technique, the pulling force normally transmitted along the vector is reduced, and the curl effect is reduced. When a stereolithography line which is part of a vertical or horizontal formation is drawn so that it does not adhere directly to the line below or beside it, but is attached, after it is formed with a secondary structure, a/k/a the "secondary structure" technique, the pulling force down the vector is eliminated, the bending moment on adjacent lines is reduced, and the curl effect is greatly reduced. When a stereolithography line which is part of a vertical or horizontal formation is drawn so that it does not adhere directly to the line below or beside it until the material is substantially reacted, a/k/a the "multi-pass" technique, the pulling force down the vector is reduced, the structure is more rigid so it can resist deformation, and the curl effect is greatly reduced.

By way of example, and not necessarily by way of limitation, the invention contemplates ways to draw rails with reduced curl; 1) a dashed line, to provide isolation of the pulling effect, 2) a line with short segments at angles to each other to isolate the pulling effect, 3) lines that do not adhere to the layer below, to eliminate the pulling effect, but which are held together with other structure, and 4) lines that are as fully reacted as possible before the exposure that extends the gel point (and adhesion) to the lower layer is applied.

Model preparation for stereolithography involves selecting the optimum orientation, adding supports, and

selecting the operating parameters of the stereolitho¬ graphy system. The optimum orientation will (1) enable the object to drain, (2) have the least number of unsupported surfaces, (3) optimize important surfaces, and (4) enable the object to fit in the resin vat. Supports must be added to secure unattached sections and for other purposes; a CAD library of supports can be prepared for this purpose. The stereolithography operating parameters include selection of the model scale and layer (slice) thickness.

The surface of the solid model is then divided into triangles, typically "PHIGS". A triangle is the least complex polygon for vector calculations. The more triangles formed, the better the surface resolution and hence the more accurate the formed object with respect to the CAD design

Data points representing the triangle coordinates are then transmitted to the stereolithographic system via appropriate network communications. The software of the stereolithographic system then slices the triangular sections horizontally (X-Y plane) at the selected layer thickness.

The stereolithographic unit (SLA) next calculates the section boundary, hatch, and horizontal surface (skin) vectors. Hatch vectors consist of cross-hatching between the boundary vectors. Several styles are available. Skin vectors, which are traced at high speed and with a large overlap, form the outside horizontal surfaces of the object. Interior horizontal areas, those within top and bottom skins, are not filled in other than by cross-hatch vectors.

" The SLA then forms the object one horizontal layer at a time by moving the ultraviolet beam of a helium-cadmium laser across the surface of a photocurable resin and solidifying the liquid where it strikes. Absorption in the resin prevents the laser light from penetrating deeply and allows a thin layer to be formed. Each layer is

comprised of vectors which are drawn in the following order: border, hatch, and surface.

The first layer that is drawn by the SLA adheres to a horizontal platform located just below the liquid surface. This platform is attached to an elevator which then lowers its vertically under computer control. After drawing a layer, the platform dips several millimeters into the liquid to coat the previously cured layer with fresh liquid, then rises up a smaller distance leaving a thin film of liquid from which the second layer will be formed. After a pause to allow the liquid surface to flatten out, the next layer is drawn. Since the resin has adhesive properties, the second layer becomes firmly attached to the first. This process is repeated until all the layers have been drawn and the entire three- dimensional object is formed. Normally, the bottom 0.25 inch or so of the object is a support structure on which the desired part is built. Resin that has not been exposed to light remains in the vat to be used for the next part. There is very little waste of material.

Post processing involves heating the formed object to remove excess resin, ultraviolet or heat curing to com¬ plete polymerization, and removing supports. Additional processing, including sanding and assembly into working models, may also be performed.

The stereolithographic apparatus of the present invention has many advantages over currently used apparatus for producing plastic objects. The apparatus of the present invention avoids the need of producing design layouts and drawings, and of producing tooling drawings and tooling. The designer can work directly with the computer and a stereo-lithographic device, and when he is satisfied with the design as displayed on the output screen of the computer, he can fabricate a part for direct examination. If the design has to be modified, it can be easily done through the computer, and then another part can be made to verify that the change was correct. If the

design calls for several parts with interacting design parameters, the method of the invention becomes even more useful because of all of the part designs can be quickly changed and made again so that the total assembly can be made and examined, repeatedly if necessary.

After the design is complete, part production can begin immediately, so that the weeks and months between design and production are avoided. Ultimate production rates and parts costs should be similar to current injection molding costs for short run production, with even lower labor costs than those associated with injection molding. Injection molding is economical only when large numbers of identical parts are required. Stereolithography is useful for short run production because the need for tooling is eliminated and production set-up time is minimal. Likewise, design changes and custom parts are easily provided using the technique. Because of the ease of making parts, stereolithography can allow plastic parts to be used in many places where metal or other material parts are now used. Moreover, it allows plastic models of objects to be quickly and economically provided, prior to the decision to make more expensive metal or other material parts.

Hence, the stereolithographic apparatus of the present invention satisfies a long existing need for a CAD and CAM system capable of rapidly, reliably, accurately and economically designing and fabricating three- dimensional plastic parts and the like.

The above and other objects and advantages of this invention will be apparent from the following more detailed description when taken in conjunction with the accompanying drawings of illustrative embodiments.

Brief Description of the Drawings

FIG. 1 illustrates rail formation with stereo1ithograph ;

FIG. 2 illustrates reactive region detail;

FIG. 3 is a perspective view of a dashed line rail;

FIG. 4 is a perspective view of a short segment or bent line rail;

FIG. 5a is an end elevational view of a rail with no adhesion except for the attaching secondary structure;

FIG. 5b is a perspective view of a rail with no adhesion except for the attaching secondary structure;

FIG. 6 is a rail held together with rivets;

FIG. 7 is a quarter cylinder; FIG. 8 is a flow chart illustrating the software architecture of a suitable stereolithography system in which the present invention may be produced;

FIG. 9 is an overall block diagram of a stereo¬ lithography system for the practice of the present invention;

FIGS. 10 and 11 are flow charts illustrating the basic concepts employed in practicing the method of stereolithography of the present invention;

FIG. 12 is a combined block diagram, schematic and elevational sectional view of a system suitable for practicing the invention;

FIG. 13 is an elevational sectional view of a second embodiment of a stereolithography system for the practice of the invention; FIG. 14a illustrates the pulling effect of one line on another line below it;

FIG. 14b illustrates the lines of FIG. 14a, which are curled upwards because of the pulling effect;

FIG. 15a illustrates two already-cured lines with a gap of uncured resin between them;

FIG. 15b illustrates the countervailing forces exerted when the uncured resin in the gap of FIG. 15a is cured;

FIG. 16a illustrates the cure depth achieved when a particular expeosure is delivered in a single pass;

FIG. 16b illustrates the cure depth achieved through the lensing effect, when the exposure of FIG. 16a is delivered through multiple passes;

FIG. 17a illustrates the problem of downward bending in the multipass technique;

FIG. 17b illustrates a possible solution to the problem of FIG. 17a, by increasing the exposure on the early passes of the multipass technique;

FIG. 18 is a sample report showing REDRAW commands in the .L file;

FIG. 19 is a sample report showing REDRAW commands in the .R file;

FIGS. 20a and 20b is a sample report showing REDRAW default parameters in the .PRM file; FIG. 21a illustrates vectors spanning a cross section of an object?

FIG. 21b Illustrates the impact, of finite jumping time on the drawing of the vectors of FIG. 21a;

FIG. 21c illustrates the use of the zig-zag technique to alleviate the problem of FIG. 21b;

FIG. 22a shows sid view of stacked lines from different layers;

FIG. 22b illustrates the use of a riveted secondary structure to attach- adjacent lines of a particular layer; FIG. 22c illustrates a side view of the riveted secondary structure of FIG. 22b;

FIG. 22d illustrates the use of rivets to attach the secondary structures from adjacent stacked layers;

FIG. 22e illustrates a top view of the riveted secondary structure of FIG. 22b;

FIG. 23a illustrates rivets, where the diameter of the rivets is much smaller than the width of the lines;

FIG. 23b illustrates rivets, where the diameter of the rivets is larger than the rivets of FIG. 23a; FIG. 23c illustrates rivets, where the diameter of the rivets is larger than the width of the lines;

FIG. 24a is a side view of stacked lines connected by rivets;

FIG. 24b is a top view of oversized rivets;

FIG. 24c is a top view of offset rivets; FIG. 24d is a top view of rivets used to connect stacked support lines;

FIG. 25a illustrates a side view of secondary structure used to connect adjacent lines;

FIG. 25b is a top view of the structure of FIG. 25a showing rivets used to connect stacked secondary structure;

FIG. 25c is a side view of the secondary structure and rivets of FIG. 25b;

FIG. 26a shows a part made according to the dashed line technique;

FIG. 26b shows a part made according to the bent line technique;

FIG. 26c shows a part made according to the secondary structure technique; FIG. 27a shows the use of bricks and mortar with the dashed line technique;

FIG. 27b show the cure sequence for the bricks and mortar variant of the dashed line technique;

FIG. 27c shows the cure sequence for another variant of the dashed line technque;

FIG. 27d shows the cure sequence for a third variant of the dashed line technique;

FIG. 27e show the cure for a fourth variant of the dashed line technique; FIG. 28a shows the relieving of stress from the bent line technique;

FIG. 28b shows the bent line technique with a gap size of 40-300 mil;

FIG. 28c shows the bent line technique with a smaller gap size than in FIG. 28b;

FIG. 28d shows a variant of the bent line technique having a triangular shape;

FIG. 28e shows another variant of the bent line technique;

FIG. 28f shows the angles associated with the variant of FIG. 28e; FIG. 28g shows a third variant of the bent line technique;

FIG. 28h shows a bricks and mortar variant of the bent line technique;

FIG. 28i shows the cure sequence for the variant of FIG. 28h;

FIG. 28j shows the cure sequence for another bricks and mortar variant of the bent line technique;

FIG. 29a illustrates an undistorted cantilevered section; FIG. 29b illustrate a distorted cantilevered section;

FIG. 29c illustrates a top view of vectors that contribute to adhesion in a cantilevered section built to reduce curl;

FIG. 30 is a sample report showing the specification of critical areas in a critical .BOX file;

FIG. 31 is a sample report showing the specification of RIVET commands in the .L file;

FIGS. 32a and 32b is a sample report showing the specification of default RIVET parameters in the .PRM file;

FIGS. 33a and 33b is a sample report showing a .V file;

FIG. 34b is a side view of a distorted quarter cylinder; FIG. 34c is a top view of a layer of the quarter cylinder;

FIG. 34d is a top view of the layer of FIG. 34c showing the effects of horizontal curl;

FIG. 35a is a side view of a quarter cylinder showing its upper, support, post, and base layers;

FIG. 35b is a top view of a quarter cylinder showing the inner and outer concentric circularly curved rails;

FIG. 35c is a top view of a quarter cylinder showing the angle subtended by the curved rails;

FIG. 35d is a top view of a quarter cylinder showing the inner and outer rails connected by cross-hatch; FIG. 35e is a top view of a quarter cylinder showing the use of rivets to connect the stacked cross hatch of FIG. 35d;

FIG. 35f is a perspective view of a quarter cylinder;

FIG. 35g is a side view of a distorted quarter cylinder illustrating the definition of curl factor;

FIG. 36a is a side view of a part having slotted sections;

FIG. 36b is a frontal view of the part of FIG. 36a;

FIG. 36c is a top view of the part of FIG. 36a; FIG. 36d is a side view of the part of FIG. 36a showing the effects of sneer;

FIGS. 37a-37f illustrate the key steps in the stereolithography process;

FIGS. 38a-38c illustrate the major components of the stereolithograph system;

FIG. 39 is a block diagram of the stereolithography system;

FIG. 40 is a software diagram of the stereolithography system; FIGS. 41a-41b illustrate the contral panel switches and indicators;

FIG. 41c illustrates a sample part log;

FIG. 42 illustrates a sample working curve;

FIGS. 43a-43e illustrate a recommended optics cleaning technique;

FIG. 44 illustrates air filter replacement;

FIGS. 45a-45b illustrate SLICE computer components;

FIGS. 46a-46b illustrate electronic cabinet components; FIGS. 47a-47c illustrate optics components;

FIG. 48 illustrate chamber components;

FIGS. 49a-49b illustrate laser resonator alignment;

SUBSTITUTE SHEET

17. 1

FIGS. 50a-50b illustrate optics alignment;

FIG. 51 illustrates chamber alignment;

FIG. 52 illustrates the SLA-1 stereolithography system; FIGS. 53a-56b illustrate the electronic cabinet assembly;

FIG. 54 illustrates the optics assembly;

FIGS. 55a-55b illustrate the chamber assembly;

FIG. 56 illustrates the SLA-1 wiring diagram; FIGS. 57a-57f illustrate the geometric model of a generic American automatic SLICE would get as input (no tires) ;

FIGS. 58a-58c illustrate an exploded view of the geometric model; FIGS. 59a-59b illustrate the way SLICE orders the triangles by type and height;

FIG. 60 illustrates the ordering of scan triangles by their lowest corner;

FIGS. 61a-61b illustrate slicing the car and stacking the slices;

FIG. 62 illustrates how a slice is formed;

FIGS. 63a-63c illustrate how SLICE makes trapezoids for the near-flat triangles;

FIGS. 64a-64b illustrate how SLICE cross-hatches and skin fills flat triangles without making trapezoids;

FIGS. 65a-65f is a "slice" flowchart implementing STYLE 1;

FIGS. 66a-66f is a "slice" flowchart implementing STYLE 2; FIG. 67 illustrates an overview of the procedure necessary to produce a part with the SLA

FIGS. 68a-68b illustrate the format of the faceted representation which follows the PHIGS standard;

FIG. 69 illustrates the bindary floating point format compatible with the Intel 80287 Nath coprocessor;

FIG. 70 illustrates a box represented by TEST 0017.STL;

17 . 2

FIGS. 71a-71h illustrate the test part specification; and

FIGS. 72a-72b illustrate the spatial orientation of the test part.

Description of the Preferred Embodiment

The present invention is an improved stereolitho¬ graphic method and apparatus of the type for building up successive layers of photopolymer, where each layer is formed by drawing a series of vectors with a light pencil on the liquid surface that defines each cross-section of the object, wherein the improvement comprises reducing or eliminating curl. A number of techniques have been examined by building rails that are a series of layers of straight lines, and examining the resulting distortion. The force, or stress, in this case is generated at the interface where the photopolymer cures (and shrinks) and adheres to the layer below, as shown in the following diagram.

Referring now to the drawings and particularly to FIGS. 1 and 2 thereof, light pencil 3 moves across liquid 2 in the direction shown, converting it to solid 1. This forms a solid top layer 4, that adheres to lower layer 5. The term light pencil refers to synergistic stimulation such as UV light which impinges on the surface of the liquid photopolymer.

SUBSTITUTE SHEET

18

In the expanded diagram (FIG. 2) , the light from the pencil is shown penetrating into the photopolymer, forming reactive region 6. Solid/liquid interface 9, or gel point, is indicated. However, the polymeric state of the material in the active region is more complex. All of the material in the region is reacting. The material at the upper left of the region is most reacted, because the light is most intense and the pencil has been in this area the most time. The material at the lower right, just above the lower layer, is the least reacted, because the light is the least intense and the pencil has been in this area the least time.

As the material reacts, it changes density. This discussion assumes that the density change causes shrinkage, but expansion is also possible. Reactive region 6 acts as a complex shrinking cylinder, and shrinkage 7 is toward the interior of this cylinder. In the lower left area of the reactive region 6, the new solid material of top layer 4 attaches to the lower layer 5 with adhesion 8.

When a layer forms without attaching to a layer below, there is no "curl" distortion because as the reactive region shrinks, it is only attached to (and constrained by) its own layer. In achieving this single layer "adhesion", the layer is placed in compression, but there is no bending moment generated. This is because all of the horizontal forces from the shrinking reaction have no firm base to grip other than the just formed layer, and the new solid reacting material is allowed to displace slightly to the left as it is formed.

However, when a layer is formed and simultaneously attached to a lower layer, the portion of the attached material in the reactive region is still shrinking. This shrinking is now coupled to the rest of the rail two ways: a. The material directly over the adhesion point is shrinking. Since this shrinking material now can use the top of the lower layer as a firm base, it puts compres-

19 sional stress into this base. As the new layer is formed, all of the top of the previous (lower) layer is com¬ pressed, and this causes a bending moment in the lower layer. b. The reactive region shrinks, and is attached to the now forming top layer. This region is pulled to the left, as when an unattached layer is formed. However, the reactive region is now also attached to the lower layer, so that it resists the movement to the left, and so the shrinking also pulls the top layer to the right. This causes a bending moment in the rail.

It should be noted that there are two types of shrinkage with photopolymer reactions. The first mechanism is that the polymer shrinks due to polymer bond formation. The result is that the solid polymer state is more dense than the liquid pre-poly er state, and hence a given amount of polymer takes up less volume than the pre-polymer that it was formed from. This shrinkage mechanism is essentially instantaneous compared to the time taken to generate laser patterns (i.e., less than a microsecond) .

The second mechanism is a thermal effect. Photo¬ polymers are exothermic, so they give off heat when they react. This heat raises the temperature of the polymer, and it expands upon formation. The subsequent cooling and shrinkage has the same effect as the shrinkage due to the change of state, except it is slower, and is long compared to the time taken to generate laser patterns (seconds) . For the current photopolymers worked with, the change of state mechanism is the larger of the two types of shrinkage.

A typical example of a stereolithographic photopolymer is DeSoto SLR800 stereolithography resin, made by DeSoto, Inc., 1700 South Mt. Prospect Road, Des Plaines, Illinois 60018.

20

Methods to Control Curl

In accordance with the invention, when a stereolitho¬ graphy line which is part of a vertical or horizontal formation is drawn with breaks in the line instead of a solid line, a/k/a the "dashed line" technique, the pulling force normally transmitted along the vector is eliminated, and the curl effect is reduced. When a stereolithography line which is part of a vertical or horizontal formation is drawn with bends in the line instead of a straight line, a/k/a the "bent line" technique, the pulling force normally transmitted along the vector is reduced, and the curl effect is reduced. When a stereolithography line which is part of a vertical or horizontal formation is drawn so that it does not adhere directly to the line below or beside it, but is attached, after it is formed, with a secondary structure, a/k/a the "secondary structure" technique, the pulling force down the vector is eliminated, the bending moment on the adjacent lines is reduced, and the curl effect is greatly reduced. When a stereolithography line which is part of a vertical or horizontal formation is drawn so that it does not adhere directly to the line below or beside it until the material is substantially reacted, a/k/a the "multi-pass" technique, the pulling force down the vector is reduced, and the structure is more rigid so it can resist curl-.

The methods to control curl depend on building parts in ways so that the effects (a) and (b) above are eliminated or reduced. There are several simple examples of ways to draw rails with reduced curl; 1) a dashed line, to provide isolation of the pulling effect, 2) a line with short segments at angles to each other, to isolate the pulling effect, 3) lines that do not adhere to the layer below, to eliminate the pulling effect, but which are held together with other structure, and 4) lines that are as fully reacted as possible before the exposure that extends the gel point (and adhesion) to the lower layer is applied. These techniques are referred to respectively as

21 the dashed line, bent line, secondary structure, and multi-pass techniques. These basic rails are further described hereinafter.

A rail made with a dashed line is illustrated in FIG. 3. FIG. 4 shows a rail made with short segments at angles to each other. FIGS. 5a and 5b illustrates a rail made with lines that do not adhere to the layer below but which are held together with other structure.

To understand how to react lines as fully as possible prior to their adhering to the line below, requires an under-standing of the solid formation process. The amount of reaction time taken to form a layer in stereolithography depends on the layer thickness, the adsorption rate of the incident reactant energy, and the reactant rate of the material.

The thickness response curve to form a solid film on a liquid surface with incident reactant energy is a logarithmic function. The solid material at the liquid/solid interface is just at the gel point, and the solid material at the surface is the most reacted. After a film is formed, subsequent exposures increase the reaction at the surface, but extend the thickness of the film less and less.

An effective way to control curl is to choose a layer thickness that is.large enough so that the bulk of the new- top layer is highly cured (reacted) . It is even more effective to cure this layer with multiple exposures so that only the last few exposures achieve the adhesion. In this case, most of the material in the reactive region has already changed density before adhesion occurs. Also, the new top layer and the lower layers are more fully cured and more able to resist deformation.

In a presently preferred embodiment of the invention, a rail is built with two parallel walls close to each other, with exposure small enough so the layers do not adhere, and the walls are connected with short perpen¬ dicular vectors that are exposed to a depth great enough

22 so that the layers adhere at these points and hold the structure together.

In this method, the vectors for the two walls are both grown for each layer, and the adhesion is achieved by using additional exposure for the connecting vectors.

This concept has been generalized as a part building method. In this method, a part is designed with an inner wall and an outer wall, and with connecting webs. The part built with the Basic program "Quarter Cylinder" attached hereto as Appendix J, described above is such a part. FIG. 7 of the drawings shows this part. This building style is referred to as "riveting", where the higher exposed connecting vectors are called rivets.

In using this building style, when the inner and outer walls are exposed enough to cause adhesion, the amount of curl of the part depends on the amount of exposure beyond that required to make the polymer depth equal to the layer depth. That is, the more the walls are exposed beyond the point where the layer touches the layer below, the more the part curls. This is, in fact, the basis of a standard "curl test" for different resins described in more detail further on in this application. According to this test, a series of these quarter cylinders are built at different exposures, and the curl versus exposure is plotted. Using this test, it has been discovered that different resin formulas curl differently, and this allows the selection of the best resins.

Also note that the methods described herein to reduce curl are also applicable to the technique of building parts by fusing metal or plastic powder with a heat generating laser. In fact, the powder fusing technique may be even more susceptible to curl than by building with photopolymers, and the curl reduction techniques are needed even more with this method. Note also that with the general building algorithms as set forth in the previously described related co-pending applications, specifically S.N. 182,830, its

23

CIP, S.N. 269,801, and its continuation, Lyon & Lyon Dkt. No. 186/195, a part can be designed by CAD, sliced using X-axis hatch and 60 degree and 120 degree hatch, and with an appropriate MIA specified to produce near radial cross-hatch. If this part is then exposed with large exposure for the cross-hatch and lower exposure for the boundaries, then the part building method described in the paragraphs above has been implemented via CAD design. FIG. 8 of the drawings illustrates an overall stereolitho- graphy system suitable for this purpose which is described in more detail in the above-referenced co-pending applications.

Variations of the basic invention are possible, such as the broken lines or bent lines can be "filled" with lower exposure dashed lines to even out the surface structure. Dashed or broken lines can be used as the support lines that do not adhere directly to the line below or next to them. The unsupported lines are connected to the support lines with small additional structure lines. The secondary structure to attach unsupported lines can be "rivets" of higher exposure on top of these lines to connect them to the lines below.

Thinner layers can be formed by adjusting the absorption of the material so that a given exposure produces a thinner film, while the material near the top surface is still almost fully reacted.

The various methods described to control curl are additive. That is, if two or more of them are combined, the curl is reduced even further. Also, there are many other possible variations of the described techniques.

An example of one embodiment of a commercial system, provided by 3D Systems, Inc. of Sylmar, California, embodying the present invention, is illustrated and described by the enclosed appendices, wherein Appendix A are manuals describing the overall system for an early Model SLA-1 Beta Site Stereolithography System, including installation and operation, Appendix B is the first draft

24 of the SLA-1 Software Manual together with an addendum for use with earlier system. Appendix C is a listing of Version 2.62 of -the software for running an early version of the stereolithography system. Appendix E is a list of non-3D Systems software vendors for the Model SLA-1 Stereolithography System, FIGS. 65a-65f is a "Slice" Flow Chart Implementing Style 1, FIGS. 66a-66f is a "Slice" Flow Chart Implementing Style 2, Appendix I is a Stereolithography CAD/CAM Interface Specification for a suitable interface between CAD/CAM equipment and the Model

SLA-1 Stereolithography System, and Appendix J is a program listing for producing a quarter cylinder which is used to measure the effectiveness of different anti-curl techniques. Referring now to the drawings, and particularly to FIG. 9 of the drawings, there is shown a block diagram of an overall stereolithography system suitable for practicing the present invention. A CAD generator 2 and appropriate interface 3 provide a data description of the object to be formed, typically in PHIGS format, via network communication such as ETHERNET or the like to an interface computer 4 where the object data is manipulated to optimize the data and provide output vectors which reduce stress, curl and distortion, and increase resolution, strength, accuracy, speed and economy of reproduction, even for rather difficult and complex object shapes. The interface computer 4 generates layer vector data by successively slicing, varying layer thickness, rounding polygon vertices, filling, generating flat skins, near-flat skins, up-facing and down-facing skins, scaling, cross-hatching, offsetting vectors and ordering of vectors.

The vector data and parameters from the computer 4 are directed to a controller subsystem 5 for operating the system stereolithography laser, mirrors, elevator and the like.

SUBSTITUTE SHEET

25

FIGS. 10 and 11 are flow charts illustrating the basic system of the present invention for generating three-dimensional objects by means of stereolithography.

Many liquid state chemicals are known which can be induced to change to solid state polymer plastic by irradiation with ultraviolet light (UV) or other forms of synergistic stimulation such as electron beams, visible or invisible light, reactive chemicals applied by ink jet or via a suitable mask. UV curable chemicals are currently used as ink for high speed printing, in processes of coating of paper and other materials, as adhesives, and in other specialty areas.

Lithography is the art of reproducing graphic objects, using various techniques. Modern examples include photographic reproduction, xerography, and microlithography, as is used in the production of microelectronic circuit boards. Computer generated graphics displayed on a plotter or a cathode ray tube are also forms of lithography, where the image is a picture of a computer coded object.

Computer aided design (CAD) and computer aided manufacturing (CAM) are techniques that apply the capabilities of computers to the processes of designing and manufacturing. A typical example of CAD is in the area of electronic printed circuit design, where a computer and plotter draw the design of a printed circuit board, given the design parameters as computer data input. A typical example of CAM is a numerically controlled milling machine, where a computer and a milling machine produce metal parts, given the proper programming instructions. Both CAD and CAM are important and are rapidly growing " technologies.

A prime object of the present invention is to harness the principles of computer generated graphics, combined with the use of UV curable plastic and the like, to simultaneously execute CAD and CAM, and to produce three- imensional objects directly from computer instructions.

26

This invention, referred to as stereolithography, can be used to sculpture models and prototypes in a design phase of product development, or as a manufacturing device, or even as an art form. The present invention enhances the developments in stereolithography set forth in U.S. Patent No. 4,575,330, issued March 11, 1986, to Charles W. Hull, one of the inventors herein.

Referring now more specifically to FIG. 10 of the drawings, the stereolithographic method is broadly outlined. Step 8 calls for generation of CAD or other data, typically in digital form, representing a three- i ensional object to be formed by the system. This CAD data usually defines surfaces in polygon format, triangles and normals perpendicular to the planes of those triangles, e.g., for slope indications, being presently preferred, and in a presently preferred embodiment of the invention conforms to the Programmer's Hierarchial Interactive Graphics System (PHIGS) now adapted as an ANSI standard. This standard is described, by way of example, in the publication "Understanding PHIGS", published by Template, Megatek Corp., San Diego, California, which is hereby fully incorporated by reference herein as though set forth in full.

In Step 9, the PHIGS data or its equivalent is converted, in accordance with the invention, by a unique conversion system to a modified data base for driving the stereolithography output system in forming three- imensional objects. In this regard, information defining the object is specially processed to reduce stress, curl and distortion, and increase resolution, strength and accuracy of reproduction.

Step 10 in FIG. 10 calls for the generation of individual solid laminae representing cross-sections of a three-dimensional object to be formed. Step 11 combines the successively formed adjacent lamine to form the desired three-dimensional object which has been programmed into the system for selective curing.

27

Hence, the stereolithographic system of the present invention generates three-dimensional objects by creating a cross-sectional pattern of the object to be formed at a selected surface of a fluid medium, e.g., a UV curable liquid or the like, capable of altering its physical state in response to appropriate synergistic stimulation such as impinging radiation, electron beam or other particle bombardment, or applied chemicals (as by ink jet or spraying over a mask adjacent the fluid surface) , successive adjacent laminae, representing corresponding successive adjacent cross-sections of the object, being automatically formed and integrated together to provide a step-wise laminar or thin layer buildup of the object, whereby a three-dimensional object is formed and drawn from a substantially planar or sheet-like surface of the fluid medium during the forming process.

The aforedescribed technique illustrated in FIG. 10 is more specifically outlined in the flow chart of FIG. 11, where again Step 8 calls for generation of CAD or other data, typically in digital form, representing a three-dimensional object to be formed by the system. Again, in Step 9, the PHIGS data is converted by a unique conversion system to a modified data base for driving the stereolithography output system in forming three-dimensional objects. Step 12 calls for containing a fluid medium capable of solidification in response to prescribed reactive stimulation. Step 13 calls for application of that stimulation as a graphic pattern, in response to data output from the computer 4 in FIG. 9, at a designated fluid surface to form thin, solid, individual layers at that surface, each layer representing an adjacent cross-section of a three-dimensional object to be produced. In the practical application of the invention, each lamina will be a thin lamina, but thick enough to be adequately cohesive in forming the cross-section and adhering to the adjacent laminae defining other cross-sections of the object being formed.

28

Step 14 in FIG. 13 calls for superimposing successive adjacent layers or laminae on each other as they are formed, to integrate the various layers and define the desired three-dimensional object. In the normal practice of the invention, as the fluid medium cures and solid material forms to define one lamina, that lamina is moved away from the working surface of the fluid medium and the next lamina is formed in the new liquid which replaces the previously formed lamina, so that each successive lamina is superimposed and integral with (by virtue of the natural adhesive properties of the cured fluid medium) all of the other cross-sectional laminae. Of course, as previously indicated, the present invention also deals with the problems posed in transitioning between vertical and horizontal.

The process of producing such cross-sectional laminae is repeated over and over again until the entire three- dimensional object has been formed. The object is then removed and the system is ready to produce another object which may be identical to the previous object or may be an entirely new object formed by changing the program controlling the stereolithographic system.

FIGS. 12-13 of the drawings illustrate various apparatus suitable for implementing the stereolithographic methods illustrated and described by the systems and flow charts of FIGS. 1 - 3.

As previously indicated, "Stereolithography" is a method and apparatus for making solid objects by successively "printing" thin layers of a curable material, e.g., a UV curable material, one on top of the other. A programmable movable spot beam of UV light shining on a surface or layer of UV curable liquid is used to form a solid cross-section of the object at the surface of the liquid. The object is then moved, in a programmed manner, away from the liquid surface by the thickness of one layer and the next cross-section is then formed and adhered to

29 the immediately preceding layer defining the object. This process is continued until the entire object is formed.

Essentially all types of object forms can be created with the technique of the present invention. Complex forms are more easily created by using the functions of a computer to help generate the programmed commands and to then send the program signals to the stereolithographic object forming subsystem.

The data base of a CAD system can take several forms. One form, as previously indicated, consists of represent¬ ing the surface of an object as a mesh of triangles (PHIGS) . These triangles completely form the inner and outer surfaces of the object. This CAD representation also includes a unit length normal vector for each triangle. The normal points away from the solid which the triangle is bounding. This invention provides a means of processing such CAD data into the layer-by-layer vector data that is necessary for forming objects through stereolithography. For stereolithography to successfully work, there must be good adhesion from one layer to the next. Hence, plastic from one layer must overlay plastic that was formed when the previous layer was built. In building models that are made of vertical segments, plastic that is formed on one layer will fall exactly on previously formed plastic from the preceding layer, and thereby provide good adhesion. As one starts to make a transition from vertical to horizontal features, using finite jumps in layer thickness, a point will eventually be reached where the plastic formed on one layer does not make contact with the plastic formed on the previous layer, and this causes severe adhesion problems. Horizontal surfaces themselves do not present adhesion problems because by being horizontal, the whole section is built on one layer with side-to-side adhesion maintaining structural integrity. This invention provides a general means of insuring adhesion between layers when making transitions from

30 vertical to horizontal or horizontal to vertical sections, as well as providing a way to completely bound a surface, and ways to reduce or eliminate stress and strain in formed parts. A presently preferred embodiment of a new and improved stereolithographic system is shown in elevational cross-section in FIG. 12. A container 21 is filled with a UV curable liquid 22 or the like, to provide a designated working surface 23. A programmable source of ultraviolet light 26 or the like produces a spot of ultraviolet light 27 in the plane of surface 23. The spot

27 is movable across the surface 23 by the motion of mirrors or other optical or mechanical elements (not shown in FIG. 12) used with the light source 26. The position of the spot 27 on surface 23 is controlled by a computer control system 28. As .previously indicated, the system

28 may be under control of CAD data produced by a generator 20 in a CAD design system or the like and directed in PHIGS format or its equivalent to a computerized conversion system 25 where information defining the object is specially processed to reduce stress, curl and distortion, and increase resolution, strength and accuracy of reproduction.

A movable elevator platform 29 inside container 21 can be moved up and down selectively, the position of the platform being controlled by the system 28. As the device operates, it produces a three-dimensional object 30 by step-wise buildup of integrated laminae such as 30a, 30b, 30c. The surface of the UV curable liquid 22 is maintained at a constant level in the container 21, and the spot of UV light 27, or other suitable form of reactive stimulation, of sufficient intensity to cure the liquid and convert it to a solid material, is moved across the working surface 23 in a programmed manner. As the liquid 22 cures and solid material forms, the elevator platform

29 that was initially just below surface 23 is moved down

31 from the surface in a programmed manner by any suitable actuator. In this way, the solid material that was initially formed is taken below surface 23 and new liquid 22 flows across the surface 23. A portion of this new liquid is, in turn, converted to solid material by the programmed UV light spot 27, and the new material adhesively connects to the material below it. This process is continued until the entire three-dimensional object 30 is formed. The object 30 is then removed from the container 21, and the apparatus is ready to produce another object. Another object can then be produced, or some new object can be made by changing the program in the computer 28.

The curable liquid 22, e.g., UV curable liquid, must have several important properties: (A) It must cure fast enough with the available UV light source to allow practical object formation times. (B) It must be adhesive, so that successive layers will adhere to each other. (C) Its viscosity must be low enough so that fresh liquid material will quickly flow across the surface when the elevator moves the object. (D) It should absorb UV light so that the film formed will be reasonably thin. (E) It must be reasonably insoluble in that same solvent in the solid state, so that the object can be washed free of the UV cure liquid and partially cured liquid after the object has been formed. (F) It should be as non-toxic and non-irritating as possible.

The cured material must also have desirable properties once it is in the solid state. These properties depend on the application involved, as in the conventional use of other plastic materials. Such parameters as color, texture, strength, electrical properties, flammability, and flexibility are among the properties to be considered. In addition, the cost of the material will be important in many cases.

The UV curable material used in the presently preferred embodiment of a working stereolithography system

32

(e.g., FIG. 12) is DeSoto SLR 800 stereolithography resin, made by DeSoto, Inc. of Des Plains, Illinois.

The light source 26 produces the spot 27 of UV light small enough to allow the desired object detail to be formed, and intense enough to cure the UV curable liquid being used quickly enough to be practical. The source 26 is arranged so it can be programmed to be turned off and on, and to move, such that the focused spot 27 moves across the surface 23 of the liquid 22. Thus, as the spot 27 moves, it cures the liquid 22 into a solid, and "draws" a solid pattern on the surface in much the same way a chart recorder or plotter uses a pen to draw a pattern on paper.

The light source 26 for the presently preferred embodiment of a stereolithography system is typically a helium-cadmium ultraviolet laser such as the Model 4240-N HeCd Multi ode Laser, made by Liconix of Sunnyvale, California.

In the system of FIG. 12, means may be provided to keep the surface 23 at a constant level and to replenish this material after an object has been removed, so that the focus spot 27 will remain sharply in focus on a fixed focus plane, thus insuring maximum resolution in forming a high layer along the working surface. In this regard, it is desired to shape the focal point to provide a region of high intensity right at the working surface 23, rapidly diverging to low intensity and thereby limiting the depth of the curing process to provide the thinnest appropriate cross-sectional laminae for the object being formed. The elevator platform 29 is used to support and hold the object 30 being formed, and to move it up and down as required. Typically, after a layer is formed, the object 30 is moved beyond the level of the next layer to allow the liquid 22 to flow into the momentary void at surface 23 left where the solid was formed, and then it is moved back to the correct level for the next layer. The requirements for the elevator platform 29 are that it can

33 be moved in a programmed fashion at appropriate speeds, with adequate precision, and that it is powerful enough to handle the weight of the object 30 being formed. In addition, a manual fine adjustment of the elevator platform position is useful during the set-up phase and when the object is being removed.

The elevator platform 29 can be mechanical, pneumatic, hydraulic, or electrical and may also be optical or electronic feedback to precisely control its position. The elevator platform 29 is typically fabricated of either glass or aluminum, but any material to which the cured plastic material will adhere is suitable.

A computer controlled pump (not shown) may be used to maintain a constant level of the liquid 22 at the working surface 23. Appropriate level detection system and feedback networks, well known in the art, can be used to drive a fluid pump or a liquid displacement device, such as a solid rod (not shown) which is moved out of the fluid medium as the elevator platform is moved further into the fluid medium, to offset changes in fluid volume and maintain constant fluid level at the surface 23. Alternatively, the source 26 can be moved relative to the sensed level 23 and automatically maintain sharp focus at the working surface 23. All of these alternatives can be readily achieved by appropriate data operating in conjunction with the computer control system 28.

After the three-dimensional object 30 has been formed, the elevator platform 29 is raised and the object is removed from the platform for post processing.

As will be apparent from FIG. 13 of the drawings, there is shown an alternate configuration of a stereolithography system wherein the UV curable liquid 22 or the like floats on a heavier UV transparent liquid 32 which is non-miscible and non-wetting with the curable liquid 22. By way of example, ethylene glycol or heavy water are suitable for the intermediate liquid layer 32.

34

In the system of FIG. 12, the three-dimensional object 30 is pulled up from the liquid 22, rather than down and further into the liquid medium, as shown in the system of FIG. 11. The UV light source 26 in FIG. 13 focuses the spot 27 at the interface between the liquid 22 and the non-miscible intermediate liquid layer 32, the UV radiation passing through a suitable UV transparent window 33, of quartz or the like, supported at the bottom of the container 21. The curable liquid 22 is provided in a very thin layer over the non-miscible layer 32 and thereby has the advantage of limiting layer thickness directly rather than relying solely upon adsorption and the like to limit the depth of curing since ideally an ultrathin lamina is to be provided. Hence, the region of formation will be more sharply defined and some surfaces will be formed smoother with the system of FIG. 5 than with that of FIG. 12. In addition, a smaller volume of UV curable liquid 22 is required, and the substitution of one curable material for another is easier.

The new and improved stereolithographic method and apparatus has many advantages over currently used methods for producing plastic objects. The method avoids the need of producing tooling drawings and tooling. The designer can work directly with the computer - and a stereolithographic device, and when he is satisfied with the design as displayed on the output screen of the computer, he can fabricate a part for direct examination, information defining the object being specially processed to reduce curl and distortion, and increase resolution, strength and accuracy of reproduction. If the design has to be modified, it can be easily done through the computer, and then another part can be made to verify that the change was correct. If the design calls for several parts with interacting design parameters, the method becomes even more useful because all of the part designs can be quickly changed and made again so that the total

35 assembly can be made and examined, repeatedly if necessary.

After the design is complete, part production can begin immediately, so that the weeks and months between design and production are avoided. Ultimate production rates and parts costs should be similar to current injection molding costs for short run production, with even lower labor costs than those associated with injection molding. Injection molding is economical only when large numbers of identical parts are required. Stereolithography is particularly useful for short run production because the need for tooling is eliminated and production set-up time is minimal. Likewise, design changes and custom parts are easily provided using the technique. Because of the ease of making parts, stereolithography can allow plastic parts to be used in many places where metal or other material parts are now used. Moreover, it allows plastic models of objects to be quickly and economically provided, prior to the decision to make more expensive metal or other material parts.

It will be apparent from the foregoing that, while a variety of stereolithographic systems have been disclosed for the practice of the present invention, they all have in common the concept of drawing upon a substantially two-dimensional surface and extracting a three-dimensional object from that surface.

The present invention satisfies a long existing need in the art for a CAD and CAM system capable of rapidly, reliably, accurately and economically designing and fabricating three-dimensional plastic parts and the like, and reducing stress and curl.

An embodiment of the multi-pass curl reduction technique described earlier will now be described. In this embodiment, a layer of liquid resin is incrementally cured to a particular depth through multiple passes of a UV laser beam over the resin such that the layer does not adhere to an adjacent already-cured layer below on the

36 first pass. Instead, adhesion is achieved at a later pass, and in fact, additional passes after adhesion has been achieved are possible to achieve even more adhesion. For example, for a layer thickness of 20 mils, adhesion will be achieved when enough passes have been made to incrementally cure the layer down to 20 mils. However, even after adhesion has been achieved, additional passes can be made to cause the layer to penetrate another 6 mils into the already-cured layer below to achieve even greater adhesion betwen the layers. As a result, a cure depth of 26 mils is achieved even though the layer thickness may only be 20 mils.

Multi-pass reduces curl in two ways. First, multi¬ pass cures a layer incrementally, and enables the top portions of a layer to cure without transmitting stress to previously cured layers. With reference to Figure 14a, when layer 100 is cured in a single pass, the resin making up the layer will simultaneously shrink and adhere to layer 101, causing stress to be transmitted to this layer. The result is that, unless layer 101 is somehow anchored to resist the transmittal of stress, both layers will curl upwards as illustrated in Figure 14b. If layer 100 were cured on multiple passes, on the other hand, it could be cured without transmitting a significant amount of stress to layer 101. With reference to Figure 15a, through multi-pass, layer 100 could be cured almost to the point of adhering to layer 101, but separated from it by distance 102, which could be on the order of a few mils. Then, in a subsequent pass, the layers would be adhered to one another, but since the amount of resin which is cured on the final pass is small, there will be less shrinkage on the final pass compared with a single pass, and therefore less stress transmitted to the lower layer.

The second way multi-pass reduces curl is that when the adhesion pass is made, the resin being cured on the adhesion pass will be sandwiched in between a rigid already-cured layer below, and the rigid already-cured

37 portion of the present layer above. With reference to FIG. 15b, the curing of this resin will simultaneously introduce stresses to both the upper and lower cured layers, which will tend to cancel each other out. For example, lower layer 101 will tend to bend upwards, while upper layer 100 will tend to bend downwards as indicated. The result is that these effects will tend to offset each other as the force tending to curl layer 101 upwards will be counter-balanced by the rigidity of the already-cured portion of layer 100, whereas the force tending to curl layer 100 downwards will be counter-balanced by the rigidity of lower layer 101.

A possible embodiment of multi-pass is to provide only two passes for a given layer, with adhesion (and possible over-curing to penetrate into the next layer for better adhesion) occurring on the second pass. In this embodiment, it is preferable to cure a layer on a first pass so it is a close as possible, i.e. within 1 mil, to the bottom layer, which layer is then adhered to the bottom layer on the second pass.

A preferred embodiment of multi-pass is to provide more than two passes, i.e. four or five passes, for a given layer, such that after the first pass, an incremental amount of the uncured gap between the layers is incrementally cured on subsequent passes until a gap of only about two to three mils remains. Then, in a subsequent pass, the remaining two to three mil gap is cured, and adherence is achieved.

In deciding whether to implement multi-pass with only two passes, or with more than two passes, it is important to consider the precision with which the cure depth for a given layer can be estimated and/or controlled. If the cure depth can only be estimated with a precision of two to three mils, for example, then in the two-pass embodiment, there is a danger that adherence will be achieved on the first pass, which would defeat the purposes of using multi-pass in the first instance, and

38 would also result in curl. Of course, there is a danger than in the preferred multi-pass embodiment described above, that adherence could be achieved before the desired pass (which desired pass may not be the final pass if over-curing into the next layer is effectuated) because of the imprecision in estimating cure depth, but this is much less of a problem than in the two pass case, since in the pass during which adherence takes place, only a very small amount of resin will typically be cured, and only a very small amount of stress will therefore be transmitted to the lower layer. In the two pass case, on the other hand, in general, a large amount of liquid resin will be cured on the first pass, so that adherence during this pass can result in a large amount of curl since the stress transmitted to the lower layer depends on the amount of resin cured when adherence takes place. The reason why a lot of resin will be cured on the first pass in the two pass case is that, as discussed earlier, it is important in this embodiment to try to cure down ' to within a few mils of the layer below on the first pass, so that in the second pass, when adherence is achieved, only a small amount of resin will be cured. Therefore, on the first pass, a large volume of resin will typically be cured with the aim of curing to within a few mils of the lower layer. For a 20 mil layer thickness, this requires that the first pass penetrate approximately 18-19 mils towards the layer below, which represents a much larger volume of liquid resin.

In the preferred multiple pass embodiment, on the other hand, it is not necessary for the first pass to bring the layers to within a few mils of each other. Instead, a wider gap can be left after the first pass, and it will be left up to subsequent passes to bring the layers to within a few mils of each other, and ultimately adhere. Therefore, if adherence takes place at all before the desired pass, it will surely not take place on the first pass, when a large amount of liquid resin will be

40 resin has a different index of refraction compared with the liquid resin. In a multi-pass implementation, during the intermediate passes, the laser beam will pass through the resin which has already been cured on previous passes, and the cured resin, as mentioned above, will act as a lens, and will focus the UV laser light, causing it to achieve a greater cure depth penetration than predicted using Beer's Law.

The lensing effect can be illustrated with respect to FIG. 16, in which, compared to previous Figures, like elements are identified with like reference numerals. FIG. 16a shows cured resin 103 produced by a single pass of the UV laser at a particular exposure. The cure depth achieved is identified as T- . FIG. 16b shows the cured resin produced by multiple passes of the UV laser beam, where the increase in the cure depth at each pass is identified with reference numerals 103a, 103b, 103c, and 103d, respectively. If it is assumed that the sum of the incremental exposures applied at each pass equals the exposure applied in the single pass of FIG. 16a, based on Beer's Law, it would be expected that T 2 would equal T However as illustrated, because of the lensing effect, T 2 will be greater than T, by an increment indicated as T 3 , which will be on the order of 2-3 mils.

Another reason.for imprecision is due to bleaching of the photoinitiator component of the resin (a/k/a "photo- bleaching") , which can occur as the resin is exposed many times through the multiple passes of the UV light. Because of photo-bleaching, less UV light will be absorbed by the photoinitiator than predicted, with the result that the laser light will penetrate deeper into the resin than predicted.

A third reason for imprecision is variations in the intensity of the light produced by the laser, which, in turn, are caused by power fluctuations in the output of the laser.

41

For example, a laser presently used in the SLA-250, a commercial stereolithography apparatus manufactured by 3D Systems, Inc., has a continuous power output of approximately 20 mW. Because of power fluctuations, the laser output may be punctuated by 16-28 mW power bursts. In the SLA-250, the laser beam is directed to step across the surface of the liquid resin in incremental steps, and to then remain stationary for a given time period after each step. The exposure for the laser on an infinitesimal part of the liquid surface will be directly proportional to the laser output power multiplied by the step period divided by the step size. In other words, for a given laser output power, the exposure to the resin can be increased either by increasing the step period or decreasing the step size. Therefore, the fluctuations in laser output power will show up directly as fluctuations in exposure, with the result that the cure depth may vary by a few mils from what is expected because of these . fluctuations. In sum, the combined impact of the lensing effect, the bleaching of the photoinitiator, and power fluctuations of the laser output result in imprecision in estimating cure depth, so that, as a practical matter, it is preferable to implement multi-pass with more than two passes.

Another possible embodiment of multi-pass is to keep the laser exposure on each pass uniform. In many instances, however, uniform exposure on each pass will not be possible because of the impact of Beer's Law, according to which uniform increments of exposure at each pass will not lead to uniform increments in cure depth. Instead, much more will be cured on the first pass than on subsequent passes. For example, it is entirely possible for a first pass to cure 90% of the layer thickness, for a second pass to cure 90% of the uncured gap which remains left over after the first pass, and for a third pass to cure 90% of the remaining uncured gap left over after the

42 second pass, etc. The result is that with uniform exposure, a layer may adhere only after two passes, with the additional passes resulting in even more adherence between the layers. As a result, in general, an embodiment where non-uniform exposures are possible on the various passes will be preferable.

Several examples will now be provided showing the advantage of providing the option of non-uniform exposures on the various passes. These examples all assume that the desired layer thickness is 20 mils, that each layer is over cured so that it penetrates 6 mils an adjacent, lower layer, that a cure depth of 26 mils will be achieved through an accumulated exposure level of 1, and that the doubling of the exposure will result in a 4 mil incremental increase in the cure depth. Based on these assumptions, the following relationship between cure depth and exposure level results:

Cure depth Accumulated Exposure 26 mils 1 22 mils 1/2

18 mils 1/4

14 mils 1/8

10 mils 1/16

In all the examples, it will be assumed that the accumulated exposure from all the passes will be 1, so that the cure depth, after all the passes have taken place, will be 26 mils. The number of passes, and the incremental exposure at each pass are the variables changed in the examples. Therefore, in the examples, exposure refers to the incremented exposure applied on a particular pass, not the accumulated exposure applied up to and including this pass.

The first set of examples are for a two-pass embodiment of multi-pass.

43

Example 1.) Two passes, uniform exposure pass exposure cure depth

1 1/2 22 mils

2 1/2 26 mils Since this example (which shows a uniform exposure at each pass of 1/2) will achieve a cure depth of 22 mils on the first pass, which is greater than the layer thickness of 20 mils, it is not a preferable implementation of multi-pass because the layer will adhere on the first pass.

Example 2 . ) Two passes, non-uniform exposure pass exposure cure depth

1 1/4 18 mils

2 3/4 8 mils Since the cure depth on the first pass is only 18 mils, this example is an acceptable implementation.

Example 3.) Two passes, non-uniform exposure pass exposure cure depth 1 1/8 14 mils 2 7/8 12 mils

Since the cure depth on the first pass is only 14 mils, this example is also an acceptable implementation.

A comparison of Examples 2.) and 3.) indicates that

Example 2.) may be preferable since the top layer is cured closer to the bottom layer after the first pass, so that on the second pass, when adherence occurs, less resin will have to be cured. In fact, if cure depth could be precisely estimated on the first pass, the optimum solution would require the exposure on the first pass to be in the range of 1/4-1/2, which would leave even less of a gap between the layers after the first pass. However, because of the imprecision in estimating cure depth discussed above, it is preferable for the exposure on the first pass to be closer to 1/4 rather than 1/2. Therefore, Example 2.) is a preferred implementation compared with Example 3. ) .

The next set of examples are for three passes.

44

Example 4.) Three passes, uniform exposure pass exposure cure depth

1 1/3 19.7 mils

2 1/3 23.7 mils 3 1/3 26 mils

As indicated, this example may not an acceptable implementation because adhesion occurs on the second pass, and in addition, due to the degree of imprecision involved, because some adhesion may, in all likelihood, occur on the first pass since the 19.7 mil cure depth is so close to the layer thickness of 20 mils. Since there is a significant danger that adhesion may occur on the first pass, when the amount of liquid resin which is cured is great, this example is not a preferred embodiment of multi-pass.

Example 5.) Three passes, non-uniform exposure pass exposure cure depth

1 1/4 18 mils

2 ' 1/4 22 mils 3 1/2 26 mils

In this example, since the cure depth after the second pass is 22 mils, adherence will occur on the second pass, which may not be acceptable if adherence is desired on the third pass. On the other hand, because the first pass achieved a cure depth of 18 mils, the amount of plastic being cured during the second pass is not great, so the cure introduced by adherence on the second pass is not likely to be dramatic.

Example 6.) Three passes, non-uniform exposure pass exposure cure depth

1 1/4 18 mils

2 1/8 20.3 mils

3 5/8 26 mils

Since the cure depth after the second pass is 20.3 mils, there with probably be some adhesion after the second pass, although the amount of resin being cured on the second pass will be small since the first pass is

45 estimated to have achieved a cure depth of 18 mils. In addition, because of the imprecision in estimating cure depth, it is possible that adherence will not occur at all on the second pass. 5 Example 7.) Three passes, non-uniform exposure pass exposure cure depth

1 1/4 18 mils

2 1/16 19.3 mils

3 11/16 26 mils

10 Since the cure depth after the second pass is only 19.3 mils, this example is an acceptable implementation, although there may be some adhesion after the second pass ' because of the imprecision of estimating cure depth. However, even if there were some adhesion on the second

15 pass, the amount of resin being cured on the second pass will not be great, the first pass having already achieved a cure depth of 18 mils.

Example 8.) Three passes, non-uniform exposure pass exposure cure depth

20 1 1/16 10 mils

2 1/16 14 mils

3 14/16 26 mils

This example is an acceptable implementation since the cure depth after the second pass is only 14 mils.

2. " However, a 6 mil , thick volume of resin will have to be cured on the third pass when adhesion occurs, which can introduce a significant amount of curl. Therefore, Example 7.) is a preferable implementation, since much less resin will have to be cured on the third pass.

30 In sum, the above examples demonstrate that non- uniform exposure levels on the various passes is preferable to an implementation which requires uniform exposure levels on the various passes, since, in many instances, uniform exposures will result in adhesion too

35 early. Also, the above examples were provided for illustrative purposes only, and are not intended to be limiting.

46

A consideration in choosing exposure levels for the multiple passes is to avoid downward curl, a problem that can occur on a given pass if the cure depth achieved in previous passes is so small, that the curing of the liquid resin that takes place on later passes will cause the resin cured on the previous passes to bend downwards. In fact, if downward bending is large enough, then adhesion to the lower layer can occur sooner than expected, which as described above, can introduce even more stress into the part by introducing upward curl of the bottom layer. This problem will be particularly acute if the incremental cure depth at each pass is uniform since, in this instance, the cured resin from the previous passes will (except for the first pass) be relatively thin, and therefore more easily bent by the curing during the later passes.

In addition, the amount of downward bending will be dependent on the amount of resin which is cured during the later passes, since the more resin which is cured on the later passes, the more stress which is transmitted to the resin cured by the earlier passes. However, particularly where multi-pass is implemented with more than two passes, the amount of resin cured during the later passes may be relatively small, so that the downward bending problem may be alleviated by this type of implementation.

The problem of downward bending can be illustrated with reference to FIG. 17a, in which compared with the previous Figures, like references numerals are used to identity like components. As indicated, in a particular multi-pass implementation, bottom layer 101 is already cured, and layer 100 is being cured by multiple passes during which incremental amounts of liquid resin, identified by reference numerals 104a, 104b, and 104c, respectively, is cured. As shown, when resin 104c is cured, it shrinks and simultaneously adheres to cured resin 104b, transmitting stress and, causing downward bending. As indicated, if

47 the downward bending at the ends of the already-cured portion of the layer, identified by reference numerals 105 and 106 respectively, is great enough, the ends may touch the upper surface of layer 101, resulting in early adherence.

To alleviate this problem, two solutions are possible. One solution is to increase the thickness of the resin cured in the early passes, 104a and 104b, respectively, with respect to that cured during the later passes, 104c, or alternatively, to decrease the thickness of the resin cured during the later passes, 104c, compared with that cured during the early passes, 104a and 104b. This is illustrated in FIG. 17b, where, as before, compared with previous Figures, like components are identified with like reference numerals.

Another problem that can occur with multi-pass is birdnesting, which is a distortion that can occur if there are significant delays between the multiple passes. The problem occurs when resin cured on a particular pass is allowed to float for a long period of time on the surface of the liquid resin before additional passes adhere this cured resin to the layer below. If the delay is long enough, the cured resin floating on the surface of the resin can migrate about before it is adhered to the layer below. Birdnesting will be discussed in more detail below in the discussion of a commercial embodiment of multi-pass known as REDRAW, but it should be noted that a possible solution to the birdnesting problem is to reduce as much as possible the delays between successive passes. A fully-operational commercial version of REDRAW (which allows the specification of non-uniform exposure values for the multiple passes) is provided in the form of a computer listing in Version 2.62 of the software, which is attached as Appendix C. In addition, aspects of REDRAW are described in the SLA-1 Bela Release Software Manual, attached as Appendix B.

48

The REDRAW capabilities and functions reside in the BUILD program (a/k/a SUPER in other versions of the software) which programs are described in detail in co¬ pending U.S. Patent Application S.N. 182,830, filed April 18, 1988, its co-pending continuation-in-part, U.S. Patent Application S.N. 269,801, and in its co-pending continuation, Lyon & Lyon Dkt. No. 186/195. Briefly, BUILD controls the laser movement through the use of two other programs, STEREO and LASER, and it obtains the parameters it needs to implement the numerous REDRAW functions based on information supplied in either 1.) a •PRM default parameter file in which a user can specify default REDRAW parameters; 2.) a .L layer control file in which a user can specify REDRAW parameters on a layer by layer, and vector type by vector type, basis; or 3.) a .R range control file in which a user can specify REDRAW parameters for a range of layers, and for vector types within a range. To implement the REDRAW functions, various command lines specifying REDRAW parameters are placed in either of these files similar to the way that other cure parameters are defined (as explained in the above co-pending applications) .

The first place BUILD looks for REDRAW control parameters is the .L or .R file, not both. As indicated above, the .L file enables a user to . specify REDRAW parameters with a high degree of control. With the .L file, a user can specify REDRAW parameters for a particular vector type within a layer of an object. For example, for a .L file consisting of merged data for four objects, which data represents 11 different vector types, the .L file enables 44 different REDRAW parameters to be specified for each layer. In sum, the .L file provides layer by layer control of multi-pass.

The .R file is designed for those applications whether the layer by layer control allowed by the .L file is not needed. Instead of providing layer by layer control, the .R file provides control on a range by range

49 basis, where a range represents any number of adjacent layers.

The REDRAW parameters can be placed into the .R file using a user interface program known as PREPARE. Tc place the REDRAW parameters into the .L file, a standard word processor type line editor is used.

If BUILD requires any REDRAW parameters which it is unable to obtain from either the .L or .R files, then it will seek them from the .PRM default parameter file. REDRAW parameters can be placed in these files by use of the PREPARE program.

The first REDRAW command is RC ##, where RC is a mnemonic for Redraw Count. This command specifies the number of passes that the laser beam will make over each vector of a cross-section, i.e., the number of passes for a particular layer. The number of passes specified can range from 1 to 10.

The second REDRAW command is RD ####, where RD is a mnemonic for Redraw Delay. This command specifies the length of time the laser will wait at the beginning of each pass. As mentioned earlier, the laser beam moves across the surface of the resin in steps followed by delays at each step. The delay at each step is known as the Step Period, which is identified with the mnemonic SP, and the command for specifying a particular value of SP is the command SP ##, where the value chosen is in units of 10 microseconds. The value of RD can be specified as any number in the range of 0 to 65,535, which number represents the delay in units which are multiples of the SP value. Thus, an RD of 10 represents a delay of ten times the value specified for SP. In general, the RD command is not used much, and the standard value is 0. The RD command is similar to the JD command (which mnemonic stands for Jump Delay) . Note that the JD and RD commands are both necessitated by the inability of the software running on the PROCESS computer (which software controls the rotation

50 of the dynamic mirrors, and hence the movement of the laser beam across the liquid resin) to take account of the time it takes for the laser beam to jump from a first vector to another vector, after it has drawn the first vector. After the laser beam has been directed to sweep out a particular vector, the software will direct the beam to start drawing out another vector, perhaps beginning at a different location than the end of the previous vector, and will then simultaneously begin counting down the time for the laser to step through the vector as if the beam were instantaneously situated at the beginning of the next vector. In many instances, the PROCESS computer will begin the counting while the laser beam is still jumping to the beginning of the vector. When the laser finally gets to the right location, the PROCESS computer will immediately position it at the location it has counted down to, with the result that the first part of the vector may be skipped over and left uncured.

The effect can be illustrated with the help of FIGS. 21a and 21b. FIG. 21b illustrates cross-section 105 of an object, and associated vectors 106a, 106b, 106c, 106d, and 106e spanning the surface of the cross-section, which vectors represent the movement of the laser beam as it cures the liquid plastic that forms the cross-section. The dotted lines between the head and tails of successive vectors is the movement of the laser as it jumps from one vector to another, and it is the jumping time for these jumps that causes the problem mentioned above.

The effect of the jumping time is illustrated in FIG. 21b, in which like elements are identified with like reference numerals compared with FIG. 21a. The jumping time results in an area, identified with reference numeral

107 in FIG. 21b, which is left uncured.

The use of JD and RD is designed to get around this problem. The delay specified by these commands is the time the PROCESS computer is directed to wait, after it has cured a particular vector, before it begins stepping

51 through the next vector. In the context of REDRAW, RD is the time the PROCESS computer is directed to wait after it has completed a pass over a particular area, before it begins a next pass over that area. By causing the PROCESS computer to wait, the stepping through can be delayed until the laser beam is positioned properly.

As mentioned earlier, JD and RD are rarely used, and the reason for this is illustrated in FIG. 21c. FIG. 21c illustrates a technique known as the "zig-zag" technique which is now implemented in the software to reduce the travel distance and hence jumping time between successive vectors. As illustrated, successive vectors 106a, 106b, 106c, 106d, and 106e, instead of all pointing in the same direction as indicated in FIGS. 21a and 21b, are caused to alternate directions, as illustrated in FIG. 21c. The direction of these vectors indicates the movement of the laser beam on the surface of the resin as it traces out these vectors. The result is that jumping time is dramatically reduced, making it frequently unnecessary to use the JD command. This technique is also implemented in REDRAW, so that the laser beam will be caused to alternate directions every time it passes over a particular area in multi-pass. As a result, it is also frequently unnecessary to use the RD command. The third REDRAW command is RS ####, where RS is the mnemonic for Redraw Size. It was recognized early on that a problem with some forms of multi-pass was birdnesting, and to alleviate this problem, the RS command was added to enable long vectors in a given cross-section to be broken up into smaller mini-vectors so that multi-pass could be performed on each mini-vector before proceeding on to the next mini-vector. By choosing an appropriate size for the mini-vector, cured resin from the early passes could more rapidly be adhered to the layer below than if the entire vector were drawn on a given pass. The RS command specifies the length of the mini-vector into which the vectors of the cross-section are divided.

52

As discussed earlier, the laser beam moves in steps, and the step size is identified by the mnemonic SS. The command for specifying the step size is SS ##, where the number specified can range from 0 to 65,538 bits, where a bit represents approximately .3 mil (the actual tranlation is 3560 bits per inch) . AS a result, a particular pass can proceed over a distance which can range from a minimum of approximately .3 mils to a maximum of approximately 20 inches. The units of RS are multiples of SS. For example, an SS of 2, and an RS of 1000, indicates that each pass will draw 2000 bits of vector information before jumping back to make additional passes. Alternatively, with an SS of 8, and an RS of 1000, then 8000 bits of vector information will be drawn before beginning another pass.

The last REDRAW command is a command for providing a different laser exposure value for each pass. This is accomplished by specifying a different SP value for each pass, since as indicated earlier, the exposure is directly proportional to SP. The format of the command is SP ####, ####, #### . . . . depending on the number of passes. The value of SP is in units of 10 μs, and in addition, each SP can range in value from approximately 5-15 to approximately 4000-6500. As mentioned earlier, for a given layer of an object, different REDRAW parameters can be specified for each vector type in that layer using the .L file. In addition, all the REDRAW commands will be completed for a particular vector type, before REDRAW commands for the next vector type are expected.

A typical command line in the .L file might appear as follows: 920, LB1, "RC 3; RD 0; RS 1000; SP 250, 150, 1000; SS 2." This command indicates that at the layer of a first object located 920 vertical bits from the bottom, that for the layer boundary vectors for that object, identified by the mnemonic LB1, 3 passes will be performed for each boundary vector (indicated by the REDRAW command

53

RC 3) , each pass will draw 2000 bits of a boundary vector (indicated by the commands SS 2 and RS 1000) before pro¬ ceeding on to the next pass, and the SP values for the first, second, and third passes, respectively, will be 250, 150, and 1000.

A typical command in a .R file might appear as follows:

LB1, "RC 3; RD 0; RS 1000; SP 250, 150, 1000; SS 2" which command is identical to that specified above for the .L file, except that no layer specification is provided, since this command will apply to all layers within a specified range. A command in the .PRM default parameter would look similar to this.

A sample report showing the format of the .L file is shown in FIG. 18. As illustrated, only vectors for a first object are represented, and REDRAW commands can be specified for each vector type within a layer of that object. The vector types and their associated mnemonics are as follows: LB layer boundary

LH layer Crosshatch

NFDB near-flat down-facing skin boundary NFDH near-flat down-facing skin cross hatch NFUB near-flat up-facing skin boundary FB flat down-facing skin boundary

FDF . flat down-facing skin fill NFDF near flat down-facing skin fill NFUF near flat up-facing skin fill FUB flat up-facing skin boundary FUF flat up-facing skin fill

The various vector types are described in more detail in S.N. 182,830, its co-pending CIP, S.N. 269,80Ϊ, and its co-pending continuation, Lyon & Lyon Dkt. No. 186/195. Briefly, boundary vectors are used to trace the perimeter of each layer, cross hatch vectors are used to trace the internal portion of each layer surrounded by the layer boundary, and skill fill vectors are used to trace any

54 outward surfaces of the object. They are traced in the following order: boundary, cross-hatch, and skin.

FIG. 19 is a sample report showing the format of the

.R file. As indicated, the format is similar to that for the .L file, except that the specifiction of REDRAW parameters is only possible for a particular vector type within a range of layers.

In FIG. 19, the REDRAW commands for a particular range are framed by the mnemonics #TOP and #BTM, and in addition, the range of layers to which the REDRAW commands apply are provided in the line before the #TOP mnemonic.

For the first block of REDRAW commands in FIG. 19, the range specified is 920, 920, which indicates that the range specified for the first block of REDRAW commands is the one layer located at 920 SLICE units from the bottom (assuming CAD/CAM units of inches, and a desired resolution of 1,000, the SLICE units will be mils. The difference between the CAD/CAM and SLICE reference scales is described in more detail in S.N. 182,830, its CIP S.N. 269,801, and its continuation, Lyon & Lyon Dkt. No. 186/195) . This is because the beginning and ending points of the range are identical: 920 mils. The ending point of the range could just as well have been specified as any other value in the CAD/CAM reference scale, in which case, the block of commands would apply to all layers in the specified range.

FIGS. 20a and 20b illustrate default parameters listed in a .PRM file, which parameters will be used if they are not specified in either the .L or .R files. As indicated, default parameters can be specified for each object (assuming more than one object is being built at the same time) , and for each object, can be further specified for each vector type within any layer of that object. For example, the default parameters specified for the layer boundary vectors of the first object are as follows: LB1, "RD 1; RS 300; RC 1; SP 20; JD 0; SS 8." This command line is interpreted as follows: the default

54.1 value for

SUBSTITUTE SHEET

55

Redraw Delay is 1 (representing 200 μs given the default SP value of 20) , for Redraw Size is 300 (representing 2400 bits or approximately 720 mils, given the default SS of 8), for Redraw Count is 1 (indicating single pass, i.e., layer boundary vectors are not to be multi-passed) , for Step Period is 20 (representing 200 μs) , for Jump Delay is 0 (indicating this command is not being used) , and for Step Size is 8 (representing 8 bits or approximately 2.4 mils) . Since the default value for RC is 1, this indicates that unless multi-pass is specified in either the .L or .R files for the layer boundary vectors, it will not be provided for these vectors.

As is evident from the above description, the commer¬ cial embodiment of REDRAW utilizes a technique known as the "short vector" technique, whereby any vector is divided up into a sequence of short mini-vectors, and the entire vector is multi-passed by successively multi- passing each of the mini-vectors. The objective of the short vector technique is to eliminate the problem of birdnesting, a problem which could occur if multi-passing were attempted on the full length of vectors as a whole, especially long vectors. In this instance, the plastic cured during the early passes will be floating quite awhile on the surface of the liquid resin before they would be adhered to the lower layer through curing from subsequent, additional passes. As a result, this cured plastic can move before it is finally adhered to the layer below, a problem which can manifest itself as a distortion in the final part, which distortion resembles a birdnest, and hence is called birdnesting.

It has been found that if the short mini-vectors are made too small, that another problem crops up, which is the downward bending or bowed down effect, discussed earlier with reference to FIGS. 17a and 17b, according to which the cured plastic from the early passes is caused to bow downwards from the shrinkage of the plastic below it cured during the later passes. As a result of this

56 effect, adherence takes place too early, and upward curl then results. The problem manifests itself in the form of a scalloped appearance of the surface of the part.

Several approaches are possible to alleviate the birdnesting and bowed down effects mentioned above. First, boundary vectors are the only vectors where birdnesting may result from their being drawn through multiple passes since they are typically drawn in isolation from the other vectors, and do not therefore have anything to adhere to when they are drawn. Hatch vectors, on the other hand, are usually drawn after the border vectors have been drawn, and they therefore adhere to the cured plastic from the border vectors when they are drawn, even if they are drawn in multiple passes. Skin and near-flat skin vectors also are typically drawn after the border and hatch vectors are drawn, and may adhere to the cured plastic from these vectors when they are drawn. In addition, the spacing between these vectors is typic¬ ally very small (approximately 1-4 mils, compared to a spacing of approximately 30-100 mils for hatch vectors) , so that adherence will also take place with cured plastic from adjacent skin and near flat skin vectors.

Thus, one solution to the birdnesting problem is to only multi-pass the hatch vectors, and not the border vectors. All the hatch vectors could be multi-passed, or alternatively, only a percentage of the hatch vectors could be multi-passed. Even if the hatch vectors did have a bowed down appearance from the multi-passing, this would not affect the outer appearance of the part. This solution is feasible in the commercial embodiment of REDRAW described above, since the use of the .L, .R, or .PRM files all allow multi-pass to be implemented only for selected vector types. Thus, REDRAW could only be provided for the hatch vectors. Another solution is to multi-pass all vector types, but to use other techniques such as Web Supports or Smalley's to eliminate birdnesting. Web Supports are

57 described in more detail in U.S. Patent Application S.N. 182,801, filed April 18, 1988, which, as indicated at the outset, is hereby incorporated by reference as though set forth in full herein. Smalley's are described in more detail in U.S. Patent Application 183,015, filed April 18, 1988, which, as indicated at the outset, is hereby fully incorporated by reference as though set forth in full herein.

A third solution is to use a two pass implementation of multi-pass so that the cured plastic from the first pass will be adhered on the second pass, and will therefore only be floating for a short while. The disadvantage is that as mentioned earlier, more than two passes is beneficial for dealing with the imprecision in estimating cure depth. This disadvantage could be alleviated by only two pass multi-passing the border vectors (where birdnesting is a problem) , but multi- passing with more than two passes for the remainder of the vectors. A fourth possible solution is to isolate the use of multi-pass to those areas of the part having critical volume features, that is areas that are most susceptible to distortion, such as cantilevered sections of a part. These areas can be isolated through the use of the .R file, which can be used to specify a range of cross sections to which multi-pass is to be applied.

An important aspect of the commercial embodiment of REDRAW in version 2.62 of the software is the ability to specify different SP values (and hence different exposures) for different passes. As discussed earlier, it is frequently necessary to specify different exposure values for the different passes in order to prevent adhesion from occurring earlier than desired. Preferably, the SP values should be chosen so that on the first pass, a large percentage of the gap between layers is cured, leaving an uncured area which is cured on successive passes, and which area has a thickness in the range of

58 only 1-5 mils depending on the layer thickness and tolerances possible. The preferred size of the gap will depend on the layer thickness as follows:

Layer thickness Uncured gap 20 mils 1-5 mils

10 mils 1-3 mils

5 mils 1-2 mils

As can be seen, the size of the uncured gap remaining after the first pass can increase with the layer thick- ness. This is because the greater the layer thickness, the more plastic that will be cured on the first pass, which plastic will be less susceptible to downward bending from the shrinking of the plastic in the uncured gap as it is cured. After the first pass, the SP for the remaining passes should preferably be chosen to effectuate a 1-2 mil increase in cure depth per pass. As a result, during the pass when adherence takes place, only a very small amount of plastic will be cured, with the result that the stress introduced by the shrinkage of the plastic during this pass will be minimal, stress which would otherwise be transmitted to the cured portion of the layer above, and to the cured layer below.

Several examples of the dashed line, bent line, and secondary structure techniques will now be described. FIGS. 22a-22f illustrate an example which combines the technique of using secondary structures and rivets to connect rails. In all these Figures, like components are identified with like reference numerals. Figure 22a shows a side view of layers 107a, 107b, and 107c, which are shown stacked on top of each other. As shown, the layers have been cured in isolation from each other in order to reduce curl by eliminating the ability of the layers to transmit stress to one another while they are being cured. As indicated, though, a problem with curing the layers in isolation from one another is that the final part will be very weak, as there is nothing holding the layers

59 together. As a result, a secondary structure must be added to connect to the layers.

Each layer in FIG. 22a is actually comprised of two lines in parallel, and a top view of a layer is illustrated in FIG. 22b, which shows layer 107b as consisting of lines 107b(1) and 107b(2) in parallel. As shown, the lines for a given layer have also been cured in isolation from each other to reduce curl, and they must also be connected by some form of secondary structure in order to provide structure to the part.

FIG. 22b is a top view of layer 107b, which illustrates secondary structure 108a, 108b, 108c, 108d, and 108e, for connecting the lines of a particular layer, in this case, lines 107b(1) and 107b(2) of layer 107b. In addition, as will be seen, the secondary structure also connects the lines of adjacent layers together, in this case, lines 107b(1) and 107b(2) are respectively connected to lines 107c(1) and 107c(2) by the secondary structure. This is illustrated in FIG. 22c, which shows a side view of the lines of layer 107b stacked on top of the lines for layer 107c, and connected by secondary structure 108a, 108b, 108c, 108d, and 108e.

The secondary structure has two aspects to it, and comprises supporting lines of lower exposure and an area of higher exposure, known as rivets for connecting support lines from adjacent layers together. This is illustrated in FIGS. 22d and 22e. As indicated in FIG. 22e, the secondary structure for layer 107b comprises, in part, connecting support lines 108a(1) , 108b(l) 108c(l) , 108d(l) and 108e(l) of lower exposure than lines 107b(1) and 107b(2) making up the layer (as a result of which the support lines have a lower cure depth than the lines making up the layer) . In addition, the support lines are used to connect the lines making up a layer, in this case lines- 107b(1) and 107b(2) of layer 107b. Also, the secondary structure is comprised, in part, of areas of higher exposure known as rivets. In FIG. 22e, these are

60 identified as 108a(2), 108b(2) , 108c(2) , 108d(2) , and 108e(2) , respectively, which rivets are areas of heavier exposure than either the support lines or the lines making up a layer, the result of which is that the rivets have a cure depth which penetrates down to and adheres to the support lines of an adjacent layer. This is illustrated in FIG. 22d, which shows the rivets connecting the support lines for layers 107b and 107c.

An important aspect of rivets is illustrated in FIGS. 23a-23c, in which like components are indicated with like reference numerals. If lines on different layers are connected by rivets, then, in certain instances, it may be important to keep the diameter of the rivets smaller than the width of the lines. This, in turn, will be accomplished by keeping the exposure used to create the rivets low enough so that this condition does not occur. FIG. 23a illustrates a line with rivets 109a, 109b, and 109c, where the diameter of the rivets is much smaller than the width of the line. FIG. 23b illustrates a line where the diameter of the rivets is larger than those in FIG. 23a. FIG. 23c illustrates a line where the diameter of the rivets is even larger than the width of the line.

Keeping the diameter of the rivets smaller than the width of the lines is only important when the lines form the outer surface of a layer of the part. In this instance, it is important to keep the rivet diameter smaller than the line width so that the outward surface of the part remains smooth. If the lines being riveted are support lines in the interior of the object, it may not be necessary to keep the diameter of the rivets smaller than the width of the lines. In fact, in this instance, as illustrated in FIGS. 22b and 22e, the diameter of the rivets can be greater than the width of the support lines.

This aspect of rivets is illustrated in more detail in FIGS. 24a-24d, in which like components are identified with like reference numerals.

61

FIG. 24a illustrates a part comprising layers 107a, 107b, and 107c respectively, which layers are connected to adjacent layers by means of rivets 109a(2) and 109b(2) (for connecting layer 107a to 107b) , and by means of rivets 108a(2) and 108b(2) (for connecting layer 107b to 107c) .

A top view of rivets 108a(2) and 108b(2) is illustrated in FIG. 24b. If line 107b makes up the outer surface of the finished part, then if the diameter of the rivets is greater than the width of the line, a rough outer surface will be introduced.

Three techniques are possible for alleviating this problem. One technique mentioned earlier is simply to reduce the size of the diameter of the rivets. A second technique, illustrated in FIG. 24c, is to offset the rivets from the surface 110 of the line forming the outer surface of the finished part so that the rivets do not extend beyond the plane of the surface. A third technique, illustrated in FIG. 24d, and which is discussed in detail above, is to introduce support lines, and then rivet only the support lines together. In fact, the above techniques can be combined. FIG. 24d shows lines 107b(1) and 107b(2) connected by lower exposure support lines, which support lines are -connected to support lines of adjacent layers by rivets 108a(2) and 108b(2) . In addition, line 107b(1) is connected to a line of an adjacent layer by means of rivets Ilia(2) and 111b(2) , and line 107b(2) is connected to a line of an adjacent layer by means of rivets 110a(2) and 110b(2) . If either of these lines forms the outer surface of the part, then as discussed above, the diameter of the rivets cannot be too large, or if it is, the rivets must be offset towards the interior of the part so they do not extend beyond the plane of the outer surface of the part. Note that in FIG. 24d, parts have been successfully built where the distance 112 between lines on the same layer is in the range of 40 to 300 mils, and in addition,

62 where lines on successive, adjacent layers are also separated by this distance. However, other examples are possible, either by separating the lines by more or less than this range, and the above range is provided for illustrative purposes only, and is not intended to be limiting.

FIGS. 25a-25c illustrate another example of using a secondary structure to connect lines. In these Figures, like components are identified with like reference numerals. As shown in FIG. 25a, successive structures 113a, 113b, 113c, and 113d are drawn, wherein each structure, as illustrated in FIG. 25c has a portion 113a(1) made with relatively low exposure, and another portion 113a(2) made with higher exposure. Moreover, as illustrated in FIG. 25a, the exposure chosen to make the higher exposure portion should be such that successively stacked high exposure portions, 113a(2) and 113c(2) in the Figure, barely touch. In fact, successful parts have been made using this technique where successive high exposure portions are within 40-300 mils of each other, but this range is provided for illustrative purposes only, and is not intended to be limiting.

Note that lower exposure portions from successive layers, 113a(l) and 113b(l) in the Figure, overlap, and it is necessary to rivet these overlapping portions together so that successive layers adhere to one another. This is illustrated in FIG. 25b, which shows rivets 116a, 116b, and 116c holding together overlapping lower exposure portions from successive layers, 113a(l) and 113b(l) in the Figure. Note that the outer surfaces 114 and 115 of the part are formed from the stacking of the higher exposed portions from successive layers, surface 114 being made up, in part, of stacked portions 113a and 113c, and surface 115 being made up, in part, of stacked portions 113b and 113d.

Note that all the curl reduction techniques described above reduce curl through one of three ways: 1.) reducing

63 stress; 2.) resisting stress; and 3.) relieving stress. An example of 1.) is multi-pass where successive layers are cured through multiple passes so that when they do adhere, only a small amount of stress will be transmitted to adjacent layers. An example of 2.) is the multi-pass technique whereby as much of a layer as possible is cured on the first pass, so that this portion of the layer will be strong to both resist downward curling, and to resist the layer below from upward curling. An example of 3.) is dashed or bent lines, where stress is actually transmitted from one layer to another, but breaks or bends act to relieve the stress.

The appropriate curl reduction technique for a given application will involve a trade-off between structural strength and curl. In general, the higher the structural strength required for a particular application, the more curl.

- FIGS. 26a-26c illustrate a part made with different curl reduction techniques. FIG. 26a shows the part made with dashed lines, FIG. 26b shows bent lines, and FIG. 26c shows a part made using the secondary structure technique described above with respect to FIGSs. 25a-25c. With respect to FIG. 26a, parts have been successfully built where the length of the solid portions of a line, identified with reference numeral 117a in the Figure, range from 40 to 300 mils, and where the breaks between the successive solid portions, identified with reference numeral 117b in the Figure, were also in the range of 40 to 300 mils. However, these ranges are illustrative only, and are not meant to be limiting.

With respect to FIG. 26b, parts have been success¬ fully made with bent lines, where the solid portion of a line, identified with reference numeral 108a in the Figure, is in the range of 40-300 mils, and in addition, where the gaps in the line between the solid portions, identified with reference numeral 118b in the Figure, is

64 also in this range. Again, this range is intended to be illustrative, and not limiting.

With respect to FIG. 26c, parts have been successfully built where the distance between parallel lines of a particular layer, identified with reference numeral 119 in the Figure, is in the range of 40-300 mils. The above range is provided for illustrative purposes only, and other examples are possible.

A problem with the dashed line technique is that because of the breaks in a line, a bad part surface finish may result, and in addition, the parts may be flimsy. Three variants of the techniques are available to alleviate these problems, which variants are illustrated in FIGS. 27a-27e, in which like components are identified with like reference numerals.

The first variant, the "brick and mortar" variant, is illustrated in FIG.27a. According to this variant, the solid portions of a dashed line are analogized to bricks, and the breaks between successive bricks are filled in with liquid resin analogized to mortar, which is then cured with less exposure than the bricks. A problem with this variant is that if the mortar is subsequently exposed at the same level as the bricks to improve strength, curl will be reintroduced. The second variant is illustrated in FIG. 27b, in which a dashed line is placed on a solid line. FIG. 27b shows the order in which the indicated portions are successively cured. As indicated, the solid layer is drawn, and then on top of it are drawn spaced bricks, and then the interstices between the bricks are filled with mortar, which interstices are then cured, preferably at a lower exposure than the bricks. An advantage of curing the bricks on top of the solid layer is so that the solid layer will be strong to resist upward curl. The third variant is illustrated in FIG. 27c, which variant is to offset a dashed line placed over another dashed line so that the solid portions of one line span

65 the breaks in the second line. FIG. 27c shows the order in which the indicated portions are cured. As indicated, bricks are drawn on one layer, and then on the next layer, bricks are also drawn, but offset from those on the first layer, so that the bricks on the second layer span the interstices between the bricks on the first layer. A problem with this technique is that it results in almost as much curl as if standard solid lines were drawn.

Other variations of the dashed line technique are illustrated in FIGS. 27d and 27e, where the numerals indicate the order of drawing the indicated solid portions. FIG. 27d shows placing a first dashed line on a solid line, and a second offset dashed line placed on the first dashed line. FIG. 27e shows placing several dashed lines on a solid line which are lined up, and then offsetting successive dashed lines.

The bent line technique illustrated in general in FIG. 26b, and variants on this technique are illustrated in FIGS. 28a-28i. As indicated in FIG. 28a, the basic idea of the bent line technique is to relieve the stress transmitted to a given layer from adjacent layers. With respect to FIG. 28a, stress introduced to portions 118a and 118b of line 118, are taken up by lateral movement of these portions into gap 118c. This is because something must give to relieve the stress, and in the example of FIG. 28a, what gives is the portions 118a and 118b, which are allowed to move laterally into gap 118c.

Parts have been successfully built with the dimensions indicated in FIG. 28b, that is with the solid portions of a line in the range of 40 - 300 mils, and the gaps between the solid portions also in this range. Other examples are possible, and the indicated ranges are intended to be illustrative only, and not limiting. The size of the gaps should preferably be as small as possible, but as a practical matter, the size of the gaps depends on the tolerances possible, because it is crucial that successive solid portions do not touch. In the

66 example of FIG. 28a, it is crucial that gap 118c is not so small that solid portions 118a and 118b touch. If they touch, then curl will result. Therefore, the lower the possible tolerances, the greater should be the gaps between successive solid portions of a bent line. Successful parts have been built with the gaps as small as 40 mils, but smaller gaps are possible. FIG. 28c shows an example of a bent line where the gaps are much smaller than the length of the solid portions. A benefit of the bent line technique compared with the dashed line technique, is that bent lines can be much stronger than dashed lines, and in addition, their stress resistance can be much greater after a part is built using bent lines. FIG. 28d shows a variant of a bent line where the bends in the line have a triangular shape. Parts have been successfully built with each triangular bend on the order of 250 mils (1/4 inch) in length. In addition, the angle of the vertex of each triangular bend, although indicated at 90" in FIG. 28d, can vary from this. In fact, if made smaller than this, the resulting line will resemble that in FIG. 28c, and even more curl can be eliminated. If the angle is made greater than this, the bent line will resemble a straight line, and the curl effect will be more pronounced.

Another variant of a bent line is illustrated in FIGS. 28e and 28f. As indicated in FIG. 28e, parts have been successfully built using bent lines where the bends in the line have an inverted triangular shape as illus- trated, and where each bend has in FIG. 28f the dimensions indicated, that is, a width of 125 mils (1/8 inch), with the gaps between successive solid portions 40 mils or smaller, and with the angles of each triangular bend at 45°, 45", and 90°, respectively. As before, it is crucial that successive solid portions of a bent line do not touch. Otherwise, curl will be introduced. Therefore, in FIG. 28e, the gaps in the line should be kept as small as

67 possible as long as successive solid portions do not touch. FIG. 28g shows another variant of a bent line technique where the bends have a trapezoidal shape. Other examples are possible, and the examples above are intended to be illustrative only, and are not intended to be limiting.

As with dashed lines, a part built with bent lines may have a poor surface finish. To get around this problem, a bricks and motar variant of bent lines is possible whereby the gaps in the bent lines are filled with liquid resin and thereafter partially exposed. As before with the dashed line, if this resin is cured to the same exposure as the rest of the line, the curl effect will be introduced. FIG. 28h illustrates the technique of filling in the gaps in the line with liquid resin and then partially exposing the resin in the gaps. The numbers indicate the order in which the portions shown are cured. Another variant is to place a bent line on a solid line as indicated in FIG. 28i, which has the advantage that the solid line drawn first resists upward curl. In addition, to improve the surface appearance, as in FIG. 28h, the gaps in the bent line are filled in with resin and partially exposed. The order in which the curing takes place is indicated by the numerals in the Figure. FIG. 28j illustrates another variant where a first bent line is placed on a solid line, and a second bent line is placed on the first bent line but offset from the first bent line so that the solid portions of the second bent line span the gaps in the first bent line. The numerals indicate the order in which the portions indicated in the Figure are cured.

Implementations of the rivet technique for reducing curl will now be described. An early implementation of rivets was in the form of programs written in the Basic Programming Language which programs provided for layers of a part to be directly scanned by a laser beam without the intermediate step of reformatting the data describing the

68 layers into vectors as described in S.N. 182,830, its CIP, S.N. 269,801, and its continuation, Lyon & Lyon Dkt. No. 186/195. These layers were scanned so that the cure depth for each layer was less than that required to cause adhe- sion between the layers. The program would then provide for additional scanning (exposure) of selected areas of each layer in order to cause adhesion, but only at these selected areas. It was found that if the number of these areas at which adhesion was to occur was relatively small, that minimal distortion and curl would be generated by the adhesion of the layers. These higher exposure adhesion areas are what is referred to here as rivets, and although part distortion can increase as the number of adhesion points increase, it will be a small effect if the number of adhesion areas is small.

Later implementations were consistent with the intermediate step of reformatting the layer data into vectors. More details about the different vector types are provided in S.N. 182,830, its CIP, S.N. 269,801, and its continuation, Lyon & Lyon Dkt. No. 186/195. An early vector-based implementation is described in Appendix B, pp. 35-36, 51. These implementations require that individual vector lengths would be small for those vectors that contribute to adhesion between layers and that there should be gaps between these vectors. In addition, it may be acceptable to use a large number of adhesion vectors between layers to insure structural integrity of the part, as long as these vectors are interior to the outer boundaries of the part so that any curl that results will not affect surface accuracy.

Also, these vectors should generally be placed so that their length is perpendicular to the direction of probable distortion. For example, on a cantilever, the direction of these vectors should preferably be perpen- dicular to the axis of the cantilever section. FIG. 29a illustrates an undistorted cantilevered section 120, made up of individual layers 120a, 120b, 120c, 120d, and 120e,

69 which adhere to adjacent layers as shown to make up the overall section. The cantilevered section is what is commonly referred to as a rail. As shown, the section is supported by supports 120 which in turn make direct contact with platform 122. The axis of the section is also indicated in the Figure.

FIG. 29b illustrates the same cantilevered section reflecting the distortion caused by curl. In the Figure, compared with FIG. 29a, like components are identified with like reference numerals. As shown, the direction of the curl is upwards, in the same direction as the axis of the cantilevered section.

FIG. 29c is a top view of layer 102d of the section showing the direction of the vectors that contribute to adhesion between layer 102d and layer 102e. As shown, the direction of these vectors is all perpendicular to the direction of distortion, and therefore to the axis of the cantilevered section.

A problem with this early vector-based implementation is that it depended on the geometry of the part by virtue of its dependence on the direction of the axis of the part. More recent vector-based implementations have taken a different approach that provides the dramatic benefits described above with rivets, but at the same time insures good structural integrity without such a strong dependence on part geometry.

In these early vector-based implementations of rivets, the mnemonics used to describe the different vector types differed from that used in S.N. 182,830, its CIP, S.N. 269,801, and its continuation, Lyon & Lyon Dkt. No. 186/195. A detailed description of the different vector types is available in these applications, and also in Appendix D. Briefly, boundary vectors are used to trace the parimeter of a layer, cross hatch vectors and used to trace the internal portions of a layer, and skin fill vectors are used to trace any outward surfaces of a part. They are traced in the following order: boundary.

70 cross hatch, and skin fill. The following list shows the correspondence between these mnemonics:

1) . For layer boundary vectors, "Z" was used to describe these vectors instead of "LB". 2). For layer Crosshatch vectors, "X", "Y" and "I" were used to describe X, Y and 60/120 Crosshatch vectors, respectively. In later implementations, these vectors were combined together and characterized by the single mnemonic "LH". 3) . For up facing skin boundary vectors, "S" was used as the single mnemonic to describe both flat and near-flat boundary vectors. In later implementations, these vector types were separated out into different categories characterized by the "FUB" and "NFUB" mnemonics respectively.

4). For up facing skin hatch vectors, "A", "B", and "J" were used to describe X, Y and 60/120 skin cross hatch vectors, respectively. Up facing skin hatch vectors have no counterpart under the mnemonics used in current implementations.

5). For up facing skin fill vectors, "H" and "V" were used to describe X and Y skin fill vectors, respect¬ ively. Both flat and near flat fill vectors were included within these mnemonics. In later implementations, X and Y fill vectors were combined, but the flat and near flat vectors were separated out. The new mnemonics are respectively "FUF" and "NFUF".

6) . For down facing skin boundary vectors, "C" was used to describe both flat and near-flat boundary vectors, but in later implementations, these vector types were separated out and described by the "FDB" and "NFDB" mnemonics, respectively.

7). For down facing skin hatch vectors, "F", "G", and "K" were used to characterize X, Y, and 60/120 cross hatch vectors, respectively. In more recent implementa¬ tions, only down facing near flat skin hatch vectors are possible, which are described by the mnemonic "NFDH".

71

8) . For down facing skin fill vectors, "D" and "E" were used to distinguish X and Y skin fill vectors respectively. Both flat and near flat fill vectors were included under these mnemonics. In later implementations, both X and Y fill vector types were combined into one mnemonic, however the flat and near flat vector types were separated out. The new mnemonics are "FDF" and "NFDF", respectively, for the flat and near flat vector types.

The first aspect of the vector-based implementation of rivets is specifying a critical area of a particular layer or layers in which rivets will be placed. These critical areas are specified by creating what is known as a critical box file. This file contains one or more box specifications enclosing volumes that will either have their Crosshatch vectors riveted or not scanned at all. An XV placed at the beginning of a box specification indicates that Crosshatch vectors inside the box will be riveted while an XI placed at the beginning of a box specification indicates that Crosshatch vectors inside the box will not be scanned. The critical box file is an ASCII file generated by any convenient text editor and is given the same name as that of the output files (the .L and .V files) that will be created by the MERGE program, which merges .SLI files for different objects before beginning the process of tracing out vectors (described in more detail in S.N. 182,830, its CIP S.N. 269,801, and its continuation, Lyon & Lyon Dkt. No. 186/195) , except it will have the extension .BOX instead of .L or .V. Briefly, the CAD file for an object is referred to as the .STL file for that object. A program known as SLICE slices or converts the .STL file into vector-based layer data which is placed into an .SLI file for the object. MERGE then merges the .SLI file for different objects to form a .V file containing the merged vector data, and also a .L file for control purposes. The BUILD program then takes the .V and .L files, and begins tracing out the vectors. When the MERGE program begins to merge its input

72

.SLI files for different objects, it looks for a corres¬ ponding .BOX file. If this file is found, MERGE then appends critical area designations onto all layers that are indicated as requiring them. Its contents consist of one or more single line critical box specifications. A single box consists of a rectangular volume for a particular vector type followed by its position in space. A typical specification might look like, "XV, .94,-04, .250,8.750, .250, .250,4.375, .250,4.375,8 .750" The XV indicates that this box surrounds a volume to be riveted.

The 0.94 indicates the location of the bottom of the box in the same units and reference scale as that used in the CAD design of the part. If the CAD units are inches, the 0.94 indicates that the bottom of the box is .94 inches from the bottom of the CAD space. The 0.04 represents the height of the box in CAD units (inches in the above example) above the bottom. The next eight numbers are read as XY pairs that indicate the corners of the box in CAD units and are based on the location of the part in space as designated by the CAD system. FIG. 30 shows the format of a typical .BOX file (entitled for illustrative purposes only as RIVET.BOX) , which file describes two boxes specifying volumes that will be riveted. The example shows the file as consisting of a single text line which is wrapped around for printing purposes only. Note that a benefit of the MERGE program is that different riveting parameters can be specified for differ¬ ent subvolumes of an object by placing the different subvolumes into separate .STL files, slicing them separ¬ ately into different .SLI files for each subvolu e, and then merging them. This is because different riveting parameters can be specified for each .SLI file. More details on the .SLI and .STL file formats are provided in

73

Appendix I, S.N. 182,830, its CIP, S.N. 269,801, and its continuation, Lyon & Lyon Dkt. No. 185/195.

An alternative to the use of the .BOX file to control riveting to specify rivet commands in the .L file which allow rivets to be controlled on a layer by layer basis, and within a layer, on a vector type by vector type basis. Another approach to controlling riveting is to specify default rivet parameters for particular vector types in the .PRM file. Briefly, the .PRM file contains default parameters, and if BUILD cannot find a particular riveting parameter in the .L file, it will search the .PRM file for the parameter. The rivet commands are described below.

1.) VC is a mnemonic for Rivet Count, a command which has an argument of 1 to 7, and which indicates the number of passes to make when riveting a vector in a layer to an adjacent layer. The command format is "VC 2" and 11 VC 5", for specifying two or five passes, respectively.

2.) VR is a mnemonic for Rivet Reduction, which is a command that can be used to prevent hatch vectors from being riveted right up to the point where they contact boundary vectors since this may cause a deterioration of the surface finish of the part along with greater distortion. Compared to the early vector-based implementation of rivets, which was heavily dependent on the geometry of the part, the use of cross hatch vectors for riveting provides geometry independence since hatch vectors, being present at most if not all layers, will provide layer to layer ahesion. If it were ever necessary for a particular application to shape riveting to a particular part geometry, the use of the .BOX file to specify critical box configurations, and the specification of different riveting parameters for different subvolume .SLI files which are then merged as described earlier, will provide the ability to do so. The VR command calls for all scans, except for the first one, to be of the reduced length. In other words, the first scan is done at full vector length, and

74 additional scans are reduced by the VR amount. The command takes an argument that specifies a particular distance at each end of a vector that will not be riveted, which argument can have a value in the range of 1 to 65535. This argument indicates the number of SS multiples taken off of each end of the vector before doing the multiple scans specified by the VC command. Since the argument for SS is in terms of bits (1 bit is approxi¬ mately .3 mil) , the argument for VR can be translated into bits by multiplying it by the SS parameter.

3.) VP is a mnemonic for Rivet Period, and is a command which is similar to SP in that it specifies an exposure volume for each scan specified by the VC command. As with REDRAW, where an exposure value could be specified for each pass, the VP has an argument for every scan called for by the VC command. Each argument can take on a value of approximately 10 to 6500 in units of lOμs. A typical VP command for VC=4 might look like:

"VC 4;VP 40, 50, 60, 70". This command would be interpreted as follows: The first scan will be over the entire vector length and will have an SP of 40. It is likely that this SP value was chosen such that the cure depth obtained by this scan is slightly less than the layer thickness. The second scan will be over a vector whose end points have been displaced by an amount specified by the VR command and which is drawn according to an SP of 50. The third scan covers the same area as the second scan but its drawing speed is based on an SP of 60. The fourth scan is identical to the previous two except for a drawing speed based on an SP of 70. Note that these rivet commands are only used on the various types of Crosshatch.

As discussed earlier with respect to the implementa¬ tion of multi-pass known as REDRAW, the .L file is created by a standard text editor, and is used by BUILD (or SUPER, depending on the software version) program for layer to layer control of the curing process. The R.

75 file, which provides control for a range of layers, is not available to control riviting for the particular implemen¬ tation of rivets described here. The .PRM file is used by BUILD to obtain default riveting parameters when a particular parameter is not specified in the .L file. In sum, the .L file is used to control riveting on a layer by layer basis, and within a layer, on a vector type by type basis. The .PRM file is used only in those instances where a critical riveting parameter is not specified in the .L. file.

The format of a .L file for use in controlling riveting is provided in FIG. 31. As above, the file is named RIVIT.L for illustrative purposes only, and shows layer 920 with no rivet parameters specified. Layer 940, on the other hand, has a number of riveting commands which apply to it, which commands are framed by the #T0P and #BTM mnemonics. Note that unlike the RIVET.BOX file, where parameters are specified in CAD units, parameters in the .L and .PRM files are specified in SLICE units. CAD units are the units in which an object is designed on a CAD system, and are the units associated with the .STL file for an object. SLICE units are the units into which the object is sliced into layers by the SLICE program, and is associated with the .SLI file for that object. For CAD units in inches, for example, and a desired SLICE resolu¬ tion of 1,000, the SLICE units will be in mils. CAD units, SLICE units and resolution are described in more detail in S.N. 182,830, its CIP, S.N. 269,801, and its continuation, Lyon & Lyon Dkt. No. 186/155. In FIG. 31, the first riveting command line specified for layer 940 is "#CA XV, 250, 250, 3750, 250, 3750, 8750, 250, 8750" where the mnemonic #CA stands for Critical Area. This command is similar to the .BOX file discussed earlier, and specifies a critical box, within which the cross hatch vectors are either riveted or not scanned at all. The XV mnemonic indicates that the cross hatch vectors will be riveted. The next eight numbers are four

76

XY pairs (in SLICE units) that describe the corners of box which makes up the critical area.

The next command line for layer 940 is a command which " applies only to "Z" vectors (which are layer boundary vectors, and as per the table provided earlier, are referred to in later implementations with the mnemonic "LB"). As indicated, the command line is "SS 8; SP 100; JD 0: RC 1", which since a VC command is not specified, indicates that the layer boundary vectors are not being rivetted. The next command line for layer 940 applies only to the "X" vectors (as per the above table, X cross hatch is now combined with Y and 60/120 cross hatch into the single mnemonic "LH") and is as follows: "SS 8; SP 100; JD 0; RC 1; VC 2; VR 500; VP 20, 100". The "VC 2" command specifies a Rivet Count of two passes, where an exposure of 20 is specified for the first pass, and an exposure of 100 is specified for the second pass. Given exposure units of 10 μs, this translates into an exposure of 400 μs, and 1,000 μs, respectively. The command "VR 500" indicates that for the second pass, the X cross hatch vectors will only be riveted to within 500 SS multiples from where the cross hatch vectors join the layer boundary vectors. Given an SS of 8 bits (approximately 2.4 mils), this translates into an offset of approximately 1,200 mils (1.2 inches) from the ends.

FIGS. 32a and 32b shows an example of a .PRM file, entitled SUPER.RPM for illustrative purposes only. The •PRM file is described in greater detail in S.N. 182,830, its CIP, S.N. 269,801, and its continuation, Lyon & Lyon Dkt. No. 186/195, and only the aspects of the example pertaining to default riveting parameters will be described here. First, the only default riveting parameters indicated are for the layer cross hatch vectors for the first object (described in the Figure by the mnemonic "LHl", which as per the table above, in earlier implementations, would have been described with the mnemonics "X", "Y" or "I", for X, Y, or 60/120 cross

SUB S TITUTE SHEET

76.1 hatch, respectively) and for the

77 near flat down facing skin vectors for the first object (described in the Figure with the mnemonic, "NFDH1," which, as per the table, would have been described in earlier implementations with the mnemonics "F", "G", and "K", for X, Y, or 60/120 cross hatch, respectively). The relevant portion of the file is reproduced below: LHl, "RC 2; SP 20, 80; JD 0; SS 8;

VCR 5; rivet count VR 99; rivet reduction VP 11, 12, 13, 14, 15" rivet step amount periods NFDH1, "RC 1; SP 176; JD 0; SS 2; VC 5; VR 99; VP 11, 12, 13, 14, 15" First, the portion of each line following the "!" is a comment for readability purposes only. For the layer cross hatch vectors, the default Rivet Count is 5 passes, with an exposure of 11, 12, 13, 14 and 15 specified for each respective pass (which given exposure units of lOμs, translates into exposures of 110, 120, 130, 140, and 150 μS, respectively) . The default Rivet Reduction amount is 99 SS multiples, which given the default SS of 8, trans¬ lates into a value of 792 bits or approximately 237.6 mils. For the near flat down facing skin vectors, the default riveting parameters are identical to those specified for the layer cross hatch vectors.

The ,V file produced by MERGE is illustrated in FIG. 33a and 33b. The file consists of the vectors to be traced for each layer divided into the various vector types. As indicated, for layer 920, the XY pairs for the layer boundary vectors (indicated by the mnemonic "ZI", with "1" denoting the first and only object) are listed followed by the XY pairs for the cross hatch vectors (indicated by the mnemonic "XI") . Then, the layer boundary and cross hatch vectors are listed for layer 940. Aspects of meaning the effectiveness of the various techniques above will now be described. Appendix J is a program for producing a quarter-cylinder, which is a type

HEET

78 of part specifically developed in order to measure the impact on curl of any of the aforementioned techniques.

The quarter-cylinder is actually a cantilevered beam made up of a number of layers which adhere to adjacent layers to form the overall beam. An aspect of the quarter-cylinder is the measurement of upward (or vertical) curl, which results from the adhesion of layers to adjacent layers. FIGS. 34(a) and 34(b) provide a side view of a quarter cylinder which shows the effects of upward curl. The quarter cylinder comprises cantilevered beam 120 made up of layers 120a, 120b, and 120c, which are supported by platform 121. FIG. 34a shows the quarter- cylinder before the effects of upward curl have been introduced, while FIG. 34b shows the same quarter-cylinder after the effects of upward curl have been introduced. FIG. 34b illustrates another aspect of upward curl, which is that as the number of cured layers increases, they become more effective in resisting the torque produced by the successively cured layers. As a result, in the example of FIG. 34b, by the time layer 120c is cured, the effects of upward curl have just about disappeared.

It is important to note that a layer may actually be cured in steps where horizontal, adjacent lines are successively cured to form the overall layer. When a line is cured along-side an already cured line, the first line will shrink and cause the already-cured line to curl horizontally depending on the degree of adhesion between the line. This effect is illustrated in FIGS. 34c and 34d, wherein FIG. 34c illustrates a top view of layer 120a comprising lines 123a, 123b, and 123c, respectively, while FIG. 34d shows the effects of horizontal curl on the same layer. As indicated, as more lines are built, the effects of horizontal curl become less pronounced since the already cured lines become better able to resist the torque exerted by successive lines.

Another aspect of the quarter cylinder is its ability to measure another type of curl known somewhat graphically

79 as "sneer". Sneer will explained after the entire structure of the quarter cylinder has been explained.

A specific example of a quarter cylinder is illustrated in FIG. 35a. As illustrated, the part comprises upper layers 124, support layer 125, post-layers 126, and base layer 127. Advantageously, upper layers 124 comprise 25 layers, post-layers 126 comprise 8 layers, base layer 127 comprises 1 layer, and support layer 125 comprises 1 layer. Other examples are possible, however, and this example is provided for illustrative purposes only, and is not intended to be limiting.

As illustrated in FIG. 35b, which illustrates a top view of the quarter cylinder, each layer advantageously comprises inner and outer concentric circularly curved rails, 128 and 129 respectively, where the inner rail has a radius of 27 mm and the outer rail has a radius of 30 mm. As illustrated in FIG. 35c, the curved rails subtend an angle of 57T/12 radians, slightly less than 90°.

With reference to FIG. 35a, post layers 126 comprise post-pairs 126a, 126b, 126c, and 126d, and as illustrated in FIG. 35c, each post-pair advantageously comprises two posts. Post-pair 126a, for example, comprises posts 126a(l) and 126a(2) , respectively. Also, as shown in FIG. 35(C), τr/4 radians, a little over half, of the concentric arc is supported by posts, with each post pair advantageously uniformally spaced by 7T/12 radians along the supported portion of the arc.

With reference to FIG. 35d, the inner and outer rails of a layer are advantageously connected by 21 uniformally spaced support lines of lower exposure (which are analo¬ gous to cross hatch vectors described in S.N. 182,830, its CIP, S.N. 269,801, and its continuation, Lyon & Lyon Dkt. No. 186/195, and which therefore will be known here simply as cross hatch) , where each line is advantageously uni- formly spaced by 7T/48 radians. Advantageously, the cross hatch is exposed at a lower exposure so that the cross hatch for a given layer does not initially adhere to cross

80 hatch for an adjacent layer. Finally, as illustrated in FIG. 35e, starting with the first cross hatch line, the center of every other cross hatch on a given layer is given extra exposure, i.e. riveted, so that it adheres to the cross hatch below at this location. In FIG. 35e, successive rivets for a particular layer are identified with reference numerals 130a, 130b, and 130c, respect¬ ively. As described earlier, the use of rivets is a technique for reducing upward curl. The part is advantageously built with 10 mil layers, but the exposure is varied amongst layers to provide different cure depths. This allows the measurement of curl at different cure depths. The base layer is advan¬ tageously given enough exposure to ensure good adhesion to the elevator platform (not shown) , which corresponds to a 30 mil cure. The posts are advantageously given enough exposure to ensure good adhesion to the previous layer, which also corresponds to a 30 mil cure. The support rail is advantageously given a 30 mil cure to assure sufficient strength to resist resin currents during dipping. The rivets are advantageously exposed at a cure depth of 30 mils, to ensure layer to layer adhesion of the lines of the upper layers. The upper lines, both inner and outer, and the supporting cross hatch lines are advantageously exposed at a varying cure depth, which parameter is varied to developed a curve of cure depth versus curl for the particular curl reduction technique used to make a quarter cylinder. An overall perspective of a quarter cylinder is provided in FIG. 35f. To measure curl for a particular curl reduction technique, the cure depth of the lines of the upper layers can be varied between one or two mils up to 40 mils. At each cure depth, as illustrated in FIG. 35g, the thickness of the quarter cylinder is measured at two locations: 1.) at the first rivet from the unsupported end of the upper layers, which location is identified with reference numeral 131 in FIG. 35g, and the thickness at this

81 location is identified as "s" in the Figure; and 2.) at the first rivet from the supported end of the upper layer, which location is identified with reference numeral 132 in the Figure, and the thickness at this location is identified as "f" in the Figure. The curl factor for a given cure depth is defined as the ratio f/s. The curl factor for a range of cure depths are computed, and then plotted against cure depth. After a particular curve is plotted, the above would be repeated for different curl reduction techniques, to find the best curl reduction technique for a particular application. The above describes the use of a secondary structure combined with rivets to reduce curl, but other techniques described earlier, such as dashed or bent lines, multi-pass, etc., are possible to evaluate with this technique. FIG. 35h illustrates several such plots for different curl reduction techniques.

The type of curl known as sneer will now be described. It should be noted that if a straight cantilevered bar were used to measure curl, the effects of sneer could not be produced or measured. It is only by curving the layers of the cantilevered sections to form a quarter cylinder that the effects of sneer will occur.

With respect to FIG. 35d, when inner and outer lines 129 and 128, respectively, are cured, they will shrink by the same approximate percentage. Since the percentage of shrink is about the same, the extent to which the radius of the outer line shrinks will be greater then the extent to which the inner line shrinks, since for the larger radius, a greater incremental change is required to achieve to same percentage change. The result is that the outer line will transmit more stress to the surrounding structure. The presence of the cross hatch will prevent the relieving of the stress by movement of the outer line inwards towards the inner line. Therefore, to relieve the stress, the outer line typically moves upwards to produce the effect known as sneer. Note that the effect of sneer

82 will be more pronounced the larger the radius of the cross section of the part under examination.

Sneer can be illustrated with the aid of FIGS. 36a- 36c, respectively, which illustrates a side, front, and top view of a particular part having slotted sections 131a, 131b, and 131c. The effects of sneer are illustrated in FIG. 36d, which shows that the areas of the part at the outer radius distort more, and in some instances, shown at slot 131c in the Figure, the distortion is so great as to cause the solid portion of the part to split. This is indicated with reference numeral 13Id in the Figure.

Therefore, the quarter-cylinder can also be used to evaluate the impart on sneer of the various techniques described above.

It will be apparent from the foregoing that, while particular forms of the invention have been illustrated and described, various modifications can be made without departing from, the spirit and scope of the invention. Accordingly, it is not intended that the invention be limited, except as by the appended claims.

-82.1-

A P P E N D I X

-82.2-

SLA-1

BETA SITE

S EROLITHOGRAPHY

SYSTEM

CONFIDENTIAL LEGENDS ON THIS APPENDIX ARE TO BE CONSIDERED DELETED..

3D Systems Incorporated 12847 Arroyo Street Sylmar, California 91342 (818) 898-1533 • FAX (818) 361-5484

NOVEMBER 1987

SUBSTITUTE SHEET

-82 . 3-

NOT TO BE DISCLOSED

THIS DOCUHENT CONTAINS CONFIDENTIAL INFORMATION RELATED TO STEREOLITHOGRAPHY PROCESSES AND EQUIPMENT WHICH ARE THE EXCLUSIVE PROPERTY OF 3D SYSTEMS, INC. THIS INFORMATION SHALL NOT BE DUPLICATED, USED OR DISCLOSED—IN WHOLE OR IN PART—FOR ANY PURPOSE OTHER THAN TRAINING AS AUTHORIZED IN WRITING BY 3D SYSTEMS, INC. ALL REASONABLE PRECAUTIONS SHALL BE TAKEN TO ENSURE COMPLIANCE WITH THESE CONDITIONS.

THE POSSESSION OF THIS DOCUMENT CONVEYS NO PROPERTY RIGHT OR LICENSE IN THE INFORMATION NOR IN ANY MATTER DISCLOSED THEREIN.

TABLE OF CONTENTS

SLA-1

INTRODUCTION

BETA SITE DESCRIPTION AND GENERAL INFORMATION

STEREOLITHOGRAPHY

CONTROLS AND INDICATORS

SYSTEM

OPERATING INSTRUCTIONS

TROUBLESHOOTING

USER'S MANUAL OPERATOR MAINTENANCE INSTRUCTIONS

3D Systems Incorporated

12847 Arroyo Street

Sylmar, California 91342

(818) 898-1533 FAX (818) 361-5484

NOVEMBER 1987

SUBSTITUTE SHEET

-82.4-

Safety Precautions

WARNING INVISIBLE LASER RADIATION

UV LASER RADIATION MAY DAMAGE EYE TISSUE. AVOID DIRECT EXPOSURE TO LASER BEAM. WEAR UV BLOCKING SAFETY GLASSES.

WARNING HIGH VOLTAGE

HAZARDOUS VOLTAGES ARE ACCESSIBLE WITH

10 MAINTENANCE PANELS REMOVED. FOLLOW SAFE WORK PRACTICES.

WARNING CHEMICAL HAZARDS

UV CURABLE RESINS MAY CAUSE EYE AND SKIN

15 BURNS. REPEATED OR PROLONGED SKIN CONTACT MAY CAUSE SENSITIZATION. VAPOR MAY BE HARMFUL.

-82.5-

Observe the following safety precautions when cleaning spilled resin or handling resin containers. Keep away from heat, sparks and flame. Protect from sunlight and fluorescent light. Closed containers may rupture/explode when exposed to extreme heat. Use National Fire Protection Association Class B extinguishers (carbon dioxide, dry chemical or foam) . Use only with adequate ventilation. Avoid breathing vapors or spray mist. Wear safety glasses.

Wear chemically resistant gloves and protective clothing. Wash thoroughly after handling and before eating, smoking or using toilet facilities.

Wear an NIOSH/MSHA approved respirator or ensure adequate ventilation when sanding or cutting cured objects. FIRST AID FOR CHEMICAL ACCIDENTS Skin Contact. Wash thoroughly with soap and vater. Remove contaminated clothing and shoes immediately. If skin is irritated, get medical attention. Wash clothing before reuse and discard contaminated shoes. Eye Contact. Flush immediately with large amounts of water for 15 minutes and avoid sunlight, fluorescent light, or other ultraviolet light. Get medical attention.

Inhalation. Remove victim to fresh air. Give artificial respiration or cardiopulmonary resuscitation if required. If breathing is difficult, give oxygen. Get medical attention.

SUBSTITUTE SHEET

-82.6- TABLE OF CONTENTS

Section/Paraσraph Title Page INTRODUCTION 82.9

I DESCRIPTION AND OPERATION 82.11 1.1 Purpose . 82.11

1.2 Description . . . . . . . . . 82.11

1.2.1 Stereolithography Process 82.11

1.2.2 Stereolithography System 82.13

1.2.2.1 Electronic Cabinet Assembly 82.14 1.2.2.2 Optics Assembly 82.14

1.2.2.3 Chamber Assembly 82.15

1.2.3 Software 82.16

1.3 Performance Specification . . . . . . . 82.17

II CONTROLS AND INDICATORS . . . . . . . . 82.20 2.1 Introduction . . . . . . . . . . . . . 82.20

2.2 Control Panel . 82.20

III OPERATING INSTRUCTIONS. . . . . . . . . 82.21

3.1 Introduction 82.21

3.2 Materials and Equipment . . . . . . . . 82.21 3.3 CAD Design to SLA-1 Parts . . . . . . . 82.22

3.3.1 How to Design CAD Parts for SLA-1 . . . 82.22

3.3.2 Rules for Design of Parts . . . . . . . 82.22

3.3.3 How to Design Support Files for SLA-1 . 82.22

3.3.4 Rules for Design of Supports 82.23 3.4 Slice Operation 82.23

3.4.1 How to Slice Files 82.23

3.4.2 Rules for Slicing 82.23

3.4.3 How to Run User Interface 82.24

3.5 SLA-1 Operation 82.26 3.5.1 Turn-On Procedure 82.26

3.5.2 How to Transfer Files form Slice

Computer to Process Computer . . . . 82.27

3.5.3 How to Insert Critical Volumes . . . . 82.28

3.5.4 How to Merge Sliced Files 82.29 3.5.5 How to Operate SLA-1 to Build Parts . . 82.29

3.5.5.1 Rules for Building SLA-1 Parts . . . . 82.29

-82.7- TABLE OF CONTENTS - CONT'D

Section/Paragraph Title Page

3.5.5.2 How to Prepare Default Parameter Files. 82.30

3.5.5.3 How to Edit Part Control Files . . . . 82.31 3.5.5.4 Operator's Checklist Before

Starting a Part 82.31

3.5.5.5 How to Run Supervisor to Make a Part. . 82.33

3.5.5.6 Post Processing of SLA-1 Parts . . . . 82.33

3.5.5.7 Shutdown Procedures 82.36 3.5.5.8 How to Create and Use Working Curves. . 82.36

IV TROUBLESHOOTING 82.38

4.1 Introduction . 82.38

4.2 Troubleshooting Procedures 82.38

V OPERATOR MAINTENANCE INSTRUCTIONS . . . 82.39 5.1 Introduction 82.39

5.2 Materials and Equipment 82.39

5.3 Resin Cleaning/Replenishment

Procedures 82.40

5.3.1 Cleanup of Small Resin Spills 82.40 5.3.2 Cleanup of Large Resin Spills 82.41

5.3.3 Vat Replenishment 82.42

5.4 Optics Cleaning 82.42

5.4.1 Equipment Required 82.42

5.4.2 Care and Handling of Optics 82.43 5.4.3 Laser Brewster Windows 82.43

5.4.4 Laser Resonator Windows 82.43

5.4.5 90 Degree Beam-Turning Mirrors . . . . 82.43

5.4.6 Beam Expander Lenses 82.44

5.4.7 Galvanometer Driven Dynamic Mirrors . . 82.46 5.4.8 Laser Chamber Window a2.47

5.5 Replacement Procedures 82.48

5.5.1 Air Filter Replacement 82.48

5.5.2 Chamber Lamp 82.49

5.5.3 Control Panel Lamps 82.49 GLOSSARY 82.50

SUBSTITUTE SHEET

-8.2.8- LIST OF FIGURES

Figure Title Page 37 Key Steps in the Stereolithography

Process 38a-38c Major Components of the Stereolithography

System

39 Block Diagram of the Stereolithography

System

40 Software Diagram of the Stereolithography

System 1a-41b Control Panel Switches and Indicators

41c Sample Part Log

42 Sample Working Curve

43a-43d Recommended Optics Cleaning Technique 44 Air Filter Replacement

LIST OF TABLES

Table Title Page

1-1 Beta SLA-1 Performance Specifications . . 82.18

4-1 Troubleshooting Procedures 82.38

5-1 Maintenance Materials and Equipment . . . 82.39

SUBSTITUTE SHEET

-82.9- INTRODUCTION

SCOPE

This manual contains operation and maintenance procedures and information for the SLA-1 Beta Site Stereolithography System.

The maintenance procedures are limited in scope to routine maintenance to be performed by the SLA-1 operator, such as filter replacement. Service and repairs not covered in this manual shall be performed by qualified technicians in accordance with the SLA-1 Service Manual.

ORGANIZATION

This manual is divided into five sections, as follows:

SECTION I. DESCRIPTION AND GENERAL INFORMATION-

Physical and functional descriptions of the SLA-1 and a list of performance specifications. SECTION II. CONTROLS AND INDICATORS - Description of each operator control and indicator. SECTION III. OPERATING INSTRUCTIONS Operating procedures and information. SECTION IV. TROUBLESHOOTING - Diagnostic and correction procedures. SECTION V. OPERATOR MAINTENANCE INSTRUCTIONS - Procedures for routine maintenance.

OTHER FEATURES OF INTEREST

Title Page Index. On the right side of the title page you will find a section index. The black markers printed to the right of the text are keyed to similar markers on the first page of each referenced section. To locate a section, flip through the manual until you find a marker printed in the same location as the title page marker.

SUBSTITUTE SHEET

-82. 10-

Warning Pages. Following the title page you will find a summary of critical warnings. You may be seriously injured if these warnings are not explicitly followed. Carefully read all warnings and first aid instructions prior to operation or maintenance of the SLA-1.

REPORTING ERRORS AND RECOMMENDING IMPROVEMENTS This manual was prepared for use by Beta Site users and maintenance personnel. It will be revised to incorporate recommended content and format changes. If you find any mistakes or if you have any recommendations for improving the procedures, please let us know by sending a copy of the marked-up page(s) to:

Attn: Chick Lewis 3D Systems Inc. 12847 Arroyo St.

Sylmar, California.91342 (818) 898-1533 • FAX (818) 361-5484

-82 . 11-

SECTION I DESCRIPTION AND GENERAL INFORMATION

1.1 " PURPOSE

The SLA-1 Stereolithography System produces three-dimensional parts directly from a CAD system. The formed objects, up to nine inches in any dimension, are made of photocurable plastic. They can be used in a wide variety of applications, including:

Industrial Engineering

Design Engineering

Architectural Design

Medical

Scientific

1.2 DESCRIPTION

1.2.1 Stereolithography Process. Stereolithography is a three-dimensional printing process which uses a moving laser beam to build parts by solidifying successive layers of liquid plastic. This method enables a designer to create a design on a CAD system and build an accurate plastic model in a few hours. The stereolithographic process is composed of the following eight steps, as shown in Figure 37.

Design solid model

Prepare model for stereolithography • Section model into triangles and reduce data for transmission

Transmit data file to SLA-1 slice computer Slice triangle files horizontally Calculate vectors and add hatch and fill • Form object

Post processing 1. The solid model is designed in the normal way on the CAD system, without specific reference to the

SUBSTITUTE SHEET

-82 . 12- stereolithographic process. A copy of the model is made for stereolithographic processing.

2. Model preparation for stereolithography involves

" selecting the optimum orientation, adding supports, and selecting SLA-1 operating parameters. The optimum orientation will (1) enable the object to drain, (2) have the least number of unsupported surfaces, (3) optimize important surfaces, and (4) enable the object to fit in the resin vat. Supports must be added to secure unattached sections and for other purposes; a CAD library of supports can be prepared for this purpose. SLA-1 operating parameters include selection of the model scale and layer (slice) thickness. 3. The surface of the solid model is then divided into triangles. A triangle is the least complex polygon for vector calculations. The Beta SLA-1 capability is approaching 200,000 triangles, with further improve¬ ments planned for the production SLA-1. The more triangles formed, the better the surface resolution and hence the more accurate the formed object with respect to the CAD design.

4. Data points representing the triangle coordinates are then transmitted to the SLA-1 via Ethernet com unica- tion. The SLA-1 software slices the triangular sections horizontally (X-Y plane) at the selected layer thickness.

5. The SLA-1 next calculates the section boundary, hatch, and horizontal surface (skin) vectors. Hatch vectors consist of cross-hatching between the boundary vectors. Several styles are available. Skin vectors, which are traced at high speed and with a large overlap, form the outside horizontal surfaces of the object. Interior horizontal areas, those within top and bottom skins, are not filled in other than by cross-hatch vectors.

-82 . 13-

6. The SLA-1 forms the object one horizontal layer at a time by moving the ultraviolet beam of a helium- cadmium lasher across the surface of a photocurable resin and solidifying the liquid where it strikes. Absorption in the resin prevents the laser light from penetrating deeply and allows a thin layer to be formed. Each layer is comprised of vectors which are drawn in the following order: border, hatch, and surface. 7. The first layer that is drawn adheres to a horizontal platform located just below the liquid surface. This platform is attached to an elevator which then lowers it vertically under computer control. After drawing a layer, the platform dips several millimeters into the liquid to coat the previous cured layer with fresh liquid, then rises up a smaller distance leav¬ ing a thin film of liquid from which the second layer will be formed. After a pause to allow the liquid surface to flatten out, the next layer is drawn. Since the resin has adhesive properties, the second layer becomes firmly attached to the first. This process is repeated until all the layers have been drawn and the entire three-dimensional object is formed. Normally, the bottom 0.25 inch or so of the object is a support structure on which the desired part is built. Resin that has not been exposed to light remains in the vat to be used for the next part. There is very little waste of material.

8. Post processing involves heating the formed object to remove excess resin, ultraviolet or heat curing to complete polymerization, and removing supports. Additional processing, including sanding and assembly into working models, may also be performed.

1.2.2 Stereolithography System. The SLA-1 is a self-contained system that interfaces directly with the user's CAD system. The SLA-1, as shown in Figures 38a-

SUBSTITUTE SHEET

-82.14-

38c, consists of four major component groups: the slice computer terminal, the electronic cabinet assembly, the optics assembly, and the chamber assembly. A block diagram of the SLA-1 is shown in Figure 39.

1.2.2.1 Electronic Cabinet Assembly. The electronic cabinet assembly includes the process computer (disc drive), keyboard, monitor, power supplies, ac power distribution panel, and control panel. The computer assembly includes plug-in circuit boards for control of the terminal, high-speed scanner mirrors, and vertical (Z-stage) elevator. Power supplies for the laser, dynamic mirrors, and elevator motor are mounted in the lower portion of the cabinet.

The control panel includes a power on switch/indicator, a chamber light switch/indicator, a laser on indicator, and a shutter open indicator.

Operation and maintenance parameters, including fault diagnostics and laser performance information, are displayed on the monitor. Operation is controlled by keyboard entries. Work surfaces around the keyboard and disc drive are covered with formica for easy cleaning and long wear.

1.2.2.2 Optics Assembly. The helium cadmium (HeCd) laser and optical components are mounted on top of the electronic cabinet and chamber assembly. The laser and optics plate may be accessed for service by removing separate covers. For safety reasons, a special tool is required to unlock the cover fasteners and interlock switches are activated when the covers are removed. The interlocks activate a solenoid-controlled shutter to block the laser beam when either cover is removed.

An optics cleaning kit and interlock shorting tool are located under the optics cover. The cleaning kit includes cotton swabs, special cleaning tissues, and materials for cleaning the beam-turning mirrors and beam

-82 . 15- expander lenses. The interlock shorting tool is used to defeat the interlocks during servicing. This is necessary to enable optics alignment and servicing procedures which require operation of the laser with the optics and laser covers removed.

The shutter assembly, two 90° beam-turning mirrors, beam expander, scanning mirror assembly, and optical window are mounted on the optics plate. The rotary solenoid-actuated shutters are installed at the laser output and rotate to block the beam when a safety interlock is opened. The 90" beam-turning mirrors reflect the laser beam to the next optical component. The beam expander enlarges and focuses the laser beam on the liquid surface. The high speed scanning mirrors direct the laser beam to trace vectors on the resin surface. A quartz window between the optics enclosure and reaction chamber allows the laser beam to pass into the reaction chamber, but otherwise isolates the two regions.

1.2.2.3 Chamber Assembly. The chamber assembly contains an environmentally-controlled chamber, which houses a platform, reaction vat, elevator, and beam profiler.

The chamber in which the object is formed is designed for ' operator safety and to ensure uniform operating conditions. The chamber may be heated to approximately 40*C (104 β F) and the air is circulated and filtered. An overhead light illuminates the reaction vat and work surfaces. An interlock on the glass access door activates a shutter to block the laser beam when opened.

The reaction vat is designed to minimize handling of the resin. It is installed in the chamber on guides which align it with the elevator and platform.

The part is formed on a platform attached to the vertical axis elevator, or Z-stage. The platform is immersed in the resin vat and is adjusted incrementally downward while the object is being formed. To remove the formed part, it is raised to a position above the vat.

SUBSTITUTE SHEET

-82 . 16-

The platform is then disconnected from the elevator and removed from the chamber for post processing. Handling trays are provided to catch dripping resin.

The beam profiler is mounted to one side of the reaction vat at the focal length of the laser. The scan¬ ning mirror is periodically commanded to direct the laser beam onto the beam profiler, which measures the beam intensity profile. The data may be displayed on the terminal either as a profile with intensity contour lines or as a single number representing the overall (inte¬ grated) beam intensity. This information is used to determine whether the mirrors should be cleaned and aligned, whether the laser should be serviced, and what parameter values will yield vectors of the desired thickness and width.

1.2.3 Software. A software diagram of the SLA-1 is shown in Figure 40. There are three computers needed to control the stereolithographic apparatus, a CAD system, a slice computer, and a process computer. Any CAD system can be used to design a part in three-dimensional space. This is identified as the object file. In order to generate the part, supports must be added to prevent distortion. This is accomplished by adding the necessary supports to the CAD part design and creating a CAD support file. The resultant two or more CAD generated files are then physic¬ ally inserted into the slice computer through Ethernet.

The stereolithography apparatus builds the part one layer at a time starting with the bottom layer. The slice computer breaks down the CAD part into individual horizontal slices. The slice computer also calculates where hatch vectors will be created. This is done to achieve maximum strength as each layer is constructed. The slice computer at the Beta Sites is a separate computer with its own keyboard and monitor. It is antici- pated that in production models, the slice computer will be in the SLA-1 electronic cabinet and will share a common

-82 . 17- keyboard and monitor with the process computer. The operator can vary the thickness of each slice and change other parameters of each slice with the User Interface program. The slice computer uses the Xenix machine language and is connected to the SLA-1 process computer by an Ethernet data bus.

The sliced files are then transferred to the process computer through Ethernet. The process computer merges the sliced object and support files into a layer control file and a vector file. The operator then inserts the necessary controls needed to drive the stereolitho¬ graphy apparatus in the layer and parameter file. (The vector file is not usually edited.) The operator can strengthen a particular volume of the part by inserting rivets. This is accomplished by inserting the necessary parameters to the critical volume file prior to merging of the sliced files. The merge program integrates the object, support, and critical volume files and inserts the resultant data in the layer control file. The operator can edit the layer control file and change the default para¬ meter file. The default parameter file contains the controls needed to operate the stereolithography apparatus to build the part. The process computer uses the MSDOS machine language and is directly connected to he stereo- lithography apparatus.

1.3 PERFORMANCE SPECIFICATIONS

Beta SLA-1 performance specifications are listed in Table 1-1 for quick reference.

SUBSTITUTE SHEET

-82.18- Table 1-1. Beta SLA-1 Performance Specifications

Characteristic Specification

Input Power

Voltage and Frequency 115 Vac, 60 Hz Current Drain 15 amperes Functional Characteristics

Laser Source

Type Helium Cadmium

Nominal Power 10 mW at 325 nm

Warmup Time (to 90 percent 15 minutes power) 4000 hours (with 1000

Expected Tube Lifetime hr. service intervals) Dielectric Beam-Turning Mirrors

Nominal Reflectivity >99 percent at 325 nm

Incident Angle Range 0 to 45 degrees Beam Expander

Expansion Coefficient

Adjustable Axes Y,Z (pitch and yaw) Scanning Mirror

Speed Minimum 0.001 inch/sec (0.025 mm/sec)

Maximum 20 inches/sec (51 cm/sec) Drawing Area Width (X-axis) 9 inches (23 cm) Length (Y-axis) 9 inches (23 cm) Elevator (z-stage) Maximum Travel 14 inches (36 em) Minimum Step Size 0.001 inch (0.025 mm) Load Capacity 110 lbs ( kg) CAD Interface Ethernet Resin Characteristics Appearance and Odor Clear amber liquid, mild Odor

T

-82 . 19- Table 1-1. Beta SLA-1 Performance Specifications - CONT ' D

Vapor Density Heavier than air

Specific Gravity (H20=l) 1.18 Flash Point >200°F (93°C) Extinguishing Media National Fire Protection Association Class B Extinguishers (carbon dioxide, dry chemical or foam)

Storage Temperature +60°F to +80 β F (+15°C to +26°C)

Physical Characteristics SLA-1

Dimensions (maximum) Height 64 inches (163 cm) Width 49 inches (124 cm) Depth 27.5 inches (70 cm) Shipping Weight 600 lbs ( kg) Resin Vat Dimensions Height 10 inches (25 cm) Width 9 inches (23 cm) Depth 9 inches (23 cm)

Operating Conditions Temperature 50"F to 104°F (10°C to 40°C)

Relative Humidity 0 to 90 percent

SUBSTITUTE SHEET

-82.20-

SECTION II CONTROLS AND INDICATORS

2.1 -INTRODUCTION

This section describes the function of each SLA-1 operating control and indicator.

2.2 CONTROL PANEL

Control panel switches and status indicators are illustrated and described in Figures 41a-41b.

SUBSTITUTE SHEET

-82. 21-

SECTION III OPERATING INSTRUCTIONS

3.1 " INTRODUCTION

This section contains complete operating instructions for design and construction of model parts. Included are instructions for design of parts and supports on the CAD system, slicing of parts on the slice computer, and operation and control of the SLA-1 system to build parts. Also included are instructions for file transfer, insertion of critical volumes, merging of sliced files, editing of part control files, preparing default parameter files, running supervisor to build parts, post processing of parts, and use of working curves.

3.2 MATERIALS AND EQUIPMENT Materials and equipment that would enhance the operation of the SLA-1 system are listed in Table 3-1. Equivalent items may used.

Table 3-1: Operation Materials and Equipment

SUBSTITUTE SHEET

-82.22- 3.3 CAD DESIGN FOR SLA-1 PARTS

3.3.1 How to Design CAD Parts for SLA-1. A part must initially be designed on a CAD system before it can be built on the SLA-1 system. This manual assumes that the operator knows how to design parts using a CAD system. In order to make the CAD design compatible with the SLA-1 system, the operator usually prepares two or more files on the CAD system, object files and support files. The object file is simply the CAD part. The support file is needed to add supporting structures to enable the part to keep its shape during construction on the SLA-1 system.

■ 3.3.2 Rules for Design of Parts. In order to prepare the CAD design for the SLA-1 system, the operator should modify the CAD object file as follows: a. Wall thicknesses should ideally be 0.020 to 0.150 inch, b. Rotate CAD parts into an orientation which will:

1. Minimize trapped volumes as the part builds.

2. Take advantage of nice up-facing skin surfaces. 3. Minimize visibility of down-facing skin surfaces.

4. Make.support design easy and optimum.

5. Make parts stable and strong as they are created. c. Design parts so that horizontal gaps and holes are larger than desired by one laser linewidth. d. All solid parts must completely enclose a volume. Single surfaces will confuse the Crosshatch algorithms.

3.3.3 How to Design Support Files for SLA-1. Supporting structures consist of bases, posts, and webs which are needed to properly support the part and prevent the part from being distorted during construction on the SLA-1

— Δ . 3- system. The supports should be designed on the CAD system in a separate support file.

3.3.4 Rules for Design of Supports. The operator should create the CAD support file as follows: a. Design a structure at the bottom of the CAD part which will rest on the elevator panel. This platform must have several horizontal legs which are at least 0.65 inch long (more than twice the diameter of the 1/4 inch holes in the platform) . b. Design supports to intersect every outside corner of a part, as these are major stress areas. c. Arrange supports so that every unsupported down- facing border falls on a previously created support. d. Space supports at a minimum distance apart for best stress resistance. e. Design supports to have at least two layers of vertical overlap into the part for a strong attachment.

3.4 SLICE OPERATION

3.4.1 How to Slice Files. The slice computer (Wyse PC 386) automatically breaks down the object and support files into individual slices under user control. The user must choose the thickness of each slice and determine the shape and method of cross-hatching.

3.4.2 Rules for Slicing. The operator should slice the CAD object and support files as follows: a. Up-facing skin surfaces should only be in one dimension (X or Y) and should have a 0.002 inch offset (high overlap) . Exposure must be low. b. Cross hatch should usually be as nearly perpendicular to part border as possible. Cross hatches parallel to part borders increase production time and may increase stress.

SUBSTITUTE SHEET

-82.24- c. Slice support files without creating skin.

3.4.3 How to Run User Interface. This procedure shows how " to operate the slice computer to use the User Interface program to insert slice parameters and run the Slice program. This procedure assumes that the CAD file has been installed in the slice computer. An asterisk (*) in front of a step indicates that this is an optional step that only needs to be performed if a common keyboard is being used to operate the slice computer and process computer. a. Press ENTER - MAIN MENU is displayed. *b. Select Data Transfer (Slice) and press ENTER - Data

Transfer menu is displayed. *c. Select TELNET, Terminal Utility and press ENTER. d. In response to $ prompt, type UI (user interface) and press ENTER - SLICE USER INTERFACE Menu is displayed. e. Select option 1 (DATABASE File Name) * f. In response to Enter Data File Name: prompt, type data file name followed by .stl (example - test.stl) and press ENTER. g. In response to Type File Binary or ASCII (B,A) : prompt, type b (binary) or a (ASCII) as applicable and press.ENTER. h. Select option 2 (Scale) . i. In response to Enter Scale Value: prompt, type (scale value per CAD dimension unit) and press ENTER. (If 1000 is selected, 1000.000 is inserted in the Value column, which is 1/1000 of one CAD dimension unit.) (Example - for a part CAD designed in inches, a scale of 1000 makes each slice scale unit 1 mil.) j. Select option 3 (Z Spacing). k. In response to Enter Fixed or Variable Spacing (F,

V, or Q) value: prompt, type F (fixed) and press

ENTER. Then type thickness in slice scale units (from option 2) (example - 20) and press ENTER. (To

S

— o^ . 2o — select variable thicknesses, refer to software manual.) 1. Select option 4 (X hatch spacing). m. In response to Enter Hatch Spacing (hx) value: prompt, type X hatch spacing in slice scale units (example - 200 (5 hatches/inch) ) and press ENTER.

NOTE Do not use option 5 (Y hatch spacing) if option 6 (60/120 degree hatch spacing) is to be used. n. Select option 5 (Y hatch spacing) . o. In response to Enter Hatch Spacing (hy) value: prompt, type Y hatch spacing in slice scale units (example - 200) and press ENTER, p. Select option 6 (60/120 degree hatch spacing) . q. In response to Enter Hatch Spacing (60/120) value: prompt, type 60/120 hatch spacing in slice scale units (example - 20) and press ENTER, r. Select option 7 (X Skin fill for near flat surfaces) . s. In response to Enter Skin fill for near flat surfaces (hfx) value: prompt, type X skin fill offset in slice scale units (example - 2) and press ENTER, t. SELECT option 8 (Y Skin fill for near flat surfaces) .

NOTE If x skin fill is used, Y should not be used, and vice versa. u. In response to Enter Skin fill for near flat surfaces (hfy) value: prompt, type Y skin fill in mils (example - 2) and press ENTER, v. Select option 9 (minimum Surface Angle for scanned facets) . w. In response to Enter a Minimum Surface Angle prompt, type desired angle in degrees from vertical (example - 60) and press ENTER. x. Select option 10 (Minimum Hatch Intersect Angle) . y. In response to Enter a Minimum Intersect Angle value: prompt, type intersect angle in degrees (example - 20) and press ENTER.

SUBSTITUTE SHEET

— 82 #26— z. Select option 11 (Segment Output File Name), aa. In response to Enter Segment File Name: prompt, type desired output file name followed by .sli (slice) - (example - test.sli) and press ENTER. ab. After all slice parameters have been selected, select s (Save) and press ENTER. (This will save the parameters for future use and reference.) ac. In response to "Press (Enter) to Continue" prompt, press ENTER. Then select d (DoSlice) and press ENTER. ad. In response to Slice Version to use (Default XY)? prompt, press ENTER. (The program now slices the files using the inserted slice parameters.) ae. After slicing is completed, DATA TRANSFER MENU is displayed. af. Press Q (Quit) and ENTER. (The sliced files are now ready to be transferred to the process computer.)

3.5 SLA-1 OPERATION

3.5.1 Turn-On Procedure. a. Set POWER ON switch to on (up) . Verify that POWER ON indicator illuminates. b. Set OVEN LIGHT switch to on (up) . Verify that OVEN LIGHT indicator illuminates and that overhead light in reaction chamber illuminates. NOTE

The SHUTTER OPEN and LASER ON indicators will illuminate during operation. The SHUTTER OPEN indicator will illuminate when the laser shutter is open and the LASER ON indicator will illuminate when the laser is operating. c. The MAIN MENU will be displayed on the monitor as the process computer boots up. Select "Power on sequence' and press ENTER. d. The POWER SEQUENCE menu will be displayed. Sequentially press function keys 1, 2, and 3 to power

-82 .27- up the laser, mirror, and elevator drivers, and to open the laser shutters, e. Wait at least 15 minutes for the laser to stabilize in power before beginning to create a part. Other functions (file preparation, data transfer, etc.) can be performed during laser warm-up.

3.5.2 How to Transfer Files from Slice Computer to Process Computer. This procedure shows how to transfer the sliced object and support files from the slice computer to the process computer (Wyse PC 286) in the SLA-1. a. Press ENTER - MAIN MENU is displayed. b. Select option 1 (Data Transfer) . c. In response to (data transfer) prompt, type 2 (FTP) (file transfer program) and press ENTER. d. In response to (ftp) prompt, type OPEN and press ENTER. e. In response to (to) prompt, type address of slice computer and press ENTER. f. In response to Remote user prompt, type the name of your directory and press ENTER. g. In response to Password prompt, type your password and press ENTER. h. In response to (ftp) prompt, type GET and press

ENTER. i. In response to (remote-file) prompt, type name of desired file usually followed by .sli (example - test.sli) and press ENTER, j. In response to (local-file test.sli is default) prompt, press ENTER (unless you want to change name) . (The FTP routine will now transfer the file to the process computer. It will prompt when the transfer is complete.) k. To exit from FTP, in response to ftp) prompt, type BYE and press ENTER. (The sliced files have now been transferred to the SLA-1 process computer.)

1. MAIN MENU is displayed after- transfer is completed.

SUBSTITUTE SHEET

-82.28-

3.5.3 How to Insert Critical Volumes. This procedure shows how to set up critical volumes. These critical volumes can be used to insert rivets, which are multiple passes of the laser beam over Crosshatch vectors to increase strength, or for other special treatment (This procedure can be skipped if the CAD part contains no critical volumes.) a. On CAD computer, call up CAD display of the part. b. Identify x, Y, and Z coordinates in CAD space for the four bottom corners of the rectangular solid

(critical volume) . c. On process computer, select option 5 (Edit System Files) and press ENTER. d. Select option to create a new file - Turbo Basic is displayed. e. Use arrow keys to select Write to and press ENTER. f. In response to New Name prompt, enter name of critical volume followed by .box (example - test.box) and press ENTER. g. Use arrow keys to select Edit and press ENTER, h. In response to C: Test .Box enter: prompt, insert the following:

<type>, <base>, <height>, <xl>, <yl>, <x2>, <y2>, <x3>, <y3>, <x4>, <y4> (Be sure to insert commas between each item. Proper syntax is critical.) where:

<type> is "XV" to rivet cross-hatches in the enclosed area or "XI", to ignore cross-hatches <base> is the base of the box relative to the slice scale <height> is the height of the box <xl, yl> is the first coordinate of the box <x2, y2> is the second coordinate <x3, y3> is the third coordinate <x4, y4> is the fourth coordinate i. Press Esc (escape) key.

-82 . 29- j . Use arrow key to select File and press ENTER. k. Use arrow key to select Save and press ENTER. 1. Use arrow key to select Quit and press ENTER. (The new <part> .box file has now been created to identify a critical volume.)

3.3.4 How to Merge Sliced Files. This procedure shows how to combine (merge) the object and support files into vector and layer control files. a. Press ENTER - MAIN MENU is displayed. b. Select option 2 (MERGE) and press ENTER. c. In response to Slice File Names prompt, type names of files to be merged (include .SLI as part of the names) and press ENTER. (Be sure to include critical volume file, if applicable.) d. In response to Output File Name prompt, type desired name of output file and press ENTER. (No ".XXX" ending is necessary.) e. Press ENTER and wait for process computer to merge files (one slice at a time) . (The program will prompt when it has completed the merge.)

3.5.5 How to Operate SLA-1 to Build Parts. These procedures show how to use the process computer to actually build a part in the reaction vat. Included are procedures for setting up the reaction vat, modifying the merged vector and control files, preparing the default parameter files, and running the part making (supervisor) program.

3.5.5.1. Rules for Building SLA-1 Parts. In order to prepare the SLA-1 to build a part, the operator must perform the operator's checklist, edit the layer control

(.L) file (SUPER .PRM), prepare the default parameter files, and run the supervisor programs as follows: a. Set speed of first support layer three times slower than normal layer drawing speed. This overcures first

BSTITUTE SHEET

-82.30- layer to enable it to adhere firmly to elevator platform.. b. Set dip speeds low to avoid undue stresses to part " in progress. c. Use longer dip delays for:

1. Fragile layers.

2. Lowest layers of supports near platform.

3. After layers with large area skins.

4. In areas with large trapped volumes of resin. 5. For shallow dip depths (thin layer thicknesses) . d. Use single passes and choose exposure speeds from working curves which provide a 0.006 to 0.008 inch overcure into previously created layers. e. Record important parameters and comments in a Part Log (example in figure 41c) . (The user is encouraged to create his own custom Part Log to his special requirements.) If a printer is available, print out important parameters for a permanent record.

3.5.5.2 How to Prepare Default Parameter Files. This procedure shows how to prepare the default parameter (.PRM) files to control the part building access: a. Press ENTER - MAIN MENU is displayed. b. Select option 5 (Edit System Files) and press ENTER. c. In response to Load File Name prompt, enter file names (insert SUPER.PRM only) and press ENTER. d. Move arrow to Edit block and press ENTER. Values can now be inserted in default parameter (SUPER.PRM) files. (Refer to software manual for definitions of codes.) e. To quit editing files:

1. Press Esc key.

2. Use arrow key to select File and press ENTER.

3. Use arrow key to select Save and press ENTER.

4. Press Q key - MAIN MENU is displayed.

-82 . 31-

3.5.5.3 How to Edit Layer Control Files. This procedure shows how to modify the layer (.L) files to fine tune the part building process: a. Press ENTER MAIN MENU is displayed. b. Select option 5 (Edit System Files) and press ENTER. c. In response to Load File Name prompt, enter file names (insert .L files only; .V files are not usually edited) and press ENTER. d. Move arrow to Edit block and press ENTER. Values can now be changed on layer (.L) files. (Refer to software manual for definition of codes.) e. To quit editing files:

1. Press Esc key.

2. Use arrow key to select File and press ENTER. 3. Use arrow key to select Save and press ENTER.

4. Press Q key - MAIN MENU is displayed.

3.5.5.4 Operator's Checklist Before Starting a Part. This procedure shows how to set up the reaction vat, laser, and elevator, and how to monitor the part during construction. a. Is correct resin in the vat? If not, insert proper resin in vat:

1. Open. chamber door.

2. Drain out resin. 3. Clean vat thoroughly.

4. Fill vat with correct resin.

5. Close chamber door.

6. Wait 1/2 hour for resin level to stabilize. b. Is resin level adequate? If not, add resin in vat: l. Open vat door.

2. Add resin as required.

3. Close vat door.

4. Wait 1/2 hour for resin level to stabilize. c. Is elevator level correct? If not, set level as follows:

SUBSTITUTE SHEET

-82.32-

1. On process computer, press ENTER - main menu is displayed.

2. Select Utilities menu and press ENTER.

3. Select Z-Stage Mover and press ENTER. 4. To move elevator up, press t (up) arrow and press any key to stop movement.

5. To move elevator down, press -1 (down) arrow and press any key to stop movement.

CAUTION Do not allow elevator to hit top bracket or side of vat. Mechanical damage can result.

6. Toggle up t arrow until liquid resin level is just below holes in the elevator platform.

7. Toggle J arrow until liquid resin is level with holes (dimples in surface visible) . d. (Optional) Is laser power properly adjusted? Check laser power as follows:

1. On process computer, press ENTER - main menu is displayed. 2. Select Utilities menu and press ENTER.

3. Select Beam/Profiler option and press ENTER.

4. The prompt Compute the Beam Profile and Measure its Intensity will be displayed while the laser is being focused on the beam profiler in the chamber.

5. The prompt Display Power will be displayed when the laser beam power has been computed and the laser is returned to its normal position. e. Are all necessary files in the active directory? Check directory for correctly named vector, layer, and default parameter files as follows: 1. Type DIR, space, part name, and .*, and press ENTER to display vector (.V) and layer (.L) files. 2. Type DIR, space, *.prm, and press ENTER to display default parameter (.PRM) files.

SUBS

-82 . 33- f. Are all the values inserted in the vector, layer, and default parameter files correct and with proper syntax? Refer to software manual for definitions of codes and syntax. g. Is the elevator driving subroutine initialized? Initialize elevator drive subroutine as follows:

1. On process computer, press ENTER - main menu is displayed.

2. Select Utilities menu and press ENTER. 3. Select Power On Sequence and press ENTER.

4. Function keys 1, 2, and 3 can be used to power the laser, driving electronics, and open the shutters.

3.5.5.5 How to Run Supervisor to Make a Part. Now that all of the preparatory work has been done, this procedure shows how to actually build a part. a. On process computer, press ENTER - MAIN MENU is displayed. b. Select option 4 (Supervisor) and press ENTER. c. In response to Part Prefix prompt:, type name of part files and press ENTER. This causes on the laser to start tracing the first layer. Verify that SHUTTER OPEN and . LASER ON indicators on operator control panel are illuminated. d. Watch the first layers form.

1. Is the part centered on the elevator platform?

2. Do the first layers stick to the platform?

3. If not, abort the run and correct the problem.

3.5.5.6 Post Processing of SLA-1 Parts. This procedure shows how to remove the finished part from the vat, drain the part, cure and dry the part, and remove supports. a. Updip and Preliminary Draining.

1. On process computer, press ENTER - main menu is displayed. 2. Select Utilities menu and press ENTER.

SUBSTITUTE SHEE

-82.34-

3. Select Z-Stage Mover and press ENTER.

4. Very, slowly toggle t arrow until elevator is raised to 1 inch above edge of reaction vat level. Do not raise part quickly or distortion could occur.

5. Wait approximately 15 minutes to allow excess resin to drip from part. b. Part/Platform Removal.

1. Place a pad of absorptive material on the special drain tray.

2. Slip the drain tray under the elevator platform and rest it on the shelves on either side of the vat.

3. ' Toggle 4 arrow on keyboard to lower the elevator platform until it is about 1/4 inch above the absorptive pad.

4. Twist one of the elevator shaft knobs one turn ccw. This will unscrew a threaded rod inside the elevator shaft from a threaded hole in one side of the elevator platform and partially release the platform.

5. Repeat step (d) with the opposite elevator shaft knob.

6. Repeat steps (d) and (e) alternately until the platform drops free from the shafts and falls a fraction of an inch to rest on the absorptive pad.

7. Raise the elevator shafts, if necessary, with the t arrow on keyboard. 8. Remove the drain tray, platform, and attached part from the vat chamber. Keep the platform horizontal if possible to avoid putting side stresses on the green (uncured) part, c. Oven Draining. l. Place elevator platform and part in an oven.

2. Set temperature to 80 to 90°C and wait 1 hour.

HEET

-82.35-

3. Carefully wipe off excess liquid resin which adheres to up and down-facing surfaces with cotton swabs. d. Post Curing. 1. Place elevator platform and part in an ultraviolet flood oven.

2. Flood the part with ultraviolet light until it is dry and no longer tacky.

3. Use a fine-tooth saw and remove the part from the elevator platform by sawing through the bottom supports that attach the part to the platform. Protect the part from stresses and inertial shocks during this procedure.

4. Clean all "sawdust" and fragments of support from the part before continuing.

5. Turn part upside down (or rest part on its side if this is not possible) and repeat steps 1 and 2. e. Platform Replacement. l. Scrape away any dry resin that is still sticking to elevator platform after removal of part. If may be necessary to tap out the threaded holes in the platform with a #10-32 tap. 2. Place the empty platform on the drain tray. 3. Place the drain tray in the SLA-1 vat chamber resting on the shelves and centered as well as possible over the vat.

4. Very slowly toggle i arrow on keyboard to lower the elevator shafts until the threaded rods are very close to the platform. Avoid running the shafts into the platform or tray as this can ruin the threads on the shaft.

5. Adjust the tray and platform so that the threaded holes in the platform are exactly aligned beneath the threaded rods.

6. Slowly toggle I arrow on keyboard until the threaded rods contact the threaded holes gently.

SUBSTITUTE SHEET

-82.36-

7. Twist one of the elevator shaft knobs one turn cw. . This will rotate the threaded rod inside the elevator shaft and cause it to engage the threaded hole in the panel. 8. Repeat step 7 with the opposite elevator shaft knob.

9. Repeats steps 7 and 8 alternately until the platform is lifted off of the drain tray and is in firm contact with the bottom of the elevator shafts.

10. Snug up the elevator shaft knobs to secure the panel to the shafts. Do not overtighten as this can fracture the interior threaded rod.

11. Toggle the t arrow on keyboard to raise the elevator.

12. Remove the drain tray. f. Removing Supports and Finishing.

1. Carefully cut away supports with side cutting pliers. 2. Carefully smooth off rough surfaces with appropriate files. 3. Surface finish as required.

3.5.5.7 Shutdown Procedures. a. Set OVEN LIGHT switch to off (down) . Verify that OVEN LIGHT indicator extinguishes. b. Set POWER ON switch to off (down) . Verify that POWER ON and other indicators extinguish.

3.5.5.8 How to Create and Use Working Curves. The degree to which liquid plastic can be solidified is determined by three factors: (1) the type of resin used, (2) laser power, and (3) degree of laser focus. By creating a working curve, the operator can adjust the laser drawing speed to compensate for variations in these three factors. Therefore, a new working curve must be prepare each time a new batch of resin is used or there is a significant

SUBSTITUT

-82.37- loss of laser power as shown on the Part Log. The working curve is then, used to change the step period (laser drawing speed) and step size in the default parameter and layer control files. a. Toggle 4 arrow on keyboard to lower elevator platform to 1 inch below resin surface. The banio part used to create working curves will be prepared free floating on the resin surface. b. On process computer, press ENTER - main menu is displayed. c. Select Utilities menu an press ENTER. d. Select Banjo and press ENTER. Follow the menu to input the largest step period (SP) to be used. The SLA-1 will prepare the banjo part in the vat. e. After banjo part is completed, drain and cure it (subparagraph 3.5.5.6) . f. Use a microscope and measure horizontal width of each string. g. Cut banjo part sideways and use microscope to measure thickness (depth) of each string. h. Plot height and width values on a working curve (sample in Figure 42) at the step periods chosen (example - 40, 80, 160, 320, and 640) . The lowest step period will create the thinnest banjo string and the highest step period will create the thickest banjo string. i. Another banjo can be created with different step periods to extend the range of the working curve. j . Connect the five or more points to form both working curves. k. The working curve can now be used to select the step period and step size for each slice.

1. Insert the chosen step period and step size into the default parameter files (paragraph 3.5.5.2) .

SUBSTITUTE SHEET

-82.38-

SECTION IV TROUBLESHOOTING

4.1 " INTRODUCTION

This section contains troubleshooting procedures to identify and correct operation errors and selected hardware failures. Fault conditions not covered in this section shall be corrected by qualified maintenance technicians using the SLA-1 Service Manual.

4.2 TROUBLESHOOTING PROCEDURES Beta SLA-1 troubleshooting procedures are listed in Table 4-1.

Table 4-1. Troubleshooting Procedures

Problem Probable Cause Remedy

SUBSTITUTE SHEET

-82 . 39-

SECTION V OPERATOR MAINTENANCE INSTRUCTIONS

5.1 " INTRODUCTION

This section contains procedures for routine maintenance to be performed by the SLA-1 operator. Included are procedures to clean up resin spills, add resin to vat, replace vat, replace air filter, and clean optical components. Maintenance requirements not covered in this section shall be performed by qualified techni¬ cians in accordance with SLA-1 Service Manual.

5.2 MATERIALS AND EQUIPMENT

Recommended maintenance materials and equipment are listed in Table 5-1. Equivalent items may be used.

Table 5-1. Maintenance Materials and Equipment

SUBSTITUTE SHEET

-32.40-

5.3 RESIN CLEANING/REPLENISHMENT PROCEDURES

5.3.1 Cleanup of Small Resin Spills.

WARNING

UV CURABLE RESINS MAY CAUSE EYE AND SKIN BURNS. REPEATED OR PROLONGED SKIN CONTACT MAY CAUSE SENSITIZATION. VAPOR MAY BE HARMFUL.

a. Read the safety precautions and first aid instructions at the front of this manual. b. Put on chemically resistant gloves and safety glasses. c. Remove the spilled resin using disposable towels. d. Seal contaminated towels and other contaminated articles in a marked container suitable for the disposal of hazardous materials.

NOTE Fully cured resins present no safety or health related hazards. An alter-native means of disposing lightly contaminated articles is to ultraviolet or heat-cure the

SUBSTITUTE SHEET

-82 .41- affected areas and dispose of as nonhazardous waste, e. Clean the spill area with isopropanol followed by a thorough washing with soap and water. f. Remove gloves and seal in disposal container. Dispose of container in accordance with applicable hazardous waste laws and regulations, g. Wash hands thoroughly with soap and water.

5.3.2 Cleanup of Large Resin Spills.

WARNING

UV CURABLE RESINS MAY CAUSE EYE AND SKIN BURNS. REPEATED OR PROLONGED SKIN CONTACT MAY CAUSE SENSITIZATION. VAPOR MAY BE HARMFUL. a. Immediately isolate the spill area. b. Read the safety precautions and first aid instructions at the front of this manual. c. Put on protective clothing, chemically resistant gloves and safety glasses. If the spill area is not well ventilated, wear NIOSH/MSHA approved respiratory equipment. d. Cover the spill with absorbing material such as sawdust, clay, diatomaceous earth, or activated charcoal. e. When the absorbent is saturated, seal it in a marked container suitable for the disposal of hazardous materials, f. Clean the spill area with isopropanol followed by a thorough washing with soap and water. g. Wipe resin off protective clothing with clean disposable towels, h. Remove protective clothing in the following order: boots, gloves and suit. After removing gloves, use disposable cloths to protect hands.

SUBSTITUTE SHEET

-82.42- i. Place contaminated articles in the disposal container. Dispose of container in accordance with applicable hazardous waste laws and regulations. j. " Shower with soap and cool water.

5.3.3 Vat Replenishment. The reaction vat contains spillways on both sides to handle resin overflow. The overflowed resin then flows through the overflow tubes, through the drain -valve, and settles in the collections bottle. Do not reuse resin after an overflow. If resin level in vat is low, replenish as follows: a. Open chamber door. b. Slowly pour new resin into vat. Make sure that new resin is the same type as the resin in the vat. The part will not build properly if different resins are mixed in the vat. c. Wait 1/2 hour for resin level to settle before resuming operation. d. Close chamber door.

5.4 OPTICS CLEANING (Figures 43a-43e) The SLA-1 optics must be cleaned when there is obvious contamination (fingerprints, dust, haze) of the optical surfaces, or when the laser power measured at the resin surface is less than the power measured at the laser by more than a few milliwatts. If laser power loss is present, the optical alignment should be checked. If the system is aligned as well as possible and still there is a significant difference in power from the laser to the resin surface, optics cleaning is required.

5.4.1 EcTuip ent Required. a. A source of clean, compressed air designed for optics cleaning, b. A small amount of clean reagent-grade methanol in a glass (not plastic) bottle.

SUBSTITUTE SHEET

-82 . 43- c. A supply of clean lens tissue. (Conventional face tissues leave lint on optical surfaces and are not recommended. Industrial wiping tissues are designed to be abrasive, and should be strictly avoided.) d. A hemostat or pair of clamping tweezers. e. A supply of special cotton swabs designed for optics cleaning. (These have a wooden stick with the cotton heads attached without glue. Plastic "sticks" and glue can be dissolved by the methanol and their residue contaminates the optical surfaces.) f. Freshly scrubbed, clean, dry hands.

5.4.2 Care and Handling of Optics. All of the optics in the SLA-1 are coated with precise dielectric coatings, either to avoid unwanted reflections from the surfaces of the transmissive optics or to achieve efficient reflec¬ tions from the mirrors. These coatings are fragile and easy to damage. Even faint fingerprints will damage the coatings, so extreme care must be taken to never touch the optical surfaces with fingers or with anything except carefully handled lens tissue or special cotton swabs. The optics must be handled only by the edges of any of the optics, or by the uncoated backs of the reflective optics.

5.4.3 Laser Brewster Windows. Refer to HeCd Laser Service Manual to clean laser brewster windows.

5.4.4 Laser Resonator Mirrors. Refer to HeCd Laser Service Manual to clean laser resonator mirrors.

5.4.5 90 Degree Beam-Turning Mirrors. (Figure 43b) The beam-turning mirrors can be removed and cleaned after their protective covers/shields have been removed. Turn the thumbscrew locking the mirror mount post into the post-holder ccw and gently lift the post and mirror mount of the post-holder. If desired, the mirrors and their immediate black-anodized holders can be separated from the

SUBSTITUTE SHEET

-82.44- mount by loosening the thumbscrew which retains the mirror holder to the mirror mount. a. carefully -remove dust and lint from the mirror surface using clean compressed air. If using an aerosol "duster," be certain that the can is always held upright or aerosol propellant will be sprayed onto and contaminate the optical surface. b. Wash hands thoroughly and fold a new sheet of lens tissue in halves repeatedly to achieve a "pad" of lens tissue about 1-inch square, and several thicknesses of tissue thick. Grasp this pad along one edge with a hemostat or locking tweezers. c. Apply a few drops of reagent-grade methanol to the pad and shake off any excess. d. Apply the side of the pad to one edge of the surface of the mirror. Carefully draw the pad across the surface one time only using some pressure on the hemostat. Allow the "tail" of the pad to follow the leading edge of the pad and drag across the optical surface. Immediately discard this piece of lens tissue, e. Allow the small film of methanol remaining on the optic to evaporate naturally. Do not wipe or blow on the optic to assist evaporation. f. Carefully examine the optic by looking at a glancing reflection of a bright area. If the optic still is not clean, choose a new sheet of lens tissue and repeat steps b through f until satisfactory results are achieved. g. If it is desired to clean the beam expander lenses as well, do not replace the 90 degree beam-turning mirrors and mounts until the lenses have been cleaned as explained below.

5.4.6 Beam Expander Lenses. (Figure 43c) Do not remove the lenses from the beam expander mount. The mount is difficult to realign and should not be removed.

-82.45- a. In order to clean the beam expander optics in place, the 90 degree beam-turning mirrors and mounts should be removed as explained above and carefully set aside. b. Apply a few drops of reagent grade methanol to an unused special cotton swab and shake or flick off any excess. c. To clean the input expanding (small) lens:

1. Carefully insert the soft tip of the swab into the input aperture until the surface of the lens is encountered. Use slight pressure and rotate the swab as it contacts the lens. Remove the swab and immediately discard it.

2. Repeat steps b and c;l with a new, much "drier" swab from which almost all of the methanol has been shaken out.

3. Repeat step cl with a new, completely dry cotton swab. d. To clean the output converging (large) lens: l. Apply a few drops of reagent grade methanol to an unused special cotton swab and shake or flick off any excess.

2. Use soft pressure with the soft tip of the swab and begin in the center of the lens. Wipe the lens with an expanding spiral pattern until the outer edge is wiped once. Immediately discard the swab.

3. Repeat step d.2 with a new, much "drier" swab from which almost all of the methanol has been shaken out.

4. Repeat step d.l with a new, completely dry cotton swab.

5. Now carefully examine the lens by looking at a reflection of a bright area. If the lens still is not clean, choose a new special cotton swab and repeat steps d.l through d.5 until satisfactory results are achieved.

SUBSTITUTE SHEET

-82.46- e. Check the cleaning job by viewing the expanded beam.

1. Replace the input 90 degree beam turning mirror.

2. Put on UV blocking glasses or goggles.

3. Defeat the interlock shutter by using the interlock-defeat jumper and realign the turning mirror so that the laser beam passes directly through the center of the beam expander.

4. Place a fluorescing piece of paper in front of the output lens and watch the expanded beam image carefully while adjusting the input turning mirror slightly to move the beam around through the beam expander. Any discontinuities in the beam pattern which do not move with the beam as it moves are likely to be caused by blemishes on the beam expander optics. If any are observed, repeat paragraph 5.3.5.6 entirely. f. Replace the output beam-turning mirror and mount it in the post holder.

5.4.7 Galvanometer-Driven Dynamic Mirrors. (Figure 43d) CAUTION

The galvanometer-driven dynamic mirrors are very light, thin, carefully balanced, and fragile. Breaking a dynamic mirror is easy to do and will involve a major replacement of the dynamic mirror system, and realignment of the SLA-1 optics. Therefore, be especially careful and gentle when cleaning the dynamic mirrors, a. Remove the protective cover from the dynamic mirrors by loosening the two machine screws which attach it to the dynamic mirror bracket. Be certain not to confuse them with the machine- screws which mount the entire dynamic mirror bracket. Do not remove the dynamic mirror bracket from its mount, nor the mount from the optical plate. Detaching and remounting the dynamic mirrors could necessitate a major optical realignment, and is not recommended.

-82.47- b. Apply a few drops of reagent grade methanol to an unused special cotton swab and shake or flick off any excess. c. Hold the stick of the swab between the fingers and carefully bring the side of the swab into contact with one end of the front surface of one of the dynamic mirrors. d. Use gentle pressure and wipe the swab along the long axis of the mirror once while rotating the swab in the opposite direction. Immediately discard the swab. e. Allow the small film of methanol remaining on the optic to evaporate naturally. Do not wipe or blow on the optic to assist evaporation. f. Repeat steps c through e for the other dynamic mirror, g. Now carefully examine the optics by looking at a glancing reflection of a bright area. ' If the optics still are not clean, choose a new cotton swab, and repeat steps c through g until satisfactory results are achieved.

5.4.8 Laser Chamber Window. (Figure 43e) a. Open chamber door. b. Remove two screws from inside chamber and remove window mount. c. Remove two screws and remove plastic retaining ring from window mount. d. Wash hands thoroughly, touch only the edges of the window, and remove the window from the mount. e. Carefully remove dust and lint from the surface using clean compressed air. If using an aerosol "duster," be certain that the can is always held upright or aerosol propellant will be sprayed onto and contaminate the optical surface. f. Fold a new sheet of lens tissue in halves repeatedly to achieve a pad" of lens tissue about 1-inch square,

SUBSTITUTE SHEET

-82 .48- and several thicknesses of tissue thick. Grasp this pad along one edge with the hemostat or locking tweezers, g. " Apply a few drops of reagent grade methanol to the pad and shake off any excess. h. Now apply the side of the pad to new edge of the surface of the window as shown in. Carefully draw the pad across the surface one time only using some pressure on the thermostat. Allow the "tail" of the pad to follow the leading edge of the pad and drag across the optical surface. This will clean one section of the surface of the large window. Immediately discard this piece of lens tissue, i. Use a new pile of lens tissue each time and repeat steps d through f until the entire surface has been cleaned, j. Allow the small film of methanol remaining on the window to evaporate naturally. Do not wipe or blow on the window to assist evaporation. k. Carefully examine the window by looking at a glancing reflection of a bright area. If the window still is not clean, choose a new sheet of lens tissue and repeat steps d through i until satisfactory results are achieved. 1. Repeat steps d through i to clean the other side of the window, m. Carefully replace the window in the mount, n. Install plastic retaining ring on window mount and secure with two screws. o. Install window mount in chamber window aperture and secure with two screws, p. Close chamber door.

5.5 REPLACEMENT PROCEDURES

5.5.1 Air Filter Replacement. (Figure 44) Replace the air filter every 6 months.

SUBSTITUTE T

-82 . 49- a. Open chamber door. b. Place lit on vat. c. Remove two screws and pull air filter with clamp " attached straight out from chamber. d. Install new air filter in chamber and secure with two screws. e. Remove lid from vat. f. Close chamber.

5.5.2 Chamber Lamp. a. Set OVEN LAMP switch to off. b. Open chamber door. c. Grasp chamber lamp at both ends and pull straight down to disengage lamp. d. Install new lamp by pushing both ends to engage the prongs. e. Close chamber door. f. Set OVEN LAMP switch to on. Verify that chamber lamp is illuminated.

5.5.3 Control Panel Lamps. a. Place a small flat blade screwdriver on bottom of plastic lens and push up to disengage lens. b. Grasp plastic tab with screwdriver and pry lamp forward to remove. c. Install new lamp in plastic tab. d. Install plastic lens. Verify that lamp illuminates during normal operating sequence.

SUBSTITUTE SHEET

-82.50-

GLOSSARY The following terms are used in the stereolithography process:

60/120 ANGLE HATCH This is a type of crosshatching pattern which supplements the standard X and Y hatching. See software manual.

BANJO This is a part which when built and measured provides line height and line width data for the working curve.

BASES (SUPPORTS) These are the structures generated by the CAD which provide structural support to the actual part when being built.

(See webs) .

BEAM PROFILE This is the spatial distribution of laser beam energy.

BORDER (BOUNDARY) The border is a block of vectors defining the walls of a sliced layer of a part.

CAD Computer aided design. CENTERING This is. a SLICE routine which automatically centers the part in space. This can only be done if the part is defined by only one STL file. See software manual.

CLIFF This is a software program which is used primarily in BASIC programming. It can also be used to move mirrors using direct commands from the DOS shell by transmitting data to STEREO. CRITICAL AREA This is an area within the part which has coordinates defined in a text file prior to merging.

TUTE SHEET

-82 . 51-

The area can have special attri¬ butes such as riveting. See software manual.

CROSSHATCH This is a general interior vector type providing structural integ¬ rity to walls. The pattern used is defined during slicing. See software manual.

CURL This is an effect sometimes encountered during part creation which can cause part inaccuracy.

DIP ACCELERATION This is a part-building variable which defines the speed of elevator dipping. It can be modified on a layer by layer basis if needed.

DIP DELAY This is a part-building variable defining the delay between the start of a dip routine and the start of next layer calculations (and laser movement) . It can be modified on a layer by layer basis.

DIP DEPTH This a part-building variable which defines the distance the elevator moves downward during a dipping sequence.

DIP SPEED This is a part-building variable which defines the maximum speed that the elevator attains.

DRAWING SPEED Laser drawing speed is defined by the Supervisor variables Step Period and Step Size. It is varied depending on layer thick¬ ness, type of resin, and laser power. The drawing speed to be

SUBSTITUTE SHEET

-82 .52- used is typically generated by use of the working curve.

DYNAMIC MIRRORS These are the galvanometer vector scanning mirrors which are controlled by SLA-1 software. Laser beammovement is defined by the rotation of these mirrors.

ELEVATOR The elevator is the vertically moving device to which the elevator platform and part are attached.

ETHERNET This is file transfer software system. It allows for easy move¬ ment of large files. FOOTPRINT This is the bottom of the supports which adheres directly to the elevator platform.

GREEN PART This is the laser cured part which has not undergone final post curing.

HATCH SPACING This is the distance between crosshatching which is defined during slicing (see Crosshatch) .

HeCd Helium Cadmium. L FILE This is a merge generated control file which contains all the layer by layer vector block identifica¬ tion information. Individual layer parameters can be modified in the L file.

LASER This is the laser controller software. If is also a device which provides the light energy required to polymerize the liquid photopolymer.

LAYER THICKNESS This is the layer to layer dip¬ ping distance. It can be either

-82.53- one value for the whole part or changed many times throughout the part (see variable layer thickness) .

LEVELING This is the time and temperature- dependent process where the resin settles to a flat surface after being distributed by dipping. The time allowed for leveling is defined by the dip delay variable.

LINE HEIGHT This the vertical thickness of a laser cured plastic line. It is variable depending on drawing speed and laser power/focus.

LINE WIDTH This is the width of a laser cured plastic line. It is vari¬ able depending on drawing speed and laser power/focus. MERGE This is a software program which takes the individual sliced files for a part and combines them. It generates the L and V files which Supervisor uses to make the part. MIA This is the minimum intersect angle and is used during slicing to delete hatch vectors which run parallel to layer boundaries. See software manual. MODULUS This is a physical attribute of a material which defines its overall toughness.

MONOMER This is a chemical species which is generally low in molecular weight and is used as a building block for preparing polymers.

SUBSTITUTE SHEET

-82.54-

MSA This is the minimum surface angle and is used during slicing. See software manual.

MSHA Mine Safety and Health Administration.

NIOSH National Institute for Occupational Safety and Health.

PHIGS FORMAT This is the software program that defines the CAD surfaces by using triangles.

PHOTOINITIATOR This is a chemical which trans¬ forms the laser energy into chemical energy and initiates the polymerization process. PHOTOPOLYMER This is a polymer which is formed using light as the energy source. POST CURE This is the process used to cure a green part. The post cure can be either ultraviolet light induced or thermal induced.

POT LIFE This is the useful life expect¬ ancy of a pot of chemical and depends on the chemical stability and other factors. PRIMARY RADICAL This is the initial radical species formed when laser light is absorbed by the photoiniti- ator. The primary radicals initiate the polymerization process.

RADIAL CROSSHATCH This is a specific type of cross- hatch which generally provides the best overall strength and support (see Crosshatch) . RADIOMETER This is a device which allows for the measurement of the laser output power.

-82.55-

RESIN This is the liquid photopolymer. RIVET This is a part making process which can be used in critical areas which may be prone to stress related inaccuracies.

SCALE FACTOR This is a Supervisor variable which can be used to scale the xy space either larger or smaller. It does not affect the vertical dimension.

SENSITIZATION This is an allergic response that some individual may obtain after repeated skin contract with a given chemical. SKIN (SKIN Fill) This is the coating of a hori¬ zontal (flat) or near horizontal (flat) area of the part.

SLA Stereolithography Apparatus SLICE This is the software that trans¬ forms the three-dimensional CAD designed part into a series of two-dimensional layers (slices) .

SMALLEY This is a stress relieving (decoupling) structure designed on the CAD.

STEP PERIOD This is a Supervisor variable which helps to define the laser drawing speed. Increasing the step period slows the speed (increases the plastic line height and width) .

STEREO This is a memory resident portion of the laser controller software.

STL FILE This is the PHIGS format CAD file used as input for slicing.

SUPERVISOR This is the software which supervises all the passing of

SUBSTITUTE SHEET

-82.56- variables and data to drive the mirrors and move the Z stage up and down during part building.

TENSILE STRENGTH This is an attribute of a material which defines the energy required to stretch it.

TRAPPED VOLUMES These are areas of the part from which resin cannot drain during dipping. USER INTERFACE This is the menu driven software which is used to control and run slicing programs.

.V FILE This is a merge generated file which contains all the layer by layer vector information. See software manual. VARIABLE LAYER THICKNESS This is the process tool which allows use of differing dipping depths and layer thicknesses in order to achieve improved strength or accuracy. It is controlled within Slice.

WEB This is a type of support struc¬ ture designed by the CAD designer which can provide additional strength or support as needed.

WORKING CURVE This is the plotted line height and line width data provided from Banjotop. It is used in with laser power to obtain drawing speed information.

ET

-82.57-

NOT TO BE DISCLOSED

THIS DOCUMENT CONTAINS CONFIDENTIAL INFORMATION RELATED TO STEREOLITHOGRAPHY PROCESSES AND EQUIPMENT WHICH ARE THE EXCLUSIVE PROPERTY OF 3D SYSTEMS, INC. THIS INFORMATION SHALL NOT BE DUPLICATED, USED OR DISCLOSED—IN WHOLE OR IN PART—FOR ANY PURPOSE OTHER THAN TRAINING AS AUTHORIZED IN WRITING BY 3D SYSTEMS, INC. ALL REASONABLE PRECAUTIONS SHALL BE TAKEN TO ENSURE COMPLIANCE WITH THESE CONDITIONS.

THE POSSESSION OF THIS DOCUMENT CONVEYS NO PROPERTY RIGHT OR LICENSE IN THE INFORMATION NOR IN ANY HATTER DISCLOSED THEREIN.

TABLE OF CONTENTS

SLA-1

INTRODUCTION

BETA SITE TROUBLESHOOTING

STEREOLITHOGRAPHY COMPONENT REPLACEMENT

SYSTEM ALIGNMENT

SPARE PARTS LISTS

SERVICE MANUAL WIRING DIAGRAM

3D Systems Incorporated

12847 Arroyo Street

Sylmar, California 91342

(818) 898-1533 FAX (818) 361-5484

NOVEMBER 1987

SUBSTITUTE SHEET

-82.58-

Safety Precautions

WARNING INVISIBLE LASER RADIATION

UV LASER RADIATION MAY DAMAGE EYE TISSUE. AVOID DIRECT EXPOSURE TO LASER BEAM. WEAR UV BLOCKING SAFETY GLASSES.

WARNING HIGH VOLTAGE

HAZARDOUS VOLTAGES ARE ACCESSIBLE WITH MAINTENANCE PANELS REMOVED. FOLLOW SAFE WORK PRACTICES.

WARNING CHEMICAL HAZARDS

UV CURABLE RESINS MAY CAUSE EYE AND SKIN BURNS. REPEATED OR PROLONGED SKIN CONTACT MAY CAUSE SENSITIZATION. VAPOR MAY BE HARMFUL.

SUBSTITUTE SHEET

-82.59-

Observe the following safety precautions when cleaning spilled resin or handling resin containers. Keep away from heat, sparks and flame. Protect from sunlight and fluorescent light. Closed containers may rupture/ explode when exposed to extreme heat. Use National Fire Protection Association Class B extinguishers (carbon dioxide, dry chemical or foam) . • Use only with adequate ventilation. Avoid breathing vapors or spray mist. Wear safety glasses.

Wear chemically resistant gloves and protective clothing. Wash thoroughly after handling and before eating, smoking or using toilet facilities.

Wear an NIOSH/MSHA approved respirator or ensure adequate ventilation when sanding or cutting cured objects.

FIRST AID FOR CHEMICAL ACCIDENTS Skin Contact. Wash thoroughly with soap and vater. Remove contaminated clothing and shoes immediately. If skin is irritated, get medical attention. Wash clothing before reuse and discard contaminated shoes. Eye Contact. Flush immediately with large amounts of water for 15 minutes and avoid sunlight, fluorescent light, or other ultraviolet light. Get medical attention.

Inhalation. Remove victim to fresh air. Give artificial respiration or cardio-pulmonary resuscitation if required. If breathing is difficult, give oxygen. Get medical attention.

SUBSTITUTE SHEET

-82.60-

TABLE OF CONTENTS Section/Paragraph Title Page

INTRODUCTION 82.62

I TROUBLESHOOTING 82.64 1.1 Introduction 82.64

1.2 How to Use this Section . . . . . . . . . . 82.64

II COMPONENT REPLACEMENT . . . . . . . . . . . 82.65

2.1 Introduction . . . . . . . . . 82.65

2.2 Tools 82.65 2.3 Slice Computer 82.66

2.3.1 Monitor 82.66

2.3.2 Keyboard. 82.66

2.3.3 Slice Computer 82.66

2.4 Electronic Cabinet Assembly 82.67 2.4.1 Monitor 82.67

2.4.3 Process Computer. . . . . .. . . . . . . . .82.68

2.4.4 Laser Power Supply. . . .. . . . . . . . . . 82.69

2.4.5 Elevator Driver 82.69 2.4.6 AC Power Distribution Panel 82.70

2.4.7 Dynamic Mirrors Driver 82.71

2.5 Optics Assembly 82.71

2.5.1 Laser 82.71

2.5.2 Shutters 82.72 2.5.3 Beam Turning Mirrors 82.73

2.5.4 Beam Expander 82.73

2.5.5 Dynamic Mirrors 82.73

2.5.6 Interlock Switches 82.74

2.5.6.1 Laser Cover 82.74 2.5.6.2 Optics Cover 82.75

2.6 Chamber Assembly 82.75

2.6.1 Heater/Fan . . . . " . 82.75

2.6.2 Reaction Vat 82.76

2.6.3 Platform , 82.76 2.6.4 Elevator 82.76

2.6.5 Beam Profiler 82.77

II ALIGNMENT 82.78

-82.61-

3.1 Introduction 82.78

3.2 Tools and Equipment 82.78

3.3 Laser Resonator 82.79

3.4 Optics 82.80

3.5 Chamber 82.81

3.5.1 Vertical Alignment of Elevator . . . . . . 82.81

3.5.2 Horizontal Alignment of Optics Plate . . . 82.82

IV SPARE PARTS LIST 82.83

4.1 Introduction 82.83

4.2 To Use this Section 82.83

4.3 Manufacturer's Names and Addresses . . . . 82.83

V WIRE LIST AND DIAGRAM 82.89

5.1 Introduction 82.89

5.2 Hire List and Diagram 82.89

LIST OF FIGURES

Figure Title Page

45a-45b Slice Computer Components 46a-46b Electronic Cabinet Components 47a-47c Optics Components 48 Chamber Components

49a-49b Laser Resonator Alignment 50a-50b Optics Alignment

51 Chamber Alignment

52 SLA-1 Stereolithography System 53a-53b Electronic Cabinet Assembly

54 Optics Assembly

55a-55b Chamber Assembly

56 SLA-1 Wiring Diagram

LIST OF TABLES Table Title Paσe

1-1 Fault Indication Chart 82.64

2-1 Replacement Tools 82.65

3-1 Alignment Tools and Equipment 82.78

4-1 Vendor Names and Addresses 82.84

SUBSTITUTE SHEET

-82. 62- INTRODUCTION

SCOPE

This " manual contains service and corrective maintenance procedures for the SLA-1 Beta Site Stereolithography System. This manual is to be used by qualified mainten¬ ance technicians to identify and replace defective components. Refer to the SLA-1 User's Manual for operation and routine maintenance procedures.

ORGANIZATION This manual is divided into five sections, as follows:

SECTION I. TROUBLESHOOTING - Diagnostic and corrective procedures. SECTION II. COMPONENT REPLACEMENT - Component removal and installation procedures. SECTION III. ALIGNMENT - Alignment of laser, optics, and chamber. SECTION IV. SPARE PARTS LISTS - Exploded view illustrations and lists of authorized spare parts. SECTION V. WIRING DIAGRAM - Wiring diagram to aid in troubleshooting and continuity tests.

OTHER FEATURES OF INTEREST

Title Page Index. On the right side of the title page you will find a section index. The black markers printed to the right of the text are keyed to similar markers on the first page of each referenced section. To locate a section, flip through the manual until you find a marker printed in the same location as the title page marker.

Warning Pages. Following the title page you will find a summary of critical warnings. You may be seriously injured if these warnings are not explicitly followed. Carefully read all warnings and first aid instructions

-82 . 63- prior to performance of operation or maintenance instructions.

REPORTING ERRORS AND RECOMMENDING IMPROVEMENTS This manual was prepared for use by Beta Site maintenance personnel. It will be revised to incorporate recommended content and format changes. If you find any mistakes, or if you have any recommendations for improving the proce¬ dures, please let us know by sending a copy of the marked-up page(s) to: Attn: Chick Lewis

3D Systems Inc. 12847 Arroyo St. Sylmar, California 91342 (818) 898-1533 • FAX (818) 361-5484

SU B STITUTE HEET

-82 .64-

SECTION I TROUBLESHOOTING

1.1 -INTRODUCTION

This section contains troubleshooting procedures to identify and correct selected hardware failures. Troubleshooting procedures for operation errors are covered in the SLA-1 User's Manual.

1.2 HOW TO USE THIS SECTION a. Perform the appropriate. troubleshooting procedure referenced in Table 1-1 in accordance with the following special instructions.

WARNING

HAZARDOUS VOLTAGES ARE ACCESSIBLE WITH MAINTENANCE PANELS REMOVED. FOLLOW SAFE WORK PRACTICES.

1. The troubleshooting procedures are presented in flow diagram format. Use of the diagrams is described in Figure 1-1.

2. Test point illustrations are provided following 'the flow diagrams (paragraph 1.3) .

Repeat the test portion of the flow diagrams after any part is replaced.

Table 1-1. Fault Indication Chart

-82 . 65-

SECTION II COMPONENT REPLACEMENT

2.1 INTRODUCTION

This section contains procedures to replace defective components. Each procedure is self-contained and is supported by an illustration keyed to the procedure in sequence of disassembly. Use the troubleshooting proce¬ dures in Section I to determine which components are defective.

WARNING

HAZARDOUS VOLTAGES ARE ACCESSIBLE WITH . MAINTENANCE PANELS REMOVED. FOLLOW SAFE WORK PRACTICES.

2.2 TOOLS Recommended replacement tools are listed in

Table 2-1. Equivalent items may be used.

Table 2-1. Replacement Tools

SUBSTITUTE SHEET

-82.66- 2.3 SLICE COMPUTER (Figures 45a-45b)

2.3.1 Monitor.

" a. Set power switch (1) on rear of monitor (2) to off. b. Disconnect power cable (3) from monitor. c. Use a small flat blade screwdriver to remove two connector screws and disconnect signal cable (4) from monitor. d. Remove monitor. e. Install new monitor. f. Connect signal cable (4) to monitor and use a small flat blade screwdriver and install two connector screws. g. Connect power cable (3) to monitor. h. Set power switch (1) on rear of monitor to on.

2.3.2 Keyboard. a. Set keyboard lockout keylock switch (5) on slice computer (6) to off. b. Disconnect signal cable (7) from keyboard (8) . The cable is terminated with a telephone jack. c. Remove keyboard. d. Install new keyboard. e. Connect signal cable (7) to keyboard. . Set keyboard lockout keylock switch (5) on slice computer (6) to on.

2.3.3 Slice Computer.

CAUTION Store the diskette in a safe place for protection. a. Remove diskette (9) (if present) from disk drive (10) . b. Set keyboard lockout keylock switch (5) to off. c. Set power switch (11) on rear panel to off. d. Disconnect two power cables (12) (monitor power and ac input power) from rear panel.

-82 . 67- e. Disconnect signal cable (7) (keyboard) from front panel. f. Disconnect one signal cable (13) (monitor) and one coaxial cable (14) (Ethernet) from rear panel. g. Remove slice computer (6) . h. Install new slice computer, i. Connect signal cable (7) to front panel, j. Connect one signal cable (13) and one coaxial cable

(14) to rear panel. k. Connect two power cables (12) to rear panel. 1. Set power switch (11) on rear panel to on. m. Set keyboard lockout keylock switch (5) to on. n. Install diskette (9) (if required) into disk drive

(10).

2.4 ELECTRONIC CABINET ASSEMBLY (Figures 46a-46b)

2.4.1 Monitor. a. Remove two screws (1) and remove cable access panel (2). b. Set power switch (3) on rear of monitor (4) to off. c. Disconnect power cable (5) from monitor. d. Use a small flat blade screwdriver to remove two connector.screws and disconnect signal cable (6) from monitor. e. Remove monitor. f. Install new monitor. g. Connect signal cable (6) to monitor and use a small flat blade screwdriver to install two connector screws. h. Connect power cable (5) to monitor. i. Set power switch (3) on rear of monitor to on. j. Install cable access panel (2) and secure with two screws (1) .

SUBSTITUTE SHEET

-82 . 68-

2 . 4.2 Keyboard. a. Set keyboard lockout keylock switch (7) on process computer (8) to off. b. " Disconnect signal cable (9) from keyboard (10) . The cable is terminated with a telephone jack. c. Remove keyboard. d. Install new keyboard. e. Connect signal cable (9) to keyboard. f. Set keyboard lockout keylock switch (7) on process computer (8) to on.

2.4.3 Process Computer. a. Remove four screws (11) and remove access panel (12) from rear of electronic cabinet assembly. b. Set keyboard lockout keylock switch (7) to off. c. Set power switch (13) on rear panel to off. d. Disconnect two power cables (14) (monitor power and ac input power) from rear panel. e. Disconnect three signal cables (15) (keyboard, elevator driver, and dynamic mirrors driver) and one coaxial cable (16) (Ethernet) from rear panel. f. Push process computer (8) out through front panel and remove. g. Push new process computer through front panel. h. Connect three signal cables (15) and one coaxial cable (16) to rear panel. i Connect two power cables (14) to rear panel. j. Set power switch (12) on rear panel to on. k. Set keyboard lockout keylock switch (7) to on.

1. Install access panel (12) on rear of cabinet and secure with two screws (11) .

-82.69- 2.4.4 Laser Power Supply.

WARNING

IF THE HIGH VOLTAGE CONNECTORS ARE DISCONNECTED BEFORE POWER SWITCH IS TURNED OFF, HIGH-VOLTAGE ARCING WILL RESULT. a. Remove four screws (11) and remove access panel (12) from rear of electronic cabinet assembly. b. Set keylock POWER switch (17) on laser power supply (18) to off. Verify that POWER ON and two DISCHARGE ON indicators are extinguished. c. Disconnect three cables (19) from unit. d. Grasp laser power supply by two handles and slide out of cabinet just enough to gain access to two cables (20) on rear of unit. e. Disconnect two cables (20) from rear of unit. f. Remove laser power supply from cabinet. g. Install new laser power supply (18) into cabinet just far enough to connect cables. h. Connect two cables (20) to rear of unit. i. Push laser power supply completely into cabinet, j . Connect three cables (19) to unit. k. Set keylock POWER switch (17) to on. Verify that POWER ON and two DISCHARGE ON indicators are illuminated. 1. Install access panel (12) on rear of cabinet and secure with four screws (11) .

2.4.5 Elevator Driver. a. Remove four screws (11) and remove access panel (12) from rear of electronic cabinet assembly. b. Set power switch (21) on elevator driver (22) to OFF. c. Loosen two screws from each connector and disconnect two cables (23) from unit. d. Slide elevator driver out of cabinet just enough to gain access to cable (24) on rear of unit.

SUBSTITUT

-82.70- e. Disconnect cable (24) from rear of unit. f. Remove elevator driver from cabinet. g. Install new elevator driver (22) into cabinet just enough to connect cable. h. Connect cable (24) to rear of unit. i. Push elevator driver completely into cabinet. j. Connect two cables (23) to unit and secure with two screws at each connector. k. Set power switch (21) to on. 1. Install access panel (12) on rear of cabinet and secure with four screws (11) .

2.4.6 AC Power Distribution Panel. a. Turn off main circuit breaker (25) on bottom rear of electronic cabinet assembly. b. Remove four screws (11) and remove access panel (12) from rear of electronic cabinet assembly. c. Disconnect power cables (26) from connectors Jl through J6 on ac power distribution panel (27) . Four to six cables will be present. d. Disconnect cables (28) from Molex connectors J7 through J10 on unit. e. Remove four screws (29) and remove terminal board access cover (30) . f. Disconnect wires from terminal strip (31) nearest rear of cabinet. Wires are marked and must be disconnected from terminals 1, 2, 3, 6, 9, 10, 11, and 12. g. Remove four screws (32) (two top and two bottom) and remove ac power distribution panel from cabinet. h. Install new ac power distribution panel (27) in cabinet and secure with four screws (32) . i. Remove four screws (29) and remove terminal board access cover (30) . j. Connect wires to terminal strip (31) nearest rear of cabinet. Connect wires to terminals 1, 2, 3, 6, 9, 10, 11, and 12 as marked.

-82 .71- k. Install terminal board access cover (30) and secure with four screws (29) . 1. Connect cables (28) to Molex connectors J7 through

J10. m. Connect power cables (26) to connectors Jl through J6 as required, n. Install access panel (12) on rear of cabinet and secure with four screws (11) . o. Turn on main circuit breaker (25) .

2.4.7 Dynamic Mirrors Driver. a. Remove ac power distribution panel (paragraph 2.4.6, steps a through g) . b. Remove six screws (33) (two top and four bottom) from dynamic mirrors driver (34) and tilt unit down to gain access to cables. c. Remove four cables (35) . d. Remove dynamic mirrors driver from cabinet. e. Install new dynamic mirrors driver (34) in cabinet. f. Tilt unit downward and install four cables (35) . g. Place unit flush against cabinet and install six screws (33) (two top and four bottom) . h. Set power switch (36) to on. i. Install ac power distribution panel (paragraph 2.4.6, steps h through o) .

2.5 OPTICS ASSEMBLY (Figures 47a-47c)

2.5.1 Laser. a. Set keylock POWER switch (17) on laser power supply

(18) to off. Verify that POWER ON and two DISCHARGE

ON indicators are extinguished. b. Turn two alien screws (1) ccw to release (one on each end) and remove laser cover (2) . c. Remove four screws (11, Figs. 46a-46b) and remove access panel (12) from rear of electronic cabinet assembly.

SUBSTITUTE SHEET

-82.72- d. Disconnect three cables (19) from laser power supply. e. Remove two screws (1) and remove cable access panel (2). f. " Pull three cables up through cable access hole. g. Remove four cap screws (3, Fig. 47a) from laser (4) (two front and two back) . h. Loosen alien screw (5) and remove interlock switch

(6) from rear of laser, i. Lift laser and remove from cabinet. j. Install new laser (4) on cabinet and secure with four cap screws (3) . k. Install interlock switch (6) on rear of laser and tighten alien screw (5) . 1. Push three cables (19, Fig. 46b) through cable access hole to laser power supply (18) . m. Install cable access panel (2) on cabinet and secure with two screws (1) . n. Connect three cables (19) to laser power supply, o. ' Set keylock POWER switch (17) on laser power supply to on. verify that POWER ON and two DISCHARGE ON indicators are illuminated, p. Install access panel (12) on rear of cabinet and secure with four screws (11) . q. Align laser mirrors (paragraph 3.3). r. Install laser cover (2, Fig. 47a) and turn two alien screws (1) cw to latch.

2.5.2 Shutters. a. Turn two alien screws (7) ccw to release (one on each end) and remove optics cover (8) . c. Tag and unsolder wires from shutters (9) . d. Remove two alien screws (10) and remove shutters. e. Solder wires to new shutters (9) . f. Install shutters and secure with two alien screws (10). g. Install optics cover (8) and turn two alien screws (7) cw to latch.

SUBSTITUTE

-82.73-

2.5.3 Beam-Turning Mirrors. a. Turn two alien screws (7) ccw to release (one on each end) and remove optics cover (8) . b. Loosen thumbscrew (11) and lift beam-turning mirror (12) straight up. c. Install new beam-turning mirror (12) and tighten thumbscrew (11) . d. Align beam-turning mirrors (paragraph 3.4). e. Install optics cover (8) and turn two alien screws (7) cw to latch.

2.5.4 Beam-Expander. a. Turn two alien screws (7) ccw to release (one on each end) and remove optics cover (8) . b. Remove four alien screws (13) and lift beam expander (14) straight up. c. Install new beam expander (14) and secure with four alien screws (13) . d. Install optics cover (8) and turn two alien screws (7) cw to latch.

2.5.5 Dynamic Mirrors. a. Turn two alien screws (7) ccw to release (one at each end) and remove optics cover (8) . b. Remove four screws (11, Fig. 46b) and remove access panel (12) from rear of electronic cabinet assembly. c. Set power switch (35) on dynamic mirrors driver (33) to off. d. Disconnect two outer cables (34) from dynamic mirrors driver. e. Remove two screws (1) and remove cable access panel (2). f. Pull two cables (34) up through cable access hole. g. Remove two alien screws (15, Fig. 47c) and lift dynamic mirrors (16) straight up from cabinet.

SUBSTITUTE SHEET

-82.74- h. Install new dynamic mirrors (16) on cabinet and secure with two alien screws (15) . i. Push two cables (34, Fig. 46b) through cable access " hole to dynamic mirrors driver (33) . j. Install cable access panel (2) on cabinet and secure with two screws (1) . k. Connect two cables to dynamic mirrors driver. 1. Set power switch (35) on dynamic mirrors driver to on. m. Install access panel (12) on rear of cabinet and secure with four screws (11) . n. Align beam-turning mirrors (paragraph 3.4). o. Install optics cover (8, Fig. 47a) and turn two alien screws (7) cw to latch.

2.5.6 Interlock Switches.

2.5.6.1 Laser Cover. a. Turn two alien screws (1) ccw to release (one at each end) and remove laser cover (2). b. Loosen one alien screw (5) and lift interlock switch (6) from rear of laser (4) . c. Tag and unsolder wires, from switch. d. Loosen two alien screws (17) and lift dual interlock switch (18) from cabinet. e. Tag and unsolder wires from switch. f. Solder wires to new interlock switch (6) . g. Install switch on rear of laser (4) and tighten one alien screw (5) . h. Solder wires to new dual interlock switch (18) . i. Install switch on cabinet and tighten two alien screws (17) . j. Install laser cover (2) and turn two alien screws (1) cw to latch.

SUBSTITUTE SHEET

-82.75-

2.5.6.2 Optics Cover. a. Turn two alien screws (7) ccw to release (one at each end) and remove optics cover (8) . b. Loosen two alien screws (19) (one for each switch) and lift interlock switch (20) from cabinet. c. Tag and unsolder wires from switches. d. Solder wires to new interlock switches (20) . e. Install switches on cabinet and tighten two alien screws (19) (one for each switch) . f. Install optics cover (8) and turn two alien screws (7) cw to latch.

2.6 CHAMBER ASSEMBLY (Figure 48)

2.6.1 Heater/Fan, a. Open chamber door (1) . b. Remove air filter (paragraph 2.6.1, steps a and b) . c. Set main circuit breaker on bottom rear of electronic cabinet assembly to off. d. Remove four screws (2) and remove bottom cover (3) on heater/fan (4) . e. Disconnect three wires from terminal strip (5) . The wires are marked. f. Remove four screws (6) and remove heater/fan (4) from chamber. h. Install new heater/fan (4) in chamber and secure with four screws (6) . g. Remove four screws (2) and remove bottom cover (3) from new heater/fan. i. Connect three wires as marked to terminal strip (5) . j. Install bottom cover (3) on heater/fan and secure with four screws (2) . k. Set main circuit breaker on electronic cabinet assembly to on.

1. Install air filter (paragraph 2.6.1, steps c and d) . m. Close chamber door (1) . Verify that fan is turning.

SUBSTITUTE SHEET

-82.76-

2.6.2 Reaction Vat. a. Open chamber door (1) . b. Remove two- side shelves (7) by lifting shelves to " disengage from attaching screws. c. Unscrew two knobs (8) to disengage platform rods (9) from vat (10) . d. Install lid (11) on vat and secure four latches (12) . e. Turn off drain valve (13) and remove collection bottle (14) . f. Grasp vat by two side handles (15) and slide out αf chamber, g. Clean resin from platform rods (9) (refer to User's

Manual) . h. Slide new vat (10) into chamber. i. Remove lid (11) from vat by releasing four snap fasteners. j. Screw two knobs (8) to engage platform rods (9) to vat. k. Place collection bottle (14) under valve (13) and turn on drain valve.

1. Fill vat with resin (refer to User's Manual), m. Install two side shelves (7) . n. Close chamber door (1) .

2.6.3 Platform. a. Open chamber door (1) . b. Remove two screws (16) . c. Unscrew two knobs (8) to disengage platform rods (9) from vat (10) and lift platform (17) straight out of chamber. d. Install new platform (17) in chamber and screw two knobs (8) to engage platform rods (9) to vat (10) . e. Install two screws (16) . f. Close chamber door (2) .

2.6.4 Elevator. a. Open chamber door (1) .

-82.77- b. Disconnect cable (18) from left side of chamber. c. Remove one screw (19) and remove cable clamp (20) . d. Remove platform (paragraph 2.6.3, steps a through c) . e. Remove four alien screws (21) and pull elevator (22) and cable straight out of chamber. f. Install new elevator (22) in chamber and secure with four alien screws (21) . g. Install platform (paragraph 2.6.3, steps d through f). h. Install cable clamp (20) on cable (18) and secure to cable and clamp to chamber with one screw (19) . i. Connect elevator cable (18) to chamber cable (23) . j. Close chamber door (1).

2.6.6 Beam Profiler. It is extremely difficult to remove the beam profiler in the Beta Site systems. Therefore, it is recommended that this unit not be removed. The SLA-1 can still operate even though the beam profiler is defective.

SUBSTITUTE SHEET

-82.78-

SECTION III ALIGNMENT

3.1 INTRODUCTION

This section contains procedures to align the laser, optics, and chamber. These procedures must be performed when the optics or laser is replaced, or when these items become misaligned through normal wear.

3.2 TOOLS AND EQUIPMENT

Recommended alignment tools and equipment are listed in Table 3-1. Equivalent items may be used.

Table 3-1. Alignment Tools and Equipment

Model/

Nomenclature Part No. Source

Ball driver, alien Commercially available

(2 ea)

Power meter, laser Liconix

T-square Commercially available

Caliper Commercially available

Tape, scotch Commercially available

Plumb bob Commercially available Alignment tool, vertical 3D Systems

Level, precision Commercially available

Wrench set, alien Commercially available

-82 . 79-

3.3 LASER RESONATOR (Figures 49a-49b)

This is a very touchy alignment which should only be performed when laser power or beam shape has deteriorated. Two alien ball drivers (5/64 inch) and a laser power meter are required to perform this procedure. a. Remove optics cover and laser cover. b. Remove two screws and remove shutter assembly. c. Place laser power meter to interrupt laser beam. d. Insert one ball driver in upper rear laser adjustment hole and second ball driver in upper front laser adjustment hole. e. Observe laser power meter and detune (turn 1/10 turn ccw) rear laser mirror adjustment. f. Tune front laser mirror adjustment to maximize power. Adjust in small increments only. g. Detune rear laser mirror (turn 1/10 turn cw) adjustment and repeat step f. h. Repeat steps e and f several times until maximum power is obtained. i. Place a card in front of the laser power meter and note shape of laser beam. The beam should be relatively round. If not, repeat steps e through h several times for a round beam shape at maximum power. j. Carefully remove both ball drivers and remove card. k. Insert one ball driver in lower rear laser adjustment hole and second ball driver in lower front laser adjustment hole. 1. Repeat steps e through i several times until a round beam shape at maximum power is obtained. m. Repeat upper and lower laser mirror adjustment several times to optimize laser power and beam shape, n. Carefully remove both ball drivers and remove card. o. Remove laser power meter. p. Install shutter assembly and secure with two screws, q. Install optics cover and laser cover.

SUBSTITUTE SHEET

-82.80- 3.4 OPTICS (Figures 50a-50b)

WARNING

UV LASER RADIATION MAY DAMAGE EYE TISSUE. AVOID DIRECT EXPOSURE TO LASER BEAM. WEAR SAFETY GLASSES.

CAUTION Fingerprints may damage optics coatings. Clean hands thoroughly and strictly avoid touching optical surfaces. a. Remove optics cover. b. Loosen two adjustment screws (front and rear) and slide beam expander out and remove. c. Adjust two each adjustment screws on two beam-turning mirrors and adjust mirrors so that laser beam strikes center of both mirrors and center window of dynamic window. d. Use a T-square to check that beam path between second beam turning mirror and dynamic mirror is exactly 3.25 inch above optic plate along entire beam path. Use a set of calipers to take measurements. e. Adjust two adjustment screws on second beam turning mirror to.achieve correct value. f. Use a 12-inch set of calipers to check that beam path between second beam-turning mirror and dynamic mirror is exactly 11.74 inch from beam path to front edge of optic plate along entire beam path. g. Adjust two adjustment screws on second beam-turning mirror to achieve correct value. h. Repeat steps d through g several times for optimum vertical and horizontal alignment. i. Put transparent scotch tape over input and exit apertures of beam expander. Make sure that tape does not contact lenses, j . Install beam expander.

-82 . 81- k. Adjust beam expander adjustment screws so that laser beam is centered as close as possible at input and exit apertures. Do not adjust any mirrors, only the beam expander. The position of the beam as it strikes the second beam-turning mirror and dynamic mirror should not change after installation of beam expander.

1. Tighten lock nuts on beam expender adjustment screws. m. Remove scotch tape from beam expander apertures. n. Install optics cover.

3.5 CHAMBER (Figure 51)

3.5.1 Vertical Alignment of Elevator. The perfect alignment of the elevator axis with the Vertical is critical for building of accurate stereolithographic parts. Any off vertical alignment of components will result in a vertical skew of every part built with the SLA-l. a. Remove reaction vat and platform (Section II) . b. On bottom of cabinet, raise up floor adjustment foot number 4 to balance cabinet on three feet. c. Remove two alien screws and remove optic cover. d. Open chamber door. e. Remove two inside screws and lower optic window mount from inside chamber. f. Suspend a plumb bob from center of optic window aperture. g. Adjust height of string until top of plumb bob exactly touches floor of chamber, h. Place a sheet of paper on bottom of chamber and mark plumb bob position exactly. i. Install vertical alignment tool and place string against vertical string groove, j . Run elevator up and don while observing plumb bob for lateral movement.

SUBSTITUTE SHEET

-82.82- k. If plumb bob moves off from spot marked in step g, adjust chamber floor adjustment cabinet feet (1, 2, and 3) for-best vertical alignment. 1. " Place string against horizontal string groove and mark plumb bob position, m. Repeat steps j and k. n. Repeat steps i through m several times until optimum leveling is achieved, o. Lower foot number 4 to floor level. (Be careful not to upset leveling.) p. Remove vertical alignment tool and plumb bob. q. Install optic window mount by installing two screws inside chamber. r. Close chamber door. s. Install platform and reaction vat (Section II) .

3.5.2 Horizontal Alignment of Optics Plate. Do not use the adjustable feet of the SLA-1 for horizontal alignment. This will upset the vertical alignment of the elevator, a. Loosen four tiedown bolts on optic plate. b. Place a precision level on optics plate. c. Adjust four levelling bolts for optimum horizontal level at all points of the optics plate. d. Tighten tiedown bolts.

-82 . 83-

SECTION IV SPARE PARTS LISTS

4.1 " INTRODUCTION

This section contains an exploded view illustration and listing of each authorized spare part.

4.2 HOW TO USE THIS SECTION a. Locate the defective part or assembly in which the part is located in Figure 52. Note the index number.

NOTE The SLA-1 is arranged into three major assemblies or component groups: the electronic cabinet assembly, the optics assembly, and the chamber assembly. These assemblies and components are illustrated and listed in Figure 52. Subassemblies and detail parts are listed in parts lists 99 through 101. b. Locate the index number in the parts list for Figure 4-1 and note the part number, nomenclature and source for replaceable parts, or the figure number in which the replaceable parts are listed. Assemblies containing replaceable parts are listed for reference purposes only and are identified by the abbreviation REF in the Units Per Assy column. c. Repeat steps a and b to locate subassemblies and detail parts in the referenced parts list, d. Order replacement parts from the listed manufacturer in accordance with the instructions in paragraph 4.3.

4.3 MANUFACTURER'S NAMES AND ADDRESSES SLA component manufacturers are listed in Table

4-1. When ordering spare parts, specify the part number, nomenclature, and quantity required. Always inform your 3-D Systems project engineer first if problems arise. He will usually be able to arrange to acquire the necessary

-82.84- parts The manufacturers of SLA-1 components and subassemblies are listed for convenience.

Table 4-1. Vendor Names and Addresses

Manufacturer Address and Telephone

3D Systems, Inc. 12847 Arroyo St. Sylmar, CA 91342 (818) 898-1533 FAX (818) 361-5484

General Scanning, 500 Arsenal St.

Inc. Waterton, MA 02272 (617) 924-1010

Liconix 1390 Borregas Ave.

Sunnyvale, CA 94089 (408) 734-4331 TWX 910-379-6475

Newport Corp. 18235 Mount Baldy Circle

Fountain Valley, CA 92728- -8020 (714) 963-9811 .

Wyse Technology 3571 North First St. ' San Jose, CA 95134

(408) 433-1026

-82.85-

SHE T

-82.86-

-82.87-

-82.88-

Figure Units & Index Part Description Per Number Number 1 2 3 Assy Manufacturer

55a-55b CHAMBER ASSY (See Figure 52 for next higher assembly)

16175 • SWITCH ASSY, 3D Systems Interlock

16170 • DEFEAT ASSY, 3d Systems Interlock

• PROFILER ASSY, 1 3D Systems Beam

16115 • VAT ASSY 3D Systems

• ELEVATOR ASSY, 3D Systems Z-Stage

• PLATFORM ASSY 3D Systems

16125 • FILTER ASSY, 3D Systems Air

HEATER/FAN ASSY 3D Systems

LIGHT 3D Systems

-82 . 89-

SECTION V WIRING DIAGRAM

5.1 INTRODUCTION

This section contains a wiring diagram to aid in troubleshooting and continuity tests.

5.2 WIRE LIST AND DIAGRAM

All SLA-1 cables and interconnections between components and subassemblies are shown in the wiring diagram (Figure 56) .

SUB TITUTE SHEET

-82.90-

A P P E N D I X B

-82 . 91- 3D Systems , Inc.

SLA-1 Software Manual

Beta Release, First Draft

October, 1987

3D Systems, Inc.

12847 Arroyo Street

Sylmar, CA 91342

(818) 898 - 1533

(818) 361 - 5484 FAX

3D Systems SLA-1 Software Manual

Beta Release, First Draft

October, 1987

TABLE OF CONTENTS 1.0 Introduction 82.94

1.1 System Overview 82.94

1.2 Major Part-Making Components 82.97

1.3 Utilities 82.99

2.0 Getting Started 82.100 2.1 Getting Around on the Slice Computer 82.100

2.1.1 Making a User Account 82.100

2.1.2 Disk Usage Maintenance 82.102

2.2 Getting Around on the Process Computer 82.103

2.2.1 Disk Usage Maintenance 82.103 3.0 SLICE and the User Interface 82.104

3.1 The TELNET Communications Program 82.105

3.2 SLICE Overview. 82.105

3.3 SLICE Features and Capabilities 82.109

3.4 SLICE Command Line Parameters 82.110 3.5 The SLICE User Interface 82.112

3.5.1 UI Overview 82.112

3.5.2 UI Main Command Menu 82.113

3.5.3 UI Alter Options Menu 82.114

3.5.4 UI Extra Parameters Screen 82.116 4.0 The Parser 82.117

4.1 The FTP File-Transfer Program 82.117

4.2 Operating The Parser 82.118

4.3 The Parser's Options 82.120

4.4 Critical Areas 82.121 5.0 The Supervisor 82.121

5.1 The Steps To Take Before Running the

Supervisor 82.122

5.1.1 Getting the Step Periods 82.122

5.1.2 Editing the Supervisors Default Parameters File 82.122

5.1.3 Editing the Layer Control File 82.124

-82 . 93-

5.1.3 Editing the Layer Control File 82.126

5.2 Operating the Supervisor 82.127

5.3 The Supervisor's Options 82.128

5.4 The Supervisor's Keyboard Commands 82.129 5.5 Using Rivets 82.130

6.0 Other Programs 82.131

6.1 FRONT, Simple Front End to Laser Controller.. 82.132

6.2 CLIFF, Control Laser Instrument From File.... 82.133

6.3 STEREO, The Stereolithography Device Driver.. 82.135 6.3.1 STEREO Command Set 82.135

6.3.2 STEREO Options 82.138

7.0 File Formats 82.140

7.1 SLICE'S Input File (*.STL) Format 82.140

7.2 SLICE'S Output File (*.SLI) Format 82.143 7.3 The Parser's Output File (*.P and *.L)

Format 82.144

7.4 Critical Area File (*.BOX) Format 82.146

7.5 Supervisor Default Parameters File

(SUPER.PRM) Format 82.147 7.6 The STEREO.DEF Driver Default File Format 82.150

7.7 The STEREO.GEO Geometric Correction File

Format 82.150

Appendix A - SLA-1 Software System Chart 82.152

Appendix B - The STEREO Command Set 82.153 Appendix C - Stereolithography Software Glossary.. 82.155 Appendix D - Editor Commands 82.157

-82 .94-

1.0 Introduction

Welcome to the . world of Stereolithography. By now, you know what Stereolithography is all about, and you have seen " an SLA=1 machine. The job of this manual is to introduce you to the software that makes a SLA machine work.

First, lets quickly review the Stereolithography process. A three-dimensional part is designed on a CAD system, and transferred to a Slice Computer where the part is trans- formed into a series of two-dimensional layers. From that computer, the two-dimensional part is moved over to the

Process Computer in the SLA machine. It is the job of that computer to make the part.

- This manual follows the Stereolithography process.. First, you will receive a brief introduction to all the important software programs. Then you will be shown how the Slice Computer works, how the Process Computer Works, and how to pass files to them.

1.1 System Overview By System, we mean the Stereolithography Software System. And it is a system. It encompasses two operating systems - MSDOS and XENIX - and over a dozen programs, each important to some aspect of the Stereolithography process. At last count, we figure there are nine levels of software. Each level can be viewed as a black box and having a unique task:

-82.95-

I Level 4 COMBINE SLICED FILES ]

] Level 3 PART-MAKING SUPERVISOR j

! Level 2 LASER DEVICE DRIVER '

+ H

The responsibilities of providing these services are spread out amongst three computers — one that you already use for CAD work, our 80386-based Slice Computer, and our 80286-based Part-Making Computer:

-82.96-

+- SLICE COMPUTER

Level 7 TRANSFER 3-D FILE TO SLICE COMPUTER Level 6 SLICE 3-D PART INTO 2-D LAYERS

+

-82.97- 1.2 Major Part-Making Components

The Slice Computer

The 80386-based Slice Computer contains XENIX, a full-bore multitasking Operating System which allows many users to simultaneously sign-on, transfer CAD files, and slice them. On this computer you will be introduced to some system management programs and some stereolithography software. The Slice Computer contains the Slice Program (SLICE) and its convenient User Interface Program (UI) . SLICE is the program that takes a 3-D database and transforms it into a 2-D one suitable for part-making. Since SLICE conforms to the Unix philosophy of how programs work (which by the way is not so intuitive) , we have developed UI which is an convenient menu- driven front-end to SLICE.

You will use UI to input the parameters you want SLICE to see and then run SLICE through UI. Generally, unless you need to do some disk or system maintenance, you will not need to leave UI until you sign-off.

— SLICE COMPUTER +

Level 7 TRANSFER 3-D FILE TO SLICE COMPUTER Level 6 SLICE 3-D PART INTO 2-D LAYERS

- UI User-Interface Program

- SLICE Part Slicing Program

The Process Computer

The Process Computer has many programs. Rather than instruct you how to call up each program from DOS, we instead have developed a menu program which you can use instead. The menu program leads you to each of the major part-making programs, the utility programs, and provides some disk management functions.

-82.98-

The SLA machine operator will tap into the Slice Computer and pull out the 2-dimensional database of the part he next wishes to make. This is accomplished using Ethernet software programs TELNET and FTP. TELNET temporarily makes the Process Computer into a computer terminal so that you can sign-into the Slice computer and run the User Interface program. You can then use FTP to transfer the 2-D databases (okay, we'll start calling them sliced files) files over to the Process Computer. Once a sliced file is on the Process Computer, it may need to be combined with other sliced files, such as those containing a base for the part. The Parser, PARSE, does this job and also makes a special layer control file which you can edit to fine-tune the part-making process. After running the Parser, you will proceed to the Supervisor, SUPER, which is the one program in charge of making a part. The Supervisor controls the motion of the laser beam and the Z-stage elevator, dipping and pausing for each layer. Actually, The Supervisor's job is to "pass along" laser movement information to some rather sophisticated memory- resident software. The Supervisor talks to STEREO, a special Stereolithography Device Driver we created that knows about such SLA-specific things as special ways to draw and geometric correction which causes the laser beam to map linearly onto the vat's surface. STEREO, in turn, talks to LASER, the low-level - laser controller, which is constantly running, moving the laser beam one discrete step every so often. We told you a bit more than you probably needed to know, but we want you to get a good understanding of the system. The STEREO Device Driver has a set of commands that control how the laser moves on any given layer. Sometimes you want the laser to behave differently at some point during the part-making process. So, we gave the Supervisor the capability of passing along to STEREO commands that you have placed in certain files.

-82 . 99-

We want you to be aware that you are learning the commands of a common device driver, a driver that many different programs can use. Once you learn the STEREO Command Set, you will be in pretty good shape to quickly adapt to other programs.

PROCESS COMPUTER

Level 5 TRANSFER 2-D FILE TO PROCESS COMPUTER

- TELNET Terminal Emulation Program

- FTP File Transfer Utility

Level 4 PARSE SLICED FILES

- PARSE The Parser

Level.3 PART-MAKING SUPERVISOR

- SUPER The Supervisor

Level 2 LASER DEVICE DRIVER

- STEREO System Resource

Level 1 LOW-LEVEL LASER CONTROLLER

- LASER System Resource

1.3 Utilities

In addition to the major components, there are a variety of utility programs that aid the part-making process. There is the power on-off sequencer (POWER) that enables you to safely turn on and off various elements of the SLA machine with appropriate directions.

And there is the Calibrator (CALIB) that is run not-so- often to calibrate the Vat Surface (the "Field") to make the SLA machine geometrically correct. Special hardware is necessary in order to use this program. The Profiler (PROFILE) that analyzes the laser beam, and it is run often, perhaps once a day. It makes note of the current shape and intensity of the beam. The results of

SUBSTITUTESHEET

-82.100- its analysis is retained in a special file that other programs can read.

The Get Step Periods program (GETSP) is one such program. It eliminates the need for you to be a chemist by reading the Profiler's data and enabling you to determine an appropriate Step Period (laser speed) for making a partic¬ ular part. It knows the working curves for different materials, and it will select an appropriate Step Period for your forthcoming part-making sessions. ZSTAGE gives you control over the Z-Stage, the vertical elevator that the part sits on. ZSTAGE is used to set the elevator just before a part is make, and it is also used to bring a part up out of the vat.

POWER Power On/Off Sequencer CALIB Field Calibrator PROFILE Beam Profiler

Determine Step Periods Z-Stage Controller

Utility Programs

2.0 Getting Started

In this chapter, we assume you have installed your Slice and Process Computer Systems according the Installation Manual and have verified their proper operation. This chapter takes you at that point to help you get started using these two computer for the part-making process.

2.1 Getting Around on the Slice Computer Each person performing slicing should have his or her own XENIX account on the Slice Computer. Once an account has been created, the owner can sign on.

2.1.1 Making a User Account

Sign onto the sysadm account by typing 'sysadm' at the login prompt and press Enter. Enter the password, which

-82 . 101- is '3dsys'. Note that the password isn't displayed as its typed in. And the case of the letters is important; type them in lower case.

The sysadm account is a special Xenix account that automatically takes you to a menu-driven system adminis¬ tration program. From this menu you can create and remove user accounts, and perform a variety of other system tasks. If you want to know more information about the sysadm function than what is presented here, please refer to the appropriate Xenix documentation.

Take a few moments to look over the screen. Select the

User Maintenance options by pressing 'U'. Do not press

Enter.

Select MakeUser by pressing 'M' . Do not press Enter. Answer 'y' (and Enter) to 'detailed instructions?'. Next time you can answer 'n' because you will be familiar with the make-user process.

Enter the new user's login name. This should be short and in all lower case letters. We simply use people's first names and an occasional first letter of their last name. Make up your own rule, but be consistent. It will make system management easier.

Answer 'y' to 'Do you wish to use the next available user id?' query. Let the system assign the id number.. You will rarely have to refer to it.

Answer 'y' to 'Do you want to use the default group?' query. This will assign the standard group 'group'. Assign a password that is at least 5 characters in length. You will have to enter it again as a safety precaution against typos. If you don't care about security, just make the password the same for all users. This way, you can hop around the various user accounts and pick up the sliced file. Select the Standard (Bourne) Shell, item 1. Enter a comment if you want. Generally, you will enter the user's full name (with upper and lower case letters) here.

SUBSTITUTE HEET

-82. 102-

Review the account information. If you are satisfied, answer 'n' to *Do you want to change anything?' prompt. The computer will take a few moments to create the user. You " have finished adding a user to the Slice Computer. That user can now sign-in and do slicing.

If you want to remove a user, you can select the Remove User option. You will have to delete all of the user's files before you can delete him from the computer system. Play around with the sysadm menu system. Don't do anything that looks irreversible or serious until you have read up on it.

2.1.2 Disk Usage Maintenance

Depending on the size of your part files, you will need to take time to make periodic maintenance. This means you should erase or archive old part files to make way for new ones.

When you sign-in, the computer will tell you how much disk space is taken up by your files. The number shown is the number of 512 byte blocks (1/2 K) . Check this number to make sure you aren't taking up more disk space than you thought. Make sure your disk usage doesn't get out of hand.

If you are in the User Interface, use option 6 to quit and return to Xenix. There you can use the r command to remove files: rm sli0045.stl will erase the single file sli0045.stl rm gbσx03* will erase all files whose name begin with

gbox03'

You can also use cp to copy and mv to move files around. Refer to the Xenix Documentation for more information. If you feel you need more information about the Xenix

Operating System, we recommend the following books: * Understanding XENIX: A Conceptual Guide Que Corporation * Working with XENIX Systems

Scott, Foresman, and Company

-82 . 103-

* XENIX at Work Microsoft Press

* Inside XENIX The Waite Group * XENIX Tutor

XENIX Training on DOS PCs SCO, our Xenix supplier sell these books to end-users. Contact them at (408) 425 - 7222.

2.2 Getting Around on the Process Computer The Process Computer is your typical AT-compatible MSDOS Computer System. If you don't know the first thing about MSDOS, don't worry. All you have to do is turn the computer on; it does the rest. You will enter a Menu Program from which you can get to all the essential part-making programs.

2.2.1 Disk Usage Maintenance

As with the Slice Computer, you will need to watch your disk usage on the Process Computer. The Process Computer contains 40 Megabytes, of which about 2 Megabytes are taken up by MSDOS and the Stereolithography Software.

Unless you have created your own directories for the sliced files, you will be in the \WORK directory. Periodically, go to the DOS Menu and select item 1 to get the disk usage stats. You will see something like: 21344256 bytes total disk space 49152 bytes in 2 hidden files 45056 bytes in 22 directories 6254592 bytes in 391 user files 20480 bytes in bad sectors 14974976 bytes available on disk 655360 bytes total memory 598128 bytes free Watch the 'bytes available on disk 1 . This system has more than 14 Megabytes (14,000,000) left so there is no i medi- ate danger of running our of disk.space. Depending on the

-82.104- sizes of the part files, you should get concerned, when this number drops below a few Megabytes. Once you realize that you need to some housecleaning, or "disk cleaning" in this case, select item 3 in the DOS Menu. This will take you to a program called QuickDos II (QD2) where you can do such disk-related things as copying files, moving files, and deleting files. To delete files, use the arrow keys to move up and down the directory listing shown. Press the Space Bar to tag a file. A white arrow should appear at the left of the file name. Keep doing this until all the files you want to delete have been tagged. To untag a file, move back to the file and press the Space Bar again. The white arrow should disappear. Press Ε' (no Enter) to erase. QuickDos will show you the file you have selected on a different screen. Press Alt-E (hold the Alt key down while pressing » E*) to begin the erase procedure. If you see something you don't like, press Esc to abort. QD2 performs a variety of other useful disk management tasks. Refer to its documentation for more information.

3.0- SLICE and the User Interface

To use SLICE and the User Interface, you can sign-on to the Slice Computer either directly via its keyboard, or from the Process Computer over the Ethernet communications link. Section 3.1 describes how to use the Ethernet TELNET terminal program.

Once you are signed-in, there are two ways to tell SLICE what you want done. One is to work directly from the Xenix Operating System where you must specify all the options on one line. The other is to use UI, the Slice User Interface Program, where you can specify the options through a set of menus. Both techniques are described below. We have found most people prefer using the User Interface.

-82 . 105-

3.1 The TELNET Communications Program

The TELNET Program allows you to connect up to the Slice Computer from - the Process Computer and run the User Interface and SLICE programs. From the Process Computer Main Menu, select item 1, Data Transfer. You will be placed in the XFER program are presented with the following options:

1. TELNET, Terminal Utility

2. FTP, File Transfer Program Q. Quit

If you don't what to communicate just yet, press Q to quit and return to the main menu. Otherwise, select item 1,

TELNET.

TELNET should run and connect the computer you are currently on (the Process Computer) up to the Slice Computer. If both computers are functioning and are properly linked together, you should see the Xenix Login message appear. At this point the Process Computer is like the Slice Computer s main console. You can now sign-in and run SLICE or the User Interface.

Eventually, you will have to sign-off. Get out of whatever program you may be in (the DEL key may do that) and type: exit You should then be logged off the Slice Computer and returned to the Process Computer's main menu.

3.2 SLICE Overview

This quick overview will give you a brief description of

SLICE methodology. SLICE'S mission is to read in a solid model whose surfaces were tessellated into triangular facets, and then to calculate output that is suitable for the laser control system to polymerize the model in layers, working from the bottom up. While we are discussing SLICE ,it is important to realize that these next questions touch upon deep topics. The

SUBSTITUTE SHEET

-82 . 106- areas of numerical analysis, analytical geometry, computer graphics, and computer architecture, are among those that are relevant to- SLICE. The discussion below is by no means a thorough treatment of these topics, but rather a starting point to provoke thought. Why use layers?

The UV catalyzed polymerization process usually takes place at or near the monomer-substrate surface, so an approach akin to assembling a loaf of bread by gluing the slices back together is taken by the laser process. SLICE "slices" the original model mathematically which the laser then puts back together.

The laser must trace the outline of each slice and sweep across ("hatching") the interior of each slice. In addi- tion, the end-slices of the bread loaf, and the near flat ones are traced more finely, called "filling" in SLICE parlance.

Therefore the object to be produced must be reduced to cross-sections. This is the heart of the problem—to do the cross-sectioning and hatching/filling efficiently and correctly. Why use triangles?

There are many ways to represent solids, such as constructive-solid-geometry, parametric representation (based upon a variety of fundamental curves such as bicubic patches) , and boundary representation (called b-rep in the literature) . B-rep is the most popular and often the most efficient for a general class of objects (e.g. not wings or boat hulls) . The boundary representation method generally involves describing a solid model in terms of its surfaces which are approximated by polygons. The smaller the polygons the better the b-rep model represents the actual object. Some solid model analysis problems (such as tolerance checking) originate right here-because we stray away from reality once we take the first step of interpolating

SUBSTITUTE SHEET

-82 . 107- polygons. We can discuss this further in a future section.

How the model is actually produced, whether by volumes of revolution, extrusion, projection, cross-sectioning (in reverse of SLICE), etc., does not (at present) concern us here. But the end result is a model that must have integ¬ rity. Polygons must be planar, and adjacent polygons must indeed abut one another, for example. The triangle is a very nice surface b-rep polygon to work with for several reasons: non-degenerate triangles always define a single plane in 3-space, (as two points define a line in 2-space, and 4 points define a hypercube in 4- space, etc.). A degenerate triangle is one in which one or more of the points have the same coordinates. Tri- angles are also the simplest entity with which to perform computations, as compared to trapezoids, hence they pro¬ liferate in many popular CAD and solid modelling systems. Why have variable z-spacing? Let us use our food example again. If we are slicing a loaf of bread that is geometrically uninteresting, say a loaf of Roman Meal, it is wasteful to slice at every millimeter; centimeters will do. If we are slicing a dome shaped French baguette, for example, but want a reasonably accurate model, some slices should be thinner than others. Those slices that have more detail and that have smaller slope should be smaller. This is a little like the resulting problem above, but now we will vary the grid size DYNAMICALLY as we move through the model. Secondly, this approximation corrects for limitations in the laser process, not for a mathematical loss of accuracy as in the integer problem.

The limitation in the laser process is caused by the fact that beam shoots at approximately a normal angle to the substrate surface. Angled surfaces are therefore built up in a stair stepping method. The side of each step is a slice, and its angle is given by the angle of the laser beam relative to the substrate liquid surface.

SUBSTITUTESHEET

-82. 108-

The second limitation is that areas that are nearly flat must be treated as if they were completely flat. Com¬ pletely flat regions are skin-filled, which is essentially a very fine cross-hatching. Near flat regions must be skin-filled lest gaps and/or warpage occur in the com¬ pleted part. Additional structural features may have to be built in order to compensate for properties inherent in the polymer. There are other effects relevant to the part-making process, but they are not covered here. There is for example, a correction necessary for the spherical projection of the laser beam onto the flat surface of the substrate liquid, which is done in a post-SLICE laser output phase. The thickness of slices must vary then to: 1) obtain a sufficient level of detail, and 2) provide sufficient polymerization/ structural strength in areas that have small slope. Why are triangles classified? Recall that the input consists only of triangles. Each slice will intersect some of the triangles. Triangles are classified by their slope relative to the x-y plane in SLICE: flat (slope=0) , near-flat (slope< human-determined subjective criteria) , and "scan" triangles (slope is large) .

The line segments that are calculated by slicing through triangles are treated differently depending on the triangle they came from. These resulting intersections of slices with triangles form outlines of slices, called "borders", and provide information needed to do the cross-hatching and skin-filling. Why have output blocks?

Output blocks in Slice's output files identify the type of two-point vectors which follow. Special action can then be taken by the Supervisor on some of these blocks to strengthen the part and prevent warpage.

SUBSTITUTE SHEET

-b^. υy-

3.3 SLICE Blocks

SLICE takes the 3-D object database and classifies the facets as flat, near-flat, or scanned. When SLICE gets around to producing 2-D output, it organizes the layer vectors into various block.

SLICE block identifiers follow the following mnemonic rule. Not all combinations are valid.

L + B

F + u + H

NF + D + F

\ boundary/border hatch fill

<iown skin

New Block Mnemonic Description

LB Layer Border

LH Layer Hatch

FUF Flat Up skin Fill

NFUB Near-Flat Up skin Border

NFUF Near-Flat Up skin Fill

FDF Flat Down skin Fill

NFDB Near-Flat Down skin Border

NFDH Near-Flat Down skin Hatch

NFDF Near-Flat Down skin Fill

The above list is shown in kind of a triangle-type order which is different from the order SLICE outputs the data. SLICE outputs the way the part is to be built:

* borders first

* then hatches

* then up fills SLICE outputs the blocks in the following order:

SUBSTITUTE SHEET

PCI7US89/01558

-82.110-

1. L Layer identifier, no vectors

2. LB Layer Border

3. IH Layer Hatch

4. NFDB Near-Flat Down βkin Border

5. NFDB Near-Flat Down skin Hatch

«. NFUB Near-Flat Up skin Border

7. FDF Flat Down skin Fill

8. NFDF Near-Flat Down βkin Fill

9. NFUF Near-Flat Up skin Fill

1100.. FFUUFF Flat Up βkin Fill

The L block isn't one really. It is followed by the internal Z-layer number, must like the old Z block.

However, unlike the old Z which has the complete boundary for that layer, the L has no vectors.

3.4 SLICE Command Line Parameters

To activate SLICE the hard way, you will need to type out a XENIX command line with the form: SLICE < input_filβ <optiσns> where SLICE iβ the current SLICE program (e.g. *slice20b » ) input_file is the name of the STL input file

<options> represent any combination of the following SLICE program options: -scale <scale ιιιι alue> Used to specify a real number scale value that will be used to scale the input file coordinates. The default scale value is 1. -sf <segaent output file> Used to specify an output file for z plane intersection segments. The default is to not generate a segment output file.

-ZB <2 spacing value> Used to indicate the constant z spacing of the output cross-sections. -hy <hatch spacing valuβ> Used to set spacing of hatch lines parallel to the Y - a x is . SUBSTITUTESHEET

-82.111-

-hx <hatch spacing value>

Used to set spacing of hatch lines parallel to the X-axis.

-ha <hatch spacing value> Used to set spacing of 60 degree angle hatch lines. -hfy <hatch spacing valuβ> Setβ spacing of hatch lines parallel to the Y-axis on flat surfaces. -hf* <hatch spacing valuβ> Sets spacing of hatch lines parallel to the X-axis on flat surfaces, -zsf <Z spacing control file> Used to specify the file containing variable Z-spacing information. -c centering option.

Centers object coordinates around 32768, 32768. -nsσ No. section codes option. Suppresses section codes in the output file, - sa Minimum surface angle option. Indicates minimum surface angle for scanned facets. Legal values are between 0 and 90 degrees, -mia Minimum intersect angle option. Indicates minimum intersect angle for hatch lines. Legal values are between 0 and 90 degrees. -b Binary input option.

Indicates that the input file is in binary format. -d Display option. Causes the program to display cross-sections on the screen as they are generated. -h Kelp option.

Causes the program to print a help similar to this list of-options and then stop. -b Binary input option. Indicates that the input file is in binary attributed format.

-aries ARIES attributed binary input option. Use when binary file is ARIES and attributed. TI TUTE SHEE

-82.112-

-diβk Disk option.

Causes the program save intermediate information on disk rather than in memory. -x or -y Slioe Axis option. Use the x-axis or y-axiβ as the slioe axis, not the standard z-axis. SLICE can be executed directly as a standard Xenix program. However, we have a developed a special User-Interface program for SLICE, described below.

3.5 The SLICE User interface

We have developed a special User Interface program to SLICE that runs under XENIX. t is a much easier way to run SLICE compared to typing command lines. UI, as the User Interface is called, can be run remotely through Ethernet.

UI, the SLICE Vseτ Interface, presents menus and allows the user to eaβily select and define the various SLICE options for a particular STL Slice Input File. The options for different STL files are remembered in special setup files with the same file name prefix, but with the extension «.UII« (UI Information).

UI also allows the user to define a special variable Z-spacing file (with the extension ».UIZ») that is used by SLICE to generate different-spaced layers for different sections of a part.

3.5.1 UI overview

The complex nature of using SLICE especially on a Unix- ba β ed system prompted the development of the User interface (UI) program. It is a simple easy-to-use front end for the Stereolithographer where, by selecting 'items off a menu, he can enter the slice options for his latest part. A key feature of UI it that it supports variable z-epecing-, a dirricult fβa-tut* ut S1ΛCZ to u»* outside or UI.

—82 . 113 —

UI allows a SLICE user to change options and invoke the SLICE program. SLICE then slices the specified 3D object into 2D layers using the UI options.

UI can be invoked from any process Unix or Xenix account. It is assumed that such a system has already been created with the necessary software. It is recommended that each individual needing to use UI and SLICE be given their own account. The command syntax for the UI command is: ui <option_file_name> where <option_file_name> is the name you wish to refer to the new set of options. If you wish, it can be related somehow to the part name. If <option_file_name> is omitted, the last option file name will be used and its option file loaded.

3.5.2 UI Main Command Menu

The User Interface's Main Command Menu is shown below:

- SLICE USER INTERFACE - Version 2.10

Current Object: test Database File Name: test.stl

Extra Parameters: -aries -x Alter - Alter standard options Extra - Set extra parameters

Load - Load a different object's options Save - Save current object's options Write - Save current option's under different object name Copy - Copy another object's options into current object DoSlice - Do slicing with current options Quit - Exit UI (Use SAVE to save options first) Which Command?

The UI commands behave as follows:

SUBSTITUTE SHEET

-82.114-

Alter - Go to the Options Menu so that the Slice Options can be changed.

Extra - Go to the Extra Parameters Screen so that non-standard Slice options can be specified.

Load - Loads a different set of options into UI. The previous objects options (if any) are not automatically saved. Using Load is equivalent to quitting UI and rerunning it with the new object's name. Save - Saves the current option data into the current object file. Stays in the main menu. Write - Same as Save, but allows you to specify a different file in which to store the option data. The new name becomes your current object file name.

Copy - Copies the options of a different object into the current object's options. The Copy command saves having to reenter options where options for a new object are being defined but the options are similar to those for some past object. By Copying those old options in and making minor adjustments, you are off and running SLICE quickly.

DoSlice - Go Do Slicing with the current options. DoSlice allows you to specify what version of Slice you wish to use.

Quit - quits UI. Does not Save. Returns to back to the Unix or Xenix command level.

3.5.3 UI Alter Options Menu All the numbered options in the UI program are parameters to the SLICE program. All the lettered options are used for UI control. Most of the SLICE options are self- explanatory.

SUBSTITUTE SHEET

-82.115-

- SLICE USER INTERFACE - Version 2.10 Current Object: test Option Description Value

(1) DATABASE File Name test.stl

(2) Scale l.ooo

(3) Z Spacing 10.000

Fixed

(4) X hatch spacing 0

(5) Y hatch spacing 0

(6) 60/120 degree hatch spacing 0

(7) X Skin fill for near flat surfaces 0

(8) Y Skin fill for near flat surfaces 0

(9) Minimum Surface Angle for scanned 0 facets

(10) Minimum Hatch Intersect Angle

(11) Segment Output File Name test. li

(12) Centering Off

(Q) Quit, return to Main Menu Alter which Option?-

(I) DATABASE File name sets the name of the file that contains the three-dimensional CAD database for the object. An extension of ".stl" is assumed.

(II) Segment Output File Name is the name of the file that SLICE will output to. An extension of ".sli" is assumed. (3) Z Spacing is one of two types. Variable or Fixed. Fixed is where just one value for all spacing, while Variable allows many. When Fixed is selected, UI just asks for the one Z spacing value. When Variable is selected, UI displays a new screen and allows you to edit the Variable Z-Spacing Table. While adding and deleting values to and from the variable Z- spacing table, you will use the following commands:

SUBSTITUTE SHEST

-S2 . U6-

A level setting Add new level and spacing value to table D level Delete level from table

S Save table, return to main menu Q Quit, return to main menu, don't save table H print a Help message similar to this

A adds a new level and spacing value. Both of these numbers will be multiplied by scale as they are sent out to SLICE. In other words, they are in the original CAD units — inches, feet, whatever. Also, the indicated spacing begins at the indicated level. The first entry goes from that level to just before the level indicated by the second entry, and so on. The new spacing and hence the new dip depth will be used after the vectors for the indicated layer are drawn.

D deletes a level. S saves the table and returns you back to UI's main menu. Q skips the save, just returning you to the main menu. Any entries you made will be lost. H prints out a convenient help message.

If after you create a Variable Z-spacing table, you go back to Fixed spacing, then return to Variable spacing, the original Z- Spacing Table is restored. The Save command in the Variable Z-spacing section does not save the table to disk. You must also use the Save or Write command in the main menu to make any changes permanent.

3.5.4 UI Extra Parameters Screen

Supplying Extra Parameters is a convenient way for us to support non-standard Slice commands without having to create confusing menus. You may never need to enter any extra parameters. This is a just-in-case feature. Below is a copy of the Extra Parameters screen:

SUBSTITUTE SHEET

-82 . 117-

Extra Parameters allows you to specify non-standard slice options for inclusion in the slice command line. What parameters are valid is based on the version of Slice you will use.

The following parameters have been known to exist:

-x part's height is in the x-axis

-y part's height is in the y-axis

-aries use the non-standard Aries CAD System input file format

Current Extra Parameters are:

-aries -x

Enter new Extra Parameters or just press Enter to keep old:

4.0 The Parser

The Parser takes sliced files and prepares them for the Supervisor. PARSE*s name comes from the fact that it parses out the slice block identifiers and stores them is a special layer control file. This file you can later edit to fine tune the part-making process. PARSE also combines multiple slice files together, such as a part and an appropriate base, and generates just one large vector file for the Supervisor.

4.1 The FTP File-Transfer Program

You can use the FTP File Transfer Program to move a sliced file over from the Slice Computer to the Process Computer. Go to the XFER program by selecting item 1 in the Main Menu. There, select item 2, for FTP. FTP will prompt you for the Remote User Name. Type in the name of your user account. Then it will prompt you for your password. Type than it. If FTP can sign onto the Slice Computer, I will display the prompt: FTP>

SUBSTIT

-82.118-

At this point, there are a variety of commands you can use. We will focus on just five of them here — mdir, ldir, get, put, and bye.

You " can use 'mdir' to get a directory listing of the Slice Computer, and 'ldir' to get a directory listing of the

Process Computer.

Use 'mdir' to see the contents of your Slice Computer directory. Is the file you want to send over there? If it is, make sure you are going to store it in the right place on the Process Computer by using 'ldir'.

If everything looks right, use 'get' to move over the file: get <filename> where <filename> is the name of the file you want to copy over. The original file on the Slice Computer will not be disturbed. Use 'ldir' again to make sure the file came over.

In a similar manner, you can use 'put' to copy a file from the Process Computer over to the Slice Computer. That's it. Use 'bye' to end FTP. FTP will sign-on the

Slice Computer and return you back to the Process

Computer's main menu.

4.2 Operating The Parser

When PARSE is brought up, it display the following heading:

PARSE, Slice Files Combine and Parse Program 3D Systems Laser Stereolithography System Version 2.30 by 3D Systems October 1987

Slice File Names:-

At this point, type in all the names of the SLICE files

(no more than 10 at a time) , separated by spaces, to combine into a single part. The output files generated will be used by SUPER, the Supervisor, to build a part on the stereolithography apparatus.

-82 . 119-

After pressing Enter, PARSE will prompt with:

Output File Name: Here, just give the prefix; do not add any extensions (like *.DAT). PARSE will make two output files <part>.L and <part>.P, where <part> is the name you input here. <part>.L will be a short file contain layer information, and <part>.P will be the combined vector file of all the SLICE input files.

Then, PARSE will ask for three numbers: Slice scale factor?_

Slice -zs layer spacing?_

Layer thickness in mm (20 mil = 0.508mm)? _ In the near future, PARSE will obtain this information directly from SLICE, but for now, you have to repeat it. Please do not delight too much in being able to "fudge" the part by inputting different numbers from what SLICE was told as this capability will soon vanish. PARSE will pass this information along to SUPER. PARSE then begins it run: Starting parsing ... Hit Ctrl-Break to abort. 7800: LI LB1 LHl NFDB1 NFDH1 FDF1 NFDF1 L2 LB2 7810: LI LB1 LHl L2 LB2 NFUB2 NFUF2 FUF2

• • •• ••

If you press Ctrl-Break at any point before PARSE has finished, you will abort the parse procedure. Incomplete

<part>.L and <part>.P files will be left on your disk so that you can look at the intermediate results. If you don't want these files, delete them to conserve disk space. The '7800', '7810' numbers shown above are references to the L blocks being read in from the SLI file. The number itself is from after the line in the SLI file that begins with an L. The letter-number combinations that follow show the block-type and input file number that PARSE is currently working on —NFUB2 means that PARSE is working on the Near-Flat Up Facing Skin Border for the indicated layer from the second input file.

TESHEET

-82 .120-

When PARSE is done, it returns control back to Menu program, at which point you can either edit its files or run the Supervisor.

PARSE maintains increasing layer numbers. It will automatically resolve the condition where the input files may start and stop on different layers by juggling the input from the various input files. PARSE can handle up to 10 input files per run. For a given input file name in the 'Slice File Names' prompt, one can add one or more of the following options: /Z<offset> - offset Z-layer numbers

/N<set of ZXYISAB HVCFGKCD> - no, don't use blocks indicated /0<set of ZXYISABJHVCFGKCD> - only use blocks indicated

/Z allows you to offset the Z-layer values for that input file. This is useful when you need to align two previously non-aligned CAD objects such as posts and the major part. /Z-100 will reduce the apparent Z-layer values for that file by 100. The actual physical shift is related to the SLICE scale factor.

/N and /O allow you to select which blocks to exclude or include, respectively. /N LH,NFDH will eliminate all section cross hatching, and /O LB,NFDB,NFUB will only allow the border blocks through. "N" stands for "No" and "O" stands for "Only". By the way, it isn't wise to use both /N and /O together since they are mutually exclusive. No matter what you type, PARSE will always include the L-block.

4.3 The Parser's Options

PARSE accepts a command line whose format mimics the input queries discussed above. This allows PARSE to be run from a *.BAT batch file without user intervention. The format is: PARSE <filel> <file2> /OUTFILE<output file prefix>

/SCALE<scale>/ZSPC<Z-spacing>/THICK><th ickness

UTE SHEET

-82 . 121-

/OUTFILE specifies the output file prefix, /SCALE and /ZSPC the SLICE scale and Z-layer spacing, and /THICK the layer thickness. You cannot use these options from the Menu program. As indicated before, specifying the scale, Z-spacing, and the thickness is temporary and will soon be eliminated. If the Command Line is incomplete, PARSE will prompt for the missing information.

4.4 Critical Areas PARSE supports critical areas, where the Supervisor can be instructed to perform or not to perform something within the confines of a box. For a given part with a file name prefix of :part>, PARSE attempts to read the <part>.BOX file. If it doesn't see the file, it simply prints out a warning message and continues. Otherwise, it reads in the file and analyzes it while parsing. Two types of critical areas are supported: Cross-Hatching with Rivets (XV) and Ignore Cross-Hatching (XI) . That is, all the cross-hatch vectors within the critical area confines will either become rivets (multi-pass draws for strength) or be ignored.

See Section 7.4 for the format of the *.BOX file. See Section 5.5 for a discussion on rivets.

5.0 The Supervisor The Supervisor supervises the part-making process. It reads the vectors from a file, sending them to the laser controller, modifying them according to the layer control file.

The Supervisor runs for as long as it takes to make a part. It sends the packets of vectors to the STEREO driver, and it controls the Z-Stage, moving it down and back up for a dip after each layer.

The Supervisor reads three files. SUPER.PRM contains the default laser controller parameters for each block. The <filename>.L part layer control file contains your

SUBSTITUTE SHEET

.ri 2. 122 — override laser controller parameters. The <filename>.P part file contains all the vectors from all the files combined together by the Parser.

The-Supervisor knows about each type of block and which number PARSE File it came from. For any block from any file, you can tell the Supervisor to alter certain laser controller parameters such as step size, and step period.

5.1 The Steps To Take Before Running the Supervisor Run the Beam Profiler and the GetSP programs if necessary. Adjust the Z-Stage using the Z-Stage Controller program. (More)

5.1.1 Getting the Step Periods

You should run the GETSP program each time you use a new material or after you have run the Beam Profiler. GETSP will ask you for the desired line height (in mils) and make an estimate of what Step Period you should use for your next part.

GETSP will ask you if it should update the SUPER.PRM Default Parameters File for you. If you answer 'y', then the next part will be made with the calculated step period. You can still override the new step period in the *.L Layer Control File for certain block if you desire.

5.1.2 Editing the Supervisor's Default Parameters File Here's an example of the new SUPER.PRM file:

Supervisor Parameter File Version 2.21

last altered: 9/28/87 reason: to test new SUPER Default Option line in this file

Default SUPER Options

SUBSTITUTE SHEET

-82.123- place options together inside of quotes; use " " if no options /NEG2 required for some prototype units

/NEG2"

General Parameters

800 Elevator board base address 50 Elevator pitch par , 100 for alphas, 50 for betas

1.0 XY-only scale factor; does not affect Z-axis 0 X-coordinate offset 0 Y-coordinate offset 750 Max number of vectors to send to Stereo

- Block defaults -

Each time the Supervisor starts a block, the respective default string below is sent to the Stereo driver. Z,X... are the block types (Z-Boundary, X-Cross-Hatch, etc.) and they are followed by the parse input file number (e.g. 1 may be for post vectors and 2 for object vectors) Although only defaults for 2 Slice files are set for here, up to 10 files are supported.

#TOP,"BX 8500;BY 34300" ! laser beam begin (home) position

LB1,"RD l;RS 300;RC 1; redraw delay, size, count SP 25; step period JP 0; jump delay

SS 2" step size

NFDB1,"RP l;RS 300;RC 1;SP 25;JD 0;SS 2" LH1,"RC l;SP 25;JD 0;SS 2;

VC 5; 1 rivet count VR 99; ! rivet reduction amount

VP 11 ,12,13,14,15" ! rivet step periods

SUBSTITUTESHEET

-82 . 124-

NFDH1,"RC 1;SP 25;JD 0; SS 2;VC 5;VR 99;VP 11,12,13,14,15" FDF1,"RC l;SP 25;JD 0;SS 16" NFDF1, RC 1:SP 25;JD 0;SS 16" NFUF1,"RC 1:SP 50;JD 0;SS 16" FUF1,"RC 1;SP 10;JD 0;SS 16"

LB2,"RD l;RS 300;RC 1;SP 25;JD 0;SS 2"

NFDB2, RD 1;RS 300;RC ljSP 25;JD 0:SS 2"

LH2,"RC 1;SP 25;JD 0;SS 2;VC 5;VR 99;VP 11,12,13,14,15"

NFDH2, "RC l;SP 25,*JD 0; SS 2;VC 5;VR 99;VP 11,12,13,14,15"

FDF2,"RC 1;SP 25;JP 0;SS 16" NFDF2, RC l;SP 25;JD 0;SS 16" NFUF2, RC l;SP 50;JD 0;SS 16" FUF2, "RC 1;SP 10;JD 0;SS 16" #BTM,"ZW 10; ! Z-axis wait time in seconds

ZD 5; ! Z-axis dip depth in mm

ZV 0.8; ! Z-axis velocity parameter

ZA 0.1" ! Z-axis acceleration parameter

Blank lines and lines starting with 1 are ignored. Text after a ! is also ignored. The first few lines contain fixed Supervisor parameters that can only be affected by changing the numbers here. The rest of the file contains the " default settings for the various blocks. The LI line contains the default laser control commands sent to STEREO laser driver whenever a L block from (PARSE input) file is encountered.

These default command strings are by no-means fixed. Feel free to change them any way you like, even just to experi¬ ment. You can even eliminate all the defaults if they confuse you and start defining them over again.

5.1.3 Editing the Layer Control File To edit a-file, select item 5 from the Main Menu and tell the Editor what file you want to edit. Layer Control Files always have a ".L" extension. The *.L file (* means any set of file name characters) can contain overrides for any block. Say that we have a FDF1

-S2 . I25-

(Flat Down-Skin Fill from file 1) block. The Supervisor first sends the FDF1 line from its SUPER.PRM file to STEREO:

RC 1;SP 25;JD 0;SS 2 Then, the FDF1 override line from the *.L is sent to STEREO:

SP 10;JD 10 Because the later commands override the earlier ones, the combined effect is: RC1;SS 2;SP 10;JD 10

NFDF1,"RC l;SP 25;JD 0;SS 16" NFUF1,"RC 1;SP 50;JD 0;SS 16" FUF1,"RC l;SP 10;JD 0;SS 16" LB2,"RD 1;RS 300;RC 1;SP 25;JD 0;SS 2" NFDB2,"RD 1;RS 300;RC 1:SP 25;JD 0;SS 2"

LH2,"RC 1;SP 25;JD 0;SS 2;VC 5;VR 99;VP 11,12,13,14,15" NFDH2,"RC 1;SP 25;JD 0; SS 2;VC 5;VR 99;VP 11,12,13,14,15" FDF2, RC l;SP 25;JD 0:SS 16" NFDF2,"RC l;SP 25;JD 0;SS 16" NFUF2,"RC 1;SP 50;JD 0;SS 16" FUF2,"RC l;SP 10;JP 0;SS 16"

#BTM,"ZW 10; ! Z-axis wait time in seconds ZD 5; ! Z-axis dip depth in mm ZV 0.8; ! Z-axis velocity parameter ZA 0.1" ! Z-axis acceleration parameter

Blank lines and lines starting with ! are ignored. Text after a ! is also ignored. The first few lines contain fixed Supervisor parameters that can only be affected by changing the numbers here. The rest of the file contains the default settings for the various blocks.

The LI line contains the default laser control commands sent to STEREO laser driver whenever a L block from (PARSE input) file 1 is encountered. These default command strings are by no-means fixed. Feel free to change them any way you like, even just to experi¬ ment. You can even eliminate all the defaults if they confuse you and start defining them over again.

SUBSTITUTE SHEET

-82 .126-

5.1.3 Editing the Layer Control File

To edit a file,, select item 5 from the Main Menu and tell the " -Editor what file you want to edit. Layer Control

Files always have a ".L" extension. 5 The *.L file (* means any set of file name characters) can contain overrides for any block. Say that we have a FDF1

(Flat Down-Skin Fill from file 1) block. The Supervisor first sends the FDF1 line from its SUPER.PRM file to

STEREO: 10 RC 1;SP 25;JD 0:SS 2

Then, the FDF1 override line from the *.L is sent to

STEREO:

SP 10;JD 10

Because the later commands override the earlier ones, the 15. combined effect is:

RCl;SS 2;SP 10:JD 10

SUPER gives you two levels of control, one in SUPER.PRM, and one in the part's control file. You may want to make special directories for different classes of parts that 20 use different SUPER.PRM files.

NOTE: Future releases of the Supervisor may require alterations to the SUPER.PRM files. Whenever possible, a

SUPER.PRM convert file will be supplied.

We recommend modifying only the *.L Layer Control files 25 and leaving the *.P vector files alone. Use the PARSE /Z,

/N and /O options to shift layers and exclude certain blocks.

Since both PARSE and SUPER ignore lines that begin with an exclamation point, you can insert comments in the data 30 files:

! temporarily reduce step period to test material XQ45 7800,FUF1,"SP5"

-32 . 127

5.2 Operating the Supervisor

SUPER is the name of the Version 2 Part-Making Supervisor.

Version l's Supervisor was called SUPV and should no longer be used.

When SUPER is brought up, it displays the title:

SUPER, Part Making Supervisor

3D Systems Laser stereolithography System

Version 2.30 by 3D Systems October 1987

Part Prefix: - Enter the prefix of the part's file name. SUPER will automatically assume the Layer Control File is the prefix plus ".L" and the vector file is the prefix plus ".P" SUPER runs much like PARSE in that it display the current Z-layer number and the block name as it runs:

7800: LI LB1 LHl NFDB1 NFDH1 FDF1 NFDF1 L2 LB2 Waiting... Dipping... Relaxing...0 7810: LI LB1 LHl L2 LB2 NFUB2 NFUF2 FUF2 Waiting... Dipping... Relaxing...19

• • •• ••

SUPER tells you when its waiting for the laser controller to idle, when its dipping the elevator, and when its relaxing (delaying) . The time to the next layer is displayed after "Relaxing". Z-stage control

Through the Layer Control File (*.L) and its own SUPER.PRM file, SUPER allows the Stereolithographer to pass along commands to STEREO to control such items as laser beam home position, draw speeds and step size. SUPER has the most flexibility because it doesn't look at the STEREO commands. It just passes the "strings" along to STEREO at the appropriate time. That control over the XY-laser motion has now been extended to the Z-stage. Four new commands have been added that allow the Stereolithography to vary various Z-stage parameters:

SUBSTITUTESHEET

ZW delay set the Z-stage wait time (after dipping) ZD depth set the Z-stage dip depth (in mm) ZV velocity set the Z-stage velocity parameter ZA accel set the Z-stage acceleration parameter These commands can be intermixed with STEREO commands in any way, as in:

1800,FUF,"SP 10,10;RC 2;ZW 10;ZD 5;RV 250" This Control Layer File entry sets a new Z-stage wait time and dip depth in the midst of setting new Redraw parameters. The SP and RC commands are passed to STEREO, SUPER analyzes itself the ZW and ZD commands, then the RV command is passed to STEREO. Note that quotes are still required around the whole command string.

5.3 The Supervisor's Options

Like PARSE, SUPER has run-time options that can be appended to the part file name: /S - show stuff /LOFF - laser off /ZOFF - Z-table off

Running SUPER with the /S option will show all the commands SUPER sends to both the Laser Controller (STEREO) and the Z-Table Controller. /LOFF suppresses laser control and /ZOFF suppresses Z-table elevator control. Neither /LOFF or /ZOFF affects the output of commands caused by /S. /LOFF and /ZOFF should be used when running the Supervisor without the appropriate control boards installed in the computer. Negative Z-stage control has also been added to SUPER. "Negative Z-Stage" refers to when the Z-stage works backwards from the default. All the old Beta will require Negative Z-stage control, since positive Z-stage control is defined as proper operation for the new Production Betas. Following "SUPER" or the input file name with "/NEGZ" will cause the Supervisor the use Negative Z-stage control.

.01 1 Q —

Two more Z-stage related options have been added to SUPER. /START defines at what layer to begin processing, and /STOP - defines at what layer to end processing. SUPER will skid past all the beginning layers to the one indi- cated by /START and end processing just after the layer indicated by /STOP. The layer numbers that follow /START and /STOP are the internal SLICE Z- layer numbers. The following set of options will cause the Supervisor to only process layers 1200 to 1450: box0035/START 1200/STOP 1450

The following set of options will cause the Supervisor to start processing layers beginning at 2000:

SUPER box0038/START 2000 The spaces after /START and /STOP are not necessary, nor is the case of the letters significant.

5.4 The Supervisor's Keyboard Commands

While the Supervisor is relaxing and counting down the wait period, you can now take one of four actions.

1. You can wait for the wait period to expire, at which point SUPER will begin processing the next layer.

2. You can press P to pause. When the wait period expires, SUPER will wait for a keystroke before continu¬ ing. The countdown continues, but the time left is followed by "-P". You can press P again to cancel the pause.

3. You can press C to continue. The rest of the current wait period is skipped, and SUPER begins processing the next layer immediately.

4. You can press S to skip. SUPER aborts the current wait period and asks you what layer you which to skip to.

Enter the internal Z layer number and press Enter. SUPER will scan .for and resume processing on that layer. If it doesn't find that layer, SUPER will end.

SUBSTITUTE SHEET

-tt-i .1JU-

5.5 Using Rivets

The laser controller supports the "rivets", where the middle section -of certain vectors are redrawn to help strengthen the plastic part being made. Rivets are a special implementation utilizing the laser controller's redraw mode. Rivets work as follows:

The redraw pass count is set to 1 using the RC command. The number of redraw passes for the rivets is set with the VC command, and the rivet reduction amount (the amount to chop off of both ends of the rivet vector) is set with the VR command. Then the various step periods for the passes are set using the SP command. The STEREO Driver processes JX,JY and NX,NY commands as before. (Section 6.3 discusses the STEREO Command Set.) When it encounters a VX,VY sequence, it constructs a rivet on this vector. Internally, this works as follows: 1. STEREO sets the step periods to the VPO (riVet Period #0) value. 2. STEREO sets up the full vector to be drawn.

3. STEREO sets the redraw pass count to the VC value, the multi-pass step period to VP1, VP2, etc. , then sets the reduced vector to be drawn and redrawn.

4. ' STEREO then restores the original redraw count and the ordinary step periods.

5. STEREO continues processing...

The most consistent laser motion occurs with the standard redraw pass count set to 1. The standard redraw mode could be on while rivets are being processed; the standard redraw pass count could be, say, 2, while the rivet redraw pass count could be, say, 6. However, the rivet redraw will truncate the distance of redraw sections just before the rivet, and that may have an effect on rivet performance. Rivet Implementation

Several STEREO commands support rivets. These commands all begin with 'V (not 'R', as - it is already used for

SHEET

-82 . 131-

"Redraw") . The code that is responsible for "making rivets" uses a combination of vector moves, jumps, and vector redraws.

VC 1-10 riVet pass Count (# passes) VP 5-6553,, rivet step Periods (10 us) VR 0-65535 riVet Reduction amount (distance) VX 0-65535 rivet end X position (position) VY 0-65535 riVet end Y position (position) where: 1100 uuss is the # of 10s of microseconds resolution = 0.84 us (from 1.19 MHz clock) position is the absolute position in the field distance is the absolute distance in step size units

# passes is the number of redraw passes Like the SP command, the VP command has multiple arguments. Each of up to ten passes of rivet redraw can have its own step period. The VP command can have 1 to 10 arguments, each a step period for a pass: VP vp0,vpl,vp2,vp3... where vpO is the step period for rivet redraw pass 0 (the full vector draw) , vpl is the step period for redraw pass 1 (the first pass of the rivet) , and so on. The VP command is stuffed into - the Background Command Queue FOR EACH RIVET, so try to limit the number of rivet redraw passes.

6.0 Other Programs

This chapter discusses some ancillary programs that you may never use. We feel that we should document them anyway just-in-case.

FRONT, CLIFF, and STEREO are documented in this chapter.

FRONT is a FRONT end interface to the low-level laser controller, CLIFF is a program that reads STEREO commands from either the keyboard or a file and sends them to

STEREO. STEREO is the Stereolithography Device Driver

SUBSTITUTESHEET

-82 . 132- mentioned many times before; its full command set is documented here.

6.1 " FRONT, Simple Front End to Laser Controller FRONT is primarily a debugging tool used in developing the low-level laser controller.

To run FRONT, just type "FRONT" at a DOS prompt. FRONT doesn't care if the laser controller has been loaded or not.

FRONT displays a menu screen that looks like this: 3D Systems Laser Controller Simple Front End

Version 2.30 by Tarnz Technologies October, 1987 A. Laser Installed Check 50. Get Software

Interrupt Number

0. Open Laser Channel 51. Get Background Interval Time

1. Close Laser Channel 52. Get Laser Control

Word 20. Add Vector to Command 61. Set Background Queue Interval Time 21. Add Open Shutter Command 62. Set Laser Control

Word

22. Add Close Shutter Command 70. Execute

23. Add Change Time Base Cmmnd 71. Execute and Clear

24. Add Pause Command 72. Clear 3. Reset Command Queue X. Exit

4. Get Command Queue Size For the most part, FRONT is self-explanatory. You simply enter the number of the option that interests you at the "FR0NT>" prompt and press Enter. FRONT will then ask you for any arguments the option might have. In the case of status options, FRONT will print out the status in a suitable format. If any errors are returned by the low- level laser controller, FRONT will print them out.

SUBSTITUTESHEET

-82 . 133-

6.2 CLIFF, Control Laser Instrument From File CLIFF stands for "Control Laser Instrument From File" and that is exactly what it does. It reads commands from a text file or optionally from the keyboard and sends them to STEREO Driver.

3D Systems personnel have found it useful to write simple BASIC programs and use CLIFF from the middle of them using the SHELL statement. Their approach to developing laser controlling programs is similar to this procedure: l. Understand what it is to be accomplished

2. Develop the Basic algorithms and write the code, temporarily displaying intermediate results to the screen for debugging purposes

3. Make a text file filled with STEREO commands 4. Invoke CLIFF by using Basic's SHELL statement

5. See if an error was generated - if the file CLIFF.ERR exists, it contains the error description

6. Dip object being built and process next layer Somewhere in the BASIC program, the Basic statement

SHELL "CLIFF <data file with commands>/T/W" can be found. This is the statement that temporarily suspends execution of the Basic program, executes the string as though it were an MSDOS command, then returns control back to the Basic program at the next statement. Ordinarily when CLIFF is run, it will display a title, identifying itself and informing you about its version number. The /T option makes CLIFF transparent and forces CLIFF to not output anything to the video screen. This allows the controlling Basic program to assume complete control over the screen.

Ordinarily, CLIFF will end when it translate the last command from the data file. The /W option forces CLIFF, after reading and translating the commands in the text file, to wait until the background task idles before quitting and returning to the BASIC program. The DOS command line syntax for CLIFF is:

BSTITUTE SHEET

CLIFF <datafile>/options where <datafile> is the name of the data file containing the laser control information, and /options are any number of user-selectable options: /S - show laser control information /W - wait for laser idle at end /T - transparency mode (no CLIFF text) CLIFF can perform the wait-for-idle function (/W option) without having any data file or commands to execute. CLIFF /W and CLIFF /W/T (transparent) will make CLIFF wait for the background task to idle.

<datafile> can be replaced by a sequence of direct commands by preceding the commands with a ' , ", or § character. A semicolon can be used to separate commands. As many commands as will fit on one line can be specified. In the following example, the block mode is turned on and the laser beam moved:

CLIFF 'MD BL +; JX 1000; JY 2000; NX 4000; NY 5000; EC If CLIFF is called up with no arguments, it will prompt with

Enter file name_: at which point the operator should enter the name of the data file.containing CLIFF-compatible commands. Direct commands can be entered here if preceded by a special character as described above.

When CLIFF is executed, it erases the CLIFF.ERR file in the currently directory if it exists. Any errors encountered during the processing of the data file will be stored in the CLIFF.ERR file as well as displayed on the screen. This feature allows for the operator to review more that a screen full of error messages, and it allows programs that called CLIFF to see what errors occurred. CLIFF reads a file, line by line, and sends the output to the STEREO device driver. Any errors indicated by STEREO are reported.

TITUTESHEET

-82 . 135-

6.3 The Stereolithography Device Driver

STEREO is a memory-resident driver specially designed for

Stereolithography. Its command set is intended to be somewhat compatible with General Scanning's PG Series

Electronic Packages for Laser Control.

STEREO installs itself in the computer's memory when the

Process Computer powers up and stays there. Any program can come along and call on STEREO to provide laser controller services.

6.3.1 STEREO Commands

STEREO understands the following commands:

BX 0-65535 Beginning X position (position)

BY 0-65535 Beginning Y position (position)

JX 0-65535 Jump to new X position (position) Y 0-65535 Jump to new Y position (position)

NX 0-65535 Next X position (position)

NY 0-65535 Next Y position (position)

SS 1-65535 Step Size (rel incr)

SP 5-6553,.. multi-pass Step Periods (10 us)

SD 0-65535 Scanning Delay ( s t e periods)

JS 1-65535 Jump Size (rel incr)

JD 0-65535 Jump Delay ( s t e periods)

LO 0-65535 Laser On delay (10 us)

LF 0-65535 Laser Off delay (10 us)

NS eNter Sequence mode -

AB Enter Absolute mode -

EX Execute -

EC Execute and Clear -

CL Clear table -

MD AS -/+ set Auto-Shutter mode (off/on)

MD BL -/+ set BLock mode (off/on)

MD PA -/+ set Pos Ack mode (off/on)

SR Soft Reset

SUBSTITUTE SHEET

-82.136-

HR Hard Reset

RC 1-10 Redraw pass Count (# passes)

RD 0-65535 Redraw Delay ( s t e periods)

RS 0-65535 Redraw Size (distance) VC 1-10 riVet pass Count (# passes) VP 5-6553,. riVet step Periods (10 us) VR 0-65535 riVet Reduction amount (distance) VX 0-65535 riVet end X position (position) VY 0-65535 riVet end Y position (position) WI 0-32767 Wait for Idle (delay) where:

10 us is the # of 10s of microseconds resolution = 0.84 us (from 1.19 MHz clock) position is the absolute position in the field range in 0 to 65535 distance is the absolute distance in step size units rel incr is the relative # of position increments # passes is the number of redraw passes step periods is the time to cover that # of steps programmed by SP command tick counts) delay delay value in milliseconds (may be faster on faster computers) In the above list, following each two-character command is the range of numbers allowed as arguments to the command. All numbers are in unsigned decimal. BX and BY set the laser beam's home position. This is the position in the field that the laser beam will be place at when there is no part-making activity.

JX and JY move the laser beam to a new location quickly. No polymerization takes place.

The Jump is conditioned by JS and LD. JS defines the Jump Size, the number of field units to jump at one time. This is usually a large number, like 10000. JD sets the number of step period delays once the jump movement have been completed. This lets the mechanical mirrors settle.

-82 . 137-

NX and NY move the laser beam to a new location slowly.

Polymerization does take place.

The slow laser beam movement is controlled by SS, SP, and

SD. SP defines the Step Period, the time for each discrete laser step. SS defines the Step Size, the number of units in the field to move each step period. SD is the delay once the laser beam reaches its destination.

LO and LF set the Laser On and Laser Off delays going into and out of the idle mode. These are delays for the homing and unhomeing of the laser beam.

NS and AB are accepted but not acted upon. They are provided simply for General Scanning compatibility.

On the SLA-1, we usually use MD AS -, MD BL +, and MD PA

MD BL + turns on the block mode, where laser con- troller commands are queue up and then let go with the -EX or EC command. This technique prevents unnecessary idle times.

EX causes then lase set of commands to be executed.

Another EX will cause the same set of commands to be executed again. EC executes, but then clears out the commands. CL clears out the command without executing.

With the block mode on, nNo commands will be interpreted unless EX or EC is used.

SR and HR reset the low-level laser controller. HR is the most useful since it stops all current activity and empties out all the previous commands. HR can be used at the beginning of programs.

RC, RD, and RS control the Redraw parameters. Redraw is where the laser controller makes multiple passes over the same vectors. RC defines the pass count, RD the delay before starting a pass, and RS the size of the redraw.

Every RS potion of the vectors will be redrawn if RC is greater than 1.

VC, VP, VR, VX, and VY control the Rivet feature. Discussed in more detail in Section 5.5, rivets are where the interiors of a vectors are redrawn. VC defines the number of redraw passes, VP the multiple step periods, one

SUBSTITUTE SHEET

-82.138- for each pass, and VR the amount to chop off of both end of the vector. Zero and negative length vectors are not redrawn. To tell STEREO a vector is a rivet, use VX and

VY instead of NX and NY. WI waits for idle. WI's parameter is some delay so that the low- level laser controller will have time to synchronize with STEREO. Typically, WI 1000 will work just fine.

The SP (and VP) command has multiple arguments. Each of up to ten passes of redraw can have its own step period.

The SP command can have 1 to 10 arguments, each a step period for a pass:

SP sp0,spl,spi,sp3... where spO is the step period for redraw pass 0 (the original vector move) , spl is the step period for redraw pass 1, and so on.

The command line with invokes STEREO and causes it to be installed in memory takes the form: STEREO [/options] where /options are any number of user-selectable options: /NV - no constant vector velocity /NG - no geometric correction /NC - no version check at install time

STEREO can only be installed once after the computer has been powered up. If different options are required, the computer system will have to be completely rebooted.

Geometric correction is automatically invoked. If geometric correction is not desired, the option /NG should be specified in the command line. Geometric correction occurs on the endpoints of any vector STEREO passes to the low-level laser controller.

6.3.2 STEREO Options

LASER and STEREO are installed automatically when the

Process Computer starts up. LASER contains the low-level laser controller and has no options. STEREO, on the other hand, has options. For the most part, these options are

-82 . 139- of little interest, but are documented for the sake of completeness.

Axes Control

Because we have SLA units with axes going in different directions, we installed Axes Control into the STEREO driver. When STEREO is brought up, either by the user typing or from an AUTOEXEC.BAT file, the following options can be use to set the axes:

/X+ X-axis is positive. This is the current default.

/X- X-axis is negative. Using this flips the direction of the X-axis. /Y+ Y-axis is positive. This is the current default. /Y- Y-axis is negative. Using this flips the direction of the Y-axis. /SWAPXY swaps the X and Y coordinates BEFORE any other axis or geometric correction operation. Swapping is not ordinarily done.

Here's a sample DOS command line that installs STEREO with the X-axis direction changed. Note that STEREO must not have already been installed.

STEREO/X_ STEREO reports to you the axes orientation it is going to use when it installs itself. Check this and make sure you got what you asked for.

Geometric Correction

Geometric Correction has been installed in STEREO. Geometric Correction now not only corrects for the pincushion distortion, but also for the imprecisions of each individual SLA unit.

We call the current correction technique Table- Interpolation Geometric Correction because the correction is done after performing look-ups in a special table.

SUBSTITUTE SHEET

-32.140-

This table maps the linear XY coordinate system in a distorted one. that ends up cancelling the real SLA unit's distortion. The look-up table is stored in a file generated by CALIB, the SLA machine calibration program. STEREO'S /NG option will cancel Geometric Correction.

The look-up table has 65 by 65 entries, one entry for each 1024 steps across the X and Y axes plus the end. Remember each axis has a resolution of 65536 steps. The table is stored in the ASCII file STEREO.GEO (see Section 6.7), which is read when STEREO installs itself. If STEREO can't find STEREO.GEO or if it detects some problem with it, it will display an appropriate message. Each SLA machine will have a different STEREO.GEO based on the results of its calibration. One machine's Geometric Correction will not be the same as that for any other in maintaining the desired mil_accuracy. (The other machine will still run; the parts it makes may seem strange, however.) Think about, recalibrating if you move around STEREO.GEO files.

7.0 File Formats

This chapter describes the various Stereolithography file formats. Of these, the ones you will become the most familiar with are the Layer Control File (*.L) and the SUPER.PRM Default Parameters File.

7.1 SLICE'S Input File (*.STL) Format

A CAD program must be able to produce a file with the specific format described below. Usually this file is quite large is size (several hundred thousand bytes) and is transferred over a high speed data link such as Ethernet to the 386-based Stereolithography Computer. Transfers of smaller-size files using RS-232 and floppy diskettes are also possible but not recommended. The SLICE Input Format loosely follows a graphics standard called PHIGS (Programmers Hierarchical Interactive Graphics Standard), and improves on it in several ways.

-82 . 141-

First, all the numeric data can be compressed into binary form, greatly reducing the size of storage files and reducing the data transfer time to the Stereolithography Computer. Second, support of special part building attributes allow certain features to be "attached" to facets and passed all the way down the pike to the Part-Making Supervisor.

Files being submitted to SLICE should has the extension ".STL", that is, the names of the files should end in ".STL". When SLICE is run and no extension is supplied, SLICE will automatically assumes a ".STL" extension. Older files that has a "DAT" extension in their file name should either be renamed or have their file names speci¬ fied completely in SLICE'S command line (see Section 2.1) . The files can be stored in either ASCII or Binary. We recommend using the ASCII format while developing STL- file-making software and then switching to the binary format for release. Older versions of SLICE, pre-SLICE17 do not support the binary format. An example of an ASCII STL file follows. It defines a simple tetrahedron. solid Solid_Tetra.2 facet normal -1 0 0 outer loop vertex 0 0 0 vertex 0 0 1 vertex 0 1 0 endloop endfacet facet normal 0 - 1 0 outer loop vertex 0 0 0 vertex 1 0 0 vertex 0 1 0 attribute 16 endloop endfacet

SUBSTITUTE SHEET

-82.142 facet normal 0 0 -1 outer loop vertex 0 0 0 vertex 0 1 0 vertex 1 1 0 attribute 16 attribute 9 attribute 22 endloop endfacet

endsolid Solid_Tetra.2 The important structure for an ASCII STL file is its use of words to identify the type of numeric data. The facet normal and vertex information can be in floating point - numbers like 43.332382912 and 1.3045E+3 are acceptable. The vertices should follow the right-hand rule. The normal vector should have a magnitude of 1. We assume a word is 16 bits and is equal to two bytes. The precise format for a Binary STL file is: (top of file) 80 bytes - general information contains part names, comments, etc. 2 words - number of facet records each facet record defines one triangle

First facet record: 6 words - Normal Vector

2 words - i coordinate 2 words - j 2 words - k

18 words - Triangle Vertices 2 words - xl ) 2 words - yl )-first vertex 2 words - zl ) 2 words - x2 )

2 words - y2 )-second vertex 2 words - z2 )

-S2 . 143-

2 words - x3 ) 2 words - y3 )-third vertex 2 words - z3 ) 1 word - Number of Attributes < special attribute formats >

This word should be set to zero

• • • * ••

The STL Binary Format is similar in structure to the ASCII format. One facet record follows another, and each facet record defines a normal, three triangle vertices, and optionally some attributes. Since we don't as yet support attributes, the attribute count word should be set to zero. The binary format for the number of facet records and for each number of attributes is just an unsigned integer. The normal and triangle vertices are in four-byte 8087 real format, with a 3 byte mantissa and a 1 byte exponent.

7.2 SLICE'S Output File (*.SLI) Format

SLICE produces one output file for each input file. By default, each output file has the extension ".SLI". The current format for the output file is as follows:

I

! optional comments

I L <layerl> L-block (mandatory)

LB non-L blocks are only present when

<X1> <Y1> <X2> <Y2> they have vectors

<X1> <Y1> <X2> <Y2>

<X1> <Y1> <X2> <Y2> LB - Layer Border <X1> <Y1> <X2> <Y2>

LH LH Layer Hatch

<X1> <Y1> <X2> <Y2>

NFDB NFDB - Near-Flat Down-skin

Border

SUBSTITUTE SHEET

-82.144-

<X1> <Y1> <X2> <Y2>

NFDH NFDH - Near-Flat Down-skin Hatch

<X1> <Y1> <X2> <Y2>

NFUB NFUB - Near-Flat Up-skin Border

<X1> <Y1> <X2> <Y2>

FDF FUF - Flat Down-skin Fill

<X1> <Y1> <X2> <Y2>

NFDF NFDF - Near-Flat Down-skin Fill

<X1> <Y1> <X2> <Y2>

NFUF NFUF - Near-Flat Up-skin Fill

<X1> <Y1> <X2> <Y2>

FUF FUF - Flat Up-skin Fill

<X1> <Y1> <X2> <Y2>

L <layer2> second Z-layer of file

: : (format repeats) where <X1> <Y1> <X2> <Y2> are the two coordinates of a vector in

X-Y space, four ASCII numbers <X1> <Y1> is the start of the vector <X2> <Y2> is the end of the vector

7.3 The Parser's Output File (*.P and *.L) Format

For a given set of input files, PARSE will produce one *.L file (* represents any set of DOS filename characters) and one *.P file. The *.L file is small and contains layer information, and the *.P file contains the combined vectors.

SHEET

-82.145-

The *.P file is similar in appearance to the original *.SLI files but differs in three ways.

First, the *.P file is the result of combining all the input files together to form a single vector file for the Supervisor. PARSE had juggled the input files so that all the layers are in ascending order - just the way the Supervisor expects them.

Second, if told to do so, PARSE has selectively included or excluded certain types of blocks, so the vectors for the excluded blocks will not appear in the *.P file.

Third, PARSE has tacked on a file and layer identifier to each block header in the *.P file. Whereas the input line was just:

LH PARSE may output to the *.P file:

LH2,7800 indicating that the block came from the second input file and belongs on layer 7800.

The *.P files can get quite long, so editing them might require a editor that can go beyond 64K of characters. Smaller files of course can be easily edited by virtually any editor.

The-*.L files are the most interesting. For each block output to the *.P file, a corresponding single-line entry was made to the *.L file. In addition, a #TOP and a #BTM line-entry wad made for each layer - the #TOP just above and the #BTM just below the layer's other block entries. Here's a sample:

7800: LI LB1 LHl NFDB1 NFDH1 FDF1 NFDF1 L2 LB2 Waiting... Dipping... Relaxing...0

7810: LI LB1 LHl L2 LB2 NFUB2 NFUF2 FUF2 * 1000,50, .508 7800,#TOP 7800,LI 7800,LB1 7800,LHl 7800,NFDB1,"SP 3;RC 1"

SUBSTITUTESHcET

-82.146-

7800,NFDH1

7800,FDF1

7800,NFDF1.

7800,L2 7800,LB2

7800,#BTM

7810,#TOP

7810,LI

7810,LB1 7810,LHl

7810,L2

7810,LB2

7810,NFUB2

7810,NFUF2 7810,FUF2

7810,#BTM

The first line contains the scale, Z-spacing, and layer thickness as told to PARSE. These values are picked up later by the Supervisor.

Note that each line starts with the layer number, followed by the block type. Any line can be followed by:

,"<override commands>" which contains override commands. The override command is the last STEREO command string sent to the STEREO device driver before drawing the block's vectors, and it can override previously set laser control defaults. Line 7800,NFDB1 above contains such a line. PARSE does not ever make any override commands - only the operator can do that. The override feature is discussed in more detail in Section 5.1.

7.4 Critical Area File (*.BOX) Format

Version 2.04 supports critical areas, where the Supervisor can be instructed to perform or not to perform something within the confines of a box. For a given part with a file name prefix of <part>, PARSE attempts to read the

-82 . 147-

<part> BOX file. If it doesn't see the file, it simply prints out a warning message and continues. Otherwise, it reads in the file and analyzes it while parsing. The Format for the *.BOX file is: <type>,<base>,<height>,<xl>,<yl&g t; ,<x2>,<y2>,<x3>,<y3>,<x4 >,<y4>

• • •• •• •• where: <type> is XV' to rivet cross-hatches in the enclosed area or 'XI' to ignore cross-hatches <base> is the base of the box relative to the scale <height> is the height of the box <xl>,<yl> is the first coordinate of the box <x2>,<y2> is the second coordinate <x3>,<y3> is the third coordinate <x4>,<y4> is the fourth coordinate If the CAD image was drawn in mils (lOOOths of inches) and the scale factor is 1000, then:

XV,8.0,0.3,1,1,1,-1,-1,-1-1,1 XI,7.90,0.2,2,2,2,-0.5,-3,-2,-1,3.1 defines two boxes, one 3/10 and one 2/10 inches high. The first box tells where cross-hatching with rivets will occur, and the second box tells where no cross-hatching will occur. All the coordinates are expressed in inches. The current box algorithm supports only lines on the X and Y-axes. Only rectangles can be specified. Don't specify diamonds or near-triangles. If you need to isolate a precise area, use a set of rectangles that nearly approximate it.

7.5 Supervisor Default Parameters File (SUPER.PRM) Format

Blank lines and lines starting with 1 are ignored. The first few lines contain fixed Supervisor -parameters that can only be affected by changing the numbers there. The

SUBSTITUTESHEET

-82.148- rest of the file contains the default settings for the various blocks.

Supervisor Parameter File Version 2.30

last altered: 9/28/87 reason: to test new SUPER Default Option line in this file

Default SUPER Options

place options together inside of quotes; * use " " if no options /NEG2 required for some prototype units

General Parameters

800 Elevator board base address

50 Elevator pitch par , 100 for alphas, 50 for betas

1.0 - XY-only scale factor; does not affect Z-axis

0 X-coordinate offset

0 Y-coordinate offset

750 Max number of vectors to send to Stereo

- Block defaults -

Each time the Supervisor starts a block, the respective default string below is sent to the Stereo driver. Z,X... are the block types (Z-Boundary, X-Cross-Hatch, etc.) and they are followed by the parse input file number (e.g. 1 may be for post vectors and 2 for object vectors) . Although

-82 . 149-

! only defaults for 2 Slice files are set for here, up ! to 10 files are supported.

I

#TOP,"BX 8500;BY 34300" ! laser beam begin (home) position

LB1,"RD 1; RS 300;RC 1: ! redraw delay, size, count SP 25; 1 step period

JD 0; ! jump delay

SS 2" ! step size NFDB1,"RD 1;RS 300;RC 1;SP 25,JD 0;SS 2" LH1,"RC 1;SP 25;JD 0;SS 2;

VC 5; ! rivet count

VR 99; ! rivet reduction amount

VP 11,12,13,14,15" ! rivet step periods NFDH1,"RC 1;SP 25;JD 0; SS 2;VC 5;VR 99;VP 11,12,13,14,15" FDF1,"RC 1,SP 25;JD 0;SS 16" NFDF1,"RC l;SP 50;JD 0;SS 16" NFUF1, » RC 1;SP 10;JD 0;SS 16 FUF1, "RC l;SP 50;JD 0;SS 16" LB2,"RD 1;RS 300;RC 1;SP 25;JD 0;SS 2" NFDB2, » RD 1;RS 300;RC 1;SP 25;JD 0;SS 2" LH2,"RC l;SP 25;JD 0:SS 2;VC 5;VR 99;VP 11,12,13,14,15" NFDH2,"RC l;SP 25;JD 0; SS 2;VC 5;VR 99;VP 11,12,13,14,15" FDF2,"RC 1;SP 25;JD 0;SS 16" NFDF2, W RC l;SP 25;JD 0:SS 16" NFUF2,"RC l;SP 50;JD 0;SS 16" FUF2, M RC l;SP 10;JD 0;SS 16"

#BTM,"ZW 10; ! Z-axis wait time in seconds ZD 5; ! Z-axis dip depth in mm ZV 0.8; ! Z-axis velocity parameter

ZA 0.1" ! Z-axis acceleration parameter

The file lets the STEREO commands be intermixed with the special Supervisor Z-stage commands. Command strings can be broken up into several lines, and comments (beginning with an !) can be at the end of any line.

SUBSTITUTESHSβT

-82.150-

7.6 The STEREO.DEF Driver Default File Format

Below is a copy of the STEREO.DEF file supplied with the system. These -are the default values loaded by STEREO when " it is installed. You may never need to change any of these values in this file. In fact, the Supervisor always resets these parameters using the appropriate lines from the SUPER.PRM and *.L files.

I

J STEREO Device Driver Initial Set-up !

2 [SS] Step Size

1190 [SP] Step Periods

64 [SD] Scan Delay

65535 [JS] Jump Size 100 [JD] Jump Delay

0 [LO] Laser On Delay

0 [LF] Laser Off Delay

1 [RC] Redraw Pass Count 0 [RD] Redraw Delay 200 [RS] Redraw Size

2 [VC] Rivet Pass Count 1190 [VP] Rivet Step Periods 100 [VR] Rivet Reduction Amount

7.7 The STEREO.GEO Geometric Correction File Format The geometric correction look-up table has 65 by 65 entries, one entry for each 1024 steps across the x and Y axes plus the end. Remember each axis has a resolution of

65536 steps. The table is stored in the ASCII file STEREO.GEO in the \3DSYS directory, which is read when STEREO installs itself. If STEREO can't find STEREO.GEO or if it detects some problem with it, it will display an appropriate message. So, the format for the look-up table is as follows:

I ! Comment Lines (optional)

SUBSTIT

-82 . 151-

65,65,2 I 65 by 65 by 2 coordinates 102.34,134.56 ! correction for (0,0) 101.23,123 * 45 ! correction for (0,1024)

• • •• •• 102.41,144.33 ! correction for (0,65536) 98.767,102.22 ! correction for (1024,0) 96.352,100.034 ! correction for (1024,1024)

• • •• ••

Note that even though we are mapping onto an integer- system, the correction table can have floating-pointing numbers. The first non-comment line must contain "65,65,2" as that is the only geometric correction format currently supported by STEREO.

Each SLA machine will have a different STEREO.GEO based on the results of its calibration. One machine's Geometric Correction will not be the same as that for any other in maintaining the desired mil-accuracy. DO NOT COPY STEREO.GEO FILES FROM ONE SLA MACHINE TO ANOTHER.

SUBSTITUTESHEET

-82.152-

Appendix A - SLA-1 Software System Chart Process Computer - - Slice Computer Start-Up Installation MSDOS XENIX

TCP TCP

LASER STEREO

Menu Programs MENU

System Functions CHKDSK SYSAPM

DIR DOS QP2

Slicing Programs

UI

SLICE Part-Making Programs PARSE SUPER GRAPH

Utility Programs POWER GETSP ZSTAGE CALIB PROFILE

Communication-Programs TELNET TELNET

FTP FTP

TUTE SHEET

-β^ . lDJ -

Appendix B - The STEREO Command Set STEREO Command Set is intended to be somewhat compatible with General Scanning's DC Series Electronic Packages for Laser Control. STEREO understands the following commands:

BX 0-65535 Beginning X position (position)

BY 0-65535 Beginning Y position (position)

JX 0-65535 Jump to new X position (position)

JY 0-65535 Jump to new Y position (position)

NX 0-65535 Next X position (position)

NY 0-65535 Next Y position (position)

SS 1-65535 Step Size (rel incr)

SP 5-6553,.. multi-pass Step Periods (10 us)

SD 0-65535 Scanning Delay ( s t e periods)

JS 1-65535 Jump Size (rel incr)

JD 0-65535 Jump Delay ( s t e periods)

LO 0-65535 Laser On delay (10 us)

LF 0-65535 Laser Off delay (10 us)

NS eNter Sequence mode -

AB Enter Absolute mode -

EX Execute -

EC Execute and Clear -

CL Clear table -

MD AS -/+ set Auto-Shutter mode (off/on)

MD BL -/+ set BLock mode (off/on)

MD PA -/+ set Pos Ack mode (off/on)

SR Soft Reset

HR Hard Reset

RC 1-10 Redraw pass Count (# passes)

RD 0-65535 Redraw Delay ( s t e periods)

RS 0-65535 Redraw Size (distance)

VC 1-10 rivet pass Count (# passes)

VP 5-6553, .. riVet step Periods (10 us)

VR 0-65535 riVet Reduction amount (distance)

SUBSTITUTE ET

-82.154-

VX 0-65535 riVet end X position (position) VY 0-65535 riVet end Y position (position) WI 0-32767 Wait for Idle (delay) where:

10 us is the # of 10s of microseconds resolution = 0.84 us (from 1.19 MHz clock) position is the absolute position in the field range in 0 to 65535 ddiissttaannccee is the absolute # distance in step size units rel incr is the relative of position increments # passes is the number of redraw passes step periods is the time to cover that # of steps programmed by SP command(-tick counts) delay delay value in milliseconds (may be faster on faster computers) Section 6.3.1 discusses these commands in more detail.

-O t. . J.O O-

Appendix C - Stereolithography Software Glossary Below, we present a software glossary of terms you may have encountered in this documentation or may hear in the future. Please take a few minutes to review these terms. 80286 - the 16-bit microprocessor in the Process Computer. 80386 - the 32-bit microprocessor in the Slice Computer, block - a set of vectors in a file critical area - an area where vectors will be treated special cross-hatching - supporting cross-vectors between the inside and outside walls of a part Ethernet - a high-speed intra-computer communications system jointly developed by Digital, Intel and Xerox field - the surface of the vat that the laser beam can reach filling - the process by which part surfaces are made geometric correction - adjusting the laser beam for the pincushion effect home position - the field location that the beam jumps to when there is no part-making activity laser controller - the software "underneath" the

Supervisor that controls the laser's motion jump - the quick, non-polymerization moving of the laser beam jump delay - the delay after a jump allowing the mirrors to settle mirrors - those which rotate to position the laser beam anywhere in the field MSDOS - the standard Disk Operating System for the

Process Computer multi-tasking - where many people can use the same computer simultaneously

SUBSTITUTESHEET

-82.156- pincushion effect - the inherent distortion of a pin-point source being directed onto a flat surface process - the act of making a part Process Computer - the computer in the SLA machine that is used to make parts; MSDOS-based redrawing - making multiple passes of the laser beam over the same vector to induce strength rivets - an intelligent method of redrawing where the extra passes are made over a smaller area segment - two-coordinate, four-point describing a line shutters - barriers of the laser beam slicing - the act of preparing a 3D part for Stereolithography by transforming it into 2D layers

Slice Computer - the computer away from the SLA machine that is use to slice parts; XENIX-based step - a discrete movement of the laser beam step period - the period during which one step is made step size - the number of field units for a step unix - an advanced multi-tasking operating system developed at Bell Labs in the 70 » s XENIX - a unix-like Operating System provided on the Slice Computer

Z-stage - the vertical elevator parts rest on

UTE SHEET

-82 . 157-

Appendix D - Editor Commands

The Editor Commands are similar to those of Word-Star, a popular Word Processing System, and to those found in the

Borland International family of products.

5 Basic Cursor Movement Commands i- character left Ctrl-S or Left

1 character right Ctrl-P or Right word left Ctrl-A word right Ctrl-F

10 line up Ctrl-E or Up line down Ctrl-X or Down scroll up Ctrl-W scroll down Ctrl-Z page up Ctrl-R or PgUp

15 page down Ctrl-C or PgDn Quick Cursor Movement Commands beginning of line Ctrl-Q S or Home end of line Ctrl-Q D or End top of window Ctrl-Q E

20 bottom of window Ctrl-Q X top of file Ctrl-Q R bottom of file Ctrl-Q C beginning of block Ctrl-Q B end of block Ctrl-Q K

25 last cursor position Ctrl-Q P Insert and Delete Commands insert mode on/off Ctrl-V or Ins insert line Ctrl-N delete line Ctrl-Y

-* 30 delete to end of line Ctrl-Q Y delete character to left of cursor Ctrl-H or

'- Backspace delete character under cursor Ctrl-G or Del delete word right of cursor Ctrl-T

35 Block Commands mark block-begin Ctrl-K B mark block-end Ctrl-K K

SUBSTITUTESHEET

-O -i . 13β mark single word Ctrl-K T copy block Ctrl-K C delete block Ctrl-K Y hide/display block Ctrl-K H move block Ctrl-K V read block from disk Ctrl-K R write block to disk Ctrl-K w Miscellaneous Commands find Ctrl-Q F find and replace Ctrl-Q A repeat last find Ctrl-L abort operation Ctrl-U restore line Ctrl-Q L quit edit Ctrl-K P

SUBSTITUTE SHEET

-82 . 159 -

3D SYSTEMS SOFTWARE MANUAL ADDENDUM #1

SLICE REVEALED TO EVERYBODY

See FIGS. 57a-57f, 58a-58c, 59a-59b, 60, 61a-61b, 62, 63a-

63c, 64a-64b

SUBSTITUTE SHEET

-82.160-

A P P E N D I X

-82 . 161- VERSION 2 . 62

3D Systems Stereolithography System Software

BEAM BAS

SLA-1 Beam Profile and Calibration Software

Warning: Compile with TB (Unmodified) , not TBM if SoundOn% = 1 (uses Sound)

'Rationalize the TotalWeight/TW/XYweight variables usage 'Use a ShortDelay(us) function for us delays using usec, •?LoήgDelay(ms) 5 'Read usec

Version$ = "2.62" FALSE = 0 TRUE = -1

0 'Global Vars:

•XRestf,YRest# - Rest Position of laser from PRM file Power#(s) - Last power in mW for sensor s 'XSensorPos#(s) ,YSensorPos#(s) - Sensor position from

15 PRM file

XSP#(s) ,YSP(s) - Actual position from FindHoles

'Resources:

'Files:

*#l=Disk File (in calibrδ)? same for parameter file? 20. '#2=LPT1 - Used by option .in Position Check

DIM Beam%(30,30) ,01dBeam%(30,30)

DIM (1) RowWeightf(30),OldRowWtf(30),Colweight#(30),

01dColWt#(30) DIM Resist!(100) ,Temp#(100) ,LastField%(4) 25 « Initialize Vars and Screen

I

Soundθn% = 0

ParamFile$ = "BEAM.PRM" 30 Blank$ = Strings(79," ") timeouts = 30000 ColMax%=22 'I%=X=across screen:

-32 . 163-

RowMax%=ColMax% 'ColMax%/RowMax% can differ IF we redraw row/col screen usec = 1/4 '4 usec per loop of 2-byte integers calib$(l)=" 1 " change to "1 - 3" when calibrating calib$(2)="l or 2" calib$(3)="l - 3 " NumSensors% = 13 Discrete Beam%=10 lamda# = 5.9 OPTION BASE 0 SCREEN 0,0,0,0 GOTO DisplayTitle

•check for BEAM Program Options

I

CheckForOptions:

CmdLine$ + UCASE$(CmdLine$) 1% = INSTR(CmdLine$,"/TEXT")

IF I%>0 THEN 'check for /TEXT text operation flag

TextDisplay% = TRUE

CmdLine$ = LEFT$(CmdLine$,I%-l)+MID$(CmdLine$,I%+2) END IF RETURN '

'Display Title while Initializing

I

DisplayTitle:

GOSUB PrintTitle Open and Read Parameters File

CALL Center(" Reading Parameters File ",25)

FileName$ = ParamFile$ ON ERROR GOTO TryHome OPEN ParamFile$ FOR INPUT AS #1 GOTO ReadParams TryHome:

UTE SHEET

-82 . 164-

ON ERROR GOTO CantOpen

OPEN "C:\3DSYS\"+ParamFile$ FOR INPUT AS #1 RESUME ReadParams ReadParams: ON ERROR GOTO BadFormat

A$ = FN GetFileLine$(l)

IF LEFT$(A$,1)=CHR$(34) THEN 'handle quoted options line

1% - INSTR(2,A$,CHR$(34)) IF 1% > 0 THEN A$=LEFT$(A$,I%) CmdLine$ = FN NoQuotes$(A$) GOSUB CheckForOptions A$ = FN GetFileLine$(l) END IF XRestf = VAL(A$)

YRest# = VAL(MID$(A$,INSTR(A$,",")+!)) SensorNum% = VAL(FN GetFileLine$(l)) FOR Sensor%=l TO SensorNum%

SensorChannel%(Sensor%) = VAL(FN GetFileLine$(l)) A$ = FN GetFileLine$Cl)

XSensorPos#(Sensor%) = VAL(A$)

YSensorPos#(Sensor%) = VAL(MID$(A$,INSTR(A$,",")+l) )

FOR Pinhole%=l TO 4

SensorCalibf(Sensor%,Pinhole%) = VAL(FN GetFileLine $(1)) NEXT Pinhole% NEXT Sensor% TempChannel% = VAL(FN GetFileLine$(l)) 'assume only one thermometer at first TempCalPts% = VAL(FN GetFileLine$(1) ) FOR I%=I TO TempCalPts% 'Resist!(i%) ,Temp#(i%) may not be integers A$ = FN GetFileLine$(l) Resist!(1%) = VAL(A$)

-82.165-

Temp#(I%) = VAL(MID$(A$,INSTR(A$,",")+1)) + 273.15 abs temp NEXT 1% CLOSE !l

Resist!(0) = 2*Resist!(l) - Resist!(2) i Temp!(0) = 2*Temp!(l) - Temp!(2) ON ERROR GOTO 0

'handle command line options iσ I

CmdLine$ = COMMAND$ GOSUB CheckForOptions

Reset JB Board and Z-table/s

15

GOSUB IOSetup

Find Sensors 1 and 2

20 GOSUB Search7

Set Initial Sensor #3

XSPf(3) - XSensorPosf(3) 25 YSP#(3) = YSensorPos!(3)

•Main Program Loop

* Menu:

■■} X!=YRestf 'Move beam to rest position

4 YfYRest!

30- GOSUB MoveBeam

GOSUB SetMenu 'Display Menu GOSUB Selection 'Get Selection

CLS

-S2.I66- IF Selection%=9 THEN EN D ON S election% GOSUB Displayl,History 2 ,_ Position3,Power4,_ Focus5,Move6,_ Search7,Calibrδ

GOTO Menu

I

'Display Main Menu

SetMenu:: KEY- OFF

GOSUB PrintTitle

Indents - STRINGS(25," ")

LOCATE 6,1,0

PRINT Indents;"!. Display Profile" PRI N T Indents;"2. Beam Power/Profile History"

PRINT Indents;"3. Position C heck"

PRINT Indents;"4. Beam Power"

PRINT Indents?"5. Beam Focus"

PRINT Indents;"6. Move B eam" PRINT Indents;"7. Find Pinholes"

PRINT Indents;"8. Calibrate System"

PRINT Indents;"T. Toggle between S creen Mo d es"

PRINT Indents;"X. Exit - Return to Main Menu"

LOCATE: 18,29,0 IF TextDisplay% THEN

PRINT " Text Display Mode "

ELSE:

I3EENT "Graphics Display Mode" END IF LOCATE 20,14,0

PRINT "Sensor ! Default Location Current Power ( m W) " FOR i = 1 TO 3

LOCATE 20+i%,17,0 HiINT i%; LOCATE 20+i%,25,0

G ALL PrintXY(XSensorPos!(i%) ,.YSensorPos! ( i% ) )

S

-82 . 167-

LOCATE 20+i%,43,0

CALL PrintXY(XSP!(i%) ,YSP!(i%))

LOCATE 20+i%,59,0 ' PRINT USING "!!!.!";Power!(i%) ; NEXT i% RETURN

I

'Print Option line and get Selection

I Selection:

GOSUB ReadTemp

LOCATE 25,1,0

PRINT "MENU: SELECT OPTION ";

LOCATE 25,66,0 PRINT "Temp:";

PRINT USING "!!!.!";Tempf;

PRINT " C"; SetMainKey:

K$=UCASE$(INKEYS) IF K$="" THEN GetMainKey

IF K$="T" THEN TextDisplay% = NOT TextDisplay%

IF K$="X" THEN Selection% = 9 ELSE Selection% - VAL(K$)

RETURN

'*****************************

'* Option 1: Display Profile * • *****************************

Displayl: Sensor% = 1 Display%=l 'numbers, graphic characters, contours st%=4 '1.4 mil Mn%=l ">1 for averaging Displayla:

IF TextDisplay% THEN SCREEN 0,0,0,0 'stay in text mode ELSE

-82 . 168-

SCREEN 10,0,0 'enter graphics mode END IF CLS

LOCATE 25,1,0 PRINT "(1) DISPLAY PROFILE: Press ";calib$ (NumSensors%) ;"to select sensor!!, Q t Displaylb:

GOSUB GoodRead IF TotWtAvg!=0 THEN *■ t$ =" ERROR: Sensor !"+Str$(Sensor%)+" 'was not found: Try (6) Move or (7) Searc CALL Center(t$,24) CALL WaitKey RETURN END IF

XSPf(Sensor%)= Xaverage! YSP!(Sensor%)= Yaverage! •GOSUB Printlnfo '*** bring in contours later? 'and log(beam-slice) contours k$=InKey$

IF (Val(k$)>0) AND (Val(k$)<=NumSensors%) THEN sensor%=Val(k$) GOTO Displayla ELSE

IF k$<>"" THEN RETURN END IF GOTO Displaylb

* ********************* '* Option 2: History * > *********************

History2:

LOCATE 24,1,0 " PRINT "(2) History of Beam Power & Profile";

CALL Center("History File Not Yet Installed",4)

-82 . 169-

CALL Center("will track beam power vs. time",5) CALL Center("also compare profiles, XY gain & drift",6)

CALL WaitKey RETURN

*****************************

•* Option 3: Position Check *

• ****************************

Position3: FOR i% = 1 TO 4 'Set up initial Fields for Ranger LastField%(i%) = 32767 NEXT i% st%=4 1.4 mil Mn%=l for averaging display%=0 don't display •& have XSP!(sensor%) , Y-, Position3a:

LOCATE 25,1 'Scroll Screen PRINT LOCATE 21,1,0 PRINT BlankS;

PRINT " X . Offset X Gain Y Offset Y Gain"; PRINT BlankS; PRINT BlankS; FOR sensor% = 1 TO 2

LOCATE 22+sensor%,20,0 PRINT "Sensor f";sensor%; PRINT USING"!!!.!";Power!(sensor%) ; PRINT" mW, "; Or for other pinholes PRINT "Center:";

CALL PrintXY(XSP!(Sensor%) ,YSP!(Sensor%) ) NEXT sensor% CALL Center("(3) POSITION CHECK: Press P for printout, Q to Quit", 25)

-82 . 170-

FOR sensor% = 1 TO 2 GOSUB GoodRead

XSP!(sensor!)= Xaveragef 'update centers * YSP!(sensor!)= Yaverage! 5 NEXT sensor!

Xoffs!=( XSP!(1)+XSP!(2)-XSensorPos!(1)-XSensorPos!(2)

)/C 2*3,556 ) 'mils Yoffs!~( YSP!(1)+YSP!(2)-YSensorPos!(1)-YSensorPos!(2) )/( 2*3,556 ) IOC- Xgaϋι#-<(XSP!(1)-XSP!(2))/(XsensorPos!(1)-XSensorPos! (2))—1*10000 'mils per 10" Ygain!=((YSP!(1)-YSP!(2))/(YSensorPos!(1)-YSensorPos! (2))-l*10000

CALL Ranger(1,Xoffs!,"X")

15 CALL Ranger(2,Xgain!,"x")

CALL Ranger(3,Yoffs#," ")

CALL Ranger(4,Ygain!,"y •• )

sensor!=l 'leave it set

k$=UCase$(InKeyS) 20 IF k$="" THEN Position3a IF k$?="P" then IΩCATE 1,1,0

CALL * Center("Do you want a printout (y/n) ?",25) waitprinfa 25 Dσ k$-UCase$(InKeyS) LOOP UNTIL (k$ = "Y") or (k$ - "N") IF k$="Y" AND printout! = 0 THEN printout!=l 30 OPEN: "0",!2,»LPTI"

WIDTH "LPT1:",255 'no end of line CR/LF added automatically PRINT!2,"X is offset, x is length change of 10";_ chr$(34);" part, both .3 mils / div

-82.171-

PRINT!2,SPC(85) ;time$

PRINT!2,CHR$(27) ;"A » ;CHR$(1) ;CHR$(15) '1/180 LPI,17 pitch ELSE IF k$ + "N" THEN GOSUB PrinterOff END IF

GOTO Position3a END IF PrinterOff: IF printout! = 1 THEN PRINT !2,timeS restore 1/6 line spacing, non-condensed

PRINT !2,CHR$(27) ;"A";CHR$(12) ;CHR$(18) ; PRINT !2,chr$(12) ; CLOSE !2 printout!=0 END IF RETURN

SUB Ranger(ffield!,position!,characters) 'field 1-4 LOCAL PPos!,ch$,CurrField!

SHARED printout!,LastField!()

CurrField! = Int(3*position!/19) '3 character posi¬ tions per .001" PPos! = Int(3*position!)-19*CurrField! ch$ = characters

IF LastField!(ffield!) < 32767 THEN 'Always display first one

IF CurrField! < LastField!(ffield!) THEN 'See if in new field ch$ - •'/" ELSE

IF CurrField! > LastField!(ffield!) THEN ch$ =

II / It

END IF END IF

LastField! ( f field!) = CurrField!

-82 . 172-

PPos!=PPos!+l+20*(Ffield!-l) LOCATE 21,PPos!,0 PRINT ch$;- . " LOCATE 21,20*Ffield!,0 PRINT "I";

IF printout! THEN

PRINT!2,SPC(PPos!) ;ch$;chr$(13) ;SPC(20*Ffield!) ; IF Ffield!=4 THEN PRINT!2,"" - END IF END SUB

I

» ************************

•* Option 4: Beam Power * •************************

'Power 4:

'as fast as possible, sound output have dropped tests for 65535,0 ori X!,Y! 'rework sounds, can speed with pre-calculation LOCATE 25,1,0

PRINT "(4) POWER: Press ";calib$(NumSensors!) ;" to select sensor !, Q to Quit"; Seήsor!=l Power- 4a: Repeats!=0

PowerAvg!(sensor!)=0 SC!=SensorChannel!(Sensor!) st!=4 '1.4 mil = matches that used for calib stf=st! xcorner!=XSP!(Sensor!)-((ColMax!+l)/2.0)*st! ycαmer!=YSP!(Sensor!)-((RowMax!+l)/2.0)*st! CALL ClearLine(24) Ebwer.4b:

TotalWeight!=0 ^ FOR I!=l TO ColMax!

X!= xcσrner! + I!*st%

Y!= ycαrner! 'extra delay on first

-82 . 173-

GOSUB MoveBeam

FOR J!=l TO RowMax! scream . . . Y!= Y!+st! hi!=Int(y!/256.0) OUT &H301,hi!

OUT &H300 ,int(y!-256.0*hi!)

OUT &H302,inp(&H302) and not &H02 2 for strobe OUT &H302,inp(&H302) or &H02 ************* ReadJBBoard MACROed ***************** counts = timeouts OUT SH30C,SC! FOR qq! = 1 TO 15*usec

NEXT qq! 'must wait lOus for EOS to go LO (286 @ 4us/next!)

DO 'then appx llOus for conversion with signal D7 HI DECR counts LOOP UNTIL (INP(SH310)>127) or (COUntS=0) qi!=INP(SH30C)

IF counts = 0 THEN JBError

IF 0.0 + TotalWeight! + qi! > 32768 THEN Call Center("Sensor !"+Str!(sensor!)+" Saturation", 24) GOTO Power4c END IF

TotalWeight! = TotalWeight! + qi! 'only overflow § 22*22*60 NEXT J! X!=xcorner!

GOSUB MoveBeam Y!=ycorner!

GOSUB MoveBeam •scan around the corners .... NEXT" I! TotalWeight!=TotalWeight!-Background!(sensor!) LOCATE 24,26,0

-82. 174-

Repeats !=Repeats!+l IF Repeats! . >I00 THEN Repeats!= 100 PowerAvg!(sensor!)=(PowerAvg!(sensor!)*(Repeats!- 1J÷TotalWeight!)/Repeats! LOCATE 20+sensor!,5,0

PRINT "Sensor !";sensor!;

PRINT USING "!ff.!!";PowerAvg!(sensor!)*SensorCalib!

(sensor!,3) ? ?" mW Averaged Reading; ("; PRINT:USING "!#!,!!"; TotalWeight!*SensorCalibf

(sensor!,3) ? ?" mW Unentered Reading)" IF TotalWeight!<l THEN TotalWeight!=l protect log function IF SoundOn! THEN

SOUND 1000,0

SOUND int(30*log(TotalWeight!)+37) , .5 END IF

I -'If 10 * round then recheck centers with goodread & XSP! ()=XAvg! range, duration, need time

I

Power 4c: k$=inkeyS

IF k$=' « " THEN Power4b

IF (Val(k$) > 0) AND (Val(k$) <= NumSensors!) THEN sensor!=val(k$) : goto Power 4a RETURN

>************************

* Option 5: Beam Focus * •************************

'Fαcus5:

sensor!=l 'starting

'assumes 22x22 array (for now)

-82 . 175-

'l/e A 2 but actring on area-integrated power IF TextDisplay! THEN

SCREEN 0,0,0,0 ELSE 5 SCREEN 10,0,0,0 END IF FocusSa: LOCATE 25,1,0

PRINT "(5) Focus Parameters: .Press "calibS(NumSensors!) " 10.' for sensor !, S to search Xaverage!=0 Yaveragef-0 st!=4 '1.4 mil st!=st! 15 Mn!=l 'for averaging HiPoints!=0

FOR i! = l TO ColMax!:Colweight!(i!)=0:NEXT i! FOR j! = 1 TO RowMax!:RowWeight!(j!)=0:NEXT j!

bk!=Bk!(sensor!) 0 FOR Try! = 1 TO Mn! smoothing TotalWeight!=0 Xweight!=0.0 Yweight!=0.0 xcorner!=XSP!(Sensor!)-((ColMax!+l)/2.0)*st! 5: ycorner!=YSP!(Sensor!)-((RowMax!+l)/2.0)*st! EOR I!=l TO ColMax! 'not step 2

'and not zig-zag until we study timing X! = xcorner! + I!*st! Y! = ycorner! 'only needed 1st time 0 GOSUB MoveBeam

FOR J!=l TO RowMax! Y!= Y! + st!

GOSUB YAxisOnly 'indistinguishable from when 4ms added pre-read 5 TotalWeight! = TotalWeight! + qi! 'do not remove background

-82 . 176-

If qi!>bk! THEN HiPoints!=HiPoints!+l Xweight! = Xweight! + X!*qi! Yweight!-= Yweight! + Y!*qi! ColWeight!(i!) = ColWeight!(i!) + qi! RowWeightf(j!) = RowWeight!(j!) + qi! NEXT J! Xf=Xcornerf GOSUB MoveBeam Yf=YCornerf GOSUB MoveBeam •scan around the corners .... NEXT I! 'need re-centering, not just speed IF TotalWeight! <> 0 THEN

Xaveragef = Xaveragef + Xweightf/TotalWeight! Yaverage! = Yaverage! + Yweight!/TotalWeight! END IF NEXT Try!

Xaverage! = Xaverage!/Mn! Yaverage! = Yaverage!/Mn! XSPf(Sensor!)=Xaveragef YSPf(Sensor!)=Yaveragef

I

Now assume only ColMax!=RowMax!(=22)

I twf=totalWeight!-Background!(sensor!) IF twf<=0 then twf=l

CALL Center("BEAM NOT FOUND",24) CALL WaitKey

GOSUB FindHoles 'scans for 2-mil hole for that sensor

IF terminate! = 1 THEN GOTO FocusCleanUp end. if

CLS?

LσσEowMax%=ColMax!:if RowMax!>ColMax! THEN LocRowMax%= RowMax.%

-82 . 177-

IF TextDisplay! THEN stp!=2 else stp!=l LOCATE 1,79 PRINT "X";

FOR ' i! = 1 TO LocRowMax! STEP stp! 'larger of the i,j: display zeros for smal cwf=colweight (i!) cwf=cw!-Background!(sensor!)/ColMax!

IF CW!<1 THEN cw! = .5 cw!=6.*(log(cw!/tw!)+8) 'from 2 to 39 .5/(22*22*220) " to: 1.

IF cwmax!<cw! THEN cwmax!=cwf colweightf(i!)=cwf

IF cw!<l THEN cw!=l IF cw!>79*8 THEN cw!=79*8 rw!=rw!+40*i

IF rw!>79*8 THEN rw!=79*8 i2! - i!*7

IF TextDisplay! THEN

LOCATE int(i!/stp!)+l,l PRINT STRINGS(cw!/8+l,"-") ;"*"; ELSE

CIRCLE (3+cw!,i2!) ,2 LINE (0,i2!)-(cw!,i2!) ,3,,SHCCCC END IF : NEXT i!

cwmaxf=cwmax!-6 'to find l/e 2 of beam x! = Int(cwmaxf*16) IF x! < 1 THEN x! = 1 IF x! > 79*8 THEN x! = 79*8 IF TextDisplay! THEN

LOCATE; 12,x!/8

PRINT " A "; ELSE

LINE (x!,0)-(x!,160)

END IF

LOCATE 13,79 PRINT "Y"; rwmaxf=0 FOR i! = 1 TO LocRowMax! step stp! 'larger of the i,j display zeros for small rwf=RowWeightf(i!) rwf=rwf-Backgroundf(sensor!)/RowMax! IF rwf<H THEN rwf = .5 'tw! really not wanted here, want absolute IF rwmax!<rw! THEN rwmaxf=rwf RowWeightf(i!)-rwf rw!=rwf*16 '*1.02*lamdaf ? IF rw!<l then rw!=l

IF rw!>79*8 THEN rw!=79*8 i2! = 155+i!*7+7

IF TextDisplay! THEN

LOCATE 12+int(i!/stp!) ,1 PRINT STRINGS(rw!/8+l,••-") ;"*• « ; ELSE

CIRCLE (3+rw!,i2!) ,2 LINE (0,i2!)-(rw!,i2!) ,3,,SHCCC END IF NEXT i! rwmaxf=rwmaxf-6 x! = Int(rwmaxf*16) IF x! < 1 THEN x! = 1 IF x! > 79*8 THEN x! = 79*8 IF TextDisplay! THEN LOCATE 23,x!/S PRINT " A "; ELSE

LINE: (ϊk!yr65}-(x!,320) END IF

-82 . 179-

FOR i!=l TO LocRowMax!-l

IF colweight!(i!+l)>cwmax! and colweight!(i!)<cw,ax# then_ cplo=i!+(cwmax!-colweight!(i!) )/colweight!(i%+l)- colweight!(i!))

IF colweight!(i!+l)<cwmax! and colweight!(i!)>cwmaxf then_ cphi=i!+(cwmax!-colweight!(i!) )/(colweight!(i!+l)- colweight!(i!)) ' . IF rowweight!(i!+l)>rwmax! and rowweightf(i!)<rwmax# then_ rphi=i!+(rwmax -rowweightf(i!) )/(rowweightf(i!+l)- rowweightf(i!)) NEXT i! LOCATE 24,1,0 PRINT blankS; LOCATE 24,15,0

PRINT "Sensor f"Sensor!" Average Width"; PRINT INT((cphi-cplo+rphi-rplo)*4/(2*3.556)*10)/10: PRINT "mils X/Y =";int((cphi-cplo)/(rphi- rplo)*100)/100;

k$=UCaseS(InKeyS) IF k$="S" then

XSP (Sensor!)= Xf : YSP (Sensor!)= Yf

GOSUB FindH01es2 'searches around new center ELSEIF (Val(k$) > 0) AND (Val(k$) <=NumSensors!) THEN sensor!=val(k$) ELSEIF k$<>"" THEN GOTO FocusCleanUp END IF GOTO Focus5a

FocusCleanUp: SCREEN 0,0,0,0 RETURN

-. .xfaU—

• ***********************

'* Option 6: Move Beam * > ***********************

Move6:

Xf = XRestf

Yf = YRestf sensor!=l Moveβa: SCREEN ' Ot, . 0,Q,0

CLS'

LOCATE 25,1,0

PRINT "(6) MOVE BEAM:"; indents = Strings(23," ") LOCATE 1,1

PRINT indents;"Sensor Default Last Found"

PRINT indents;" Position Position"

PRINT indents;"

LOCATE 5+NumSensors!,1 PRINT indents;"Beam Rest Position: ••; CALL PrintXY(XRestf,YRestf) CALL Center("KeyPress Action ",17)

CALL Center(" ",18)

CALL Center(" "+calib$(NumSensor!)+" Change sensor m

CALL. CSsnter(" X Reposition X coord, of beam ",20) CALL " . Center(" Y Reposition Y coord, of beam ",21) CALL Center(" S Search for hole of sensor from current position ",22) CALL.Center(" Q Quit Move Beam function ",23) CALL- Center("************************************",11) CALL Center("* *'\12)

CALL Center("* *",13)

CALL Center("************************************" .14) EOR i i — 1 TO NumSensors! LOCATE! 3+i!,26 PRINT: ϋ?" ";

-82 . 181-

CALL PrintXY(XSensorPosf(i!) ,YSensorPosf(i!) ) PRINT " ";

CALL PrintXY(XSPf(i!) ,YSP (i!) ) NEXT i! 5 Move6b:

CALL ClearLine(15) GOSUB MoveBeam Move6c:

CALL Pause 10.:- CALL ReadJBBoard(SensorChannel!(Sensor!)) LOCATE 12,29

PRINT "Sensor f";Sensor!;" Power:"; PRINT using "fff";qϋ; LOCATE 13,22 15 PRINT "Current Beam Position: "; CALL PrintXY(Xf,Yf)

IF SoundOn! AND (qi!>bkf(sensor!)) THEN SOUND 1000,0 SOUND int(30*qi!+37) , .1 0 END IF

SELECT CASE (ch$) CASE ""

GOTO Move6c 'ch$ from Pause Command CASE "X" 5 LOCATE 15,30,0

PRINT "New X Position ="; INPUT a$

IF a$<> »» THEN Xf=Val(a$) GOTO Move6b 0 CASE "Y"

LOCATE 15,30,0 PRINT "New Y Position ="; INPUT a$

IF a$<>"" THEN Yf=Val(a$) 5i GOTO Moveδb CASE "S"

XSPf(Sensor!)= Xf

—82 . IS2—

YSP! (Sensor!) = Yf CLS

GOSUB FindHoles2 'start again at this new center Xf = XSPf(Sensor!) Y# = YSP!(Sensor!) if terminate! - 0 THEN CALL WaitKey GOTO Move6a CASE ELSE » IF (ValfchS) > 0) AND (Val(chS) <= NumSensors!) THEN sensor!=val(ch$) GOTO Move6b END IF END SELECT

IF SoundOn! THEN SOUND 1000,0 RETURN

****************************

* Option 7: Find Pinholes * ****************************

Search7: CLS: sensor!—1

GOSUB FindHoles 'scans for 2-mil hole around original : center

IF terminate! = 0 THEN CALL Pause

CLS sensor!=2

GOSUB FindHoles IF terminate! = 0 THEN CALL Pause

RETURN

• ******************************

"** Option 8: Calibrate System * « ****************************** Calibr8: •

-82.183- 'start with 2nd menu

WARNING..: changing laser, focus etc

•will invalidate geometric calibration

I '1 calibrate power readings (S update file) sensor 1/2 •2 calibrate temperature readings (S update file) •3 update sensor location file sensor 1/2

4 update beam rest position (S update file) *5 Calibrate geometric corrections

'warning : requires calibrator a) X-Y precision table 'b) 3D Systems precision grid

(set flag to use either) •? here restart history file •even calibrate usec delay for file 'remind of need to center table, align etc NumSensors! = 3 from now on, use 3 sensors ... may revise CALL Center("Beam Calibration Function",1) LOCATE 12,1,0

PRINT "WARNΪNG: Beam Calibration requires that the X-Y Calibration System with"

PRINT " the 3rd Sensor is setup. If calibration is attempted without" PRINT " the system in place, Z Table damage may result" CALL Center("Is the X-Y Calibration System in place (Y or N)?",25) DO k$ = UCaseS(InKeyS) LOOP UNTIL (k$ = "Y") or (k$ = "N") IF k$="N" THEN

-82. 184-

CALL Center("**** Aborting Beam Calibration ****" f 24)

CALL WaitKey -RETURN END IF CLS

CALL Center("Beam Calibration Function",1) XTablePos01df=0 YTablePosOldf=0 XTabIeP&sf=0 YTableFos!=0 GOSUB MoveTable

GOSUB BacktoCenter 'eliminates backlash by - S + .025"

Sensor!=3 Xf=32767 Yf=32767 GOSUB movebeam

CALL Center("Press a key when Sensor f3 is centered",13)

LOCATE 12,28,0

PRINT "Sensor #3 reading is "; adjust?;

CALL.ReadJBBoard(SensorChannel!(Sensor!) ) LOCATE 12,48,0 PRINT qi!;

IF SoundOn! AND (qi!>7) THEN SOUND 1000,0

SOUND INT(30*qi!+37) , .11 END IF

FOR i!=l TO 30

FOR ii! = 1 TO 10000*usec NE32E? ϋ% NEXIT i! IF InKey$= » *'* THEN ADJUST

-32. 185-

CALL ClearLine(12) CALL ClearLine(13)

GOSUB FindHoles

IF terminate! = 1 THEN AbortCalib

'FOR sensor! = 1 TO 2 'could also use Position3 routine

'GOSUB CalibFind 'have the background readings IF terminate! - 1 THEN AbortCalib •NEXT sensor!

CALL Center("Do you want to run a Full or Partial

Calibration (F/P?",24) DO k$ =UCase$(InKeyS) LOOP UNTIL (k$="F") OR (k$="P") IF k$="F" THEN FullPartf - .25 ELSE FullPartf=10 FOR sensor! = 1 TO 2

GOSUB SlowCalibFind

IF terminate!=l THEN AbortCalib NEXT sensor!

FOR tableXf=5 TO -5 step -FullPartf 'convert the axes here sensor!=3

XSP!(Sensor!)=32767.0-(.9539)*3556.0*TableX! YSP!(Sensor!)32767.0+(.9760)*3556.0*(-5) TableY! 'here adjust for geometry = or we'll miss holes 'must set parameters before findholes X!=XSP!(sensor!) best 'guess, improve with pre- calib

Y!=YSP!(sensor!) GOSUB MoveBeam

FOR ii = 1 to 10000 'allow mirror coil temperature to stabilize NEXT ii

-82 . 186-

FOR tableY!=-5 TO 5 step FullPart #.25 or .5 sensor!=3

XSP!(Sensor!)=32767.0-(.9539)*3556.0*TableX! YSP!(Sensor!)=32767.0+(.9760)*3556.0*TableY!

Adjust for Geometry

XTablePosf=100000.0*TableXf YTablePosf=100000.0*TableY! GOSUB-MoveTable

CALL,Center("X Table ="+Str$(tableX!)+" Y Table ="Str$TTableYf) ,23) GOSUB CalibFind

IF terminate! = 1 THEN AbortCalib ** needs revision NEXT TableYf FOR sensor! = 1 TO 2 could also use Position3 routine

GOSUB SlowCalibFind

IF terminate! = 1 THEN AbortCalib ** needs revision NEXT sensor! NEXT TableXf

CALL Center("Beam Calibration complete at "+date$+" "+time$,24)

BackToCenter: XTablePosf=0

YTablePos#=0

GOSUB MoveTable

CALL WaitKey RETURN

AbortCalib:

CALL Centear("**** Aborting Beam Calibration ****",24) GOTCe I&ckTbCenter 'Later, may want to stop table instead of centering

-82.187-

*******************************************************

UTILITIES *******************************************************

Z-Table(s)

*************

* MoveTable * *************

MoveTable: cmd$=" 01 " GOSUB SendTableText XMoveS= XTablePosf-XtablePosOldf Sign$="" IF XMoveS<0 THEN Sign$="-" '????? need to wait after

00,17? Move$=str$(xmoveS) cmd$=" D"+sign$+right$(moveS,len(move$)-l)+" G " » a,v already set GOSUB SendTableText XtablePosOldf = XTablePosf

cmd$=" 00 " GOSUB SendTableText

Y oveS = YTablePosf-YtablePosOldf

Sign$=""

IF YMoveS<0 THEN Sign$="-"

Move$=str$(YmoveS) cmd$=" D"+sign$+right$(move$,len(move$)-l)+" G " 'a,v already set

GOSUB- SendTableText

YtablePosOldf = YTablePosf

cmd$=" 01 "

- t. . ISo-

GOSUB SendTableText cmd$=" D-2500 G " •Backlash routine moves -0.025"

THEN +0.025" X,Y GOSUB SendTableText cmd$=" D2500 G " 'Backlash routine moves -0.025"

THEN +0.025" X,Y GOSUB SendTableText cmd$=" 0O " GOSUB.SendTableText crndS^'-^ α-2500 G " 'Backlash routine moves -0.025" THEN +0.025" X,Y GOSUB SendTableText cmd$=" D2500 G " •Backlash routine moves =0.025" THEN +0.025" X,Y GOSUB SendTableText RETURN

*****************

* SendTableText * *****************

The following is a handshake subroutine allowing data to be transferred from the IBM BUS to the PC21. Command string data is sent to the PC21 one character at 'a time.

I

SendTableText:

RAH: Do we need delay?

FOR qq = 1 TO 10 FOR qq! = 1 TO 1000*usec NEXT qq! NEXT: qq

FOR ro - 1 TO LEN( CMD$ ) CHARS = MID$( CMDS, IO, 1) GOSUB SendTableByte

-82.189-

NEXT 10

CHARS = CHRS(13):GOSUB »* SendTableByte

GOSUB InputTableByte wait for completion

RETURN

SendTableByte: counts = timeouts DO

BYTE = INP( TableAddr!+l ) DECR counts LOOP WHILE (IDBREADY AND NOT BYTE) AND (countS>0) IF counts - 0 THEN JBError OUT TableAddr!, ASC( CHARS ) OUT TableAddr!+l, ( CONTROL OR IDBREADY ) counts = timeouts DO

BYTE = INP( TableAddr!+l ) DECR counts LOOP WHILE (IDBREADY AND BYTE) AND (countS>0) IF countS= 0 THEN JBError OUT TableAddr!+l, ( CONTROL AND NOT IDBREADY ) RETURN

I

' The following is a handshake subroutine allowing data 'to be transferred from the PC21 to the IBM BUS. This 'data is sent one character at a time.

I

InputTableByte: counts = timeouts DO BYTE = INP( TableAddr!+l ) DECR counts LOOP UNTIL (BYTE = 22) OR (count =0) IF counts = 0 THEN JBError RETURN

SUBSTITUTE SHEET

-82 .190-

SCANNING ROUTINES

*************

* FindHoles * *************

Updates hole position 2 Needs to confirm that we have 2 mil hole.

FindHoles:

CALL- FlushKey

CALL Center("Searching for Sensor f"+Str$(sensor!)+" press any key to abort",25 5 Xf=XRestf 'first get background reading

Yf=YRestf

GOSUB MoveBeam 'make sure to move beam away Bkf=0 0 FOR i!=l TO ColMax! FOR j!=l TO RowMax!

«: ********** ReadJBBoard MACROed ****************

counts = timeouts OUT " SH30C,SensorChannel!(Sensor!) 5 FOR qq! = 1 TO 15 usec

NEXT qq! 'must wait lOus for EOS to go LO (286 §

•4us/next!) DO 'then appx llOus for conversion with

'signal D: 'D7 HI

DECR counts LOOP UNTIL (INP(SH310)>127) or qi!=INP(SH30C)

SUBSTITUTE SHEET

-82.191- IF counts = 0 THEN JBError

Bkf=Bkf+qi! -NEXT j! NEXT i! 5 Backgroundf(sensor!)=bkf bkf(sensor!)=3+2*Backgroundf(sensor!)/(ColMax!*RowMax!

) remove noise for centeri XSP (Sensor!) = XSensorPos (Sensor!) will be best starting point 10 YSPf(Sensor!) = YSensorPosf(Sensor!) ******* ? or not check ******

FindHoles2:

When we want to use new starting point •updates hole position 15 • display!=l calibrate!=0

ExtraTries!=0 'repeats of finest centering routine

GOSUB FastFine ' background, spiral, zero_in

20 •** here need to search for other 3 pinholes: radius 'known, try angles

•or know approx position from assembly

'details ' (sensor 3 different) . 25 'must modify IF 2 mil hole saturates, or is 'too small.. RETURN

SlowCalibFind:

Xf = XSPf(Sensor!) 3.0. Y! = YSP!(Sensor!) GOSUB MoveBeam FOR ii!=l TO 15 15 sec

CALL Center("Waiting ..."+Str$(16-ii!)+" ",24)

SUBSTITUTE SHEET

-82.192-

FOR jj! = 1 TO 20000*usec NEXT jj! . NEXT ii!

CALL ClearLine(24) CalibFind:

Display!=l

ExtraTries!=3 'repeats of finest centering routine Calibrate!=l FastEind: term nate!=0 'looks for requests to terminate CantFϊnd!=0 Spiral:

SpiralsideMax!=l00 '100*4.5 mil to start search stf=16 '.0045" per steep is fine for seeing our beams bkf=bkf(sensor!) Spiral2:

Xf - XSP!(Sensor!) Y! = YSP!(Sensor!) GOSUB MoveBeam 'gets us to best starting position FOR qq!=l TO 2000*usec NEXT qq! CALL FlushKey

CALL Center("Searching, for Sensor !"+Str$(sensor!)+": press any key to abort",2

•Now spiral to search for 2 mil holes

KJHlspiralside! = -5 TO SpiralsideMax! EOR i!= 1 TO spiralside! GOSUB MoveBeam IF qi! > bk! THEN foundit 'found IF 2 * background +3 X! = X! + st!

NEXT i!

EOR. j!=l TO spiralside! GOSUB MoveBeam

SUBSTITUTE SHEET

-82 .193-

IF qi! > bk! THEN foundit 'found IF 2 * background +3 Y ! = γ# " . + stf NEXT j! stf = -stf 'reverse directions after each 2 sides

IF inkeySo"" THEN CALL Abort

IF terminate! = 1 THEN RETURN END IF

Next spiralside!

CALL Center("Cannot find Sensor f"+Str$(Sensor!)+": is beam blocked?",24) stf=st!/1.5 SpiralSideMax!=SpiralSideMax!*3 bk!=bkf-.5

CantFind!= CantFind! +1 IF CantFind! < 5 THEN spiral2

CALL Center("Could not find Sensor f"+Str$(Sensor!) ,24) CALL WaitKey

RETURN 'couldn't find it

Fouridlt:

IF TextDisplay! THEN

SCREEN 0,0,0,0 ELSE

SCREEN 10,0,0,0 END IF IF display! THEN

LOCATE 1,70,0 PRINT "Sensor "Sensor!;

CALL Center("Found Sensor f"+Str$(Sensor!) ,25) END IF

XSPf(Sensor!) = Xf 'new best starting point YSP (Sensor!) = Yf

st!=stf 'scan step in bits

SUBSTIT

-82,194-

XSPav!=0 YSPavf=0

FOR retry!= 1 TO 1 + ExtraTries! 'discard the first " IF display! THEN CALL ClearCol(22) 5 XYweightf=0 Xweight!=0 Yweight!=0

TWf=0 'for power, not removing noise till end SaturationCount!=0 10. xcornerf=XSP (Sensor!)-((ColMax!+l)/2.0)*st! ycornerf=YSPf(Sensor!)-((RowMax!+l)/2.0)*st! MaxVal! = 0

FOR I!=l TO ColMax! 'prefer to return around edges after line. 15 IF display! THEN CALL ClearCol(ColMax!-!!) Xf= xcornerf + I!*st! Yf= ycornerf . GOSUB MoveBeam FOR J!=l TO RowMax! 20 Yf= Yf + stf

GOSUB YaxisOnly

•************* ReadJBBoard MACROed ****************** countSϊ= timeouts OUT £H30C,SensorChannel!(Sensor!) 25 EORiqq! = 1 TO 15*usec

NEXT: qq! 'must wait lOus for EOS to go LO (286 @

•4us/next!) DO) 'then appx llOus for conversion with signal D7 'HI 30 DECR counts

LOOP UNTIL (INP(SH310)>127) or (countS=0) qi!=INP(SH30C)

IF:MaxVal! < qi! THEN MaxVal! = qi!

IF counts = 0 THEN JBError

35 TWf=TWf+qi!

HEET

-82 . 195-

IF qi!<bkf(sensor!) THEN Qi! = 0 'note this affect totalweight IF qi!>210 THEN SaturationCount! = 5 SaturationCount! + 1

XYweightf = XYweightf + qi! IF display! THEN gx! = (3*(ColMax!-I!)+l*8 gy! = (RowMax!-J!+l)*14 10. q! = qi!/DiscreteBeam!+l

IF q! > 20 THEN q! = 20 IF TextDisplay! THEN

LOCATE RowMax!-J!+l,3*(ColMax!-I!)+l IF NOT qi! THEN PRINT " +" ' ; ELSE PRINT 15 USING "fff";qϋ;

ELSE

FOR cc!=l TO q! CIRCLE (gx!,gy!) ,cc! NEXT cc! 0 END IF

END IF if inkeySo"" then return

Xweight = Xweightf + Xf*qi! 'want floating point numbers here 5 Yweightf = Yweightf + Yf*qi!

NEXT J! Xf= xcornerf GOSUB MoveBeam Yf= ycornerf 0 GOSUB MoveBeam NEXT I! IF XYweightf=0 THEN

CantFind!= CantFind! +1 IF CantFind! < 5 THEN spiral 5 t$ ="ERROR: Sensor f"+Str$(sensor!)+" not found: Try (6) Move" CALL Center(t$,24)

-82 . 196-

CALL WaitKey

RETURN . couldn't find it -END IF

IF SaturationCount! > 0 THEN 5 LOCATE 24,1,0 t$ = "WARNING: » +Str$(SaturationCount!)+" sensor readings near saturation" CALL Center(t$,24) FOR 1=1 TO 25000 delay 0 NEXT i END IF

I

Later select sensor hole size automatically

I

15 XSP!(Sensor!) = Xweight!/(XYweight!) 'protected against missing beams YSPf(Sensor!) = Yweight!/(XYweight!) Power!(sensor!)=(TWf-Background (sensor!))* (SensorCalibf(Sensor!,3) ) 20 IF retry! > 1 THEN display! = 0 faster without XSPavf=XSPavf+XSPf(sensor!) YSPavf=YSPav!+YSP!(sensor!) END IF - 25. NEXT retry! 'use average outside-subroutine, or terminate to here XSPav!=XSPavf/(ExtraTries!+(ExtraTries!=0) ) YSPav#=YSPavf/(ExtraTries!+(Extra ι yries!=O i ) ) IF calibrate! THEN 30 OPEN "A",!1,"calibr8.dat" '?use spaces or comma delimiters? PRINT !l,USING"!!ffff.f!;XSPav!;YSPav!;Power!

(sensor!) ;Temp!; PRINT !1, timeS 35^ CLOSE !1 END IF

-82. 197-

GOSUB Printlnfo RETURN

ReadTemp:

'SUBROUTINE: READ voltage of thermistor on JB Board 'use 1/T, LOG(R) function TO linearize the interpolation

CALL ReadJBBoard(TempChannel!) resistf=20000.0*(255-qi!)/(255+qi!) from 20K resistor on JB Board IF qi!>214 THEN

PRINT "Temperature > 70 C" Tempf=71 BEEP RETURN END IF calctemp:

FOR It!=l TO TempCalPts!

IF Resist (It!)>Resistf THEN NEXT It!

IF Resistf(It!)=Resistf THEN

Tempf=Tempf(It!) ELSE Bf = (1/Temp (It!-1)-1/Tempf(It!) / (LOG(Resistf(It* 1) )-LOG(Resist (It!) ) )

Tempf = 1/(1/Tempf(It!-1) - Bf * ( LOG(Resist!(It* 1))-LOG(Resist! ))) END IF

Temp!=Temp!-273.15 RETURN

BEAM CONTROL

************

* MoveBeam * ************

-82.198-

'Routine to move mirrors to X,Y directly 'Note: X,Y can.be any kind of variable, we change 'to integers .

•and get qi! (for speed: later fixed addrs 5 'routines for each)

I

MoveBeam:

IF xf>65534 THEN xf=65534 0^ ELSEIF xf<0 THEN x!=0 'faster than math expression xf=xf+(xf- 65534) *(xf>65534)+(X END IF hi!=int(xf/256.0) 5 OUT SH301,hi!

OUT SH300,INT(xf-256.0*hi!)

OUT SH302,INP(SH302) AND NOT SHOl 1 for strobe x

OUT SH302,INP(SH302) OR SOI

IF yf>65534 THEN 20 yf=65534

ELSEIF y#<0 THEN yf=o

END IF

YAxisOnly: •

25. hi!=int(yf/256.0) OUT SH301,hi!

OUT SH300,INT(y#-256.0*hi!)

OUT SH302,INP(SH302) AND NOT SH02 '2 for strobe y OUT SH302,INP(SH302) OR SH02

30 ************** ReadJBBoard MACROed ******************** counts = timeouts

OUT SH30C,SensorChannel!(Sensor!)

FOR qq! = 1 TO 15*usec

-82.199-

NEXT qq! 'must wait lOus for EOS to go LO (286 @

'4 us/next!) DO 'then appx llOus for conversion with

'signal •D7 HI DECR counts LOOP UNTIL (INP(SH310)>127) or (countS=0) qi!=INP(SH30C) IF counts = 0 THEN JBError

RETURN

************

* GoodRead * ************

'Enter with ColMax!,j-,sensor!,XSPf() ,y- ,Bkf() , 'Backgr.. , Mn!,St!

GoodRead:

IF display! THEN LOCATE 1,70

PRINT "Sensor f"Sensor!; END IF

FOR i! = 1 TO ColMax! ColWeight (i!)=0 NEXT i!

FOR j! = 1 TO RowMax!

RowWeightf(j!)=0 NEXT j! Xaveragef = 0 Yaveragef = 0 TotWtAvgf = 0 FOR Try! = 1 TO Mn!

IF display! THEN CALL ClearCol(22) TotalWeightf=0 XYweight =0

-82 . 200-

Xweight!=0 Yweight!=0. - xcorner!=XSP!(Sensor!)-((ColMax!+l)/2.0)*st! ycorner!=YSP!(Sensor!)-((RowMax!+l)/2.0)*st! MaxVal! = 0

FOR I!=l TO ColMax!

IF display! THEN CALL ClearCol(ColMax!-I!) X!= xcorner! + I!*st! X#«-ycornerf GOSUB MoveBeam

FOR J!=l TO RowMax! Y!= Y! + st! GOSUB YAxisOnly

i************* ReadJBBoard MACROed ****************** counts = timeouts

OUT SH30C,SensorChannel!(Sensor!) FOR qq! = 1 TO 15*usec

NEXT qq! 'must wait lOus for EOS to go LO (286 @ •4us/next!) DO 'then appx llOus for conversion with signal 'D7 HI DECR counts LOOP UNTIL " (INP(SH310)>127) or (countS=0) qi!=INP(SH30C) IF MaxVal! < qi! THEN MaxVal! = qi! IF counts = 0 THEN JBError

Beam!(i!,j!) = qi! 'full array TotalWeight! = TotalWeight! + qi! 'true totals GϋlWeightf(i!) = ColWeightf(i!) + qi! RowWeight (j!) = RowWeightf(j!) + qi!

IF display! THEN gx! = (3*(ColMax!-I!)+l)*8 gy! = (RowMax!-J!+l)*14 q! = (qi!-(bk (sensor!)-3)/2)/DiscreteBeam!+l

-82 . 201-

IF 9! . > 20 THEN 9! = 20 IF TextDisplay! THEN

LOCATE RθWMax!-J!+l,3*(CθlMax!-l!)+1 IF lnt(qi!)=0 THEN PRINT " +"; ELSE PRINT USING » fff » ;INT(qi!)

ELSE FOR cc!=l TO q!

CIRCLE (gx!,gy!) ,cc! NEXT cc! END IF

END IF

IF qi! >+ Bkf(sensor!) THEN 'no background for centering

XYweightf= XYweightf+ qi! Yweightf = Xweightf + Xf*qi!

Yweightf = Yweightf + Yf*qi! END IF

•IF qi! = 0 THEN qi! = .5 row/col? •PRINT fl ,mid$(" .io!0f§**********",int (2+log(qi!)),l);

•or contours NEXT J! Xf=xcornerf GOSUB MoveBeam Yf=ycorner!

GOSUB MoveBeam 'scan around the corners .... NEXT I! IF XYweight! <> 0 THEN

Xaverage! = Xaverage! + Xweight!/XYweightf Yaveragef = Yaveragef + Yweightf/XYweightf END IF

TotWtAvgf = TotWtAvgf + TotalWeightf - Background! (sensor!)

NEXT Try! Xaveragef = Xaverage#/Mn! Yaveragef = Yaveragef/Mn%

SUBSTITUTE SHSET

-82 .202-

TotWtAvg! = TotWtAvgf/Mn!

Powerf(sensor!)=TotWtAvgf*SensorCalibf(Sensor!,3)

RETURN

*******************************************************

MISCELLANEOUS FUNCTIONS *******************************************************

HARDWARE ROUTINES

10. ***********

* IOSetup * ***********

IOSetup:

CALL Center("— Resetting Hardware ".25)

15 OUT SH303,SH88 •control byte of XY JB Board; A,B out, 'C 1/2 in 1/2 out S Thermistor Board •same

X!=XRestf Yf=YRestf

2.0: GOSUB MoveBeam GOSUB MoveBeam TableAddr!=800

CONTROL = 96' = 64+32 is the normal state of the Control Byte

25 CRASH = 4' bit 2 mask for Control Byte INTACK = 8' bit 3 mask for Control Byte IDBREADY = 16' bit 4 mask for Control Byte FAULT = 32' bit 5 mask for Control Byte ZINTERRUPT = 64' bit 6 mask for Control Byte

3D " RECEIVED = 128' bit 7 mask for Control Byte STOPPED = 2 * mask for Status Bit 1 LOADRDY = 4 r mask for Status Bit 2 MESSAGE = 8 » mask for Status Bit 3

-82 .203-

OUT TableAddr!+l, ( CONTROL OR CRASH ) Control Bit 2 high OUT TableAddr!+l, ( CONTROL AND NOT CRASH ) Control

Bit 2 low '

RAH: Do we need delay?

I

FOR qq = 1 TO 500

FOR qq! = 1 TO 1000*usec 'wait for BMA ?how long :; NEXT qq! NEXT qq OUT TableAddr!+l, ( CONTROL AND NOT FAULT ) Control

Bit 5 low OUT TableAddr!+l, ( CONTROL OR FAULT ) Control Bit 5 high

I

' RAH: Do we need delay?

I

FOR qq = 1 TO 500 FOR qq! = 1 TO 1000*usec

NEXT qq! NEXT qq cmd$="E 01 MN A.3 VI " 'defines acceleration S velocity throughout " GOSUB SendTableText cmd$="E 00 MN A.3 VI.5 " 'defines acceleration S velocity throughout GDSUB SendTableText RETURN

SUB ReadJBBoard(channel!) ' and return value qi! of Intensity

SHARED) usec,qi! counts = timeouts

OUT SH30C,channel! 'automatic strobe ? FOR qq! - 1 TO 15*usec

-82.204-

NEXT qq! 'must wait lOus for EOS to go LO (286 §

'4us/next!) DO - 'then appx llOus for conversion with

'signal 'D7 HI

DECR counts LOOP UNTIL (INP(SH310)>127) or (countS=0) qi!=INP(SH30C) IF counts = 0 THEN JBError ND SUB

• SCREEN AND KEYBOARD ROUTINES

PrintPowerPos:

CALL ClearLine(23)

LOCATE 23,10,0

PRINT (Sensor !";sensor!;"Power";

PRINT USING"###.#";Powerf(sensor!) ; PRINT" W, "; 'or for other pinholes

PRINT "Center";

CALL. PrintX (XSPf(Sensor!) ,YSP!(Sensor!)) RETURN;

Printlnfo: LOCATE 3,71

PRINT "Power";

LOCATE 4,69

PRINT USING "###.# mW";Power (sensor!) ;

LOCATE 6,71 PRINT "Center";

LOCATE 7 68

CALL PrintXY(XSPf(Sensor!) ,YSPf(Sensor!))

LOCATE 18,71

PRINT "Maximum"; LOCATE 19,72

-82 . 205-

PRINT MaxVal!; RETURN

PrintTitle: SCREEN 0,0,0 CLS

CALL Center("BEAM, V"+Version$,l)

CALL Center("3D SYSTEMS SLA-1 STEREOLITHOGRAPHY

SOFTWARE",2) RETURN

SUB PrintXY(xf,yf) LOCAL s$,i$ s$ = »("+Mid$(Str$(Int(xf)),2)+","+Mid$(Str$(Int(y!)) ,

2)+")" IF Len(s$)<12 THEN i$ = StringS(6-Int(Len(s$)/2) ," ") PRINT LeftS(i$+s$+" ",13); END SUB

SUB ClearLine(ϋ)

SHARED blankS

LOCATE i!,l PRINT blankS; END SUB

SUB Center(t$,num!) SHARED BlankS LOCATE num!,l,0 PRINT BlankS;

LOCATE num!,40-Len(t$)/2 PRINT t$; END SUB

SUB WaitKey SHARED BlankS

CALL Center("<Hit any key to continue>",25) DO

-82 . 206-

LOOP UNTIL InKeyS <> "" LOCATE 25,1,0 PRINT BlankS;- END SUB

SUB Pause

SHARED usec,ch$ LOCAL iS i!S " =- 30000*usec DD Deer is ch$ = UCaseS(InKeyS) LOOP UNTIL (iS=0) OR (ch$<>"") END SUB

SUB FlushKey WHILE InKey$<>"" WEND END SUB

SUB ClearCol(coϋ) SHARED, TextDisplay! IF (col! > 0) and (TextDisplay! = 0) THEN col2.!r = (col!-l)*24-4 IF COl2!<0 THEN Cθl2! = 0 LINE (Cθl2!,0)-(col2!+23,330) ,0,BF END5 IF END, SUB

FILE ROUTINES

DEF FN~GetFileLine$(FileNum!) LOCAL TempS TryAnotherLine:

IF EOF(FileNum!) THEN BadFormat

-82.207- LINE INPUT !FileNum!,Temp$ IF LEN(Temp$)=0 OR LEFTS(TempS,1)="!" THEN

TryAnotherLine FN ' GetFileLine$=TempS END DEF

1 ERROR ROUTINES

SUB Abort SHARED terminate!,BlankS

LOCAL ch$

CALL Center("Do you really want to abort (Y or N)? » ,25)

DO ch$ = UCaseS(InKeyS)

LOOP UNTIL (ch$="Y") OR (ch$="N")

IF ch$ = "Y" THEN terminate! = 1

LOCATE 25,1,0

PRINT BlankS; END " SUB

CantOpen:

CALL SystemError("Can't open "+FileName$+" file!") END

BadFormat: CALL SystemErrorS("Invalid format for "+FileName$+" file!") END

JBError:

CALL Center("JB Board I/O Timeout Error, Aborting Beam Program",24) CALL WaitKey CLS

-82 . 208- END

I

' " Remove excess quote marks around string

I DEF FN NoQuotesS(TextS) LOCAL S,E S = 1

IF LEFT$.(Text$,l)=CHR$(34) THEN S=S+1 E =-LEN(T ' ext$-)+l IF RIGHT$(Text$,l)= CHR$(34) THEN E-E-l FN NoQuotesS = MID$(TextS,S,E-S)

END DEF

SUB SystemError(Text$)

PRINT TextS OPEN "C:\SYSTEM.ERR" FOR OUTPUT AS #9

PRINT !9,"BEAM: ";Text$

CLOSE #9 END SUB

■ ******************************************************* ' END OF BEAM.BAS

' *******************************************************

-82 . 209-

CLIFF, Control Laser Instrument From File for 3D Systems Sterolithography System Version 2.60 by Tarnz Technologies

CLIFF reads simple (X,Y) laser position commands from a file and controls the laser mirrors using the LASER background process. Please see the MRCLIFF program for details on the commands and their arguments.

The command line for cliff takes the form:

CLIFF <datafile> [/options]

where <datafile> is the name of the data file containing the laser control information, and /options are any number of user-selectable options:

/S - show laser control information /W - wait for laser idle at end -/T - transparency mode (no CLIFF text)

CLIFF can perform the wait-for-idle function (/W option) without having any data file or commands to execute. CLIFF /W and CLIFF /W/T (transparent) will make CLIFF wait for the background task to idle.

<datafile> can be replaced by a sequence of direct commands by preceding the commands with a ' , ", or @ character. A semicolon can be used to separate commands. As many commands as will fit on one line can be specified. In the following example, the block mode is turned on and the laser beam moved:

CLIFF MD BL +; JX 1000; JY 2000; NX 4000; NY 5000; EC

-82.210-

If CLIFF is called up with no arguments, it will prompt with .

Enter file name: _

at which point the operator should enter the name of the data file containing CLIFF-compatible commands. Direct commands can be entered here if preceded by a special character as described above.

} {Recent History:

8/18/87 Ver 2.02 CLIFF Version 2.00 released interfaces with memory resident STEREO device driver

8/22/87 Ver 2.03 /NVC changed to /NC for no version check

8/25/87 Ver 2.04 only updated version number

9/23/87 Ver 2.12 added MinSystemVersion check

9/30/87 Ver 2.25 only updated version number

11/12/87 Ver 2.30 first Beta software release 12/09/87 Ver 2.40 upgraded to Turbo Pascal Version 4 different STEREO-installed check

1/25/88 Ver 2.60 version update only

} uses Dos,Crt;

type strl6 = string[16]; strSO = string[80] ; str255 = string[255] ;

vaar ch,key: Char;

Line,tem ,cmd: str255;

StereoVersion: str16;

-82 . 211- count,i,re line,Er,OpNu ,code: Integer; Format,LineCount,IOerr: Integer ErrorFile,InputFile: text;

VersionCheckFlag,TransparentFlag,WaitForIdleFlag: Boolean;

ShowData,ErrorOpen,Abort: Boolean; regs: Registers;

const

ThisCliffVersion = '2.60'; MinSystemVersion = '2.40'; CtrlC = !3; sp40 =

_LASERVECTOR = $64; _STEREOVECTOR = $65;

label ExitProgram;

function upper(text: str255) : str255; var i: Integer; temp: str255; begin temp := text; for i := 1 to length(temp) do temp[i] := upcase

(temp[i] ; upper := temp; end;

function many(Ch: Char;num: Integer): str255; var temp: str255; i: Integer; begin temp := ' • ; for i:=l to num do temp := temp+Ch; many := temp;

-82 .212- end;

procedure ReadCommandLine(var line: string) ; var " i: Integer; 5 begin line := ParamStr(l) ; for i:=2 to ParamCount do line := line + • ' + ParamStr(i) ; end ' ;;

lT procedure print(text: str255) ; begin if not TransparentFlag then write(text) ; end;

procedure println(text: str255) ; 15 begin if not TransparentFlag then writeln(text) ; end;

function IntStr(num: Integer): strl6; var 20 temp: striβ; begin if num>=0 then Str(num,temp) else Str(num+$8000,temp) ; IntStr := temp; 25 end;

function LaserOk: Boolean; type

CopyType = array[1..20] of char; var 3SX CopyPtr: CopyType; CopyStr: string[20]; begin

-82 . 213- with regs do begin

AX := ($35 shl 8) or _LASERVECTOR; Intr($21,regs) ; CopyPtr := Ptr(ES,BX-19) ; end; move(CopyPtr A [1] ,CopyStr[1] ,18) ; CopyStr[0] := !18; LaserOk := (CopyStr = Tarnz Technologies ) ; end;

function LaserPresent: Boolean; begin if LaserOk then LaserPresent := true else begin LaserPresent := false; writeln(•LASER system not installed.'); end; end;

function StereoOk: Boolean; type CopyType = array[1..20] of char; var

CopyPtr: A CopyType; CopyStr: string[20]; begin with regs do begin

AX := ($35 shl 8) or _STEREOVECTOR; Intr($21,regs) ; CopyPtr := Ptr(ES,57) ; end; move(CopyPtr A [l],CopyStr[1],18) ; CopyStr[0] := #18; if CopyStr = 'Tarnz Technologies' then begin StereoOk := true; with regs do CopyPtr := Ptr(ES,30) ;

-82 . 214- move(CopyPtr Λ [l] ,StereoVersion[l] ,4) ; StereoVersion[0] := f4; -end else begin StereoOk := false; StereoVersion := '?.??'; end; end; function stereoPresent: Boolean; begin if StereoOk then StereoPresent := true else begin StereoPresent := false; writel (*STEREO driver not installed.*); end; end;

procedure Error(text: str255) ; begin if whereX > 1 then println(' •) ; if LineCount=0 then println(•*** '+text) else println('*** '+text+ « in line '+IntStr (LineCount)) ; if not ErrorOpen then begin rewrite(ErrorFile) ; ErrorOpen := true; end; writeln(ErrorFile,text) ; end;

procedure DescribeError(Er: Integer) ; begin case Er of 0: ;

1: Error('1. Laser interface card not found•) ; 2: Error(•2. Laser channel not open') ; 3t Error('3. Background Command Queue full timeout' ) ;

-82 . 215-

4: Error('4. Invalid interrupt time');

5: Error( '5. Not in block mode') ;

6: Error('6. Exec Queue limit timeout');

127: Error('127. Bad SIH command parameter'); 128: Error('128. Unrecognized STEREO command');

255: Error('255. Internal error (please report)'); else Error(IntStr(Er)+' . Unrecognized SIH error'); end: end;

{

Pass Command on to Memory Resident Portion

}

procedure StereoCommand(line: str255) ; begin if (length(line)>0) and (line[l]<>' ! •) then with regs do begin line := line + chr(0) ; { end-of-line } AX := $00; { for future expansion ) BX := Ofs(line)+l; { pass pointer to string ) ES := Seg(line) ; Intr(_STEREOVECTOR,regs) ; end; if regs.AL>0 then DescribeError(regs.AL) ; end;

procedure ProcessFile; begin if not ShowData then begin println( ' ') ; print('0 lines'); end; while not eof(InputFile) and not Abort do begin readln(InputFile,Line) ; if ShowData then println(Line) ;

-82 .216-

LineCount := LineCount+1;

StereoCommand(Line); if not TransparentFlag then if not ShowData then if LineCount mod 25=0 then begin gotoxy(l,whereY) ; print(IntStr(LineCount) ) ; end; if: keypressed then begin key : =ReadKey; if key in [CtrlC, 'A' , 'a'] then Abort := true; end; end; {not eof) if not (TransparentFlag and ShowData) then begin gotoxy(l,whereY) ; println(IntStr(LineCount)) ; end; if Abort then begin

Error(*Control Process Aborted•) ; while keypressed do key := ReadKey; end; {if Abort} end;

procedures CheckForOptions(var str: str255) ; var i: integer; begin while (length(str)>1 and (str[l]=' ') do delete

(str,1,1); i := pos('/S' ,upper(str)) ; { show input file lines } if i>o then begin

ShowData := true; delete.(str,i,2) ; end;; i :?= poαsC'/W' ,upper(str) ) ; { set wait for idle flag } if i>0 then begin

-32 . 217-

WaitForldleFlag := true; delete(str,i,2) ; end; i := pos( '/T' ,upper(str) ) ; { set transparency flag } if i>0 then begin

Transparentflag := true; delete(str,i,2) ; end; i := pos(*/NC ,upper(str) ) ; { no version check } if i>0 then begin

VersionCheckFlag := false; delete(str,i,3) ; end; end;

procedure CliffHeader; begin writeln; writeln(!213,many(!205,52) ,!184) ; writeln(!179, • CLIFF, Control Laser Instrument From File Program • , l79); writeln( 179, • 3D Systems Laser Sterolithography

System \fl79) ; writeln(f179, • Version * ,ThisCliffVersion, ' by Tarnz Technologies November 19 writeln(f212,many(f205,52) ,fl90) ; writeln; end;

begin ReadCommandLine(cmd) ;

LineCount := 0;

Abort := false;

WaitForldleFlag := false;

TransparentFlag := false; ErrorOpen := false;

-32. 218-

ShowData := false; VersionCheckFlag := true;

{ ***** check for memory resident STEREO device driver }

Assign(ErrorFile, 'CLIFF.ERR') ; {$1-} { erase error file if it exists } Erase(ErrorFile) ;

($1+)

IOerr := IOresult; { clear I/O result }

CheckForOptions(cmd) ;

if not TransparentFlag then CliffHeader; if not ( LaserPresent and StereoPresent) then goto

ExitProgram; if VersionCheckFlag then if SteveoVersion < MinSystemVersion then begin writeln(Obsolete STEREO in use.'); goto ExitProgram; end; if length(cmd)=0 then begin write('Enter file name: •) ; readln(cmd) ;

CheckForθptions(cmd) ; end; if (length(cmd)>l and (cmd[l] in [•§',"",""]) then begin { handle direct commands} cmd := copy(cmd,2,199) ; StereoCommand(c d) ; end else begin

{ handle commands from a file } if length(cmd)>0 then begin

-if pos(' . • ,cmd)=0 then cmd := cmd + '.DAT': assign(InputFi1e.cmd) ;

{$I-> reset(InputFile) ;

-82 . 219-

IOerr := IOresult;

{$1+} if IOerr <> 0 then

Error('I/0 Error "+IntStr(IOerr)+' opening file > +cmd) else begin ProcessFile; close(InputFile) ; end; end; end; if WaitForldleFlag then StereoCommand( 'WI 1000');

ExitProgram:

{$1-} close(InputFile) ; close(ErrorFile) ;

($1+) end.

FRONT; Simple Front End Program

for 3D Systems' Laser Controller Software

Version 2.60 by Tarnz Technologies

This program, FRONT, is primarily a debugging tool used by Tarnz Technologies in developing the machine language laser controller and software interface. Along with LASER.INC, the laser controller library, this program serves as an example for interfacing the laser control with a high-level language. The machine language routines were written language-independent - BASIC and C programs can be written to perform the same tasks embodied here. Turbo Pascal was chosen for development because of its compile speed.

-82.220-

This program allows the user access to all the software interface routines. Of course, any consumer- oriented program would only use those software interrupt routines it needs and would certainly work on a more general basis.

==}

History: 8/18/87 Ver 2.02 FRONT released very similar to versions 1.20 on

8/22/87 Ver 2.03 version number updated only

8/25/86 Ver 2.04 version number updated only

9/23/87 Ver 2.12 added MinSystemVersion (nop)

9/30/87 Ver 2.25 only updated version number

11/12/87 Ver 2.30 first Beta software release

12/09/87 Ver 2.40 upgraded to Turbo Pascal Version

.0

12/23/87 Ver 2.41 show control word fixed

1/25/88 Ver 2.60 version update only }

uses Dos,Crt;

{($3i laser,inc} { include laser interface library }

type strlβ = string[16]; 5 str80 = string[80];

BitArray = array[0..15] of Word;

var chι„key: Char; done: Boolean; ? Line,temp: str80; i,num.remline,Er,OpNum,cod : Integer;

-82.221- const

ThisFrontVersion = '2.60'; MinSystemVersion = '2.30'; HexDigits: strlβ = '012345689ABCDEF' ; sp40 =

Indentl = 4; Indent2 = 41; AllBits = $FFFF; BitValue: BitArray = ($0001, $0002, $0004, $0008, $0010, $0020, $0040, $0080, $0100, $0200, $0400, $0800, $1000, $2000, $4000, $8000);

function many(Ch: Char;num: Integer) : String; var temp: String; i: Integer; begin temp := ' • ; for i:=l to num do temp := temp+Ch; many := temp; end;

procedure beep; begin sound(1000) ; delay(500); NoSound; end;

procedure centerln(text: str80) ; begin gotoxy( (80-length(text) ) div 2,whereY); writeln(text) ; end;

procedure DrawBox(xl,yl,x2,y2: Integer);

—82.222— var i: Integer " : begin gotoxy(xl,yl) ; write(f218); for i:=xl+l to x2-l do write(f196) ; write(f191) ; for i:=yl+l to y2-l do begin gotoxy(xl,i) ; write(#179) ; gotoxy(x2,i) ; write(!179) ; end? gotoxy(xl,y2) ; writ (!192) ; for i:=xl+l to x2-l do write(!l96) ; write(!217) ; end;

procedure LaserOk; begin if LaserOk then writeln(•Lasersystem installed. ') else writeln('Laser system not installed.'); end;

procedure OpenLaser; var

Ticks: Word; begin write(*Ticks: ') ; readln(Line) ; val(Line,Ticks,code) ; if code=0 then Er := OpenLaser(Ticks) ; end;

procedure CloseLaser; begin

SUBSTITUTE SHEET

— O -i . 4 B->

Er := CloseLaser; end;

procedure parse(var num: Real) ; begin val(temp,num,code) ; temp "= copy(temp,code+1,99); end;

procedure DoBox; var iter,step: Word; begin write(•Enter step rate: ') ; readln(temp) ; val(temp,step,code) ; iter := trunc(65536.0 / step -1) ; step := step * 256; writeln(step, * ' ,iter) ; { Er := AddVector(0,0,step.step,iter) ;} repeat . Er := AddVector(0,0,step ,0,iter) ; until Er=0; repeat

Er := AddVector(65535,0,0,step,iter) ; until Er=0; repeat

Er := AddVector(65535,-step,-step,0,iter) ; until Er=0; repeat

Er := AddVector(0,65535,0,-step,iter) ; until Er=0: end;

procedure AddVector; var startX,startY,deltax,deltaY,incr: Real;

-82.224- begin writeln(•Enter startX,startY, deltaX, deltaY, # of steps: ') ; readln(temp) ; if (length(temp)>0) and (upcase(temp[l]='B') then DoBox else begin parse(startX) ; parse.(startY) ; ' parse(deltaX) ; parse(deltaY) ; parse(incr) ;

Er := AddVector(trunc(startX) ,trunc(startY) , trunc(deltaX*256) ,trunc(deltaY*256) , trunc(incr)) ; writeln(* (' ,trunc(startX) , ' , * ,trunc(startY) , ') [' ,

trunc(deltaX*256) , • , ' ,trunc(deltaY*256) , •] • , trunc(incr) ) ; end; end;

procedure AddOpenShutter; begin.

Udm. := AddOpenShutter; - endS-

procedure AddCloseShutter; begin

Er := AddCloseShutter; end;

: procedure AddChangeTimebase; begάar, write('Enter new Time Base: ') ; readln(Line) ; val(Line,num,code) ;

-82.225- if code=0 then Er := AddChangeTimebase(num) ; end;

procedure AddPause; begin write('Enter # of ticks to pause: '); readln(Line) ; val(Line,num,code) ; if code=0 then Er :=AddPause(num) ; end;

procedure ResetCmdQueue; begin

Er := ReserCmdQueue; end;

procedure GetCmdQueueSize; var size: Word; begin

Er := GetCmdQueueSize(size) ;

•write('CommandQueue Size =',size,' bytes (',#126); size := size div _PACKET_SIZE; write(size, ' ') ; if sizeol then write(•entries') else write('entry•) ; writeln(•)•); end;

procedure GetlntNum: var num: Word; begin Er := GetlntNum(num) : writeln( •Software Interrupt Number is ' ,num) ; end;

-82.226- procedure GetBkgndTime; var time: Word;, begin Er := GetBkgndTime(time) ; writeln('Background Interval Time is *,time, ' (• ,trunc (time/1.19) , •us) ') ; end;

procedure GetControlWord; var bit: Integer; Ctrl: Word; begin

Er := GetControlWord(Ctrl) ; write(•Control word is •) ; bit := 15; repeat if (Ctrl and BitValue[bit])=0 then write(O) else write('l') ; if bit=8 then write(• •); bit := bit-1; until, bit<0; writeln; end;

procedure SetlnNum; begin write('Enter new Software Interrupt Number:'); readln(Line) ; vseLL(Line,num,code) ; if 5 code=0 then Er := SetlnNum(num) ; end;;

procedure SetBkgndTime; begin write('Enter new Background Interval time: ') ;

-82.227- readln(Line) ; val(Line,hum,code) ; if code=0 then Er := SetBkgndTime(num) •; end;

procedure SetControlWord; var bit: Word; begin write( 'Set/Clear which bit?') ; readln(Line) ; if length(Line)>0 then begin val(copy(Line,2,99) ,bit,code) ;

Er := AlterControlWordBit(Line[1] ,bit) ; end; end;

procedure Execute; begin

Er := Execute; end;

procedure ExecuteClear; begin

Er := ExecuteClear; end;

procedure Clear; begin

Er := Clear; end;

procedure AskExit; begin write('Are you sure (Y/N)?'); readln(Line) ; if upcase(Line[l]='Y' then done := true;

-82.228- end;

procedure Command; begin ClrScr; done := false; repeat Er := Q; £ LaserOk then if: ^GetBkghdIdleStatus then write('-•) else write(•*'); write('FRONT> » ) ; readln(Line) ; if length(Line)>0 then case upcase(Line[l] of A : LaserOk; 'E'^QV'X 1 : AskExit; else begin val(Line,OpNum,code) ; case OpNum of 0: Open Laser; l: CloseLaser;

20: AddVector; 21: AddOpenShutter; 22: " AddCloseShutter; 23: AddChangeTimebase; 24: AddPause;

3: ResetCmdQueue; 4: GetCmdQueueSize; 50: GetlntNum; 51: GetBkgndTime; 52: GetControlWord;

60: SetlntNum; 6:1.:; SetBkgndTime; 62::: SetControlWord; 70: Execute; 71: ExecuteClear;

72: Clear;

-o 2 . 62 -1 — end: {case OpNum) end;{begin} end; {case Line[1] } if Er>0 then begin beep; writeln(•Error - ',Er); end; until done; end;

procedure menuln(indent: Integer;text: str80) ; begin gotoxy(indent,whereY) ; writeln(text) ; end;

begin

ClrScr; centerln('3D Systems Laser Controller Simple Front

End') ; centerln('Version '+ThisFrontVersion+* by Tarnz Technologies December 1987*); writeln; centerln(many(f196,12) ) ; writeln; remline := whereY; menuln(Indentl, A. Laser Installed Check'); menuln(Indentl, 0. Open Laser Channel•) ; menuln(Indentl, 1. Closer Laser Channel') ' menuln(Indentl, 20. Add Vector to Command Queue'); menuln(Indentl , 21. Add Open Shutter Command') ; menuln(Indentl, 22. Add Closer Shutter Command'); menuln(Indentl, 23. Add Change Time Base Command') ' menuln(Indentl, 24. Add Pause Command'); menuln(Indentl, 3. Reset Command Queue') ; menuln(Indentl, 4. Get Command Queue Size*); gotoxy(Indent2,remline) ;

-82.230- menuln(Indent2, '50. Get Software Interrupt Number 1 ); menuln(Indent2, '51. Get Background Interval Time'); menuln(Indent2, '52. Get Laser Control Word'); menuln(Indent2 , '61. Set Background Interval Time'); menuln(Indent2 , '62. Set Laser Control Word•) ; menuln(Indent2, '70. Execute') ; menuln(Indent2, '71. Execute and Clear'); menuln(Indent2, •72. Clear'); menuln(Indent2, • X. Exit') ;

10. wr±teln-;-

DrawBox(l,18,80,24) ; window(3,19,78,23) ; Command; window(l,l,80,25) ;

15 ClrScr; end.

LASER.INC

StereoLithography Laser Controller Software Interrupt 20 Interface Routines for 3D Systems, Inc. Version 2.60 by Tarnz Technologies

Th ϋ purpose of these routines is to interface general- purpose Turbo Pascal programs with the memory resident 25 laser controller software. The machine language-based laser controller software the routines below interface to can be used with other languages like Basic, C, and 8086 Assembly Language.

Turbo Pascal was chosen because of its development 30 environment and low source-to-executable-object code turnaround time. As development progresses and there is nα longer a great need for a fast development environment, these routines should be adapted to C to

-82 . 231- maintain project software consistency. Turbo C and Microsoft C are the leading choices for C languages.

Below is a list of the routines in this include file. Most of the functions relate directly to specific software interrupt calls. The Code is the related interrupt's AX (AH,AL) value. Some of the interrupt functions require arguments to be passed in other registers, and some will return results. See the actual routines for more details on the interface protocol.

Pascal Function Code Description

LaserOk see if laser software is installed

LaserPresent tell if laser software not installed

_OpenLaser 00 — open laser DAC channel and initialize

CloseLaser 01 — close laser DAC channel and restore system

02 xx add command to background command queue

.AddVector 02 00 add vector command

_AddOpen Shutter 02 01 add open shutter command

_AddCloseShutter 02 02 add close shutter command

.AddChangeTimebase 02 03 add change time base command

_AddPause 02 04 add pause command

_ResetCmdQueue 03 — reset background command queue

GetCmdQueueSize 04 — get background command queue size

05 xx get option

GetlntNum 05 00 get software interrupt vector number

_GetBkgndTime 05 01 get background task interval time

-82.232-

_GetControlWord 05 02 get laser control word AutoShutterModeOn 05 02 get status of auto shutter mode

PosAckModeOn 05 02 get status of position acknowledge mode

_BlockModeOn 05 02 get status of block mode

_GetStatus 05 03 get laser status

_GetOpenStatus 05 03 get laser channel open status

10. GetBkgndIdleStatus05 03 get background idle status GetTurnOffDelay 05 04 get laser turn-off delay GetTurnOnDelay 05 05 get laser turn-on delay GetHomePosition 05 06 get laser home position

06 xx set option

15 SetlntNu 06 00 set software interrupt vector number SetBkgndTime 06 01 set background task interval time SetControlWord 06 02 set laser control word

20 (general)

SetAutoShutMode 06 02 set laser control word, bit

0

SetPosAckMode 06 02 set laser control word, bit

25 SfetBlockMode 06 02 set laser control word, bit

2 06 03 SetTurnOffDelay 06 04 set laser turn-off delay setTurnOnDelay 06 05 set laser turn-on delay

30 SetHomePosition 06 06 set last home position

07 xx background task execution control

Execute 07 00 execute command queue to current point and stop

355 FxecuteClear 07 01 execute command queue to current point, stop, and

-82.233-

Clear 07 02 clear command queue (reset queue's start pointer)

08 XX background task redraw control

SetStepPeriods 08 00 set multi-pass step periods

SetRedrawCount 08 01 set redraw pass count

SetRedrawDelay 08 02 set redraw delay

Mark 08 03 mark redraw start position

Redraw 08 04 perform multi-pass redraw

} const LASERVECTOR = $64; { Interrupt vector alternative

{ values: $60 through $67.

PACKET SIZE 13; { length of vector packet

_0K 0;{ Errors returned by Level Zero }

_INTERNAL_ERROR 255;

_MINIMUM_TICKS 59; { don't go below 50 us

_LASER__QUEUE_MAX 60000.0 { Laser Queue size

ALLBITS = SFFFF; BITVALUE: array[0]..15] of Word =

($0001, $0002, $0004, $0008, $0010, $0020, $0040,

$0080, $0100, $0200, $0400, $0800, $1000, $2000,

$4000, $8000);

type _strl6 = string[16]; _Str255 = string[255]; _VectorType = record fractX: Byte; { start coordinates

-82.234- startX: Word; fractY: Byte; { fractional portion - 1 byte, should be set to-0 } startY: Word; { integer portion - 2 bytes } deltaX: Integer; { +/- change values in 1/256 units } deltaY: Integer; inert Word { f of increments within vector count : }} endV _StepPeriodsType = record num : Byte; periods: array[0..9] of Word; end;

var IntReg: Registers;

LaserVersion: Strl6;

{

0 LaserOk function check to see if laser controller code has been installed. returns; false if code not installed 5 true if code is installed

EaserVersion contains laser controller version number

}

D: function LaserOk: Boolean; type

CopyType = array[1..20] of char; var

-32 . 235-

CopyPtr: CopyType; CopyStr: string[20] ; begin with IntReg do begin AX := ($35 shl 8) or _LASERVECTOR;

Intr($21, IntReg) ;

CopyPtr :=Ptr(Es,BX-19) ; end; move(CopyPtr A [1] ,CopyStr[1] ,18) ; CopyStr[0] := #18; if CopyStr = 'Tarnz Technologies' then begin LaserOk := true; with IntReg do

CopyPtr := Ptr(Es,BX-46) ; move(CopyPtr A [1] ,LaserVersion[1] ,18) ; LaserVersion[0] := #4; end else begin LaserOk := false;

LaserVersion := •?.??'; end; end;

LaserPresent function same as LaserOk but also prints a message if laser system is not installed.

returns: false if code not installed true if code is installed

}

function LaserPresent: Boolean; begin

-82 .236- if LaserOk then LaserPresent := true else begin LaserPresent := false; writeln('LASER system not installed. •) ; end; end;

OpenLaser(Ticks) function open up laser DAC channel with the background server interrupting every Ticks timer 0 ticks.

Input for timer 0 is a 1.19 MHz clock signal, so if Ticks = 119, the background task would activate once per 100 us; with Ticks = 1190, once per ms; etc.

returns error code

}

function OpenLaser(ticks: Word) : Integer; begin { Min Time CHeck bypassed — BE CAREFUL! ! ! ! ! } { ±£ ticks<119 then ticks := 119; } with IntReg do begin

AX : = $0000;

BX := ticks ; (* trunc(Period*1.19 {MHz}) Intr(_LASERVECTOR, IntReg) ; OpenLaser :=AL; end; end

-82 . 237- CloserLaser function close off laser DAC channel after the background command queue empties. If laser needs to be stopped immediately, ResetVectorPool should be called before this routine.

returns error code

}

function CloseLaser: Integer; begin with IntReg do begin

AX := $0100;

Intr(_LASERVECTOR, IntReg) ; CloseLaser := AL; end; end;

AddVector(startX,startY,deltaX,deltaY,incr) function add the vector to the background command queue. Vector start coordinates are (startX,startY) and their change value is (deltaX,deltaY) . The number of incremental steps in the vector is incr. deltaX and deltaY are in a special format (high byte is +/- integer portion; low byte is 1/256 units) conducive to high-speed DAC updating. See the 3DPC protocol specification for more information.

returns error code

}

SUB S TITUTE SHEET

-82.238- function AddVector (startX,startY:

Word;deltaX,deltaY: Integer; incr: Word) : Integer; var VectorPacket: _VectorType; begin if incr>0 then begin

VectorPacket.fractX := 0; { set up vector packet } VectorPacket.startX :=* startX; " VectorPacket.fractY := 0;

VectorPacket.startY := startY; VectorPacket.deltaX := deltaX; VectorPacket.deltaY := deltaY; VectorPacket.incr := incr; with IntReg do begin

AX := $0200;

ES := Seg(VectorPacket) : { point ES:BX to vector packet } BX := Ofs(VectorPacket) ; Intr(_LASERVECTOR, IntReg) ;

AddVector := AL; end; end else AddVector := 0; endfr - {, —

.AddOpenShutter function add the open shutter command to the background command queue. The shutter will be opened by the background task when it gets to this command in the command queue.

returns error code

SHEET

-82 . 239- function AddOpenShutter: Integer; begin with IntReg do begin

AX := $0201;

Intr(_LASERVECTOR, IntReg) ; AddOpenShutter := AL; end; end;

{ 10. }

AddCloseShutter function add the close shutter command to the background command queue. The shutter will be closed by the background task when it gets to this command in 15 the command queue.

returns error code

>

function AddCloseShutter: Integer; 0 begin with IntReg do begin

AX := $0202;

Intr(_LASERVECTOR, IntReg) ;

AddCloseShutter := AL; 5 end; end;

AddChangeTimebase(Newticks) function add the change time base command to the background 0 command queue.

-82.240-

The timer that awakens the background task will be reloaded with the count of Newticks by the background task when it gets to this command in the command queue.

returns error code

}

function AddChangeTimebase(NewTicks: Word) : Integer; begin with IntReg do begin

AX := $0203; BX := NewTicks;

Intr(_LASERVECTOR, IntReg) ;

AddChangeTimebase := AL; end; end;

{

AddPause(DelayTicks) function add the-pause command to the background command queue. When the background task gets to this command, it will pause for DelayTicks number of time ticks. If the Background Interrupt Time is 119 (100 us) , then a pause of 1 ms will ensue if DelayTicks is 10. Afterwards, background activity resumes.

returns error code

function AddPaus (DelayTicks: Word) : Integer;

SUBSTITUTE SHEET

begin with IntRegdo begin

AX := $0204;

BX := DelayTicks;

Intr(_LASERVECTOR, IntReg) ; AddPause := AL; end; end;

ResetCmdQueue function clear out the background command queue. Usually used as part of an abort procedure. Best when used just before a CloseLaser call.

returns error code

)

function ResetCmdQueue: Integer; begin with IntReg do begin AX := $0300;

Intr-(_LASERVECTOR, IntReg) ; ResetCmdQueue := AL; end; end;

{

GetCmdQueueSize function get" the background command queue's size in actual number- of bytes. Number of vectors is variable but can be estimated by the number returned by this routine / 13.

-82.242- returns error code

}

function GetCmdQueueSize(var size: Word) : Integer; begin with IntReg do begin

AX: :?= $0400; mtr:(_LASERVECTOR, IntReg) ; size := BX; if size<0 then size := size + 65536; GetCmdQueueSize := AL; end; end;

{ GetlntNum(num) function place in num the software interrupt number. Not really important unless we have a software interrupt conflict.

returns error code

}

function GetlntNum(var num: Word) : Integer; begin with IntReg do begin AX := $0500;

Intr(_LASERVECTOR, IntReg) ; num := BL;

GetlntNum := AL; end; end;

T

GetBkgndTime(ticks) function

- place in time the background task interrupt interval time in actual 1.19 MHz tick counts. (119 is 100 us, 1190 is 1 s, etc.)

returns error code

function GetBkgndTime(var ticks: Word) : Integer; begin with IntReg do begin

AX := $0501;

Intr(_LASERVECTOR, IntReg) ; ticks := BX; GetBkgndTime := AL; end; end;

GetControlWord(Ctrl) function place in Ctrl the Laser Control Word showing the status of various hardware and software mechanisms.

word bit description

0 Auto-Shuuter Mode

1 ' Position-Acknowledge Mode

2 Block Mode 3

0 shutter control, 0=open/l=closed

SUBSTITUTE SHEET

-82.244- returns error code

}

function GetControl Word(var Ctrl: Word) : Integer; begin with IntReg do begin

AX := $0502;

Intr(_LASERVECTOR, IntReg) ; GetControlWord := AL; end; end;

AutoShutterModeOn function returns the status of the Auto Shutter Mode (true for on) .

}

function AutoShutterModeOn: Boolean; ) var

Er: Integer; ctrl: Word; begin

Er := GetControlWord(ctrl) ; _AutoShutterModeOn := (ctrl and BITVALUE[0] > 0; endr

PosAckModeOn function returns the status of the Position Acknowledge Mode (true for on) .

-82 . 245-

}

function PosAckModeOn: Boolean; var Er: Integer; ctrl: Word; begin

Er := GetControlWord(ctrl) ; PosAckModeOn := (ctrl and BITVALUE[1] > 0; end;

{

BlockModeOn function returns the status of the Block Mode (true for on) .

}

function BlockModeOn: Boolean: var

Er: Integer; ctrl: Word; begin

Er := GetControlWord(ctrl) ; BlockModeOn := (ctrl and BITVALUE[2] > 0; end;

{

_GetStatus(statusl,status2) function place in statusl and status2 the Laser system's stati of various non-programmable hardware and software mechanisms.

-82.246- word bit description

statusl.0 laser system channel open status statusl.1 laser system software interrupt established (sic) statusl.2 laser system background task in idle state statusl.3-15 status2.0 bit 0 of Port Cl, X and Y-axis

1.0 position acknowledge status2.1 bit 1 of Port Cl, Z-axis position acknowledge status2.2 bit 2 of Port Cl status2.3 bit 3 of Port Cl

15 status2.4-15

returns error code

}

function Getstatus(var statusl,status2: Word)

20 Integer; begin with IntReg do begin

AX := $0503;

Intr(_LASERVECTOR, IntReg) ;

25 statusl :- BX; status2 := CX; GetStatus := AL; end; end;

-. . Δ -i I —

GetOpenStatus function

- tells whether or not the laser system communications channel has been opened and the time tick trap installed. The function returns a boolean value of TRUE if the channel is open.

returns boolean value

}

function GetOpenStatus: Boolean; var

Er: Integer; stati,stat2: Word; begin Er := GetStatus(stati,stat2) ; if Er=0 then GetOpen Status := (stati and BITVALUE[0] > 0 else GetOpenStatus := false; end;

{

GetBkgndldleStatus function tells whether or not the laser system background task is currently in the idle state where no more laser activity can be performed without some more foreground-sourced commands. The function returns a boolean value of TRUE if the background task is idle.

returns boolean value

SUBSTITUTE SHEET

-82.248-

}

function GetBkgndldleStatus: Boolean; var Er: Integer; stati,stat2: Word; begin

Er.- :>— GetStatus(stati,stat2) ; i E2:=0! then. GetBkgndldleStatus := (stati and BITVALUE[2] > 0 else GetBkgndldleStatus := false; end;

GetTurnOffDelay(ticks) function get the idle state's laser turn-off delay in interrupt tick counts.

returns error code

}

functiom GetTurnOffDelay(var ticks: Word): Integer; begin with: IntReg do begin S := $0504;

Iπtr(_LASERVECTOR, IntReg) ; ticks := BX; GetTurnOffDelay := AL; end.;, end;;;

SUBSTITUTE S

-82 . 249-

GetTurnOnDelay(ticks) function get the idle state's laser turn-on delay in interrupt tick counts.

returns error code

}

function GetTurnOnDelay(var ticks: Word) : Integer; begin with IntReg do begin

AX :- $0505;

Int(_LASERVECTOR, IntReg) ; tricks := BX; GetTurnOnDelay := AL; end; end;

{

GetHomePosition(X,Y) function get the idle state's laser home position.

returns error code

}

function GetHomePosition(var X,Y: Word) : Integer; begin with IntReg do begin

AX := $0506;

Intr(_LASERVECTOR, IntReg) ;

X := BX;

SUBSTITUTE SHEET

-82.250-

Y := CX; GetHomePosition := AL;

. end; end;

{

SetlntNum(num) function set the software interrupt number to num. All software interrupt call after this point must use this new interrupt number. The interrupt vector for the old number is restored.

returns error code

}

function SetIntNum(num: Word) : Integer; begin with IntReg do begin

AX := $0600; BL := num;

Intr(_LASERVECTOR, IntReg) ; SetlntNum := AL; end; end;

SetBkgndTime(ticks) f nction set the background task interrupt interval to ticks which has the actual number of 1.19 MHz tick countgs. (119 is 100 us, etc.)

returns error code

SUBSTITUTE SHEET

-82 . 251-

}

function SetBkgndTime(ticks: Word) : Integer; begin if ticks<_MINIMUM_TICKS then ticks := _MINIMUM_TICKS; with IntReg do begin

AX := $0601; BX := ticks; Intr(_LASERVECTOR, IntReg) ; SetBkgndTime := AL; end; end;

{

SetControlWord(ctrl) function set the Laser Control Word to ctrl. It is recommended that most software programs use the AlterControlWordBit and the specific mode set routines which follow.

word bit description

0 Auto-Shutter Mode

1 Position-Acknowledge Mode

2 Block Mode 3 -

4 shutter control, 0=open/l=closed

returns error code

function SetControlWord(ctrl: Word) : Integer;

SUBSTITUTE SHEET

-82.252- begin with IntReg do begin

AX := $0602; BX := ctrl;

Intr(_LASERVECTOR, IntReg) ; SetControlWord := AL; end; end;

AlterControlWordBit(op,bit) function alter the state of the indicated Control Word bit. If op is 'S' or '+' , the bit is set; if op is 'C or '-', the bit is cleared.

returns error code

>

function AlterControlWordBit(op: Char;bit: Word) :

Integer; var Er:- Integer; ctrl: Word; begin

Er := GetControlWord(ctrl) ; if Er=0 then begin if upcase(op) in ['S','+'] then Ctrl := or BITVALUE[bit] else if upcase(op) in ['C','-*] then ctrl := ctrl and ( ALLBITS- BITVALUE[bit] ) ;

Er := SetControlWord(ctrl) ;o end; AlterControlWordBit := Er; end;

SUBSTI

-82 . 253-

SetAutoShutterMode(state) function set the state ('S'or '+' to set, 'C or -' to clear) of the Auto-Shutter Mode.

returns error code

function SetAutoShutterMode(op: Char) : Integer; begin SetAutoShutterMode := AlterControlWordBit(op,0) end;

SetPosAckMode(state) function set the state ('S' or •+• to set, 'C or '-' to clear) of the Position-Acknowledge Mode.

returns error code

)

function SetPosAckMode(op: Char) : Integer; begin SetPosAckMode := AlterControlWordBit(op,1) ; end;

SUBSTITUTE

-82.254-

. SetBlockMode(state) function

" set the state ('S' or '+• to set, 'C or '-• to clear) of the Block Mode where the 07 commands (below are active.

returns error code

}

function SetBlockMode(op: Char) : Integer; begin SetBlockMode := AlterControlWordBit(op,2) ; end;

(

SetTurnOffDelay (ticks) function sets the idle state's laser turn-off delay to ticks interrupt counts, returns error code

} :

fiinct±σn SetTurnOffrDelay ( ticks : Word) : Integer; hescgiir with IntReg do begin

AX := $0604; BX := ticks; " . Intr(_LASERVECTOR, IntReg) ; SetTurnOffDelay := AL; end; end;

mi -. . -L D D

SetTurnOnDelay(ticks) function sets the idle state's laser turn-on delay to ticks interrupt counts.

returns error code

}

function SetTurnOnDelay(ticks: Word) : Integer; begin with IntReg do begin

AX := $0605; BX: = ticks;

Inter(_LASERVECTOR, IntReg) ; SetTurnOnDelay := AL; end; end;

{

SetHomePosition(X,Y) function sets the idle state's laser home position.

returns error code

}

function SetHomePosition(X,Y: Word): Integer: begin with IntReg do begin

AX := $0606; BX := X; CX := Y;

-82 .256-

Intr(_LASERVECTOR, IntReg) ; SetHomePosition := AL; end; end;

Execute function set the background task running. The background task will process those commands added to the command queue from the last Clear Operation up to this Execute call. For the first Execute, then background task will start at the beginning of the queue. New commands can be added to the command queue while the background task is. running.

When the background task is finished processing the current command block, it will automatically shut down, placing the laser beam at the present home position. To make programs written for earlier versions (where the background task free-ran) compatible, Execute, ExecuteClear, and Clear calls (see below) should be used wherever appropriate.

returns error code

}

function Execute: Integer; begin with; IntReg do begin

AX := $0700; Intr(_LASERVECTOR, IntReg) ;

Execute := AL;

SUBSTITUTE SHEET

-82.257- end ; end;

_ExecuteClear function perform the equivalent of the Execute function

(see above) and a Clear function (see below) function. The ExecuteClear function provides a convenient shorthand for:

Er := Execute; Er := —Clear;

returns error code

function ExecuteClear: Integer; begin with IntReg do begin

AX := $0701;

Intr(_LASERVECTOR, IntReg) ; ExecuteClear := AL; end; end;

Clear function clear the command queue. Future Execute and ExecuteClear calls will start the background task processing command queue entries added after the call to this routine. An Execute Operation asked for immediately after a Clear Operation has no effect.

SUBSTITUTE SHEET

-82.258-

If Clear is not called between consecutive

Execute Operations, then background task will reprocess the command queue entries for the first Execute Operation. Sometimes this is desired, and sometimes it isn't.

returns error code

y.

function Clear: Integer; begin with IntReg do begin

AX := $0702;

Intr(_LASERVECTOR, IntReg) ; Clear := AL; end; end;

SetStepPeriods function set.the step periods for the multiple passes. Array contains number of step periods to define (1 to; m y, and the step period values in 0.82 us (1.19 Mlrz}} units.

returns: error code

},

function SetStepPeriods(var sp_array:

_StepPeriσdsType) : Integer; begin with IntReg do begin AX := $0800;

SU

-82 . 259-

ES := Seg(sp_array) ; { point ES:BX to step period array } BX := Ofs(sp_array) ;

Intr(_LASERVECTOR, IntReg) ; SetStepPeriods := AL; end; end;

SetRedrawCount function set the number of passes for the background task's redraw (1-8) .

returns error code

}

function SetRedraw Count(count: Word) : Integer; begin with IntReg do begin

AX := $0801; if count<l then count := 1 else if count>10 then count := 10;

BX := count;

Intr(_LASERVECTOR, IntReg) ; SetRedrawCount := AL; end; end;

.SetRedrawDelay function set the number of timer ticks the background task should delay before starting a redraw pass.

SUBSTITUTE SHEET

-82.260- returns error code

}

function SetRedrawDelay(delay: Word) : Integer; begin with IntReg do begin

AX := $0802 r BX := delay;

Intr(_LASERVECTOR, IntReg) ; SetRedrawDelay := AL; end; end;

{

Mark function marks the current position as the start of the next redraw. Usually only necessary at the beginning of a block.

returns error code

}

function Mark: Integer; begin with IntReg do begin

AX := $0803; Intr(_LASERVECTOR,__IntReg) ; Mark := AL; end; end;

SUB

-82 . 261-

Redraw function causes the background task to perform a multi-pass redraw operation when it is encountered in the Background Command Queue. Redraw also marks so as to minimize use of commands.

returns error code

function Redraw: Integer; begin with IntReg do begin

AX := $0804;

Intr(_LASERVECTOR, IntReg) ; Redraw := AL; end; end;

{ end of LASER, INC } Program SLAGRAPH;

{ 3D Systems SLA Graphics Software

Change Log:

2/16/88 - Original Release

)

{$V-} uses

Crt,Dos,Graph;

const

VERSION : String = 'Test260a'; MAX WORD : Word = 65535;

SUBSTITUTE SHEET

-82.262-

MAX_REAL : Real = 1.7E37; MIN_REAL : " .Real = -1.7E37; ZERO_DEF = 1E-5; ESC : Char = #27; CR : Char = #13; LF : Char = !10; BUF_SIZE = 4095; Spaces : String = MAX_PTR_ARRAY = 16382;

{ ' Slice Constants }

MAX_LAYERS = 16382;

EAYER_SIZE = 16;

MAX_SECTIONS = 5;

SliceBlocks : Array [0..4] of String[3] =

('L', 'FU', 'FD » , 'NFU', 'NFD') ; L_SECTIONS = $0007; LjSECTION = $8000; LB_SECTION = $00011- LH_SECTION = $0002; FU_SECTIONS = $0038; FD_SECTIONS = $01C0; NFU_SECTIONS = $0E00; NFD_SECTIGNS = $7000; FJSECTIONS = $01F8; NF_SECTIONS = $7E00;

{ Triangle Constants }

MAXJTRIANGLES = 10921;

TRIANGLE_SIZE = 10;

ASC_FILE = 1; { File Type Constants }

BINARY_FILE = 2;

ARIES_FILE = 3;

GOOR_CHAR : Array [1..3] of Char = ('X' , 'Y « , 'Z') ;

type

DynamicsLWordArray = Array [0..16382] of Word;

-82 . 263-

DynamicSLLonglntArray = Array [0..16382] of Longint; DynamicTRILongIntArray= Array [0..10921] of Longint; DynamicTRIRealArray = Array [0..6552] of Real; PointerStruct = Array [0..255] of Byte; PointerType = A PointerStruct;

var

Exitsave : Pointer;

HeapTop : Pointer;

InBuffer : Array [0.. ,BBUUIF_SIZE] of Char;

InBufStr : String;

InBufEnd : Integer;

InBufPtr : Integer;

CurrFilePos : Longint;

StartLinePos : Longint;

EndOfFile : Boolean;

FileError : Boolean;

ErrLine : String; ch : Char; re Integer; iw,jw Word;

.Templnt : Integer;

TempByte : Byte;

TempWord - : Word;

TempBoolean : Boolean;

Te pReal : Real;

TempLong : Longint;

TempStr : String;

TempChar : Char;

InputLine : String;

MonoDisplay : Boolean;

GraphDriver, GraphMode: Integer;

SizeX,SizeY : Integer;

AspectRatio : Real

Graphscale : Real;

GraphCenterX,GraphCents .rY : Word;

GrOffsetx,GrOffsetY ,GrCffsetZ : Real;

SUBSTITUTE

-82 .264-

{ Triangle File Global Vars }

TriangleFile . : File; TriangleFi1ename : String; { Filename of Triangle

File }

TriangleFilename : Byte { File Type of Input File

> TrianglePtr A DynamicTRILongIntArray;

{ Pointers to Tria

TriangjeAxisValue A DynamicTRIRealArray; { Z values of each

Tri ' angleNbrmal Array [1..3] of Real;

TriangleVertex Array [1..3,1..3] of Real;

TriangleAttrib Word;

TriangleTotal Longint;

TriangleFileMin Array [1..3] of Real;

TriangleFileMax Array [1..3] of Real;

TriangleSelected Longint;

TriangleSelectStart Real;

TriangleSelectEnd Real?

TriangleSelectMin Array [1..3] of Real;

TriangleSelectMax Array [1..3] of Real;

TriangleWindowingFile Boolean;

TriaήgleAngle Array [1..3] of Byte;

TriangleAxis Byte;

G 3DMat: Array [0..2,0..2] of Real;

TotaJ^Triangles Longint;

{ Slice File Global Vars }

Sl±ceFile : File;

SϋceFilename : String; { Filename of Slice

File } SliceFileXMin,SliceFileXMax : Word; { File Max and Min values } SliceFϋeYMin,SliceFileYMax : Word; SSL ceϋastLayer : Integer; { Pointer to last layer }

SUBSTITUTE SHEET

o - y tz

SliceLayerValue : Λ DynamicSLWordArray; { Layer

Values } SliceLayerPtr : A DynamicSLLongIntArray; {

Pointer to Layer SliceLayerBlocks : A DynamicSLWordArray; { Layer

Blocks } S1iceLayerXMin,

SliceLayerXMax : A DynamicSLWordArray; { Layer

Max and Min SliceLayerYMin,SliceLayerYMax : A DynamicSLWordArray; SliceLayer : Word; { Current Layer }

SliceWindowingFile : Boolean; SliceOutputBlocks : Word; Total_Layers : Longint; {$F+} procedure MainExit: {$F-} begin

{$1-} Close(SliceFile) ; Close(TriangleFile) ; {$1+} RestoreCrtMode; TextBackground(Black) ; TextColor(White) ; ClrScr;

ExitProc:=ExitSave; end;

procedure ProgramError(ErrorLine : String) ; { Print Program Error and exits program } begin

RestoreCrtMode;

TextBackground(Black) ;

TextColor(White) ;

ClrScr; writelnC*** SLAGRAPH ERROR: " ,ErrorLine, • ***'); ch:=ReadKey;

Halt(l) ; end;

procedure Reallocate(ch : Char;Alloc : Longint) ; { Allocates .the array space to suggested number } var

" MemoryAvail : Longint; begin

{ Free Heap }

Release(HeapTop) ;

SliceFilename := • ' ;

TriangleFilename:= ' * ;

MemoryAvail t= MemAvail - 32768;

if ch='S' then begin

{ Don't allow more than machine can handle } if Alloc>MAX_LAYERS then Total_Layers:=MAX_LAYERS else Total_Layers:=Alloc;

{ Make sure you can allocate that many alone. If not, set maximum } if Total_Layers*LAYER_SIZE>MemoryAvail then

Total_Layers:=Round(Memory Avail/L { Given number of Layers, fill rest of memory with

Triangles } Total_Triangles:=Round((MemoryAvail-Total_

Layers*LAYER_SIZE)/TRIANGLE_SIZE) ; if:Tώtal_Triangles>MAX_TRIANGLES then Total_

Triangles:=MAX_TRIANGLES; end else begin

{ Don't allow more than machine can handle} if Alloc>MAX_TRIANGLES then Total_

Triangles:=MAX_TRIANGLES else Total_Triangles:=Alloc; { Make sure you can allocate that many alone. If not, set maximum } if Total_Triangles*TRIANGLE_SIZE>MemoryAvail then

Tαtal_Triangles:=Round(Memo {' Given number of Triangles, fill rest of memory with Layers }

SUBSTITUTE SHE

-82 .267-

Total_Layers:=Round( (MemoryAvail-Total_Triangles*

TRIANGLE_SIZE)/LAYER_SIZE; if Total_Layers>MAX_LAYERS then Total_Layers:= MAX_LAYERS; end;

GetMem(SliceLayerValue,Total_Layers*2) ; GetMem(SliceLayerPtr,Total_Layers*4) ; GetMem(SliceLayerBlocks,Total_Layers*2) ; GetMem(SliceLayerXMin,Total_Layers*2) ; GetMem(S1iceLayerXMax,Total_Layers*2) ; GetMem(SliceLayerYMin,Total_Layers*2) ; GetMem(SliceLayerYMax,Total_Layers*2) ; GetMem(TrianglePtr,Total_Triangles*4) ; GetMem(TriangleAxisValue,Total_Triangles*6) ; Dec(Total_Triangles) ; Dec(Total_Layers) ; end; procedure OutTextLn(aline:String) ; { "writeln" for graphics } begin

OutText(aline) ;

•MoveTo(1,GetY+TextHeight(• •)+2) ; end;

procedure GrTextXY(aline:String;x,y : Byte) ; { writes text at XY char on graphic screen } begin

OutTextXY( (x-1)*(TextWidth( ')+2) , (y- l)*(TextHeight(' ')+2) ,aline) ; end;

procedure ConvertStoR(s,r : PointerType) ;

{ Converts a Single type (4 byte) number to a Real (6 byte) } begin r A [0] :=(((s A [3] shl 8) + s A [2] shr 7) and $FF; r A [l] :=0;

SHEET

— Q -. . 2 θ O — r A [2] :=0; r A [3] :=s A [0] r A [4] :=s A [l] ; . r A [5]:=(s A [3] and $80) or (s A [2] and $7F) ; if r A [0]<>0 then Inc(r Λ [0] ,2) ; { e offset } end;

procedure ConvertRtoS(r,s : PointerType);

{ Converts a Real type (6 byte) number to a Single (4 byte) } var e : Byte; begin e:=r A [0] ; if e<>0 then Dec(e,2) ; { e offset } s A [3]:=(r A [5] and $80) or ((e shr 1) and $7F) ; s A [2]:=((e shl 7) or (r A [5] and $7F)) and $FF; s A [l]:=r A [4]; s A [0]:=r [3]; end;

procedure ToUpper(var aline : String); { Converts a string to upper case } var i : Integer; begin for i:=l to Length(aline) do aline[i] := UpCase(aline[i]) ; end;

procedure Center(str : String;linenum : Byte) ; { Centers text on screen line } begin.

GotoXY(l,linenum) ;

CTrFσl; if: Eength(str)>79 then GotoXY(l,linenum) else GαtoXY(40-(Length(str) div 2), linenum) ;

SUBSTITUTE SHEET

-82 . 269- write(str) ; end;

procedure WaitKey;

{ Waits for a key press while prompting } var ch : Char; begin

Center('<Press any key to continue;*' ,25) ; ch:=ReadKey; end;

procedure SelectTxtColor(select : Integer) ;

{ Sets text color requested or White for non-color displays } begin if MonoDisplay then TextColor (White) else TextColor(select) ; end;

procedure SelectGraphColor(select : Integer) ;

{ Sets graphic color. If black and white, uses dashed lines, etc. } var

LineType : Integer; begin if MonoDisplay then begin

SetColor(White) case select of

1 : LineType:=SolidLn;

2 : LineType:=CenterLn; 4 : begin

LineType:=CenterLn; SetColor(LightGray) ; end; 9 : begin

SUBSTITUTE SHEET

-82 . 270-

LineType:=SolidLn; SetColor(LightGray) ; end; 10 : LineType:=DashedLn; 12 : begin

LineType:=DashedLn; SetColor(LightGray) ; end; ELSE LineType:=CenterLn; end;

SetLineStyle(LineType,0,NormWidth) ; end else SetColor(select) ; end;

procedure PrintHeader;

{ Prints general 3D header at top of screen } begin

TextColor(White) ; if Not MonoDisplay then TextBackground(Blue) else TextBackground(Black) ;

ClrScr;

.Center('3D Systems Graphis Display Program (Version •+VERSION+') ',!) ;

Center(*Copyright (C) 1988 3D Systems Inc',2);

SelectTxtColor(LightGreen) ; end;

procedure PrintsliceHeader;

{ Print Slice Screens header } begin

PrintHeader;

SelectTxtColor(LightRed) ;

Center('Slice File Control Functions',3) ;

TextColor(White) ; end; procedure PrintTriHeader;

{ Print Triangle Screens header }

SUBSTI

-82.271- begin

PrintHeader;

SelectTxtColor(LightRed) ;

Center( 'Triangle File Control Functions',3) ;

TextColor(White) ; end;

function GetFilename(var FileName : String; sel : Integer) : Boolean;

{ Displays file with SLI or STL extensions and allows user to select a file to use. } var

DirRec : SearchRec;

CurrFileName : String;

Extn : String; row,col : Integer; count : Integer; begin if sel = 1 then begin

Extn := '.STL';

PrintTriHeader;

GotoXY(l,6) ; write( 'Triangle') ; end else begin

Extn := '.SLI';

Prints1iceHeader;

GotoXY(l,6) ; write( 'Slice') ; end;

{ Display the entries } write(' Files in current directory:'); row := ό; col := 0; count := 0;

FindFirst( '*'+Extn,AnyFile,DirRec) ; while (DosError = 0) and (count < 75) do begin

SUBSTITUTE SHEET

-82 . 272-

GotoXY(3+col*15.8+row) ; write(Copy(DirRec.name,l,Pos) • . ' .DirRec.name)-1) ) ; col := col- + 1; if col = 5 then begin col := 0; row := row + 1; end;

FindNext(DirRec) ; end;

{; Read the filename } repeat

GotoXY(l,24) ; ClrEol; write('Enter File Name: '); Readln(CurrFilename) ; ToUpper(CurrFilename) ; if CurrFilename <> • ' then begin { Find in directory } if Pos(' . * ,CurrFilename) = 0 then CurrFilename :=

CurrFilename + Extn; if Pos(•*' ,CurrFilename)=0 then begin FindFirst(CurrFilename,AnyFile,DirRec) ; if DosError <> 0 then Center(•****

"•+CurrFilename+" , File Not Found **** end else begin DosError:=1;

CenterC*** No Wild cards allowed ***',25); end; end; until (CurrFilename = ' ') or (DosError = 0) ; if CurrFilename = • • then GetFilename:=FALSE else begin

FileName := CurrFilename; GetFilename:=TRUE; end;; end;

SUBSTITUTE S

_o 077 — procedure ASCError(FileName : String) ; { Prints ASC file error } begin

Str(StartLinePos.TempStr) ;

Center('Error found in Text file "•+FileName+'" at position'+TempStr,23) ; Center( 'Line: '+ErrLine,24); WaitKey; end;

procedure CheckBuffer(var InFile : File) ;

{ Makes sure the input buffer has enough data in it.

If not, it reads more in. } var

NumRead : Word; begin if InBufPtr > InBufEnd-160 then begin { Reload Buffer } if InBufPtr > InBufEnd then InBufEnd := 0 { Buffer

Empty } else begin

{ Buffer almost empty } InBufEnd := InBufEnd - InBufPtr + 1; Move(InBuffer[InBufPtr] ,InBuffer[0] ,InBufEnd) ; end;

{ Fill rest of buffer } if Not Eof(InFile) then BlockRead(InFile,InBuffer

[InBufEnd] ,BUF_SIZE-InBufEnd else NumRead:=0; { Set buffer pointers } if InBufEnd+NumRead=0 then EndOfFile:=TRUE else Inc(InBufEnd,NumRead - 1) ; InBufPtr := 0; end; end; procedure ResetFile(var InFile : File) ; { Resets input file to top of file }

SUBSTI

-82.274- begin

Reset(InFile,1) ;

Seek(InFile,0) ;

CurrFilePos:=0;

InBufPtr := BUF_SIZE+1;

InBufEnd := BUF_SIZE;

EndOfFile:=FALSE;

Eil&Error;=FALSE; end?;

procedure PositionFile(var InFile : File;charnum : Longint) ; { Positions input buffer to specific character of file. If not in buffer reads from file } begin if (charnum>=CurrFilePos-InBufPtr) AND (charnum<= CurrFilePos-InBufPtr+InBufEnd) InBufPtr:=InBufPtr+charnum-CurrFilePos else begin

Seek(InFile,charnum) ; InBufPtr := BUF_SIZE+1; InBufEnd := BUF_SIZE; EndOfFile:=FALSE; end;

CurrFilePos:=charnum; CheckBuffer(InFile) ; end;

procedure ReadLine(var InFile : File);

{ Reads a line from input file into a string } var

CRPos,i i. Integer; begin

InputLiπeε—' ' ; rf (NbtFileError) AND (Not EndOfFile) then repeat CheckBuffer(InFile) ; { Search for CR }

SUBSTITUTE SHEET

-82 . 275- if Not EndOfFile then begin i := InBufEnd-InBufPtr+1; if 1 > 255 then i := 255; InputLine[0] := Char (i) ; Move(InBuffer[InBufPtr] ,InputLine[1] ,i) ; CRPos := Pos(CR,InputLine)-1; if CRPos < 0 then CRPos := length(InputLine) ; InputLine[0] := Char (CRPos) ; StartLinePos:=CurrFilePos; PositionFile(InFile,CurrFilePos+CRPos+1) ; if InBuffer[InBufPtr] = LF then PositionFile (InFile,CurrFilePos+1) ; end else InputLine := ' ' ; until EndOfFile OR (InputLine <> ''); ToUpper(InputLine) ; ErrLine:=InputLine; end;

function ParseLine(var aline : String) : String;

{ Parses first word from string and truncs off from original string } var parsed : String; i,j : Integer; begin i:=l; while (i<=Length(aline) ) AND (aline[i]=' ') do Inc(i) ; if i>Length(aline) then begin aline:=• * ; parsed:=• • ; end else begin j:=i; while (j<=Length(aline) ) AND (aline[j]<>' •) do

Inc(j) ; Move(aline[i] ,Parsed[l] ,j-i) ; parsed[0] :=Char (j-i);

SUBSTITUTE SHEET

if j>=Length(aline) then aline:=* • else begin

Move(aline[j+l] ,aline[l] ,Length(aline)-j; aline[0] :=Char (Length(aline)-j) ; end; end;

ParseLine:=parsed; end;

procedure SetMinMax(var num,min,max : Word) ; { " Updates Min and Max values with given data } begin if num>max then max:=num; if num<min then min:=num; end;

procedure SetGraph;

{ Finds what type of video hardware is installed and picks best graphics screen. Sets screen definition information. } var aspectx,aspecty : Word; begin

DetectGraph(GraphDriver,GraphMode) ; if GraphDriver < 0 then ProgramError('Graphics - +GraphErrorMsg(Graph Driver)) ;

GetModeRange(GraphDriver,Templnt ,GraphMode) ; if GraphMode>3 then GraphMode:=3; { for CGA }

InitGraph(GraphDriver, GraphMode, 'c:\tp') ; re := GraphResult; if re <> GrOk then ProgramError('Graphics - '+GraphErrorMsg(re) ) ; if (GraphDriver <5) or (GraphDriver=8) then MonoDisplay:=FALSE else MonoDisplay:=TRUE;

GetAspectRatio(aspectx,aspecty) ;

AspectRatio := aspectx/aspecty;

SUBSTITUTE SHEET

-82.277-

SizeX := GetMaxX + 1; SizeY := GetMaxY + 1; GraphCenterX:= Round(SizeX/2) ; GraphCenterY:= Round(SizeY/2) ; end;

procedure SetupGraphicW(MinX,MaxX,MinY,MaxY : Word) ; { Sets up graphic vars using Integer(Word) proposed ranges } var scalex : Real; begin

GraphScale:=(SizeX-4)/( (MaxX-MinX)/AspectRatio) ; if Integer (MaxY-MinY)*GraphScale>SizeY then GraphScale:=(SizeY-4)/Integer (Max

GrOffsetX:=MinX+Round( (MaxX-MinX)/2) ;

GrOffsetY:=MinY+Round( (MaxY-MinY)/2) ;

SetGraphMode(GraphMode) ;

SetColor(White) ;

SetBkColor(Black) ;

SetLineStyle(SolidLn,0,NormWidth) ; end;

procedure SetupGraphicR(MinX,MaxX,MinY,MaxY,MinZ,MaxZ : Real) ; { Sets up graphic vars using Real values and assuming rotations } var

RangeX,RangeY,RangeZ : Real; begin

RangeX:=(MaxX-MinX)*1.42; { 1.42 = 1/Sin(45deg) = worst expansion diag } RangeY:=(MaxY-MinY) *1.42; RangeZ:=(MaxZ-MinZ)*l.42; GraphScale:=SizeY/RangeX; if RangeY*GraphScale>SizeY then GraphScale:= SizeY/RangeY;

SUBSTITUTE SHEET

-82 .278- if RangeZ*GraphScale>SizeY then GraphScale:=

SizeY/RangeZ; GrOffsetX:=MinX+(MaxX-MinX)/2; GrOffsetY:=MinY+(MaxY-MinY)/2; GrOffsetz:MinZ+(MaxZ-MinZ)/2; SetGraphMode(GraphMode) ; SetColor(White) ; SetBkColor(Black) ; SetLineStyle(SolidLn,0,NormWidth) ; end;

procedure DrawLine(xl,yl,x2,y2 : Word) ;

{. Draws a line on graphics screen (no rotation) } begin xl:=GraphCenterX+Round(Round(xl-GrOffsetX)*

GraphScale/AspectRatio) ; x2:=GraphCenterX+Round(Round(x2-GrOffsetX)*

GraphScale/AspectRatio) ; yl:=GraphCenterY-Round(Round(yl-GrOffsetY)*

GraphScale) ; y2:=GraphCenterY-Round(Round(y2-GrOffsetY)*

GraphScale) ; Line(xl,yl,x2,y2) ; end;

procedure Compute3D(x,y,z : Real;var new_x,new_z : Integer) ;

{ Maps a 3D point into 2D graphics screen } begin x:=x-GrOffsetX; y:=y-GrOffsetY; new_x " := GraphCenterX + Round(GraphScale*(x*Gr3DMat [0,0]+y*Gr3DMat[l,0]+z *®r3DM

{ Have Y mapping just for reference.

SUBSTITUT

-82 .279- new_ := GraphCenterY - Round(GraphScale*(x*Gr3DMat [0,l]+y*Gr3DMat[l,l]+z *Gr3DM

" ) new_z := GraphCenterY - Round(GraphScale* (x*Gr3DMat [0,2]+y*Gr3DMat[l,2]+z *Gr3DM end;

procedure Draw3D(xl,yl,zl,x2,y2,z2 : Real);

{ Takes 2 3D points and draws line between them } var coorxl,coory1,coorx2,coory2 : Integer; begin

Compute3D(xl,y1 ,z1,coorxl,coory1) ;

Compute3D(x2,y2 ,z3,coorx2,coory2) ;

Line(coorxl,coory1,coorx2,coory2) ; end;

procedure Init3D;

{ Sets up 3D transformation matrix for mapping 3D to 2D } var txy ,txz,tyz : Real; begin txy := TriangleAngle[3]*0.0175; { Z Axis } txz := TriangleAngle[2]*0.0175; { Y Axis } tyz := TriangleAngle[l]*0.0175; { X Axis }

Gr3DMat[0,0] := Cos(txz)*Cos(txy) ;

Gr3DMat[l,0]:= Cos(tyz)*Sin(txy)-Sin(tyz) *Sin(txz) *

Cos(txy) ; Gr3DMat[2,0]:= Sin(tyx)*Sin(txy)-Cos(tyz) *Sin(txz) *

Cos(txy) ; Gr3DMat[0,l]:= Cos(txz) *Sin(txy) ; Gr3DMat[l,l] := Cos(tyz)*Cos(txy)+Sin(tyz)*Sin(txz) *

Sin(txy) ;

SUBSTITUTE SHEET

-82.280-

Gr3DMat[2,l] := Sin(tyz)*Cos(txy)+Cos(tyz)*Sin(txz)*

Sin(txy); Gr3DMat[0,2]:= Sin(txz) ; Gr3DMat[l,2]:= Sin(tyz)*Cos(txz) ; Gr3DMat[2,2] := Cos(tyz)*Cos(txz) ; end;

Start of Main Triangle Routines

}

function FindTriangleLevel(value : Real;highlo : Byte) : Word; { Binary search for value and then file lowest or highest common index } var low,mid,high,index : Word; begin low:=0; high:=TriangleTotal; inde :=MAX_WORD; repeat mid:=(low+high) div 2; if value<TriangleAxisValue [mid] then high:=mid elses if value>TriangleAxisValue A [mid] then low:=mid else index:=mid; until (high-low=l) or (index<MAX_WORD) ; if highlo=l then begin if index=MAX_WORD then inde :=high; while (index>0) and (TriangleAxisValue A [index-l]= TriangleAxisValue A [index]) d end else begin ϋ£ iπdϋex=MAX_WORD then index:=low; while (index<TriangleTotal) and (TriangleAxisValue A [index+1]=TriangleAxisValue end;

SUBSTITUTE

-82 . 281-

FindTriangleLevel:=index; end;

function ReadTriangle : Boolean;

{ Read in one triangles data from.input files current location } var

ParsingLine : String; i,j : Word; begin if TriangleFiletype=ASC_FILE then begin TriangleAttrib:=0;

ReadLine(TriangleFile) ; { FACET NORMAL i j k } TempStr:=ParseLine(InputLine) ;. if TempStr=•END• then begin if ParseLine(InputLine)<>'SOLID' then

FileError:= TRUE; EndOfFile:=TRUE; end else begin if (TempStro•FACET•) OR (ParseLine(InputLine)<>

•NORMAL') then FileError:=T if Not FileError then for i:= 1 to 3 do begin

Val(ParseLine(InputLine) ,TriangleNormal[i] ,rc) ; if rcoo then FileError:=TRUE; end;

ReadLine(TriangleFile) ; { OUTER LOOP } if (ParseLine(InputLine)<>'OUTER') OR (ParseLine (InputLine)<>•LOOP') then

ReadLine(TriangleFile) ; { VERTEX } if ParseLine(InputLine)<>'VERTEX' then

FileError :=TRUE else for j:= 1 to 3 do begin

Val(ParseLine(InputLine) ,TriangleVertex[i,j ] , re) ; if rcoo then FileError:=TRUE;

SUBSTITUTE SHEET

— . . 232 — end; end; - end; - ReadTriangle:=Not (FileError or EndOfFile) ; end else begin

{ A Binary File } for i:=0 to 2 do begin

ConvertStoR(§InBuffer[InBufPtr+i*4] ,§Triangle Normal[i+l]) ; end?; for i:=0 to 2 do for j:=0 to 2 do ConvertstoRΘInBuffer[InBufPtr+ 12+i*12+j*4] ,§TriangleVerte ReadTriangle:=Not EndOfFile; end; end;

procedure GraphTriangles;

{ Graph the selected triangles to screen } var index : Longint; min,max : Real; begin min^MAX^REAL; max : =MIN JREAL ; if TraπgleWindowingFile then

SetupGraphicR(TriangleFileMin[1] ,TriangleFileMax[1] ,

TriangleFileMin[2],TriangleFileMax[2] , TriangleFileMin[3] ,TriangleFileMax[3] , else

SetupGraphicR(TriangleSelectMin[l] , TriangleSelect Max[l],

TriangleSelectMin[2] ,TriangleSelectMax[2] , Triang!eSelectMin[3],TriangleSelectMax[3] , Init3D;

SUBSTITUTE SHEET

-82.283-

GrTextXY('Triangle Filename : '+TriangleFilename,

1,1); .Str(TriangleSelected,TempStr) ;

GrTextXY( 'Triangles Displayed : '÷TempStr,1,2) ; index:=0 repeat if (TriangleAxisValue A [index]>TriangleSelectStart) and (TriangleAxisValue [index]<=TriangleSelectEnd) then begin PositionFile(TriangleFile,TrianglePtr A [index]) ; TempBoolean:=ReadTriangle; if abs(TriangleNormal[TriangleAxis])>l-ZERO_DEF then if TriangleNormal[TriangleAxis]>0 then

SelectGraphColor(LightGreen) {FU} else SelectGraphColor(LightBlue) {FD} else if TriangleNormal[TriangleAxis] .0 then SelectGraphColor (Green) {U} else SelectGraphColor(Blue) ; {D}

Draw3D(TriangleVertex[l,l] ,TriangleVertex[1,2] ,

TriangleVertex[1,3], TriangleVertex[2,1],TriangleVertex[2,2],

TriangleVertex[2,3]; Draw3D(TriangleVertex[2,1] ,TriangleVertex[2,2] ,

TriangleVertex[2,3] , TriangleVertex[3,1],TriangleVertex[3,2],

TriangleVertex[3,3] ; Draw3D(TriangleVertex[3,1] ,TriangleVertex[3,2] ,

TriangleVertex[3,3], TriangleVertex[1,1],TriangleVertex[1,2],

TriangleVertex[1,3]) ; end; if Not KeyPressed then Inc(Index) else Index:=TriangleTotal+l; until Index>TriangleTotal;

SUBSTITUTE SHEET

-82.284-

SetColor(LightGray) ; if KeyPressed then begin

TempChar:=ReadKey; - GrTextXY('Drawing ABORTED',1,3); end else GrTextXY('Drawing Complete',1,3); end;

procedure PrintRealRange(Strl,Str2 : String;min,max Real);;;

{; Prints Range values on line for parameters } begin

GotoXY(3, hereY) ;

TextColor(LightGray) ; write(Copy(Strl+ » ',1,12),': ');

TextColor(White) ; write(min:16:8) ;

GotoX (42,WhereY) ;

TextColor(LightGray) ; write(Copy(Str2+' » ,1,12),*: ');

TextColor(White) ; write(max:16:8) ; end;

procedure PrintTriangleMenu;

{ Print out Triangle Main Menu } var i : Word; begin

PrintTriHeader;

GotoX (3,5) ;

TextColor(LightGray) ; write('Triangle Filename : ');

TextColor(White) ; wrϋte(TriangleFilename) ;

GotoXY ( 3 , here Y+l ) ;

TextColor (LightGray) ; write ( 'Total Triangles: • ) ;

SUBSTITU

-82.285-

TextColor(White) ; writeln(TriangleTotal+1) ; for i:= 1 to 3 do begin

GotoXY(1, hereY+l) ;

PrintRealRange('File •+COOR__CHAR[i]+' Min• , 'File •+COOR_CHAR[i]+' Max', Triang end;

GotoX (3,WhereY+2) ; TextColor(LightGray) ; write('Total Selected : •); TextColor(White) ; writeln(TriangleSelected) ; PrintRealRange('Selected Min' , 'Selected Max' ;

TriangleSelectStart,TriangleSelectEnd) ; for i:= 1 to 3 do begin

GotoXY(1,WhereY+l) ;

PrintRealRange(•Sel. '+COOR_CHAR[i]+• Min• , •Sel. •+COOR_CHAR[i]+ « Max',

TriangleSelectMin[i],TriangleSelectMax[i] ; end;

TextColor(LightGray) ; GotoXY(3,WhereY+2) ; for i:=l to 3 do write(COOR_CHAR[i], ' '); write('Axis Rotation: '); TextColor(White) ; for i:= 1 to 3 do write(TriangleAngle[i], ' •); GotoXY(60,WhereY) ; TextColor(LightGray) ; write('Windowing by '); TextColor(White) ; if TriangleWindowingFile then write('File*) else write('Range') ; GotoXY(3,WhereY+2) ; TextColor(LightGray) ; write('Slice Axis is '); TextColor(White) ; write(COOR_CHAR[TriangleAxis]) ;

SUBSTITUTE SH

-82.286-

GetXY(l,24) ; TextColor(White) ; write(•Commands: (New file. Select range, Windowing, - Rotation, Axis, Graph) : ') ; end;

procedure Switch(var First : Word ; var Second : Word) ; begin;

TempReal. := TriangleAxisValue [First] ;

TriangleAxisValue A [First] :=TriangleAxisValue [Second] ;

TriangleAxisValue A [Second] :=TempReal;

TempLong := TrianglePtr A [First] ;

TrianglePtr A [First] :=TrianglePtr [Second] ;

TrianglePtr A [Second]:=TempLong; end;

procedure Quicksort(Left,Right : Word) ; var

LeftIndex,RightIndex : Word; KeyValue : Real; begin if Left < Right then begin Leftlnde := Left ; Rightlnde := Right + 1 ; KeyValue := TriangleAxisValue A [Left] ; repeat repeat Inc(Leftlndex) until TriangleAxisValue A [Leftlndex] >= KeyValue; repeat Dec(Rightlndex) ; until TriangleAxisValue A [Rightlndex] <= KeyValue; i£ Leftlndex < Rightlndex then Switch(Leftlndex, Right Index) ; until Leftlndex >= Rightlndex; Switch(Left, Rightlndex) ; Quicksort(Left,Rightlndex - 1) ;

-82 . 287-

QuickSort(Rightlndex + 1 , Right); end; end;

procedure GetTrianglelnfo;

{ Read in Triangle Database } var

FacetCount : Longint; i,j : Word; begin

Center('<Scanning Triangle File>',25);

{ Open triangle file }

Assign(TriangleFile,TriangleFilename) ;

ResetFile(Trianglefile) ;

TriangleTotal:=0; for i:= 1 to 3 do begin

TriangleFileMin[i] :=MAX_REAL; TriangleFileMax[i] :=MIN_REAL; TriangleSelectMin[i] :=MAX_REAL; TriangleSelectMax[i] :=MIN_REAL; end; repeat

{ Skip over file header } if TriangleFiletype=ASC_FILE then begin RealLine(TriangleFile) ; if ParseLine(InputLine)<> » SOLID'then FileError:= TRUE; end else PositionFile(TriangleFile,CurrFilePos+80) ;

{ Read in the triangles } if Not FileError then repeat

TrianglePtr [TriangleTotal] :=CurrFilePos; { Currently pointing to first tri if ReadTriangle then begin

SUBSTITUTE SHEET

-82 .288- if (TriangleNormal[1]<>0) or

(TriangleNormal[2]<>0) or (Triangle

Normal[3]

TriangleAxisValue A [TriangleTotal] :=MAX_REAL;

{ Set Axis Value to smalle { Set Min and Max Values } for i:= 1 to 3 do begin if TriangleVertex[i,TriangleAxis]

<TriangleAxisValue A [Triangle Total] t TriangleAxisValue A [TriangleTotal] := TriangleVertex[i, TriangleAxis] ; for j:=1 to 3 do begin if TriangleVertex[i,j]<TriangleFileMin[j] then TriangleFile Min[j]:= if TriangleVertex[i,j]>TriangleFileMax[j] then TriangleFile Max[j]:= if

TriangleVertex[i,j]<TriangleSelectMin[j] then Triangle SelectMin[ if

TriangleVertex[i,j]>TriangleSelectMa [j] then Triangle SelectMax[ end; end;

Inc(TriangleTotal) ; end;

{ Move to next triangle } if TriangleFiletype=ASC_FILE then begin ReadLine(TriangleFile) ; if ParseLine(InputLine)<>'ENDLOOP' then

FileErro:=TRUE; ReadLine(TriangleFile) ; if ParseLine(InputLine)<>'ENDFACET' then FileError:=TRUE; end else begin

Move(InBuffer[InBufPtr+48] ,TriangleAttrib.2) ;

SUBSTITUTE SHEET

-82 .289-

PositionFile(TriangleFile,CurrFilePos+ TriangleAttrib+50) ; end; end; until (TriangleTotal>Total_Triangles) or FileError or EndOfFile; until (TriangleTotal>Total_Triangles) or FileError or

EndOfFile; if TriangleTotal>Total_Triangles then begin Str(TriangleTotal,TempStr) ; Center('*** Warning: Maximum of » +TempStr+' triangles read in. Ignoring rest. WaitKey;

FileError:=False; end; if Not FileError then begin

TriangleSelected:=TriangleTotal; Dec(TriangleTotal) ; { Quicksort(0,TriangleTotal) ; }

TriangleSelectStart:=TriangleFileMin[TriangleAxis] ; TriangleSelectEnd:=TriangleFileMax[TriangleAxis] ; end; end;

procedure DoTriangle;

{ User selected Triangle option of Main Menu } var ch : Char;

TempReall : Real; i ,j,k : Word; begin ch := ' •; FileError:=FALSE; repeat if TriangleFilename = ' then ch := 'N' else begin

ResetFile(TriangleFile) ;

SUBSTITUTE SHEET

-82 .290-

PrintTriangleMenu; if ch= » • then repeat ch:= UpGase(ReadKey) ; " until (ch = ESC) or (Pos(ch, 'NWSRAG') > 0) ;

TextColor(White) ; end; case ch of 'N' : begin if GetFilename(TriangleFilename,1) then begin

GotoXY(1,24) ; write(*File "' ,TriangleFilename, '" selected.

File type ASCII, Bin repeat TriangleFiletype:=Pos(UpCase(ReadKey) , 'ABR')

until TriangleFiletype>0 TriangleAxis:=2; { Assume Y } GetTrianglelnfo; TriangleWindowingFile:=TRUE; for i:= 1 to 3 do TriangleAngle[i] :=0; end; ch:=' ' ; end; •W' : begin

TriangleWindowingFile:=Not TriangleWindowing

File; ch:=' ' ; end;

151 begin

GotoXY(1,24) ; ClrEol; write('Select Range Start:'); readln(TempStr) ; ToUpper(TempStr) ; if TempStr='RESET• then begin

SUBSTITUTE SHEET

-82 . 291-

TriangleSelectStart := TriangleFileMin

[TriangleAxis] ; TriangleSelectEnd := TriangleFileMax

[TriangleAxis] ; end else begin Val(TempStr,TempReal,re) ; if rc=0 then begin

GotoXY(1,24) ;

ClrEol; write(*Select Range End:'); readln(TempStr) ;

Val(TempStr,TempReal1,re) ; if rc=0 then begin if TempReal<TempReall then begin TriangleSelectStart:=TempReal; TriangleSelectEnd:=TempReall; end else begin

TriangleSelectStart:=TempReail; TriangleSelectEnd:=TempReal; end; end; end; for i:=l to 3 do begin

TriangleSelectMinfi] :=MAX_REAL;

TriangleSelectMax[i] :=MIN_REAL; end;

TriangleSelected:=0; for i:=0 to TriangleTotal do begin if (TriangleAxisValue A [i]>=TriangleSelect

Start) and

(TriangleAxisValue A [i]<=TriangleSelectEnd) then begin PositionFile(TriangleFile,TrianglePtr [i]) ; TempBoolean:=ReadTriangle; TempBoolean:=FALSE; for j:=1 to 3 do for k:= 1 to 3 do begin

SUBSTITUTE SHEET

-82.292- if TriangleVertex[j,k]<TriangleSelect

Min[k] then Triangle if TriangleVertex[j ,k]>TriangleSelect Max[k] then Triangle end;

Inc(TriangleSelected) ; end; end; end; ch:= •; end; R' : begin

GotoXY(l,24) ;

ClrEol; for i:=l to 3 do write(COOR_CHAR[i], • '); write('Axis Rotation: '); readln(TempStr) ; for ir=l to 3 do begin

Val(ParseLine(TempStr) ,TempReal,re) ; if (rcoo) or (TempReadoO) or (TempReal>180) then TriangleAngle[i else TriangleAngle[i] :=Round(TempReal) ; end; ch:=> '; end; 'A' : begin

GotoXY(1,24) ;

ClrEol; write('New Axis: *) ; repeat

TempByte:=Pos(UpCase(ReadKey) , 'XYZ') ; until TempByte>0 if TempByteoTriangleAxis then begin

TriangleAxis:=TempByte;

Close(TriangleFile) ;

GetTrianglelnfo; end;

SUBSTITUTE SHEET

-82.293- ch:= « •; end; 1 G' : begin repeat

GraphTriangles; ch:=UpCase(ReadKey) ; until cho'G' ; RestoreCrtMode; end; ELSE if choESC then ch:= » *; end; until FileError OR (ch = ESC) OR (TriangleFilename=' •) ; if FileError then begin

ASCError(TriangleFilename) ; TriangleFilename:=' • ; end; end;

{

Start of Main Slice Routines

function FindZLayer(value : Word) : Word; { Binary search for Z Value } var low,mid,high,index : Word: begin low:=0; high:=S1iceLastLayer; index:=MAX_WORD if (value>=SliceLayerValue A [low]) AND (value<=

SliceLayerValue [high]) then while (low<=high) AND (index=MAX_WORD) do begin mid:=(low+high) div 2; if value<SliceLayerValue A [mid] then high:=mid-l

SUBSTITUTE SHEET

else if value>SliceLayerValue A [mid] then low:=mid+l else, index:=mid; end; if index=MAX_WORD then FindZLayer:=high else FindZLayer:=index; end;

function BlockTyp (var line : String) : Word; {{ Returns- Bslαck. Type of String in Word bits B- H F

L 0 1 2 (Bits Set)

FU 3 4 5

- FD 6 7 8

NFU 9 10 11

MFD 12 13 14

L(level) = 15

Not Found = None

} var bitword : Word; i : Word; begin if Copy(line,l,2)=*L ' then bitword := L_SECTION else begin i:=0 while (i<MAX_SECTIONS) AND

(Copy(line,l,Length(SliceBlocks[i]) ) o SliceBlocks[i] do Inc(i) ; if (i=MAX_SECTIONS) OR (Length(line)=Length (SliceBlocks[i]) ) then bitword := $0000 else ease (line[Length(SliceBlocks[i]+1]) of "B » : bitword:=l shl (i*3) ; 'H* : bitword:=1 shl (i*3+l) ;

SUB S TITUTE SHEET

-82 . 295-

•F » : bitword:=l shl (i*3+2) ; else bitword:=$0000; end; - end; BlockType:=bitword; end;

function BitOn(num : Word; bit : Byte) : Boolean; { Tells if a bit is on in number } begin if ((1 shl bit)and num)>0 then BitOn:=True else BitOn:=FALSE; end;

procedure PrintWordRange(Strl,Str2 : String;min,max : Word;control : Longint) ;

{ Prints Range values on line for parameters } begin

GotoXY(3,WhereY) ;

TextColor(LightGray) ;

Write(Copy(Strl+' ',1,12),'; •);

TextColor(White) ; if control < 0 then write ('Undetermined') else write(min);

GotoXY(53,WhereY) ;

TextColor(LightGray) ; write(Copy(Str2+' ',1,12),': ');

TextColor(White) ; if control < 0 then write(•Undetermined') else write(max) ; end;

procedure PrintBlockTable(section : Word) ;

{ Prints the Block table for menu from section value at current location } var

XPos,YPos : Byte;

SUBSTITUTE SHEET

-82.296- i,j : Word; begin

XPos:=WhereX; YPos:=WhereY; for i:= 0 to 4 do begin

GotoXY(XPos,YPos+i) ;

TextColor(LightGray) ; write(SliceBlocks[i]) ;

GotoX (XPos+4 , hereY) ; for/j:^ 0 to 2 do begin if " BitOn(section,i*3+j) then TextColor(White) else if Not MonoDisplay then TextColor(Blue) else TextColor(Black) ; if ((i <> 0) or (j o 2)) then case j of

0 : write(• B')

1 : writeC H')

2 : write(' F*) end; end; end;

TextColor(White) ; end;

procedure PrintSliceMenu:

{ Prints Slice Menu Screen with all information } begin

PrintsliceHeader; GotoXY(1,5) ; TextColor(LightGray) ; write('Slice Filename : '); TextColor(White) ; write(SliceFilename) ; GotoXY(1,6) ;

Er±ntWαrdRange( 'Layer Start* , •Layer End' , SlieeLayerValue A [0] ,SliceLayerValue A [S GotoXY(l,7);

SUBSTITUTE SHEET

-82 . 297-

PrintWordRange('File X Min 1 , 'File X Max 1 ,

SliceFileXMin,SliceFileXMax,l) ; GotoXY(1,8) ; PrintWordRange( •File Y Min' , •File Y Max' ,

SliceFileYMin,SliceFileYMax,l) ; GotoXY(1,10) ; TextColor(LightGray) ; write( 'Selected Layer : ') ; TextColor(White) ; if SliceLayer=MAX_WORD then write( 'None') else begin write(SliceLayerValue A [SliceLayer]) ;

GotoXY(1,11) ;

PrintWordRange(•Layer X Min', 'File X Max',

SliceLayerXMin A [SliceLayer] ,SliceLa GotoXY(1,12) ;

PrintWordRange( 'Layer Y Min » , 'File Y Max , SliceLayerYMin A [SliceLayer] ,SliceLa end;

GotoXY(1,14) ; TextColor(LightGray) ; write('Windowing by ') ; TextColor(White) ; if SliceWindpwingFile then write( 'File') else write(•Layer') ; TextColor(LightGray) ; GotoXY(1,16) ; write( 'Layer Blocks: ') ; GotoXY(53,16) ; write( 'Display Blocks: •) ; if SliceLayer<MAX_WORD then begin GotoXY(2,17) ;

PrintBlockTable(SliceLayerBlocks A [SliceLayer]) ; GotoXY(54,17) ;

PrintBlockTable(SliceOutputBlocks) ; end; GotoXY(1,24) ;

SUBSTITUTE SHEET

TextColor(White) ; write(*Commands: (New file. Layer select, Blocks, Windowing, Graph) : ') ; end;-

f nction ParseSegment(line : String;var xl,yl,x2,y2 : Word) : Boolean; { Parses out a line that should contain 4 segment coords. } var trv : Integer; num : Word; good : Boolean; code : Word; oldlen : Char j : Wordr begin good:=TRUE; try:=l; repeat if line[0]=!0 then good:=FALSE else begin if line [1]= « ' then line[l] :='0 « ; j:=Pos(' *,line); if j+0 then j:=Length(line)+l; oldlen := line[0] ; line[0] := Char (j-1) ;

Val(line,num,code) ; line[0] := oldlen; if code>0 then good:=FALSE else case (try) of

1 : xl:=num;

2 : yl:=num;

3 : x2:=num;

4 : y2:=num; end; if j>=Length(line) then line:=' '

SUBSTITUTE SHEET

-82.299- else begin line[0] := Char (Length(line)-j) ; Move(line[j+1] ,line[l] ,Integer (line[0]) ) ; end; end;

Inc(try) ; until (Not good) OR (try>4) ; ParseSegment := good; end;

procedure GetSlicelnfo;

{ Reads a Slice File and sets up Range and Layer information } var sectype : Word; xl,yl,x2,y2 : Word; begin

SliceFileXMin := MAX_WORD;

SliceFileXMax := 0;

SliceFileYMin := MAX_WORD;

SliceFileYMax := 0;

SliceLayer := MAX_WORD;

SliceLastLayer := -1;

Assign(SliceFile,SliceFilename) ;

Reset(SliceFile,1) ;

ResetFile(SliceFile) ;

ReadLine(SliceFile) ; repeat if (Not EndOfFile) AND (InputLine[1]<>' ! ) then begin sectype := BlockType(InputLine) ; if sectype = 0 then if (Not ParseSegment(InputLine, l,yl,x2,y2) ) or (SIiceLastLayer<0) then else begin

{ A Segment }

SUBSTITUTE SHEET

-82.300-

SetMinMax(xl,SliceLayerXMin A [SliceLastLayer]

, SliceLayerXMax A [SliceLas SetMinMax(x2,SliceLayerXMin A

[SliceLastLayer] , SliceLayerXMax A [SliceLas SetMinMa (yl,SliceLayerYMin A

[SliceLastLayer], SliceLayerYMax A [SliceLas SetMinMax(y2,SliceLayerYMin A

[SliceLastLayer], SliceLayerYMax [SliceLas end else

{ A Block line } if sectype=L_SECTION then begin if SliceLastLayer>=0 then begin if SliceLayerXMin A [SliceLastLayer]<

SliceFileXMin then SliceFileXMin if SliceLayerXMax [SliceLastLayer> SliceFileXMax then SliceFileXMax if SliceLayerYMin A [SliceLastLayer]<

SliceFileYMin then SliceFileYMin if SIiceLayerYMax [SliceLastLayer]> SliceFileYMax then SliceFileYMax end;

Inc(SliceLastLayer) ; if SliceLastLayer>Total__Layers then begin Str(SliceLastLayer,TempStr) ; Center('Warning - Maximum number of •+TempStr+' Slice layers read*, WaitKey; end else begin

Val(Copy(InputLine,3,255),TempWord,re) ; if rcoo then FileError:=TRUE else begin

SliceLayerValue A [SliceLastLayer] :=TempWord;

SliceLayerBlocks A [SliceLastLayer] :=$0000;

S3jfceLayerPtr A [SliceLastLayer] :=CurrFilePos;

SUBSTITUTE SHEET

-82 . 301-

SliceLayerXMin A [SliceLastLayer] :=MAX_WORD; SliceLayerXMax A [SliceLastLayer] :=0; SliceLayerYMin A [SliceLastLayer] :=MAX_WORD; SliceLayerYMax A [SliceLastLayer] :=0; end; end; end else SliceLayerBlocks A [SliceLastLayer] := SliceLayerBlocks A [SliceLast end;

ReadLine(SliceFile) ; until FileError OR EndOfFile OR (SliceLastLayer>

Total_Layers) ; if Not FileError then begin if SliceLastLayer>Total_Layers then SliceLastLayer:=

Total_Layers; if SliceLayerXMin A [SliceLastLayer]<SliceFileXMin then SliceFileXMin:=SliceL if SliceLayerXMax [SliceLastLayer]>SliceFileXMax then SliceFileXMax:=SliceL if SliceLayerYMin A [SliceLastLayer]<SliceFileYMin then SliceFileYMin:=SliceL if SliceLayerYMax [SliceLastLayer]>SliceFileYMax then SliceFileYMax:=SliceL end; end;;

procedure GrphS1iceLayer; var sectype,currentsection : Word; xl,yl,x2,y2 : Word; begin if SliceWindowingFile then

SetupGraphic (SliceFileXMin,SliceFileXMax, SliceFileYMin,SliceFileYMax) else

SetupGraphicW(SliceLayerXMin A [SliceLayer] , SliceLayer

-82.302-

XMax A [SliceLayer] ,SliceLayerYMin A [SliceLayer] , SliceLayerYMax A [SliceLayer]) ; OutTextLn( •Filename: '+SliceFilename) ; Str(SliceLayerValue [SliceLayer] ,TempStr) ; OutTextLn( •Layer : +TempStr) ;

PositionFile(SliceFile,SliceLayerPtr A [SliceLayer]) ; repeat

ReadLine(SliceFile) ; if (Not- EndO File) AND (InputLine[l]<>* ! ') then begin* sectype :=- BlockType(InputLine) ; if sectype=0 then begin { A Segment } if (currentsection>0) AND

ParseSegment(InputLine, xl,y1,x2,y2)then DrawLi end else begin { A Block line } currentsection:=sectype AND SliceOutputBlocks; if currentsection>0 then if currentsection=LB_SECTION then

SelectGraphColor(Blue) else if currentsection=LH_SECTION then

SelectGraphColor(LightBlue) else- if (currentsection and NFD_SECTIONS)>0 then SelectGraphColor(Red) else if (currentsection and NFU_SECTIONS)>0 then SelectGraphColor(Green) else if (currentsection and FD_SECTIONS)>0 then SelectGraphColor(Light else if (currentsection and FU_SECTIONS)>0 then SelectGraphColor(Light else SelectGraphColor(White) ; ends; end5r until (sectype=L_SECTION) OR EndOfFile; end;

-82 . 303- procedure DoSlice;

{ User selected Slice option of Main Menu } var ch : Char; i,j : Word; index : Integer; begin ch := ' '; repeat if SliceFilename = ' ' then ch := 'N' else begin

ResetFile(SliceFile) ;

PrintsliceMenu; if ch=' • then repeat ch:= UpCase(ReadKey) ; until (ch = ESC) or (Pos(ch, 'NLBWG') > 0) ; TextColor(White) ; end; case ch of 'N' : begin if GetFilename(SliceFilename,2) then begin Center(*<Scanning Slice File>',25); GetSlicelnfo; SliceWindowingFile:=TRUE; SliceLayer:=0

SliceOutputBlocks:=SliceLayerBlocks A [Slice Layer] ; end; ch:=' * ; end; 'L' : begin index:=0; Templnt:=l; repeat if Templntoindex then begin

ClrScr;

Center( 'Slice Layer Select',1) ;

-82.304- for j:=0 to 15 do if j+indez<= SliceLastLayer then begin GotoXY(l+(j mod 4)*20,2+(j div 4)*5); write(SliceLayerValue A [j+index] :5, * ') ;

PrintBlockTable(SliceLayerBlocks A [j+index]) ; end;

GotoXY(1,24) ; write('+ or - to move forward or back. ENTER to select Level•) ; Templnt:=inde ; end; ch:=ReadKey; if (ch='+') and (index+16<=SliceLastLayer) then Inσ(inde ,16) ; if (ch='-' and (index-16>=0) then Dec(index,16) ; until ch=CR; GotoXY(1,24) ; ClrEol; write('Enter Layer Number: •); readln(TempStr) ; if TempStro' • then begin Val(TempStr,iw,re) ; jw:=FindZLayer(iw) ; if (rcoo) OR (jw=MAX_WORD) then begin Center( » Layer "'+TempStr+•" Not Found* ,24) ; WaitKey; end else begin SliceLayer:=jw SliceOutputBlocks:=SliceLayerBlocks A [Slice

Layer] ; end; end; chr=' *; end; 'B• : begin

SUBSTITUTE SHEET

-82.305-

GotoXY ( l , 24 ) ;

ClrEol ; write.CEnter Block Type to Toggle: '); readln(TempStr) ;

ToUpper(TempStr) ;

SliceOutputBlocks:=SliceOutputBlocks xor Block

Type(TempStr) ; ch:= » •; end; •W' : begin

SliceWindowingFile := not SliceWindowingFile; ch:=' •; end; •G' : if SliceLayer<MAX_WORD then begin repeat

GraphsliceLayer; ch:=UpCase(ReadKey) ; until cho'G'; RestoreCRTMode; end else ch:=' * ; ELSE if choESC then ch:=' '; end; until (ch = ESC) OR (SliceFilename=' *) ; end;

{

Start of Main Program } begin

{ Setup Exit routine } ExitSave:=ExitProc; ExitProc:=§MainExit;

{ Determine graphics screen to use } GraphDriver := Detect; SetGraph;

SUBSTITUTE SHEET

-82.306- RestoreCrtMode;

{ Use this heap location as top of heap for rest of program } Mark(HeapTop) ;

{ Allocate Memory for arrays }

ReAllocate('S' ,16382) ; if Total_Triangles<5000 then ReAllocate('T' ,5000) ;

repeat:

PrintHeader; GotoXY(3l,WhereY+2) ; writeCGraphic Card: '); Case GraphDriver of

1 : write('CGA') ;

2 : write('MCGA') ;

3 : write('EGA') ;

4 : write('EGA 64 « ) ;

5 : write('EGA Mono') ;

6 : write(•Reserved•) ;

7 : write('Hercules Mono') ;

8 : write(ΑTT400') ;

9 : write('VGA') ; 10: write('PC3270') ; else write('Unknown Type ',GraphDriver) ; end;

GotoXY(28,WhereY+l) ; write('Graphics Mode: ' ,GraphMode, ' ( ' ,SizeX, ' , ,

SizeY,') « );

GotoXY(1,25) ; write(' aximum Triangles: • ,Total_Triangles+l) ;

GotoXY(57,25) ; write('Maximum Layers: ' ,Total_Layers+l) ;

-82.307-

GotoXY(29,10) ; write('1. Triangle File Display');

GotoXY(29,WhereY+2) ; write('2. Slice File Display');

GotoXY(29,WhereY+2) ; write( '3. Reallocate # Layers') ;

GotoXY(29,WhereY+2) ; write(•Q. Quit*) ;

GotoXY(28,WhereY+3) ; write('Enter Selection: '); repeat ch := UpCase(ReadKey) ; until Pos(ch, •123Q')>0 Case ch of

'1' : if Total_Triangles>=0 then DoTriangle; '2' : if Total_Layers>=0 then DoSlice; •3' : begin

ClrScr;

GotoXY(1,24) ; write('Enter number of Slice Layers desired: •) ; readln(TempStr) ; if TempStr ' ' then begin Val(TempStr,TempReal,re) ; TempLong:=Round(TempReal) ; if (rc=0) and (TempLong>=0) then ReAllocate ('S' ,TempLong) ; end; end; end; until (ch = 'Q') ; TextBAckground(Black) ; TextColor(White) ; ClrScr; end.

SUBSTITUTE SHEET

-82.303- Page 60,132 Title 3D Systems Laser Driver Package

LASER 3D Systems Laser Controller Driver Package Version 2.60

This code constitutes levels 1 and 2, the lowest software levels, of the Laser Controller System.

Copyright (C) Tarnz Technologies, 1987

History:

8/17/87 Ver 2.02 LASER released new identifcation schemes

8/22/87 Ver 2.03 version number updated only

8/25/87 Ver 2.04 version number updated only li/12/87 Ver 2.30 first Beta software release, version update only

1/25/88 Ver 2.60 version update only

System Equates

current_version equ 020Oh ;current software version debug equ 0 ;debug flag

Public And External Declarations

public code references

SUBSTITUTE SHEET

-82 . 309-

public laser_entry ;only callable entry point to this pkg public enddata ;segment ends for residency size calc public endqueue public endbkgtask public endcode

public variable references

public laser_int,old_tv,old_tv,current_status public sys_int_count,sint_counter,bkgnd_int_time

external references

extrn bkg_ins:far ;install background task extrn bkg_insl:far ;change timebase extrn bkg_rmv:far ;remove background task

subttl Operating System Equates page

IBM PC and Compatible Operating System Equates

Equates defining 8259 (Programmable Interrupt

Controller) and 8253 (Programmable Interval Timer) ports and constants.

intaOO equ 2Oh ;8259 PORT intaOl equ 21h ;YET ANOTHER 8259 PORT time_cmd_reg equ 43h ;8253 command register

SUBSTITUTE SHEET

-82..310- tim_ch2 equ 42h ;8253 channel two ppi__port-A equ 6Oh ;8255 port A ppi_port_B equ 61h ;8255 port B ext_bkg equ 4 ;ext background intr signal ppi_port_C equ 62h ;8255 port C

subttl Laser I/O Card Equates page

Laser I/O Card Equates

using John Bell Engineering Card "Universal I/O" 83-064

laserlO equ 300h portAl equ laserlO ;DAC value low byte portBl equ laser10+1 ;DAC value high byte portci equ laser10+2

; outputs strobeX = 1 ;X-axis DAC strobe (falling edge) strobeY = 2 ;Y-axis DAC strobe (falling edge) strobeZ = 4 ;Z-axis DAC strobe (falling edge) shutter_ctrl ^ 8 ;laser shutter control (open/ closed)

: inputs posackXY = 16 ;X and Y-axis position acknowledge posackZ = 32 ;Z-axis position acknowle ctrll equ laserIO+3 ;control fl byte (write only!)

-82.311 portA2 equ laserIO+4 portB2 equ laserIO+5 portC2 equ laserIO+6 ctrl-12 equ laserIO+7 portA3 equ laserIO+8 portB3 equ laserIO+9 portC3 equ laserIO+10 ctrl3 equ laserIO+11

Miscellaneous

ExtSigs segment at OF600h ;for debugging

IntBeg db ?

IntEnd db ?

ExtSigs ends

subttl Miscellaneous Other Equates And Structures page

; Error codes

• err_none equ 0 ;no error err_no_card equ 1 ;no laser interface card found err_not_open equ 2 ;laser channgel not open err_queue_full equ 3 ;background command queue " is full err_bad_time equ 4 ;invalid interrupt time err_not_block equ 5 ;not in block mode err_exec_limit equ 6 ;exec limit (f EC S EX's) reached err_had_param equ 127 ;some other bad parameter erjr_bad_code equ 255 ;internal code error all equ OFFFFh ;for turning flags off (all- flag)

-82 . 312- subttl Structures page

The stack frame defines the locations of the parameters on the stack

stack. .frame struc

P_bp dw 0

Pi.d χ r dw 0

P.c dw 0 p_bx dw 0 p_ax dw 0

P_ds dw 0 p_si dw 0 p_di dw 0 p_es dw 0 p_flags dw 0

P_ip dw 0 p_cs dw 0 stack framd ends

subttl LASER code segment page

i l.

!outr. - Starting pass 1 - endif if2>

!out - Starting pass 2 - endif

subttl Data Segments pag

)ata segment public 'DATA'

-82 . 313-

Block Variables

Execute Queue (must be first item in segment)

- 10 entries of StarPtr [2 bytes], EndPtr [2 bytes]

exec_queue_slze = 200 ;max f of blocks awaiting processing exec_entry_len = 4 exec_queue_limit = exec_queue_size*exec_entry_len exec_queue db exec_queue_limit dup (?) ;queue space

exec_queue_start dw 0 exec_queue_end dw 0

Background Command Queue Variables

bcmd_queue_start dw 0 ;command queue's "hard" limits bcmd_queue_end dw 0 ;real start and end of queue

Execution Block Variables

queue_start dw 0 ;command queue's "soft" limits queue_end dw 0 ;start and end of current block

rem_queue_start dw 0 ;redraw storage of the queue_start rem_queue_end dw 0 ; and queue_end pointers

Background Task Variables

static = 0 ;in static state ff_delay = 2 ;in laser turn-off state idle = 4 ;in laser system fully idle state

-82 .314-

_pos_ack 6 ;in position acknowledge state

_on_delay . = 8 ;in laser turn-on state

_moving = 10 ;in moving state

_pausing = 12 ;in pausing state

_redraw_pausing = 14 ;redrawing pause state bkgnd_mode dw _static ;execution mode bkgnd_intr_time dw 1190 ;interrupt interval time sys_int_cαunt dw 10 ;sys int routine tick count sinfc_ αuπter dw 10 ;sys int down-counter ciear_pointer dw 0 ;start of command queue block delay dw 0 ;general delay downcounter off_delay_count dw 0 ;laser turn-off delay count value on_delay_count dw 0 ;laser turn-on delay count value

HomeXpos dw 0 ;laser beam (X,Y) home position

HomeYpos dw 0

RemXpos dw 0 ;remember beam (X,Y) position here

RemYpos dw

XposFract db 0 ;current vector's variables

Xpos dw 0

YposFract db 0

Ypos dw 0 deltaX dw 0 deltaY dw 0 steps dw 0 signX db 0 ;sign-extends signY db 0 dummy dw 0 ut_steps dw 0 ;utility downcounting steps

redraw count dw 1 ;redraw pass count

-82.,315- redraw_delay dw 0 ;redraw delay step_periods dw 10 dup ;multi-pass Step Periods array (1190) markjposition dw 0 ;redraw mark position pass dw 0 ;redraw pass number

Software Interrupt Variables

swi_int dw 0 ;interrupt vector number swi__ofs dw 0 ;old SWI vector swi_seg dw 0

return_code db 0 ;function return code

ls_open as 1 ;laser system initialized ls_interrupt = 2 ;software interrupt vector set bkgnd_idle = 4 ;background in idle state flag redrawing = 8 ;doing redraw operation need_to_pause = 16 ;need to pause flag (redraw) current_status dw 0 ;general status register autoshut_mode = 1 ;automaticallyopen/close shutter on idle posack_mode = 2 ;wait for X-Y mirrors • position acknowledge block_mode = 4 ;execution block mode (EX/EC/CL active) shutter = 16 ;open/closed shutter flag laser control dw sshhiutter ;laser control word

enddata label far LaserData ends

LaserQueue segment public 'DATA'

-82.316-

Background Command Queue

6OK workspace- can hold approximately 3750 move entries

bcmd_queue_size = 60000 ;vector circular queue size bcmd_queue_limit = bcmd_queue_size-32 bcmd_queue db bcmd_queue_size+16 dup (?) move_size. = 13 ;background command s±zes: open_shutter_s ze = 1 close_shutter_size = 1 change_timebase_size = 3 pause_size = 3 set_periods_size = 2 + 2 * num set_redraw_count_size = 3 set_redraw_delay_size = 3 mark_size = 1 redraw size = 1

endqueue label far LaserQueue ends

subttl Laser Background Task page

Laser Control Background Task

responsible for:

- updating x-axis S y-axis DACs every 100 us

(typ.)

- mαvingj of laser beam

- geometric correction

- shutter control

- idling system while command queue is empty

-82 . 317-

LaserGroup group LaserBackground,LaserCode

LaserBackground segment public 'CODE' assume cs:LaserBackground,ds:LaserData

; high-speed timer 0 interrupt r

T typically 100 us, settable via software interrupt

.. laser_int proc far assume cs:LaserBackground,ds:LaserData,es:LaserData

set for interrupt service

push ax in al,ppi_port_B ; signal start of background interrupt and al,all-ext_bkg out ppi_port B,al push ds push bx push ex push dx push es push di push si

background task interrupt service

mov ' ax,LaserData ;point to laser system variables

-82.318- mov ds,ax ov ax,LaserQueue ;point to laser command queue mov es,ax- eld ;for block moves moc bx,bkgnd_mode jmp word ptr sc: [bx + offset bkgnd_states]

Background State Address Table

bkgnd_states label word dw static dw off_delay dw idle dw pos_ack dw on_delay dw moving dw pausing dw redraw_pausing

; old system timer interrupt vector

; must be in CS for indirect intersegment jump to

BIOS

old_tv dd ;called every sys_int_count ticks

static state - determine processing

static: test laser_control,block_mode jnz block

; STREAM MODE

-82 . 319-

; laser commands executed as they are added to table for best throughout ; and easiest control

stream: mov si,bcmd_queue_start ;any entries in queue? cmp si,bcmd_queue_end jz prep_idle jmp read_queue ;yes, go execute command

BLOCK MODE laser commands executed in blocks to prevent intermediate idles multi-pass redraw of small sets of vectors supported

block: mov ax,queue_start ;finished processing block? cmp ax,queue_end jz blockl jmp read_queue blockl: test current_status,redrawing ;redrawing? jnz go_redraw mov si,exec_queue_start ;no, something in exec queue? cmp si,exec_queue_end jz prep_idle ;no, idle jmp block_proc ,yes, go process next block

go_redraw: jmp redraw_pass ;multiple passes

prepare to idle

-82 . 320-

prep_idle: test laser_control,autoshut_mode ;if autoshutter mode, close shutter jz home or laser_control,shutter call set_ctrl_port jmp laser off home:; mov ax,Xpos ; else remember current position mov RemXpos,ax mov ax,Ypos mov RemYpos,ax mov ax,HomeXpos and home laser beam mov Xpos,ax mov ax,HomeYpos mov Ypos,ax call update_DACs

laser_off: mov ax,off_delay_count ;observe laser turn- off delay cmp: ax,0 je set_idle ;if 0, don't delay at all mov/ delay,ax mov- bkgnd_mode,_off_delay sdone:jmp; int fini

laser turn-off delay state

σ f delay:. dec; delay jnz sdone

-82.321- set_idle: mov bkgnd_mode,_idle ; set idle state

; laser system fully idle state ; idle: test laser_control,block_mode jz idle_stream

idle_block: mov si,exec_queue_start ;wait for something in exec queue cmp si,exec_queue_end jnz out_of_idle

idle_set: or current_status,bkgnd_idle ;make sure idle flag is on jmp int_fini

idle_stream: mov si,bcmd_queue_start ;wait for something in command queue cmp si,bcmd_queue_end jz idle_set

out_of_idle and current_status,all-bkgnd_idle ;turn off idle flag test laser_control,autoshut_mode ;if autoshut mode, open shutter jz repos and laser control,all-shutter call set_ctrl_port jmp laser_on

-82.322- repos: mov ax,RemXpos else reposition laser beam mov Xpos,ax mov ax,RemYpos mov Ypos,ax call update_DACs

test laser_control,posack_mode jz:. l.aser_on mov dx,portCl ;wait for position acknowledgement in al,dx and dx,posackXY jz laser_on mov bkgnd_mode,_pos_ack

position acknowledge state

pos_ack: mov dx,portCl in al,dx and dx,posackXY jnz sdone mov bkgnd_mode,_static

laser_on: mov ax,on_delay_σount ;observe laser turn-on delay cmp ax,0 je set__proc ;if 0, don't delay mov delay,ax mov/ bkgnd__mode,_on_delay

J p: int fini

-82.323- ; laser turn-on delay state

ι_delay: dec delay jz set_proc jmp int_fini

set_proc: mov bkgnd_mode,_static ;set for normal processing test laser_control,block_mode jz read_queue ;start processing commands immediately

setup for block mode processing

block proc: mov si,exec_queue_start mov ax, [si] ;get start index mov bcmd_queue_start,ax ;update command queue's hard start mov queue_start,ax ;set exec block start add si,2 mov ax, [si] ;get end index mov queue_end,ax ;set exec block end add si,2 cmp si,exec_queue_limit ;next index jb block_procl mov si,0 block_procl: mov exec_queue_start,si jmp block :catch O-length blocks

begin processing background command from command queue

SUBSTITUTE SHEET

-82.324-

read_queue: test laser_control,block_mode jz read_stream read_bloσk: mov si,queue_start ;use right pointer jmp read_queuel read_stream: mov si,bcmd_queue_start readi_gueuel: mov- al,es: [si] ;read next background command inc si ;point to command parameters inc al ; + 1 so that FF becomes 0 xor ah,ah ;computer jump table offset shl ax,1 cmp ax.bkgnd__ops_end ;don't use to increase throughout jae ski_bad_token mov bx,ax jmp word ptr cs: [bx + offset bkgnd_ops_tbl]

skip_bad._token: mσv bx,l ;skip past bad token jpnp end_read_queue ; hope we resync on next byte

bkgnd_ops_tbl label word dw reset_queue ;FF dw move ;o dw open_shutter ;i w close_shutter ;2 dw change_timebase ;3 dw pause ;4 dw set_periods ;5

-82.325- dw set_redraw_count ;6 dw set_redraw_delay ;7 dw mark ;8 dw redraw ;9 bkgnd_ops_end equ $-bkgnd_ops_tbl

reset to beginning of command queue Background Command FF (Internal)

reset_queue: mov queue_start,0 ;zero start pointer jmp static ;go process next command, if any

move/draw vector Background Command 0

move: mov bx,dx ;swap DS SES temporarily for movsw mov ax,es mov ds ,ax mov es,bx mov di,offset XposFract mov ex, (move_size+l)/2 ;copy packet from queue to workarea rep movsw mov bx,ds ;swap segments back mov ax,es mov ds,ax mov es,bx mov al,byte ptr deltaX+1 ;computer sign-extends

-82.326- cbw mov signX,ah mov al,byte ptr deltaY+l cbw mov signY,ah test current_status,need_to_paus jz . movel jmp redraw_pause movel: mov bkgnd_mode,_moving mov bx,move_size

; end of reading queue

. end_read_queu : text laser_control,block_mode jz end_stream

end_block: mov ax,queue_start add ax,bx cmp ax,bcmd_queue_size ;next start index jb end_read_queue1 mov ax,0 ;wraparound command queue (soft) end_read_queuel: mov queue_start,ax jmp set_DACs

end_stream: mov ax,bcmd_queue_start add ax,bx cmp ax,bcmd_queue_size ;next start index jb end_read_queue2 mov ax,0 ;wraparound command queue (hard:);

-82 . 327- end_read_queue2: mov bcmd_queue_start,ax jmp set_DACs

moving state - vector processing

moving: mov ax,word ptr XposFract ;compute new X position add ax,deltaX ;add fract & 1st byte of integer mov word ptr XposFract,ax mov al,byte ptr Xpos+1 ;add carry to 2nd byte of integer adc al,signX mov byte ptr Xpos+l,al

mov ax,word ptr YposFract ;compute new Y position add ax,deltaY mov word ptr YposFract,ax mov al,byte ptr Ypos+1 adc al,signY ;0 for + deltas, FFh for deltas mov byte ptr Ypos+l,al

dec steps ;count down f steps jnz set_DACs mov bkgnd_mode,_static ;static state next tick

set laser mirror DACs to appropriate values

set_DACs: call update_DACs

-82 .328-

return from interrupt

int_fini: dec sint_counter ;call system timer interrupt routine mov ax,sint_counter ; every (sys_int_count) f ticks cmp. ax,0 sys_fini pop- si ;normal, non-sys interrupt return pop di pop es pop dx pop ex pop bx pop ds mov al,20h ;acknowledge interrupt out 020h,al sti pop ax iret

sys_fini: mov ax,sys_int_count ;reload downcounter mov sint_counter,ax pop si pop di pop es pop dx pop ex pop bx pop ds mov al,20h ;reset interrupt to allow laser out 020h,al ;interrupts during BIOS operation

— O il . -1 -. -1 — sti pop ax jmp old. tv ;continue timer interrupt in

VIOS-

bkgnd_local_sbrs proc near page

; Set Output Control Port shutter control

set_ctrl_port: mov dx,portCl in al,dx ;read existing port

Cl bits test laser_control,shutter ;update for shutter jnz shut_closed shut_open: and al,all-shutter_ctrl imp shut_str shut_closed: ;shutter closed if shutter not 0 or al,shutter_ctrl shut_str: out dx,al ret

Update laser beam X and Y Digital to Analog Converters

update_DACs •

set_XDAC: mov " ax,Xpos ;output X-pos to laser X asix DAC mov dx,portAl out dx,al inc dx

-82.330- mov al,ah out dx,al inc dx ;port Cl has strobe lines in al-dx and al,all-strobeX ;falling edge out dx,al or al,strobeX out dx,al

set_YDAC: mov ax,Ypos ;output Y-pos to laser Y-axis=

DAC mov dx,portAl out dx,al inc dx mov al,ah out dx,al inc dx ;port Cl has strobe lines in al,dx and al,all-strobeY ;falling edge out dx,al or al,strobeY out dx,al

mov ax,OFFh mov dx,portAl out dx,al inc dx out dx,al ret

pkgnd_local_sbrs endp page

open laser beam shutter Background Command 1

-82 . 331-

open_shutter: and laser_control,all-shutter call far ptr set_ctrl mov bx,open_shutter_size jmp end_read_queue

close laser beam shutter Background Command 2

close_shutter: or laset_control,shutter call far ptr set_ctrl mov bx,close_shutter_size jmp end_read_queue

change interrupt time base Background Command 3

change_timebase: mov bx,es: [si] mov step_periods,bx ;just alter first step period call bkg_insl ;change time base now mov bx,change_timebase_size jmp end_read_queue

pause queue processing

-82.332- Background Command 4

pause: mov ax,es: [si] mov ut_steps,ax mov bkgnd_mode,_pausing ;set for pausing state mov bx,pause_size jmp end_read_queue

pausing: dec ut_steps ;count down f steps jnz pausingl mov bkgnd_mode,_static ;static state next tick pausingl: jmp int fini

set_periods Background Command 5

set_periods: mov cl,es:[si] ;get sp count [1 byte] inc si mov ch,0 ;set high byte to 0 push ex cmp paa,0 ;read sp only on redraw/pass 0 jnz set_periods_skip mov di,offset step_periods mov bx,ex:[si] ;get spO mov [di],bx push es call bkg_insl ;set new timer interrupt pop es jmp set_periods_next

-82.333- set_periods_loop: mov ax,es: [si] ;copy spl, sp2... mov [di],ax ; to step_periods array set_periods_next: add si,2 add di,2 dec cl jnz set_periods_loop set_periods_ski: pop bx ;calc size of sp command shl bx,l add bx,set_periods_size jmp end_read_queue

set_redraw_count Background Command 6

set_redraw_count: mov ax,es: [si] mov redraw_count,ax mov bx,set_redraw_count_size jmp end_read_queue

set_redraw_delay Background Command 7

set_redraw_delay: mov ax,es: [si] mov redraw_delay,ax mov bx,set_redraw_delay_size jmp end_read_queue

-82.334-

mark

Background Command 8

mark: mov ax,queue_start ;remember current queue position mov mark_position,ax mov bx,mar_size jmp end_read_que

redraw

Background Command 9

set up for redraw

redraw test last_control,block_mode jz no__redraw ;make sure task in block mode mov ax,queue_start mov rem_queue_start,ax ;remember current queue start / end mov ax ,queue_end mov rem_queue_end,ax or current_status,redrawing ;turn on redrawing flag

start a redraw pass

-82.335-

redraw pass:

inc pass ;next pass number mov di,pass cmp di-redraw_count ;all passes done? jae finish_redraw shl di,l ; x 2 mov bx,step_periods[di] ;no, change step period

(1..) call bkg_insl cmp redraw_delay,0 ;if redraw_delay > 0, je redraw_passl or current_status,need_to_pause ;pause on next vector pos redraw_passl: mov ax,mark_position ;set redraw start / end mov queue_start,ax mov ax,rem_queue_start mov queue_end,ax mov bx,mark_size ;skip mark or last redraw instruction jmp end_read_queue

finish up redraw

finish_redraw: mov ax,rera_queue_start ;restore queue start / end mov queue_start,ax mov mark_jposition,ax ;update mark position mov ax,rem_queue_end mov queue_end,ax mov current_status,all-redrawing-need_to_pause ;turn off flags

-82.336- mov pass,0 ;set redraw pass to 0 mov bx,step_periods ;set step period 0 call bkg^insl

no_redraw: mov bx,redraw_size ;skip redraw instruction jmp end_read_queue

redraw_pause: mov ax,redraw_delay ;delay this number of timer ticks mov ut_steps,ax mov bkgnd_mode,_redraw_pausing jmp set_DACs ;update DACs with first move position

redraw_pausing: dec ut_steps ;count down ! steps jz redraw_pausingl jmp int_fini

redraw_jpausingl: and current_status,all-need_to_pause ;turn off need-to- pause flag jmp movel ;now, go do vector move

laser_int endp

endbkgtask label far

LaserBackground ends

subttl Copyright Notice page

LaserCode segment public 'CODE' assume cs: LaserCode,ds:Laser Data

-82 . 337-

LASER SYSTEM INFORMATION AREA

dw current_version ;current version number dw LaserData ;memory-resident segments dw LaserQueue dw LaserBackground dw LaserCode db 16 dup (0)

COPYRIGHT NOTICE

db 'LASER Controller Version 2.60 Copyright (C)

1988 by Tarnz Technolo subttle Software Interrupt Service page

Laser Software Interrupt Functions

These functions can be called from any high-level language having software interrupt capability.

AH AL

00 — open laser DAC channel and initialize

01 — close laser DAC channel and restore system

02 xx add command to background command queue 0.200 move/draw vector

0201 shutter open QL2, 02 shutter closed 02 03 change time base

02 04 pause

03 — reset background command queue

-82.338-

04 — get background command queue size

05 xx get_option

05 00 get software interrupt vector number

05 01 get background task interval time

05 02 get laser control word

05 03 get laser status

05 04 get laser turn-off (active to idle) delay

05 05 get laser turn-on (idle to active) delay

05 06 get laser home position

06 xx set_option

06 00 set software interrupt vector number

06 01 set background task interval time

06 02 set laser control word

06 03

06 04 set laser turn-off delay

06 05 set laser turn-on delay

06 06 set lase home position

07 xx background task execution control

07 00 execute command queue to current point and stop 07 01 execute command queue to current point, stop, and clear 07 02 clear command queue (reset queue's start pointer)

08 XX background task redraw control

08 00 set multi-pass step periods

08 01 set redraw pass count

08 02 set redraw delay

08 03 mark position

08 04 perform multi-pass redraw

page

Laser Controller Software Interface Interrupt Handler

-82 . 339-

All calls have the following format:

ah = function code al = sub-function code if applicable

bx..dx are call dependent

On return, the following is always true:

al = error code: 0 - operation was successful

255 - internal error, please report

software interrupt entry point

laser_swi: call far ptr laser_entry iret

laser_entry proc far

; save the working registers on the user's stack for

; the moment until we can switch to the internal stack

pushf push es push di push si push ds push ax push bx push ex

-82.340- push dx push bp mov bp,sp

mov ax,LaserData ; oint to laser system variables mov ds,ax mov ax,LaserQueue ;point to laser system queue mov es,ax

decode the function call and dispatch it

mov ax, [bp] .p_ax mov return_code,err_none

convert AH into an index into the function table

mov al,ah ;computer jump table offset xor ah,ah shl ax,l cmp ax,funct_tbl_end jc entry_l mov return_cod ,err_bad_param ;invalid function code jmp entry_2

call the appropriate procedure

entry_l: mov bx,ax call word ptr sc: [bx + offset funct_tbl]

return to caller with return code

-82.341 entry_2: mov ax, [bp] .p_ax mov al,return_code mov [bp] .p_ax,ax mov sp,bp pop bp pop dx

Pop ex

Pop bx pop ax

Pop ds pop si

Pop di pop es popf ret

laser_entry endp

funct_tbl label word dw open_laser_and_init ;0 dw close_laser_and_reset ;1 dw add_to_bcmd_queue ;2 dw reset_bcmd_queue ;3 dw get_bcmd_queue_size ;4 dw get_option ;5 dw set_option ;6 dw bkgnd_exec_ctrl ;7 dw redraw_ctrl ;8 funct_tbl_end equ $-funct_tbl

subttle setinterrupt page

Set an interrupt vector. The register programming is:

-82.342-

.

; BX:AX = CS:IP for the Interrupt Service Routine

DX = interrupt type (number)

Upon return, BX:AX contains the previous interrupt vector

setinterrupt proc near push ds push es push ex push dx push bx push ax mov ax,dx ;first return old vector mov ah,35h ;it will be in ES:BX int 21h mov cx,bx ;save BX mov ax,dx ;now set the new vector mov ah,25h pop dx ;pop AX into DX and so that pop bx ;DS:DX is the desired value mov ds,bx push es . ;save ES and CX push ex int 21h pop ax ;restore ES:CX as BX:AX and pop bx ;return pop dx pop ex pop es pop ds ret

setinterrupt endp

subttle Software Interrupt Functions

page

soft_fns proc near

AH = OO: open_laser_and_init

Install background task and initialize variables.

if BX > 0 then use BX to set new background interrupt interval else use previously defined time interval value

open laser and init: call reset_bcmd_queue mov bx, [bp] .p_bx or bx,bx jnz open_l mov bx,bkgnd_intr_time open_l: call set_ports call set_ctrl call set_bkgnd_time ret

set up 8255 ports on John Bell I/O Card

Al(0-7) output mode 0

Bl(0-7) output mode 0

Cl(0-3) output mode 0

Cl(4-7) input mode 0

set_ports

-82..344- mov dx,ctrll mov al,10001000b ;output control1 byte out dx,al ;doing so reset ports mov dx,portAl ;init ports mov al,00h out dx,al ;port Al, DAC value of 0 inc dx out dx,al ;port Bl inc dx mov dx,portCl mov al,OFFh out dx,al ;port Cl, strobes high ret

page

AH = 01: close_laser_and_reset

Stop background task and clean-up system as much as possible.

σlose_laser_and_reset: call bkg_rmy mov bkgnd_mode,_static ;static state ret

page

AH = 02: add command to background task's queue

AL COMMAND TYPE ADDED 00 vector move/draw

-82.345-

01 shutter open

02 shutter closed

03 change time base

04 pause

addbcmd tbl label word dw add_vector dw add_shutter_open dw add_shutter_close dw add_change_timebase dw add_pause addbcmd_tbl_end equ $-addbcmd_tbl

add_to_bcmd_ queue: test current_status,ls_open ;only add vector if channel open jnz add_bcmdl mov return_code,err_not_open ret add_bcmdl: call get_size ;check for near-full background queue cmp ax,bcmd_queue_limit jb add_bcmd2 mov return_code,err_queue_full ret add_bcmd2: mov ax, [bp] .p_ax mov di,bcmd_queue_end mov es: [di] ,al ;store command type inc di xor ' ah,ah shl ax,l cmp ax,addbcmd_tbl_end jc add bcmd3

-82.346- mov return_code,err_bad_param ;invalid function ret

call appropriate function

add bcmd3: mov bx,ax call word ptr cs:[bx + offset addbcmd_tbl] ret

AX = 0200: add_vector

Add vector to background command queue.

ES:BX points to vector packet: byte 0 - startX fractional (start coordinates) 1,2 - startX integer

3 - startY fractional 4,5 - startY integer

6,7 - deltaX tract/int (change coordinates) 8,9 - deltaY fract/int 10,11 - incr (# of steps)

add_vector: push ds mov ds,[bp].p_es ;ES:BX point to vector packet mov si, [bp] .p_bx eld mov ex, (move_size+l)/2 rep movsw pop ds mov bx,move_size jmp end_store

-82 . 347-

AX = 0201: background shutter open

Open laser beam shutter in-line with background sequencing.

add_shutter_open: mov bx,open_shutter_size jmp end_store

AX - 0202: background shutter closed

Close laser beam shutter in-line with background sequencing. add_shutter_close: mov bx,close_shutter_size . jmp end_store

AX = 0203: background change time base

Change interrupt time base in-line with background sequencing. add_change_timebase: mov bx,[bp].p_bx mov es: [di] ,bx mov bx,change_timebase_size jmp end_store

AX = 0204: temporarily pause background task

Pause background processing in-line with background ; sequencing. add_pause:

-82.348- ov bx, [bp].p_bx mov es:[di],bx mov bx,pause_size

finishing off storing to background queue

end_store: mov ax,bcmd_queue_end ;next end index add ax,bx cmp ax,bcmd_queue_limit ;next start index jb end_storel mov di,ax ;store queue max token mov es:[di],byte ptr OFFh mov ax,0 ;wraparound queue end_storel: mov bcmd_queue_end,ax ret page

AH = 03: reset_bcmd_queue

Throw away all commands currently in background command queue. Current background task operations are suspended.

reset_bcmd_queue: pushf ;will stop current operation cli mov ax,exec_queue_end mov exec_queue_start,ax mov ax,bcmd_queue_end ;force queues to zero length

-82.349- mov bcmd_queue_start,ax ;and make background routine idle mov clear_pointer,ax mov ax,queue_end mov queue_start,ax and current_status,all-redrawing-need_to_pause

;no redraw mov pass,0 mov bkgnd_mode,_static ;will enter idle state popf ret

page

AH = 04: get_bcmd_queue_size

Return the number of bytes currently used by background command queue in BX.

get_bcmd_queue_size: call get_size mov [bp] .p_bx,ax ret

get_size: pushf cli mov ax,bcmd_queue_end ;try end-start sub ax,bcmd_queue_start jnc get_sizel

,- add in background command queue size for negative numbers ; won't be perfectly accurate on queue wraparound

-82 .350-

add ax,bcmd_queue_size get_sizel: " popf ret

page

/ r

AH =- 05 : get_option

Return laser control option:

AL OPTION RETURNED

00 Software interrupt vector number

01 background task interval time

02 laser control word

03 laser status

04 laser turn-off delay tick count

05 laser turn-τon delay tick count

06 laser beam home position

goptn_tbl label word dw get_int_vector dw get_bkgnd_time dw get_laser_ctrl dw get_status dw get_off_count dw get_on_count dw get_home_pos goptn_tbl_end equ $-goptn_tbl

get_optiσn.:: mov ax,[bp].p_ax xor ah,ah

T

-O t. . -x x- shl ax,l . cmp ax,goptn_tbl_end jc go_l mov return_code , err_bad_j?aram ;invalid function ret

go_l: call appropriate function

mov bx,ax call word ptr cs:[bx + offset goptn_tbl] ret

AX - 0500: get software interrupt vector number

BL gets interrupt vector number

get_int_vector: mov ax,swi_int mov bx, [bp] .p_bx mov bl,al mov [bp] .p_bx,bx ret

AX - 0501: get background task interrupt interval time

BX gets timer parameter: intr freq = BX / 1.19 MHz (e.g. if BX = 119, freq is 100 us)

qet_bkgnd_time: mov bx,bkgnd_intr_time

-82.352- mov [bp] .p_bx,bx ret

AX = 0502: get laser control word

get_laser_ctrl: mov bx,laser_control mov [bp] .p_bx,bx refc

AX = 0503: get laser status

get_status: mov ax,current_status ;return current__status in

BX mov [bp] .p_bx,ax mov dx,portCl ;return Port Cl inputs in Cx in al,dx shl al,l shl al,l shl al,l shl al,l mov ah.,0 mov [bp] .p_cx,ax ret

AX = 0504: get laser turn-off delay count

get_off_count: mov bx,off_delay_σount ; return off tick count mov [bp] .p_bx,bx ret r

; AX - 0505: get laser turn-on delay count

-82 . 353-

get_on_count: mov bx,on_delay_count ;return on tick count mov [bp] .p_bx,bx ret

AX = 0506: get laser home position

mov bx,HomeXpos mov [bp] .p_bx,bx ;home X-position in BX mov cx,HomeYpos mov [bp] .p_cx,cx ;home Y-position in CX ret page

AH = 06: set_option

Change laser control option:

AL OPTION CHANGED

00 software interrupt vector number

0.1. background task interval time

02 laser control word

03

04 laser turn-off delay tick count

05 laser turn-on delay tick count

06. laser beam home position

soptn_tbl. label word dw set_int_vector dw set_bkgnd_time dw set_laser_ctrl dw no so

-82.354- dw set_off_count dw set_on_count dw set_home_pos soptή_tbl_end equ $-soptn_tbl

set_option: mov ax, [bp] .p_ax xor ah,ah shl ax,l cmp ax,soptn_tbl_end jo so_l mov return_code,err_bad_param ;invalid function . ret

so 1: call appropriate function

mov bx,ax call word ptr cs: [bx + offset soptn_tbl] no so: ret

AX = 0600: set software interrupt vector number

if BL = 0, then if vector previously set, then restore old vector else do nothing else use BL to set software interrupt vector number

set_int_ ector: mov bx, [bp] .p_bx or bl,bl jz set int 1

SΞT

-82.355- xor bh,bh mov swi_int,bx mov dx,bx mov ax,offset laser_swi mov bx,cs call setinterrupt or current_status,ls_interrupt mov swi_seg,bx mov swi_ofs,ax ret

set int 1:

restore old interrupt vector

test current_status,ls_interrupt jnz set_int_2 ret

set_int_2: mov bx,swi_seg mov ax,swi_ofs mov dx,swi_int call setinterrupt and current_status,all-ls_interrupt ret

AX = 0601: set background task interrupt interval time activate background task if not already running

BX has timer parameter: intr freq = BX / 1.19 MHz

(e.g. if BX = 119, freq is 100 us)

-82 . 356-

. - set_bkgnd_time: mov bx, [bp] .p_bx mov step_periods,bx call bkg_ins ret

AX. =- 0602: set laser control word

set_laser_ctrl: mov bx, [bp] .p_bx mov laser_control,bx

set control bits

set_ctrl mov dx,portCl in al,dx ; read existing port Cl bits test laser_control,shutter ;update for shutter jnz shutter_closed shutter_open: and al,all-shutter_ctrl jmp shutter_str shutter_closed: ;shutter closed if shutter not

0 or al,shutter_ctrl shutter_str: out dx,al ret

AX = 0604: set laser turn-off delay count

-82.357- set_off_count: mov bx,[bp].p_bx ;set off tick count mov off_delay_count,bx ret

AX = 0605: set laser turn-on delay count

set_on_count: mov bx, [bp] .p_bx ;set on tick count mov on_delay_count,bx ret

AX = 0606: set laser home position

set_home_pos: mov bx, [bp] .p_bx ;home X-position in

BX mov HomeXpos,bx mov ex, [bp] .p_cx ;home Y-position in

CX mov HomeYpos,ex ret page

AH = 07: control background task's execution

only functional when Block Mode is on (laser_control bit 2)

AL EXECUTION CONTROL ESTABLISHED

00 execute command block

01 execute and clear command block

-82.358-

02 clear command block

exec_ctrl_tbl label word dw exec dw exec_clear dw clear exec_ctrl_tbl_end equ $-exec_ctrl_tbl

bkgnd_exec_ctrl: test current_status,ls_open ;continue only if channel open jnz exec_ctrll mov return_code,err_not_open ret exec_ctrll: test laser_control,blockjiiode ; and in block mode jnz exec_ctrl2 mov return_code,err_not_block exec_ctrl2: mov ax, [bp] .p_ax mov di,bcmd_queue_end xor ah,ah shl ax,l cmp ax,exec_ctrl_tbl_end jo exec call mov r turn_code,err_bad_param ;invalid function ret

call appropriate function

exec_caIlL:r mov bx,ax call word ptr cs: [bx + offset exec_ctrl_tbl] ret

-82 . 359-

AX = 0700: execute command block

Execute command queue entries from last Clear Operation to the last command entered.

exec: mov bx,exec_queue_end ;check for full exec queue mov si,bx add bx,exec_entry_len cmp bx,exec_queue_limit jb execl mov bx,0 ;wraparound execl: cmp bx,exec_queue_start; full if indexes are equal jne exec2 mov return_code,err_exec_limit ret exec2: mov ax,clear_pointer mov [si],ax ;establish block to execute: add si,2 ; from clear_pointer (set by clear mov ax,bcmd_queue_end ;routine) to current end of mov [si] ,ax ; command queue mov exec_queue_end,bx / ret

AX = 0701: execute and clear command block

Execute command queue entries from last Clear

-82.360- Operation and then Clear.

exec_clear: call exec ;set up exec block cmp return_code,0 je clear ;fall into clear if no error ret

AX = 0702: clear command block

Reset the start of the command block for future Execute Operations.

clear: mov ax,bcmd_queue_end ;set clear pointer to current end mov clear_pointer,ax ; of command queue ret page

AH = 08: background task's redraw control

AL REDRAW CONTROL ESTABLISHED

00 set multi-pass step periods

01 set redraw count

02 set redraw delay

03 mark position

04 perform multi-pass redraw

redraw_ctrl_tbl label word dw add set periods dw add set redraw count

-82 . 361- dw add_set_redraw_delay dw add_mark_position dw add_redraw redraw_ctrl_tbl_end equ $-redraw_ctrl_tbl

redraw. _ctrl: test current_status,ls__open ;continue only if channel open jnz redraw_ctr11 mov return_code,err_not_open ret redraw_ _ctrll test laser_control,block_mode ;and in block mode jnz redraw_ctrl2 mov return_code,err_not_block redraw_ .ctrl2 call get_size ;check for near-full queue cmp ax,bcmd_queue_limit jb redraw_ctrl3 mov return_code,err_queue_full ret redraw_ .ctrl3: mov ax, [bp] .p_ax add al,5 ;token val = subcmd # + 5 mov di,bcmd_queue_end mov es:[di],al ;store token inc di mov ax, [bp] .p_ax xor ah,ah shl ax,l cmp a ,redraw_ctrl_tbl_end jc redraw_call mov return_code,err_bad_param ;invalid function ret

-82 . 362-

; call appropriate function

. redraw_call: mov bx,ax call word ptr cs:[bx + offset redraw_ctrl__tbl] ret

AX = 0800: add set multi-pass step periods to command queue

Add the set multi-pass step periods token and the variable size argument to the Background Command Queue

ES:BX points to step periods array: byte 0 - number of step periods (byte) 1,2 - step period pass 0 (word) 3,4 - step period pass 1 (word) etc.

add_set__periods: push ds mov ds,[bp].p_es ;ES:BX points to step periods array mov si, [bp] .p_bx eld ;for movsw, DS:SI+ ->

ES:DI+ mov cl,ds: [si] ;get f step periods, word count mov ch,0 mov es: [di],cl inc si inc di cmp ex,10 ; ;mmaaxx ooff 1100 ppaasssseess jbe add_set_periods1 mov ex,10

SUBSTITUTESHEET

-82 . 363- add_set_periodsl: mov bx,cx shl bx,l ;compute laser command size add bx,set_periods_size rep movsw pop ds jmp end_store

AX = 0801: add set redraw count to command queue

Add the set redraw count token and argument to the Background Command Queue

add_set_redraw_count: mov bx, [bp] .p_bx mov es: [di] ,bx mov bx,set_redraw_count_size jmp end_store

; AX = 0802: add set redraw delay to command queue

;

; Add the set redraw delay token and argument to the

; Background Command Queue

. add_set_redraw_delay: mov bx, [bp] .p_bx mov es: [di],bx mov bx,set_redraw_delay_size jmp end_store

E sπeeT

-82 . 364-

AX = 0803: add mark position to command queue

Add the mark position token to the Background Command Queue

add_mark_position: mov bx,mark_size jmp end_store

AX = 0804: add redraw to command queue

Add the redraw token to the Background Command Queue

add_redraw: mov b ,redr w_size jmp end_store

soft_fns endp

endcode label far

LaserCode ends

end

-82.365- DISKOFF.ASM

Page 60,132

Title DISKOFF Turn Floppy Disk's Motor Off

DISKOFF Turn Floppy Disk's Motor Off

This program turns off the floppy disk drive's motor which isn't automatically turned off by the OS. By installing the variable-speed sterolithography laser controller code, we have trapped out the system clock which would have automatically time-out the floppy disk drive(s) .

Version 1.00 (c) Copyright Tarnz Technologies, 1987

name diskoff

System Data

sysdata segment at 4Oh org 03Fh motor_status db ? motor_count db ? sysdata ends

subttl DiskOff Code page

DiskOff Code

-82 . 366-

DiskOffCode segment public 'CODE' assume cd:DiskOffCode,ds:sysdata,ss:stack

nomotor proc far mov ax,sysdata mov ds,ax mov motor_count,0 and motor_status,OFOh ;turn off motor running bits mov dx,03f2h ;FDC control port out dx,al ;turn off the motor

mov ax,4D0oh ;exit back to DOS int 21h ret

nomotor endp DiskOffCode ends

stack segment para stack 'STACK' db 32 dup (O) stack ends

end nomotor

3D Systems Stereolithography System Software

MATERIAL.BAS

SLA-1 Material Manager Software

History:

12/01/87 Ver 2.30 first release

-82 . 367-

' 12/14/87 Ver 2.40 handles line widths min and max, computes MSA

12/17/87 Ver 2.41 FN zero conditions handled

(divide, LOG)

1/08/88 Ver 2.50 relabeled Calc MSA due to MSA concept problems ' 1/25/88 Ver 2.60 version update only

DIM SP[20],LH[20],WMIN[20] ,WMAX[20]

VersionId$ = "2.60" TRUE = -1 FALSE = 0 ScanFlag! = FALSE

SingleBar$ = STRINGS(45,196) PowerFile$ = "POWER.LST" LastMaterialFile$ = "MATERIAL.LST"

COLOR 15 MatAsk: CLS

PRINT SingleBar$

PRINT " MATERIAL, Material Manager" PRINT " 3D Systems Laser Stereolithography System" PRINT " Version "+VersionId$+" 3D Systems, Inc." PRINT SingleBar$ PRINT

IF LEN(MaterialFile$)>0 THEN PRINT " Material File:

";MaterialFile $ PRINT

PRINT " l. Load Material Data" PRINT " 2. View Material Data"

T

-82 . 368-

PRINT " 3. Input New Material Data" PRINT " 4. Layer Thickness Information" PRINT " Q. Quit" PRINT PRINT " Option: "; MatAskLoop:

A$ = UCASE$(INKEY$)

IF LEN(A$)=0 THEN MatAskLoop

PRINT. A$,;

I A$«"l! ,i THEN LoadMaterial

IF A$="2 " "' THEN ViewMaterial

IF A$="3" THEN InputMaterial

IF A$="4" THEN Layerlnfo

IF A$="Q" ' THEN END

LoadMaterial:

CLS

PRINT "Available Material Files:"

PRINT

ON ERROR GOTO NoMaterialFiles

FILES "*.MAT"

GOTO GetMaterialAsk NoMaterialFiles:

PRINT "- πσ material files in working directory -"

RESUME GetMaterialAsk GetMaterialAsk:

PRINT

INPUT "Name of data file to read: ",MaterialFile$

IF LEN(MaterialFile$)=0 THEN MatAsk

MaterialFile$ = UCASE$(MaterialFile$)

IF INSTR(MaterialFile$,".")=0 THEN MaterialFile$ = MateriaEFile$ + ".MAT"

ON ERROR? GOTO CantReadMaterialFile

GOSUB GetMaterialFileData

OPEN LastMaterialFileS FOR OUTPUT AS f9

-82 . 369-

PRINT f9,MaterialFile$ CLOSE #9 GOTO MatAsk

GetMaterialFileData:

OPEN MaterialFile$ FOR INPUT AS #7

ON ERROR GOTO 0

INPUT f7,MaterialLaserPower

INPUT 7,NumberOfPairs!

FOR I! = 1 TO NumberOfPairs!

INPUT 7,SP(I!)

INPUT #7,LH(I%)

INPUT #7,WMIN(I!)

INPUT #7,WMAX(I!)

SP(I!) = LOG(SP(I!))/LOG(10) NEXT I! CLOSE #7

CALL Regression(LH() ,LHSlope,LHYint,LHRval) CALL Regression(WMIN() ,WMINSlope,WMINYint,WMINRval) CALL Regression(WMAXO ,WMAXSlope,WMAXYint,WMAXRval) RETURN

CantReadMaterialFile:

PRINT "Can't read material file ";MaterialFile$

CLOSE #7

RESUME GetMaterialAsk

InputMaterial: CLS

PRINT "INPUT MATERIAL DATA" PRINT PRINT

INPUT "Name of Material Data File: ",MaterialFile$ MaterialFile$ = UCASE$(MaterialFile$)

-82.370-

IF LEN(MaterialFile$)=0 THEN MatAsk

IF INSTR(MaterialFile$,".")=0 THEN MaterialFile$ =

MaterialFile$ + ".MAT" '

PRINT

INPUT "Enter Material Test Laser Power Reading ( W) :

",MaterialLaserPower INPUT "How many Step Period/Line Height data pairs?

",NumberOfPairs! PRINT

ON ERROR?.GOTO) FOR I! = 1 TO NumberOfPairs! PRINT "Data pair #";I!;": ";

INPUT ."SP = ",SP(I!)

LOCATE CSRLIN-1,30

INPUT " LH = ",LH(I!)

IF SP(I!)=0 OR LH(I!)=0 THEN MatAsk ' abort

SP(I!)=LOG(SP(I!))/LOG(10) ' convert to log(sp)

LOCATE CSRLIN-1,45

INPUT "WMIN = ",WMIN(I!)

LOCATE CSRLIN-1,60

INPUT "WMAX = ",WMAX(I!) NEXT I!

OPEN MaterialFile$ FOR OUTPUT AS f7 PRINT #7,MaterialLaserPower PRINT 7,NumberOfPairs! FOR I! = 1 TO NumberOfPairs!

PRINT #7,10 A SP(I!)

PRINT #7,LH(I!)

PRINT #7, MIN(I!)

PRINT #7,WMAX(I!) NEXT I! CLOSE f7

OPEN LastMaterialFileS FOR OUTPUT AS f9 PRINT #9P,.Ma erialFile$ CLOSE #9

CALL Regressio (LH() ,LHSlope,LHYint,LHRval) CALL Regression(WMINO ,WMINSlope,WMINYint,WMINRval)

-82 . 371-

CALL Regression(WMAX() ,WMAXSlope,WMAXYint,WMAXRval) GOTO MatAsk

ViewMaterial: CLS

PRINT "Data from Material File: ";MaterialFile$ PRINT PRIN

PRINT "Material Test Laser Power Reading: "; PRINT USING "###.f#";MaterialLaserPower PRINT

PRINT NumberOfPairs!;"Material Data Pairs:" PRINT FOR I! = 1 TO NumberOfPairs!

PRINT USING "f#. ";I!;

PRINT USING " SP = ### .f ";10 A SP(I!) ;

LOCATE ,20

PRINT USING " LH = ####.## » ;LH(I%) ;

LOCATE ,35

PRINT USING •• WMIN = ####.##";WMIN(l!) ;

LOCATE ,52

PRINT USING " WMAX = !###.##";WMAX(I!) NEXT I! PRINT

PRINT " LH: Slope =";

PRINT USING " ff##.##";INT(LHSlope*1000)/1000; PRINT " Y-Intercept =";

PRINT USING "### #.f ";INT(LHYint*100)/100; PRINT " R-Value =";

PRINT USING "ff#f#.ff";INT(LHRval*1000)/1000 PRINT "WMIN: Slope =";

PRINT USING "ff###.##";INT(WMINSlope*1000)/1000; PRINT " Y-Intercept =";

PRINT USING "#f ##. #";INT(WMINYint*100)/100; PRINT " R-Value =";

-82.372-

PRINT USING "ff f .f ";INT(WMINRval*1000)/1000

PRINT "WMAX: Slope =";

PRINT USING "f # . #";INT(WMAXSlope*1000)/1000;

PRINT " Y-Intercept =";

PRINT USING " fff .#!";INT(WMAXYint*100)/100;

PRINT " R-Value =";

PRINT USING "f#ff#.f#";INT(WMAXRval*1000)/1000

PRINT

INPUT "Press Enter to continue... ",A$

GOTO MatAsk

Layerlnfo:

CLS

PRINT "LAYER THICKNESS INFORMATION"

PRINT

PRINT

INPUT "Desired max layer thickness (mils): ",T$

T = VAL(T$) • to simulate cure depth

IF T=0 THEN GOTO MatAsk

PRINT

PRINT

WMIN = FN GetLog(T+6,WMINSlope,WMINYint)

WMAX = FN GetLog(T+6,WMINSlope,WMINYint) ' MSA = 180/3.1415926535*(2*T/(WMIN+WMAX) ) ' wrong 1 IF MSA<0 THEN MSA=0 r IF MSA>89.999 THEN MSA=90

PRINT USING "WMIN = ###.f#";WMIN;

PRINT USING " WMAX = f# .f ";WMAX ' PRINT USING " MSA = f#!.f#";MSA don't show yet

PRINT

INPUT "Press Enter to continue ",A$

GO.τα Mat sk

i ____.

-82 . 373-

SUB Regression(Array(1) ,Slope,Yint,Rval) SHARED NumberOfPairs!,SP() XY = 0 SUMX = 0 SUMY = 0 SUMY2 = 0 XSQUARED = 0 IF NumberOfPairs!<l THEN

Slope = 0

Yint = 0

Rval = 0

GOTO EndRegSub END IF FOR I! = 1 TO NumberOfPairs!

XY = XY + SP(I!) * Array(l!)

SUMX = SUMX + SP(I!)

SUMY = SUMY + Array(I!)

SUMY2 = SUMY2 + Array(l!) A 2

XSQUARED = XSQUARED + SP(I!) A 2 NEXT I!

Denom = XSQUARED - (SUMX A 2) / NumberOfPairs! IF Denom < 1E-5 THEN Slope = 0_

ELSE Slope = (XY - (SUMX*SUMY)/NumberOfPairs!) / Denom Yint = SUMY/NumberOfPairs! - Slope * SUMX/NumberOfPairs!

Denom = SUMY2 - SUMY A 2 / NumberOfPairs!

IF Denom < 1E-5 THEN Rval = 0_

ELSE Rval = SQR(((Yint * SUMY + Slope * XY) -

SUMY A 2/NumberOfPairs!) / Denom) EndRegSub: END SUB

DEF FN GetLog(DataPoint,Slope,Yint) IF 1 DataPoint > 0 THEN

FN GetLog = Slope * LOG10(DataPoint) + Yint ELSE

FN GetLog = 0

-82.374-

END IF END DEF

UTILITY FUNCTIONS AND PROCEDURES

*Removes^ all double spaces in CmdLine$

RemoveDoubleSpaces:

WHILE INSTR(CmdLine$," ")>0

I = INSTR(CmdLine$," ")

CmdLine$ = left$(CmdLine$,I) + mid$(CmdLine$,I+2,99) WEND RETURN

' Find any char of Char$ in Main$ starting at index

Start

1 Returns LEN(Main$)+l if no character of Char$ in

Main$

I

DEF FN FindStr(Start!,Main$,Char$) LOCAL I!,J!,MIN! MIN! = LEN(Main$) + 1 FOR I!=l to LEN(Char$)

J! = INSTR(Start!,Main$,MID$(Char$,I!,l) ) IF (J! > 0) AND (J! < MIN!) THEN MIN! = J! NEXT I!

FN FindStr = MIN! END DEF

Make a string from a number without a leading space

-82 . 375-

DEF FN StrNoSp$(Num)

LOCAL A$

A$=STR$(Num)

IF LEFT$(A$,1)=" " THEN A$=RIGHT$(A$,LEN(A$)-1)

FN StrNθSp$ = A$ END DEF

* Pick out a number from a string

' starting at Index and going to the next space or comma or end-of-string

I

SUB UnitValInt(Storage , ext$,Index!) Storages = VAL(MID$(Text$,Index!) ) Index! = FN FindStr(Index!,Text$," ,") + 1

END SUB

SUB UnitVal(Storage,Text$,Index!) Storage = VAL(MID$(Text$,Index!) ) Index! = FN FindStr(Index!,Text$," ,") + 1

END SUB

' Pick out text from a string

' ' starting at Index and going to the next comma or end-of-string

I

SUB UnitStr(Storage$,Text$,Index!)

LOCAL I!

I! = FN FindStr(Index!,Text$," ,")

Storage$ = MID$(Text$,Index!,I!-Index!)

Index! = I! + 1 END SUB

Remove excess spaces around string

-82 .376-

DEF FN NoSp$(Text$) •LOCAL S!,E! IF LEN(TextS)>0 THEN S! = 1 WHILE MID$(Text$,S!,l)=" "

INCR S! WEND

E! = LEN(TextS) WHILE E!>S!+1 AND MID$(Text$,E!,1)=" "

DECR, E! WEND"

FN NθSp$ = MIDS(Text$,S!,E!-S!+1) ELSE

FN NθSp$ = "" END IF END DEF

Can't open file. Report this to operator.

CantOpen:

CALL SystemError("Can't open file "+FileName$) END

I

' Show error and store it on disk

I

SUB SystemError(Text$)

PRINT Text$

OPEN "C:\SYSTEM.ERR" FOR OUTPUT AS f9

PRINT 9,"PREPARE: ";Text$

CLOSE #9 END SUB

-82.377-

3D Systems Stereolithography System Software

MERGE.PAS

SLA-1 Merge Sliced Files Software

Compile with Turbo Pascal Version 4.0

File name line syntax:

<file name>/Z<offset>/N<blocks/0<blocks> <file name>...

/OUTFILE<outfile>/RES<resolution>/ZSPC<z-s pacing> /THICK<thickness>

where <file name> is a Slice input file

<offset> is a + or - Z-axis offset for that input file <blocks> contains the identifiers for the blocks to skip for that input file separated by commas

<outfile> follows all input file specs and is the name of the part output file to store the parsed data

Up to: ID Slice data files can be combined.

Merge *.V vector output file format: (file #2)

LI,<layer A>

-82.378- <Xl> <yl> <X2> <y2>

<another block,<layer A>

[L2,<layer A>

<xl> <yl> <x2> <y2>

<another block>,<layer A> : : ] LI,<layer B>

(EOF)

Critical Area Codes:

XV = draw section cross-hatch vectors in box as rivets XI = ignore section cross-hatch vectors in box SV = draw up/down skin cross-hatch vectors in box as rivets SI = ignore up/down skin cross-hatch vectors in box

Recent History:

9/ 1/87 Ver 2.04 Version 2 released

9/ 3/87 Ver 2.07 Compiled by TBM (Modified

Turbo Basic)

9/ 4/87 Ver 2.08 added SV, SI critical areas

9/17/87 Ver 2.10 only updated version number

9/25/87 Ver 2.20 new SLICE 19 block format supported

9/28/87 Ver 2.21 added NFUB support

9/30/87 Ver 2.25 only updated version number

-82.379-

10/26/87 Ver 2.27 Parse name changed to Merge *.P files now *.V files error file support

11/12/87 Ver 2.30 first Beta software release 11/20/87 Ver 2.31 added directory listing of *.SLI files

Ver 2.32 12/04/87 Ver 2.33 Slice20 FUB FDB blocks

BLOCK.ID file support

12/14/87 Ver 2.40 input file names in *.L output file pass along ! comment lines in slice files

12/21/87 Ver 2.41 second !MERGE line contains start, end, # of layers BOX file noted when found, not if not found scans !SLICE comments for

Res, ZSpacing, Thick

1/11/88 Ver 2.50 BLOCK.ID looked for in \3DSYS too 1/22/88 Ver 2.54 makes Range instead of Layer

Control File as default Layer

Control File made if /LAYERCTRL option used

1/25/88 Ver 2.60 generates both Layer and Range

Files (.L and .R)

1/27/88 thickness input is in mils, not millimeters

1/27/88 thickness defaults to Z-Spacing value 2/10/88 converted from Turbo Basic to

Turbo Pascal 4.0 merge operation runs 2.5 times faster than before merge status box with layer and range information /O only and /N no block selections improved

2/12/88 Ver 2.61 EndLayer variable now Longint layer numeric output is type word, not integer

-82 . 380-

uses Crt,Dos ;

const Versionld = '2.61' ; sp80 = »

ErrorFileName = 'C:\SYSTE .ERR' ; BlockldFileName = •BLOCK.ID• ; HomeDixectory = r C:\3DSYS' ; Cr = A M; ' StatusBoxLeft = 42; StatusBoxRight = 79; StatusBoxTop = 10; StatusBoxBottom = 22;

type " str6 = string[6]r strl6 = string[16];

var

FirstVar: Byte; { must be first variable defined }

X1,Y1,X2,Y2,X3,Y3,X4,Y4: array [1..10Q] of Longint; ZBaseBox,ZHeightBox: array [1..100] of Longint;

BoxType: array [1..100] of str6:

CurrentZ,ZOffset: array [1..10] of Longint;

OnlyBlocks,NoBlocks: array [1..10] of String;

BlockMnemonics: array [1..32] of str6; Blocks: array [1..100] of str6;

ErrorFile: Text;

InputFiles: array[1..10] of Text; code,NumPartFiles,InFile,NumCritVols: Integer;

BlockMnemonicsCount,ZSpace,BlockCount,Layers: Integer; Cmd i.ne„MergeLine,FirstFileNam ,Lin ,OutFileName: String;-

SingleBα2rr,,EayerFileName,RangeFileName,VectorFileName:

String;

-82 . 381-

Resolution,ZSpacing,Thickness: Real; CurrentLayer,LastLayer,ZStart,ZEnd,ZVal: Longint; StartLayer,EndLayer,MergeLayer: Longint; LayerFile ,RangeFile,VectorTextFile: Text; UpdateFile: File of Char; Updatelndex: Longint; HeaderType: Char; FileNum,Cmd,Blk: str6;

FirstRange,NewRange,SkipBlock,NeedStep: Boolean; " RangeLayerCount,RangeCount,UpdX,UpdY: Integer;

LastVar: Byte; { should be last variable defined }

Utility Routines

function upper(text: string) : string; var i: Integer; temp: string; begin temp :- text; for i := 1 to length(temp) do temp[i] := upcase(temp[i]) ; upper := temp; end;

function many(Ch: Char;num: Integer) : string; var temp: string; i:. Integer; begin temp := • ' ; for i:=l to num do temp := te p+Ch; many := temp;

-82.382- end;

procedure centerIn(text: String) ; begin gotoxy((79-length(text)) div 2,whereY) ; 5 writeln(text) ; end;

function IntStr(num: Integer) : strl6; vaar: temp: strlδ; 1D0 begin if num>=0 then Str(num,temp) else Str(num+$8000,temp) ;

IntStr := temp; end;

function WordStr(num: Word): strlδ; 15. var temp: strlδ; begin

Str(num,temp) ; WordStr := temp; 20 end;

function LongStr(num: Longint) : str16; var temp: strl6; begin 25 Str(num,temp) ;

LongStr := temp; end;

function RealStr(num: Real;AfterDecimal: Integer) : String; 3DJ var i: Integer; temp: String;

-82.383- begin

Str(num:10:AfterDecimal,temp) ; i := 1; while (i<length(temp) ) and (temp[i]=' ') do inc(i) ; RealStr := copy(temp,i,99) ; end;

function spc(len: Integer) : string; begin spc := copy(sp80+sp80,l,len) ; en ;

procedure ReadCommandLine(var line: string) ; var i: Integer; begin line := ParamStr(l) ; for i:=2 to ParamCount do line := line + • ' + ParamStr(i) ; end;

{ Remove excess quote marks around string

} function NoQuotes(Text: String) : String; const

Quote = *"' ; var s,e: Integer; begin s := 1; if (length(Text)>1) and (Text[l]=Quote) then inc(s) ; e := length(Text) ; if Text[e]=Quote then dec(e) ;

NoQuotes := cop (Text,s,e-s+1) ; end;

ε <$#

-82.384-

(

Removes all double spaces in text string

} procedure RemoveDoubleSpaces(var text: string); " begin while pos(' ',text)>0 do delete(text,pos(' ',text),l); end;

(1 Find: any char of Chars in Main starting at index Start

Returns length(Main)+1 if no character of Chars in Main

} function FindStr(Start: Integer;Main: string;Chars: strlβ) : Integer; var i,j,min: Integer; temp: String; begin min := length(Main)+1; temp := copy(Main,Start,199) ; for i:=l to length(Chars) do begin j; :,= Start + pos(Chars[i] ,temp) - 1; if: (j >= Start) and (j < min) then min := j; T end;;;

FindStr := min; end;

{ better val routines } function IntVal(line: String;var code: Integer):

Int ger-? vaar code2: Integer; num: Integer;

-82.385- begin val(line,num,code) ; if codeoo then val(copy(line,1,code-1) ,num,code2) ; IntVal := num; 5 end;

function LongVal(line: String;var code: Integer):

Longint; var- code2: Integer; IOC' num: Longint; begin val(line,num,code) ; if codeoo then val(copy(line,l,code-l) ,num,code2) ;

LongVal := num; 15 end;

function RealVal(line: String;var code: Integer): Real; var ofs ,code2: Integer; num: Real; 0 begin ofs := 0; if line[l]='.' then begin line := '0' + line; ofs := -l; 5 end; val(1ine,num,code) ; if codeoo then val(copy(line,l,code-l) ,num,code2) ; if codeoo then inc(code,ofs) ; RealVal := num; 0 end;

{ -

Pick out a number from a string starting at Index and going to the next space or comma or end-of-string

-82.386-

} procedure UnitValShortInt(var Storage: Integer;Text:

String;var Index: Integer) ; var 5 i: Integer; begin

Storage := IntVal(copy(Text,Inde ,99) ,i) ; if i=0 then Index := length(Text)+1 else, inc(Index,i) ; IDT endj;

procedure UnitValInt(var Storage: Longint;Text:

String;var Index: Integer) ; var i: Integer; 15- begin

Storage := LongVal(copy(Text,Index,99) ,i) ; if i=0 then Index := length(Text)+1 else inc(Index,i) ; end;

20 procedure UnitVal(var Storage: Real;Text: String;var Index: Integer) ; var. i:; Integer; begin 25 Storage := RealVal(copy(Text,Index,99) ,i) ; if i=0 then Index := length(Text)+1 else inc(Index,i) ; end;

{ 3D Pick out text from a string starting at Index and going to the next comma or ΘϊHsf-string

} procedure UnitStr(var Storage,Text: String;var

-82.387-

Index: Integer) ; var i: Integer; begin i := FindStr(Index,Text, • , •) ;

Storage := copy(Text,Index,i-Index) ; Index := i + 1; end;

{ [ Show error and store it on disk

} procedure QuietSystemError(TextLine: string) ; begin assign(ErrorFile,ErrorFileName) ; rewrite(ErrorFile) ; writeln(ErrorFile, 'MERGE: • ,TextLine) ; close(ErrorFile) ; end;

procedure SystemError(TextLine: string) ; begin writeln(TextLine) ;

QuietSystemError(TextLine) ; end;

{ Can't open file. Report this to operator.

} procedure CantOpen(FileName: string) ; begin

SystemError(•Can''t open file '+FileName) ; end;

{ Harry's ultimate Draw-A-Box on the text screen routine }

-82 . 388- procedure DrawBox(xl,yl,x2,y2: integer;BoxTyp : integer) ; type

BoxMode = array[1..4] of Char; {

Box Types:

1: Single Line all around 2: Double Line all around

2.Z- Single Line horizontal, Double Line vertical 4":: Double Line horizontal, Single Line vertical

} const

{ Type 1 2 3 4

} UpperLeftCorner : BoxMode = (f218,#201,f214, 213) UpperRightCorner: BoxMode = ( 191, 187,#183,#184) LowerLeftCorner : BoxMode = ( 192,#200,#211,#212) LowerRightCorner: BoxMode = (#217,#188,#189,#190) HorzBar : BoxMode = (#196,f205,#196,#205) VertBar : BoxMode = (f179, 186,#186,#179) var i: integer; FullHorzBarr String; begin gotoxy(xl,yl) ; if xl<x2 then begin if yl=y2 then FullHorzBar

:= Many(HorzBar[BoxType] ,x2-xl+l) else FullHorzBar := Many(HorzBar[BoxType] ,x2-xl-l) ; end else FullHorzBar := ' ' ; if yloy2 then begin if xloχ2 then write(UpperLeftCorner[BoxType]) ; write<FullHorzBar) ; if X1Z X2 then write(UpperRightCorner[BoxType]) ; end; for i:=yl+l to y2-l do begin

-82 . 389- gotoxy(xl,i) ; write(VertBarfBoxType]) ; gotoxy(x2,i) ; write(VertBar[BoxType]) ; end; gotoxy(xl,y2) ; if yl = y2 then write(FullHorzBar) else begin if xloχ2 then write(LowerLeftCorner[BoxType]) ; write(FullHorzBar) ; if xloχ2 then write(LowerRightCorner[BoxType]) ; end; end;

procedure SetUpStatusBox; begin

DrawBox(StatusBoxLeft,StatusBoxTop,StatusBoxRight, StatusBoxBottom,l) ;

DrawBo (StatusBoxLeft+1,StatusBoxTop+2,StatusBoxRight-1 ,

StatusBoxTop+2,1) ; DrawBox(StatusBoxLeft+1,StatusBoxBottom-2,

StatusBoxRight-1,StatusBoxBottom-2,1) ; end;

{$F+} procedure ExitMerge; {$F-} begin window(l,l,80,25) ; gotoxy(1,22) ; end;

{=====================================================}

procedure ReadBoxFi1e; var

SUBSTITUTESHEET

-82 . 390-

BoxFile: Text; BoxFileLine: String; index,BoxLineCount: Integer; TempBoxType: str6; 5 TempZBaseBox,TempZHeightBox: Real;

TempXl,TempYl,TempX2,TempY2,TempX3,TempX4, emp 4: Real; begin

NumCr±tVσls :. = 0; 00 assign(Bϊ3xFile,OutFileName + '.BOX');

{$1-} reset(BoxFile) ;

{$1+} if IOresult = 0 then begin 15 writeln; writeln(.Critical Area box file found (',OutFileName, ' .BOX) » ) ; BoxLineCount := 0; 20. while not eof (BoxFile) do begin readln(BoxFile,BoxFileLine) ; inc(BoxLinecount) ; if (BoxFileLineo* ') and (BoxFileLine[1]<>* !') then begin 25 index := 1;

UnitStr(TempBoxType,BoxFileLine,index) ; UnitVal(TempZBaseBox,BoxFileLine,index) ; UnitVal(TempZHeightBox,BoxFileLine,index) ; UnitVal(TempXl,BoxFileLine,index) 30 UnitVal(TempYl ,BoxFileLine,index) UnitVal(TempX2,BoxFileLine,index) UnitVal(TempY2,BoxFileLine,index) UnitVal(TempX3,BoxFileLine,index) UnitVal(TempY3,BoxFileLine,index) 35 UnitVal(TempX4,BoxFileLine,index) if index > length(BoxFileLine) then writeln('Box line ',BoxLineCount, ' too

-82.391- short') ; UnitVal (TempY4,BoxFileLine,index) ; if index <= length(BoxFileLine) then writeln('Box line ',BoxLineCount, ' too long'); inc(NumCritVols) ;

BoxType[NumCritVols] := upper(TempBoxType) ; ZBaseBox[NumCritVols] := round(TempZBaseBox *

Resolution) ; ZHeightBox[NumCritVols] := round (TempZHeightBox *• Resolution) ; •

XI[NumCritVols] = round(TempXl * Resolution) Yl[NumCritVols] = round(TempYl * Resolution) X2[NumCritVols] = round(TempX2 * Resolution) Y2[NumCritVols] = round(TempY2 * Resolution) X3[NumCritVols] = round(TempX3 * Resolution) Y3[NumCritVols] = round(TempY3 * Resolution) X4[NumCritVols] = round(TempX4 * Resolution) Y4[NumCritVols] = round(TempY4 * Resolution) end; end; close(BoxFile) ; end; end;

procedure FindFirstLayers; var i,dummy: Integer; GoodLine: Boolean; begin

{ determine first layer number for each slice file } MergeLayer := 99999; for InFile := 1 to Nu PartFiles do begin if not eof(InputFilesfInFile]) then begin GoodLine := false; repeat readln(InputFilesfInFile] ,Line) ;

-82 . 392- if (Line = ' •) or (Line[l] in ['!','*']) then begin writeln(LayerFile,Line) ; writeln(RangeFile,Line) ; if copy(Line,l,6) = '!SLICE' then begin i := pos( '-RES ' ,Line) ; if (i>0) and (Resolution<=0) then Resolution := RealVal

(copy(Line,i+5,99) ,dummy) ; i := pos('-ZS ',Line); if (i>0) and (ZSpacing<=0) then

ZSpacing := RealVal(copy(Line,i+4,99) , dummy) ; i := pos('-THICK • ,Line) ; if (i>0) and (Thickness<=0) then

Thickness := RealVal

(copy(Line,i+7,99) ,dummy) ; end; end else GoodLine := true; until GoodLine or eof(InputFiles[InFile]) ; HeaderType := Line[l]; Zval := LongVal(copy(Line,3,99) ,dummy)

+ ZOffset[InFile] ; CurrentZ[InFile] := Zval; if Zval < MergeLayer THEN MergeLayer := Zval; end; end;

StartLayer := MergeLayer; end;

procedure GetParameters; var

MmFLa t Boolean; dummy: Integer; DefaultTh ckness: Real; temp: String; begin

-82.393- writeln; if Resolution <= 0 then repeat write('Slice -res resolution value? '); readln(Line) ; 5 Resolution := RealVal(Line,dummy) ; end; if ZSpacing <= 0 then begin write('Slice -zs layer spacing? '); readln(Line) ; 10. ZSpacing := RealVal(Line,dummy) ; end;

MmFlag := false; if Thickness <= 0 then begin

DefaultThickness := int(ZSpacing * 1000 / 15 Resolution) ; write( •Layer thickness in mils

[ ,RealStr(DefaultThickness,0) , ]? ') ; readln(Line) ; if Line = ' • then Thickness := DefaultThickness 0 else begin if pos( 'MM' ,upper(Line) )>0 then MmFlag := true; Thickness := RealVal(Line,dummy) ; end; end; 55 if not MmFlag then Thickness := Thickness * 0.0254; { convert to mm } temp := •* * + RealStr(Resolution,3) + ',' + RealStr(ZSpacing,3) + ',' + RealStr(Thickness,3) ; 0 writeln(LayerFile,temp) ; writeln(RangeFile,temp) ; end;

{

procedure AddBlock; 5 var

-82 . 394- i: Integer; begin i := 1; while (i <= BlockCount) and (Blocks[i] o Blk) do inc(i) ; if i > BlockCount then begin inc(BlockCount) ; Blocks[BlockCount] := Blk; end; end;:

procedure OutputRange; var i: Integer; begin gotoxy(UpdX,UpdY) ; write(LastLayer:5, • • ,RangeLayerCount:5) ; NewRange := true; writeln(RangeFile,ZStart, • , » ,LastLayer, ' , ' , ZSpace, ', • ,ZSpace) ; for i:=l to BlockCount do writeln(RangeFile,Blocks[i]) ; inc(RangeCount) ; end^

procedure StartNewRange; begin

ZStart := MergeLayer; BlockCount := 0; NeedStep := true; end;

procedure MakeControl; var

EayerDi f: Longint; begin writeln(LayerFile, ergeLayer, * , ' ,Blk) ;

-82 . 395- if Layers=l then begin ZStart := MergeLayer; CurrentLayer := MergeLayer; NeedStep := true; AddBlock; end else begin if CurrentLayer = MergeLayer then AddBlock else begin

CurrentLayer := MergeLayer; if NeedStep then begin NeedStep := false; ZSpace := MergeLayer - LastLayer; AddBlock; end else begin LayerDiff := MergeLayer - LastLayer; if LayerDiff o ZSpace then begin OutputRange; StartNewRange; AddBlock; end else AddBlock; end; end; end; end;

{

procedure NewLayer; var i: Integer; begin inc(Layers) ;

EndLayer := MergeLayer; if NewRange then begin if FirstRange then begin LastLayer := MergeLayer; FirstRange := false;

-82.396- end; writeln; write(Cr,RangeCount+1:2, ' . ' ,LastLayer:5, • - ') ; UpdX := whereX; UpdY := whereY; writ (LastLayer:5, ' 1 layers') ; NewRange := false; RangeLayerCount := 1; end: else begin gptαxy(UpdX,UpdY) ; inc(RangeLayerCount) ; write(LastLayer:5, ' ' ,RangeLayerCount:5) ; end;

Blk := '#TOP'; MakeControl;

{ write out critical areas for layer } for i := 1 to NumCritVols do if (ZBaseBox[i] <= MergeLayer) and

(MergeLayer <= ZBaseBox[i] + ZHeightBox[i]) then writeln(LayerFile,MergeLayer, ' ,#CA • ,BoxType[i] ,

, ,Xl[i] , ' , ' ,Yl[i] , ' , ' ,X2[i] , « , ' ,Y2, , ' ,X3[i] , • , ' ,

Y3[i],', » ,X4[i],', « ,Y4[i]); end

{ procedure PrintHeaders; begin

(* write(Cmd,FileNum, ' *); *0 { update vector file } writeln(VectorFile,Cmd,FileNum, ' , ' ,MergLayer) ; { update layer and range files } Blk. t= Cmd + FileNum; MakeControl; Θtd : ;

{

BSTITUTE SHEET

-82 . 397- procedure ReadSlices; var i,j,c: Integer; select,temp: String; begin

FirstRange := true; NewRange := true; repeat

NewLayer; for InFile := 1 to Nu PartFiles do begin FileNum := IntStr(InFile) ; { process rest of Z block & other blocks } SkipBlock := false; if not(eof(InputFiles[InFile]) ) and (CurrentZ [InFile]=MergeLayer) then begin

Cmd := HeaderType; PrintHeaders; end; while not(eof(InputFiles[InFile]) ) and (CurrentZ [InFile]=MergeLayer) do begin repeat readln(InputFiles[InFile] ,Line) ; Lin [length(Line) + 1] := #0; if copy(Line,1,1) = '!' then begin writeln(LayerFile,Line) ; writeln(Rangefile,Line) ; end; until copy(Line,1,1)<>' ! ; ;

{process slice block } i := 0; temp := copy(Line,l,2) ; if (temp = 'Z') or (temp = 'L') then i := 1 else if length(temp) =1 then i := pos(temp, 'ZXYISHVABJCDEFGK') ; if i=0 then begin

T

-82.398- i := 1; while (i <= BlockNmemonicsCount) and

((copy(Line,1,length(BlockMnemonics[i]) ) o BlockMnemonics[i]) or not (Line[length(BlockMnemonics[i])+l] in [#0, • •])) do inc(i) ; if i > BlockMnemonicsCount then i := O; end; if i > 0 then begin

SkipBlock := false; c := FindStr(1,Line, ' •); Cmd := copy(Line,l,c-l) ; if i=l then begin { handle Z block special } Zval := LongVal(copy(Line,c+1,9) ,code)

+ ZOffset[InFile] ; CurrentZ[InFile] := Zval; end else begin select := ' , ' + cmd + • , ' ; if (pos(select,NoBlocks[InFile]) > 0) or

((length(OnlyBlocks[InFile]) > 0) or (pos(select,OnlyBlocks[InFile])=0)) then begin SkipBlock := true; end else PrintHeaders; end; end else if not SkipBlock then writeln (Vectorfile,Line) ; end; {while} end; {for}

Blk := #BTM' ; MakeContro1;

LastLayer t= Mergelayer; MergeLayer := 00000; for InFile := 1 to NumPartfiles do if not eof(InputFiles[InFiles]) then if CurrentZ[InFile] < MergeLayer then MergeLayer

S

-82 . 399-

:= CurrentZ[InFile] ; until MergeLayer = 99999; and;

procedure Update(FileName: String) ; var i: Interger;

St: String; begin assign(UpdateFile,FileName) ; reset(UpdateFile) ;

Seek(UpdateFile,UpdateIndex) ;

St := WordStr(StartLayer) ;

St := St + spc(5-length(St) ) ; for i:=l to 5 do write(UpdateFile,St[i]) ; Seek(UpdateFile,Updatelndex + 16) ;

St := WordStr(EndLayer) ;

St := St + spc(5-length(St) ) ; for i:=l to 5 do write(UpdateFile,St[i]) ;

Seek(UpdateFile,Updatelndex + 16 + 17) ; St := Wordstr(Layers) ;

St := St + spc(5-length(St) ) ; for i:=l to 5 do write(UpdateFile,St[i]) ; close(UpdateFile) ; end; {

procedure MergeFiles; begin

{ determine output file prefix } if OutFileName = ' ' then begin write(•Output file Name Prefix [ ' ,FirstFileName, ]

•) readln(OutFileName) ; if OutFileName = ' ' then OutFileName := FirstFileName; OutFileName := upper(OutFileName) ;

-82 .400- end;

{ open up output files, existing files are overwritten }

LayerFileNa e := OutFileName + ' .L' ; RangeFileName := OutFileName + ' .R' ; VectorFileName := OutFileName + • .V ; assign(LayerFile,LayerFileName) ; rewrite^LayerFile) ; writelirβLayerFile, • !MERGE: -FILES ' ,MergeLine) ; - writeln(LayerFile, •! ERGE: -STARTLAYER XXXXX -ENDIAYER XXXXX -NUMLAYERS XXXXX'); Updatelndex := length(MergeLine) + 17 + 20; { points to StartLayer value }

assign(RangeFile,RangeFileName) ; rewrit (RangeFile) ; writeln(RangeFile, * ! ERGE: -FILES ' ,Mergeline) ; writeln(RangeFile, « !MERGE: -STARTLAYER XXXXX -ENDIAYER XXXXX -NUMLAYERS XXXXX');

assign(VectorFile,VectorFileName) ; rewrite.(VectorFile) ; Layers- := 0; EindFirstLayers; GetParameters; ReadBoxFile;

window(StatusBoxLeft+1,StatusBoxTop+1,StatusBoxRight-

1,

StatusBoxBottom-1) ; ClrScr; window(l,1,80,25) ; ? SetUpStcEtusBox; gotoxy(StatusBoxLeft+2,StatusBoxTop+1) ; write('Different Z-Spacing Ranges:';

-82.401- window(StatusBoxLeft +2,StatusBoxTop+3,StatusBoxRight-

2,

StatusBoxBottom-3) ; Reads1ices;

5 close(VectorFile) ;

OutputRange; close(LayerFile) ; close(RangeFile) ;

Update(LayerFileName) ; 10 ' . Update(RangeFileName) ; window(1,1,80,24) ; gotoxy(StatusBoxLeft+2,StatusBoxBottom-1) ; write(RangeCount, ' range') ; if RangeCount>l then write('s'); 15 write( ' , • ,Layers, ' layer') ; if Layers>l then write('s'); write( ' processed. ') ; end;

{

20 procedure CheckForOptions; var i,oil, jr Integer; FileName: String; begin 25 FirstFileName := ";

CmdLine := upper(cmdLine) ; RemoveDoubleSpaces(CmdLine) ; i := pos C/OUTFILE' ,CmdLine) ; if i>0 then begin 30. oi. := i; mcr(i,8) ; while (i<length(CmdLine) ) and (CmdLine[i]=* ') do inc(i) ; j := FindStr(i,CmdLine, • /');

SUBSTITUTE SHEET

-82 .402-

OutFileName := cop (CmdLine,i,j-i) ; delet (CmdLine,oi,j-oi) ; end; i := pos('/RES* ,CmdLine) ; 5 if i>0 then begin oi := i; inc(i,4); while (i<length(CmdLine)) and (CmdLin [i]=' ') dσ inc(i) ; 0= jj :.— FindStr(i,CmdLine, ' /*); vai(cop (CmdLine,i,j-i) ,Resolution,code) delete(CmdLine,oi,j-oi) ; end; i := pos('/ZPC ,CmdLine) ; 15 if i>0 then begin oi :- i; inc(i,5) ; while (i<length(CmdLine)) and (CmdLine[i]=' ') do inc(i) ; 2.0 j := FindStr(i,CmdLine, » / « ) ; val(copyCmdLine,i,j-i) ,ZSpacing,code) ; delete(CmdLine,oi,j-oi) ; end; i :.=pσs(•/THICK' ,CmdLine) ; 25 if ii>C then begin αi ::- i; inc£i,6); while (i<length(CmdLine) ) and (CmdLine[i]=' ') do inc(i) ; 30 j := FindStr(i,CmdLine, ' /'); val(copy(CmdLine,i,j-i) ,ZSpacing,code) ; delet (CmdLine,oi,j-oi) ; end; i. :—pos('/THIC ' ,CmdLine) ; 35 if: i>0 then begin oi := i; inc(i,6) ;

SUBSTITUTE SHEET

-82 . 403 - while (i<length(CmdLine) ) and (CmdLine[i]=' ') do inc(i) ; j := FindStr(i,CmdLine, ' /'); val(cop (CmdLine,i,j-i) ,Thickness,Code) ; 5 delete(CmdLine,oi,j-oi) ; end;

Remove DoubleSpaces(CmdLine) ; MergeLine := CmdLine;

{(. pick out" slice file names and open them up } ID: while CmdLineo ' • do begin i := pos (' ',CmdLine); if i=0 then begin

FileName :- CmdLine; CmdLine := » ' ; 15 and else begin

FileName := copy(CmdLine,l,i-l) ; CmdLine := copy(CmdLine,i+1,255) ; end; inc(NumPartfiles) ; 0 i := pos( '/Z' ,FileName) ; if i=0 then i := pos( '/L' ,FileName) ; if i>0 then begin oi :.= i; inc(i,2) ; 5 " . while (i<length(FileName) ) and (FileName[i]=' ') do inc(i) ; j := FindStr(i,Filename, ' /'); val(copy(FileName,i,j-i) ,ZOffset[NumPartFiles] ,code) ; delete(FileName,oi,j-oi) ; 0 end; i := pos( '/N* ,FileName) ; if i>0. then begin oi :=- i; inc(i,2) 5 while (i<length(FileName) ) and (FileName[i]=* ') do inc(i) ;

SUBSTITUTE SHEET

-82.404- j := FindStr(i,FileName, '/') ;

NoBlocks[NumPartFiles] := ',* +copy(FileName,i,j- i)+ « ,'; delete(FileName,oi,j-oi) ; end; i := pos('/O' ,FileName) ; if i>0 then begin oi := i? inc(i,2) ? while ( <length(FileName) ) and (FileName[i]=' ') do inc(i) ; j := FindStr(i,Filename, •/') ; OnlyBlocks[NumPartFiles] := ',' +copy(FileName, i,j-i)+ « , « ; 5 delete(FileName,oi,j-oi) ; end; if FirstFileName = • ' then FirstFileName := FileName; i := pos(' . ' ,FileName) ; if i=0 then FileName := FileName + '.SLI'; -0 assign(InputFiles[NumpartFiles] ,FileName) ;

{$1-} reset(inputFiles[NumPartFiles]) ; if IOresultoO then begin writeln('Can't open file *,FileName); 5 halt(l); end; end; {while} if NumPartFiles = 0 then halt(0) ; end;

0 procedure ShowFiles(FileSpec: String) ; var

Filecount: integer; Dirln o: SearchRec; begin 5 FileCount := 0;

FindFirst(FileSpec, nyFile,Dirlnfo) ;

SUBSTITUTE SHEET

-82 .405- if Dos Error oo then writeln( - none -') else begin while Dos Error=0 do begin if FileCount >0 then write(spc(11-( (whereX-1) 5 mod 10+1) ) ) ; inc(Filecount) ; write(copy(DirInfo.Name,1,pos('.',DirInfo.Name)

1) ) ;

FindNext(Dirlnfo) ; ID. end; writeln; end; end;

procedure ProcessCommandLine; 15 begin

ReadCommandLine(CmdLine) ; if CmdLine = ' ' then begin writeln(•Directory Listing of Sliced Files: 1 ); writeln; 0 ShowFiles( •*.SLI•) ; writeln; write('Slice File Names: '); readln(CmdLine) ; writeln; 5 end;

NumPartfiles := 0; CheckForOptions; end;

procedure ReadBlockldFile; 0 var

BlockldFile: text;

BlockldLine: string; index,Group: Integer;

Block: String; 5 begin

SUBSTITUTE SHEET

-82 .406-

BlockMnemonicsCount := 0;

{$1-} assign(BlockldFile,BlockldFileName) ; reset(BlockldFile) ; if IOresultoO then begin writeln('Can't find Block Id file.'); halt(2) ; end; end; {$!+} while not eof(BlockldFile) do begin readln(BlockldFile,BlockldLine) ; if (length(BlockldLine)>0) and (BlockIdLine[!]<> ! • then begin index := 1;

UnitValShortInt(Grou ,BlockldLine,index) ; UnitStr(Block,BlockldLine,index) ; if Group=0 then begin inc(BlockMnemonicsCount) ; BlockMnemonics[BlockMnemonicsCount] := upper(Block) ; end; end; end; close(BlockldFile; end;

MAIN PROGRAM

begin

ExitProc := §ExitMerge; CheckBreak := true;

FillChar(FirstVar,ofs(LastVar)-Ofs(FirstVar) ,#0) ; {: dear variables }

SingleBar := many(#196,26) ; centerlnf*MERGE, Sliced Files Merger');

SUBSTITUTE SHEET

-82 . 407- centerln('3D Systems Laser Stereolithography System 1 ); centerln('Version '+VersionId+' 3D Systems, Inc. 1 ); centerln(SingleBar) ;

writeln; writeln;

OutFileName := • • ; ReadBlockldFile; ProcessCommandLine; MergeFiles; QuietSystemError( 'Success. ') ; end.

SUBSTITUTE SHEET

-82.408-

3D Systems Stereolithography System Software

MENU.PAS

SLA-1 Menu Software

History:

11/12/87 Ver 2.30 first Beta software release

11/20/87 Ver 2.31 ENTER for Exit option fix

11/23/87 Ver 2.32 pauses for Turbo Basic error messages

11/24/87 Ver 2.33 converted from Turbo Basic to

Turbo Pascal SHELL'S no longer eat up 64K or main memory

Consolidated Profiler &

Calibrator Added Materials

Manager to Utility Menu

Added Change Directory to Dos

Menu - Alt-F9 View Option

History added

12/02/87 Ver 2.34 fixed date format

12/06/87 Ver 2.35 Using BEAM instead of CALIB and

PROFILE

12/12/87 Ver 2.40 resets Text Mode when returning from Shell

12/16/87 Ver 2.41 clearing of screen for pause fixed prevent double pause (esp for directory)

12-/1.7/87 Ver 2.42 revitalize cursor before running

Shells

SUBSTITUTE SHEET

-82.409-

12/24/87 Ver 2.43 better cursor on/off routines

'X' input at ExitSystem verify ignored

1/08/88 Ver 2.50 TESTPART program access added 1/25/88 Ver 2.60 version update only 2/12/88 Ver 2.61 1900 + year in resetting system date

{$R-,S+,I+,D+,T-,F-,V+,B-,N-,L+ } {$M 4096,0,0 }

program MenuProgra ; uses Crt,Dos;

type strlO = string[10] ; strlδ = string[16] ; str40 = string[40] ; str80 = string[80] ; strlOO = string[100] ; str255 = string[255] ; HistoryType = record Menu,Option: Byte; mon,day,hour,min: Byte; end;

var Fnkey,CmdChr,key,key2: Char;

IOerr,CmdVal,ordkey: Integer;

Row,Menu,Indent: Integer;

Mon,Da ,Year,Hour,Minu,Sec,WeekDay: Integer; code,i: Integer; PausedFlag,IntervalLock,ErrorFlag,Nolnterval: Boolean;

Line,CurrentDate,CurrentTime: str80;

SingleBar,DoubleBar: strlOO;

SUBSTITUTE SHEET

-82 .410-

CurrentDir: str40; cmd: strl6; regs: Registers; SystemFile,ErrorFile: text; 5 MenuPos: arra [1..3] of Integer;

OptionHistory: array[1..19] of HistoryType; StartHistory,EndHistory: Integer;

const.

MSDOS = $21; ID: Versionld = '2.61';

ComSpec = « C:\C0MMAND.COM' ; SystemFileName = 'C:\SLA1.SYS• ; ErrorFileName = •C:\SYSTEM.ERR « ; sp80 = • 15-.- DayOfWeek: String[21] = 'SunMonTueWedThuFriSat' ; Zel: array[1..12] of Integer = (1,4,3,6,1,4,6,2,

5,0,3,5) ; MainExecs: array[1..8] of strlO = ('XFER' , 'MERGE' , GRAPH' , 'PREPARE' , 'SUPER' ,",",*'); 20 UtilityExecs: array[1..8] of strlO =

("POWER* , "GOBEAM* , 'ZSTAGE' , 'MATERIAL' , 'EDIT' , 'TESTPART', ••,''); DαsExecs: array[1..8] of strlO =

('CHKDSK' , " , 'DIR/W', 'QD2*,"," ,'','') ,* 25: MenuMax: array[1..3] of Integer = (8,7,6);

MenuColor: array[1..3] of Integer = (12,11,10); MaxHistory = 19; Cr = M;

30 procedure CursorOff; begin with regs do begin AH := 3; BH := 0; 35: Intr($10,regs) ; AH := l?

SUBSTITUTE SHEET

-82 . 411-

CH : = CH or $20 ; Intr($10, regs) ; end; end;

procedure CursorOn; begin with regs do begin AH := 3; BH := 0; Intr($10,regs) ; AH := 1;

CH := CH and $DF; Intr($10,regs) ; end; end;

procedure ResetScreen; begin

TextMode(CδO) ; CursorOff; end;

function upper(text: str255) : str255; var i: Integer; temp: str255; begin temp := text; for i := l to length(temp) do temp[i] := upcase(temp[i]) ; upper := temp; end;

function many(Ch: Char;num: Integer): str80; var temp: str80;

SUBSTITUTE SHEET

-82 .412- i: Integer; begin temp := ' ' ; for i:=l to num do temp := temp+Ch; many := temp; end;

function spc(len: Integer) : str255; begin spc := copy(sp80,l,len) ; '5 end;

procedure beep; begin sound(1000) ; delay(100) ; 5 NoSound; end;

function IntStr(num: Integer) : strlO; var temp: strlO; 0 begin if num>=0 then Str(num,temp) else Str(num+$8000,temp) ;

IntStr := temp; end;

procedure ReadCommandLine(var line: str80) ; 5T var i: Integer; begin line := ParamStr(l) ; for i:=2 to ParamCount do D: line := line + ' ' + ParamStr(i) ; end;

SUBSTITUTE SHEET

-82 .413-

Pad time element with left space if necessary

} function PadSp(num: Integer): strlO; var 5 temp: str10; begin * temp := IntStr(num) ; if num<10 then PadSp := ' ' + temp else PadSp := temp; 10 " end;

{

Pad time element with left zero if necessary

) function LZero(num: Integer) : strlO; 15 var temp: strlO; begin temp := IntStr(num) ; if num<10 then LZero := '0' + temp 20 else LZero := temp; end;

{

Compute day-of-week using Harry's modified Zeller Algorithm 25 } function Zeller(month,day,year: Integer) : Integer; begin if month<3 then dec(year) ;

Zeller := (Zel[month] + day + year + (year shr 2)) mod 30 7; end;

{

Read time directly from clock chip

SUBSTITUTE SHEET

-82.414- works only on ATs, 286s, 386s; does not work on standard

PCs, XTs

} procedure GetTime; var good: Boolean; begin good :?= false? wliile≥ not good do begin t. port[$T0] := $0A; { wait for update to finish (then there's 244 us) } if (port[$71] and $80)=0 then begin port[$70] := $00; { get seconds } port[$70] := $0A; if (port[$71] and $80)=0 then begin port[$70] := $02; { get minutes } Minu := port[$71]; port[$70] := $0A; if (port[$71] and $80)=0 then begin port[$70] := $04; { get hours } Hour := port[$71]; port[$70] := $0A; if (port[$71] and $80)=0 then begin port[$70] := $07; { get day } Day := port[$71]; port[$70] := $0A; if (port[$71] and $80)=0 then begin port[$70] := $08; { get month }

Mon := port[$71]; port[$70] := $0A; if (port[$71] and $80)=0 then begin port[$70] := $09; { get year } Year := port[$71]; port[$70] := $0A;

UTE SHEET

-82.415- if (port[$71] and $80)=0 then good true; end; end; end; end; end end; end;

Sec := (Sec shr 4) * 10 + (Sec and $0F) ;

{ convert from BCD }

Minu •= (Minu shr 4) * 10 + (Minu and $0F) ;

Hour •= (Hour shr 4) * 10 + (Hour and $0F) ;

Day : = (Day shr 4) * 10 + (Day and $0F) ;

Mon : = (Mon shr 4) * 10 + (Mon and $0F) ;

Year : = (Year shr 4) * 10 + (Year and $0F) ;

WeekDay := Zeller(Mon,Day,Year) ; end;

{ Get a time stamp consisting of the relative day and the current time

) procedure GetTimeStamp; var tdow,tday,tmon,tyear,tsec,tminu,thour: str4;

AmPm: Char; begin

GetTime; tmon = PadSp(Mon) ; tday = LZero(Day) ; tyear = LZero(Year) ; tdow = copy(DayOfWeek,Zeller(Mon,Day,Year)*3+l,3) ; CurrentDate := tdow+' '+tmon+'/'+tday+'/'+tyear; tsec := LZero(Sec); tminu := LZero(Minu) ;

SUBSTITUTE SHEET

-82 .416- if Hour=0 then begin thour := '12';

AmPm := 'A' ; end else if Hour<12 then begin thour := PadSp(Hour) ;

AmPm := 'A' ; end else if Hour=12 then begin thour := '12' ;

AmPm := 'P'; end else begin thour := PadSp(Hour-12) ;

AmPm := 'P' end;

CurrentTime := thour+• : '+tminu+* *+AmPm+'M'; end;

{

Reset Computer System's Date and Time from Hardware Clock

} procedure SetSystemDateTime; begin

GetTime;

SetDate(1900+Year,Mon,Day) ;

SetTime(Hour,Minu,Sec,0) ; end;

{

Remove excess quote marks around string

} function NoQuotes(Text: strδO) : str80; var s,e: Integer; begin s := 1; if (length(Text)>1) and (Text[l]=chr(34) ) then s:=s+l; e := length(Text) ;

SUBSTITUTE SHEET

-82.417- if (Text[e]=chr(34) ) and (e>s) then e:=e-l; NoQuotes := copy(Text,s,e-s+1) ; end;

function InChildProcess: Boolean; begin

InChildProcess := (Mem[0:99 shl 2] and $80)>0 end;

procedure SetChildProcess; begin Mem[0:99 shl 2] :- $80; end;

procedure ClearChildProcess; begin

Mem[0:99 shl 2] := $00; end;

procedure CheckForOptions(var line: str80) ; var i: Integer; begin line := upper(line) ; i := posC/NOINTERVAL',line) ; { check for /NOINTERVAL

} if i>0 then begin Nolnterval := true; delete(line,i,11) ; end; end;

procedure Pause; begin if not PausedFlag then begin gotoxy(1,25) ; write('Press Enter to Continue— ) ;

SUBSTITUTE SHEET

-82 .418- readln(Input) ; PausedFlag := true; end; end;

function Desc(menu,line: Integer) : strδO; var index: Integer; begin index := menu * 10 + line; case index of

11: Desc := 'Transfer Files Between this Computer and

Another over Ethernet* ; 12: Desc := 'Merge Separately-Sliced Object Files Together' ;

13: Desc := 'Graph an Object in either Faceted or

Sliced form' ; 14: Desc := 'Prepare to Make a Part and Set Up Various Parameters' ; 15: Desc := 'Run the Part-making Supervisor Program• ;

16: Desc := 'Go to the Utility Menu'; 17: Desc := 'Go to the Disk Operating System Menu' ; 18: Desc := 'Exit Stereolithography System

Completely' ; 21: Desc := 'Control the Power-Up or Down Sequence

of Laser Equipment'; 22: Desc := 'Laser Beam Profile and Calibration Operations';

23: Desc := 'Move the Z-stage Elevator Up and Down' ;

24: Desc := 'View, Alter, and Add Data for Vat Materials' ;

SUBSTITUTE SHEET

-82.419-

25: Desc := 'Enter the Editor to Modify the Contents of a File* ;

26: Desc := •Run the Test Part Utility Program'; 27: Desc := 'Return to the Main Menu' ;

31: Desc := 'Show Hard Disk Statistics, including

Free Space Remaining';

32: Desc := •Change to a Different File Directory' ; 33: Desc := 'Show the Directory for the Current Directory' ;

34: Desc := 'Enter the Quick-DOS Utility to Move Files and Change Directories' ;

35: Desc := 'Enter a DOS Shell, Allowing You to Run

Other Programs' ;

36: Desc := 'Return to the Main Menu' ; else Desc = • * end; end;

{

procedure DrawMain; begin writeln(' MAIN MENU') ; TextColor(White) ; writeln; gotoxy(20,whereY) ; writeln(copy(SingleBar,1,40) ) ; writeln; gotoxy(Indent,whereY) ; writeln('1. Data Transfer•) ; gotoxy(Indent,whereY) ; writeln('2. Merger') ; gotoxy(Indent,whereY) ; writeln('3. Graher');

SUBSTITUTE SHEET

-82.420- gotoxy(Indent,whereY) ; writeln('4. Prepare•) ; gotoxy(Indent,whereY) ; writeln('5. Supervisor') ; gotoxy(Indent,whereY) ; writel (•6. Utility Menu') ; gotoxy(Indent,whereY) ; writeln('7. DOS Menu*) ; gotoxy(Indent,whereY) ; writeln('X. Exit'); end;

procedure DrawUtility; begin writeln(• UTILITY MENU') ; TextColor(White) ; writeln; gotoxy(20,whereY) ; writeln(copy(SingleBar,1,40) ) ; writeln; gotoxy(Indent,whereY) ; writeln(•1. Power Sequencer') ; gotoxy(Indent,whereY) ; writeln('2. Beam Analysis') ; gotoxy(Indent,whereY) ; writeln('3. Z-Stage Mover') ; gotoxy(Indent,whereY) ; writeln('4. Material Manager') ; gotoxy(Indent,whereY) ; writeln('5. Edit a File'); gotoxy(Indent,whereY) ; writeln('6. Make Test Parts*) ; gotoxy(Indent,whereY) ; writeln('X. Return to Main Menu'); end;

procedure DrawDos;

SUBSTITUTE SHEET

-82.421- begin writeln(' DOS MENU » ) ;

TextColor(White) ; writeln; gotoxy(20,whereY) ; writeln(copy(SingleBar,1,40) ) ; writeln; gotoxy(Indent,whereY) ; writeln(•1. Disk Usage Stats•) ; gotoxy(Indent,whereY) ; writeln( •2. Change Directory•) ; gotoxy(Indent,whereY) ; writeln(•3. Directory Listing•) ; gotoxy(Indent,whereY) ; writeln('4. Quick DOS Utility'); gotoxy(Indent,whereY) ; writeln('5. DOS Shell'); gotoxy(Indent,whereY) ; writeln('X. Return to Main Menu'); end;

procedure DrawMenuScreen; begin

SetSystemDateTime; ClrScr; TextColor(White) ; writeln(DoubleBar) ; writelnC SLA-1 3D SYSTEMS STEREOLITHOGRAPHY SYSTEM

+ Versionld) ; writeln(DoubleBar) ; writeln;

TextColor(MenuColor[Menu]) ; case Menu of 1: DrawMain; 2: DrawUti1ity; 3: DrawDos;

SUBSTITUTE SHEET

-82.422- end; writeln; gotoxy(20,whereY) ; writeln(copy(SingleBar,1,40) ) ; Row := whereY; writeln; writelnC Select an Option either by Using the Arrows and

Pressing Enter*); write C or by Pressing the Corresponding Number'); end;

function ErrorOnScreen: Boolean; var

BaseAddr: Word; ScanError: Boolean; i: Integer; begin if LastMode=7 then BaseAddr := $B000 else BaseAddr := $B800; i := 0;

ScanError := true; while (i<4000) and ScanError do begin if upcas (chr(Mem[BaseAddr:i]) )=*E then if (upcase(chr(Mem[BaseAddr:i+2]) )='R') and (upcase(chr(Mem[BaseAddr:i+4]))='R') then

ScanError := false; inc(i,2) ; end;

ErrorOnScreen := not ScanError; end;

{

SHELL program, check for existence of error If error, pause and wait for Enter before returning to menu }

SUBSTITUTE SHEET

-82.423- procedure Shell(Prog,Options: str80) ; begin

PausedFlag := false;

SetSystemDateTime; CursorOn;

Exec(Prog,Options) ;

CursorOff;

($I-> assign(ErrorFile,ErrorFileName) ; reset(ErrorFile) ;

($1+)

ErrorFlag := (IOresult=0) ; if ErrorFlag then begin close(ErrorFile) ; Pause;

{$1-} erase(ErrorFile) ;

($1+) end else if ErrorOnScreen then Pause; end;

{

{

Option History routines

} procedure AddHistory(text: strlO) ; begin

OptionHistory[EndHistory] .Menu := Menu;

OptionHistory[EndHistory] .Option := CmdVal;

OptionHistory[EndHistory] .mon := Mon; OptionHistory[EndHistory] .day := Day;

OptionHistory[EndHistory] .hour := Hour;

OptionHistory[EndHistory] .min := Minu; inc(EndHistory) ; if EndHistory > MaxHistory then EndHistory := 1; if StartHistory = EndHistory then begin

SUBSTITUTE SHEET

-82.424- inc(StartHistory) ; if StartHistory > MaxHistory then StartHistory := 1; end; end;

procedure ShowHistory; begin ClrScr; writeln('Menu System Recent Option History:'); writeln; writeln('Menu Option Name Date Time'); writeln(' ') ; i := StartHistory; while ioEndHistory do with OptionHistory[i] do begin write(' • ,Menu, ' ',Option, ' '); case Menu of

1: cmd := MainExecs[Option] ; 2: cmd := UtilityExecs[Option] ; 3: cmd := DosExecs[Option] ; end; write(cmd,spc(16-length(cmd) ) ) ; writeln(PadSp(mon) , '/' ,LZero(day) , ' ' ,

PadSp(hour) , ' : ' ,LZero(min)) ; inc(i) ; if i > MaxHistory then i := 1; end; writeln; write('Press any key to continue... '); key := ReadKey; DrawMenuScreen; end;

{

Show Menu Item Description

} procedure ShowDescription; begin

SUBSTITUTE SHEET

-82.425- gotoxy(Indent-2,8+MenuPos[Menu]) ;

TextColor(Yellow) ; write(chr(16) ) ; gotoxy(1,24) ; write(spc(79) ) ; gotoxy((7β-length(Desc(Menu,MenuPos[Menu]) ) ) div 2,24) ;

TextColor(Black) ;

TextBackground(MenuColor[Menu]) ; write(• » ,Desc(Menu,MenuPos[Menu]) , ' ') ;

TextColor(White) ;

TextBackground(Black) ; end;

{ Execute INTERVAL Program

} procedure Dolnterval; begin if IntervalLock = false then begin IntervalLock := true;

Shell(ComSpec, '/C INTERVAL'); DrawMenuScreen; ShowDescription; end; end;

{

Get Input for Menu, handle scrolling

} procedure HelpAsk; var

LineChange,Leave: Boolean; begin

Leave := false; LineChange := true; repeat

SUBSTITUTE SHEET

-82.426- if LineChange then ShowDescription; repeat

GetTimeSta p; GetDir(0,CurrentDir) ; gotoxy(2,4); write(CurrentDir) ; gotoxy(67,4) ; write(CurrentDate) ; gotoxy(71,5) ; write(CurrentTime) ; if IntervalHour = -1 then begin if IntervalMin = Minu then Dolnterval { handle xx:mm interval } else IntervalLock := false; { free interval lock } end else begin if IntervalHour = Hour then begin { handle hh:mm interval } if (IntervalMin = -1) or (IntervalMin = Minu) then Dolnterval else IntervalLock := false; end; end; until keypressed; LineChange := false;

CmdChr := upcase(ReadKey) ; if CmdChr = chr(0) then FnKey := ReadKey else FnKey := chr(0) ; if CmdChr in [fO, » 1 « .. '9' , *X' ,Cr] then begin LineChange := true; gotoxy(Indent-2,8+MenuPos[Menu]) ; write(* •) ; if (CmdChr=Cr) and (MenuPos[Menu]<MenuMax[Menu]) then CmdChr := chr(ord(•0')+MenuPos[Menu]) ; if (CmdChr='X » ) or ((CmdChr=Cr) and (MenuPos[Menu]=

SUBSTITUTE SHEET

-82.427-

MenuMax[Menu]) ) then

CmdChr := chr(ord(•0')+MenuMax[Menu]) ; case FnKey of

'P*: if MenuPos[Menu] >= MenuMax[Menu] then MenuPos[Menu] := 1 else inc(MenuPos[Menu]) ; •H': if MenuPos[Menu] <= 1 then MenuPos[Menu] := MenuMax[Menu] else dec(MenuPos[Menu]) ; 'p': ShowHistory; end; val(CmdChr,CmdVal,code) ; if (CmdVal>0) and (CmdVal<=MenuMax[Menu]) then begin Leave := true;

MenuPos[Menu] := CmdVal; end; end; until Leave; case Menu of

1: cmd := MainExecs[CmdVal] ; 2: cmd := UtilityExecs[CmdVal] ; 3: cmd := DosExecs[CmdVal] ; end; if length(cmd)>0 then AddHistory(cmd) ; end;

{ UTILITY STUFF }

procedure UtilityMenu; begin repeat

Menu := 2; DrawMenuScreen; HelpAsk; ClrScr; if CmdVal<7 then begin

SUBSTITUTE SHEET

-82.428-

Shell(ComSpec, '/C « +UtilityExecs[CmdVal]) ; ResetScreen; end; until CmdVal = MenuMax[2]; end;

DOS STUFF

procedure DiskUsage; begin writeln( » DISK USAGE STATISTICS') ; writeln(copy(SingleBar,l,34)) ; writeln?

Shell(ComSpec,•/C •+DosExecs[1]) ;

Pause; end;

procedure DirList; begin

Shell(ComSpec, '/C •+DosExecs[3]) ; Pause; end;

procedure ChangeDir; var

NewDir: str40; begin

CursorOn; ClrScr; writelnCCurrent directory is •,CurrentDir) ; writeln; writeln; writel ('You can specify a new directory using the following rules: ') ; writeln; writeln('If you wish to move to a subdirectory, just type

SUBSTITUTE SHEET

-82.429- in the') ; writeln( 'subdirectory' 's name. ') ; writeln; writeln('If you want to move up a directory level, just enter .. (two periods).'); writeln; writeln('If you are going to specify a completely new directory path, start'); writeln('your entry with a \ (backslash).'); writeln; writeln; write('Enter new directory specification: •); readln(NewDir) ; {$1-}

ChDir(NewDir) ; if IOresultoO then begin writeln; writeln( 'Can' 't find directory. *) ; writeln; write( 'Press any key to continue... ') ; key := ReadKey; end;

{$1+} CursorOff; end;

procedure QDos; begin

Shell(ComSpec, '/C '+DosExecs[4]) ; end;

procedure DosShell; begin

CursorOn;

ClrScr; SetChildProcess;

SUBSTITUTE SHEET

-82.430- writeln('To return to the Dos Menu, use the EXIT command. *) ; writeln(copy(SingleBar,1,48)) ; Exec(ComSpec, ' ') ; ResetScreen;

ClearChildProcess; end;

procedure DosMenu; begin repeat

Menu := 3; DrawMenuScreen; HelpAsk; ClrScr; case CmdVal of 1: DiskUsage; 2: ChangeDir; 3: DirList; 4: QDos; 5: DosShell; end; until CmdVal = MenuMax[3]; end;

{ MAIN STUFF }

procedure ExitSystem; begin

CursorOn;

ClrScr; writeln('Dos Menu Option 5 allows you to issue DOS commands and run other') ; writeln('programs, then return to the Menu System using the EXIT command. ) ; writeln; writeln('This option will cause you to leave the

SUBSTITUTE SHEET

-62 . 431-

Stereolithography System'); write ('completely. Are you sure you want to do this? •) ; repeat key := upcase(ReadKey) ; until keyo'X'; writeln(key) ; if key='Y' then begin SetSystemDateTime; Halt(0); end;

CursorOff; end;

procedure MainMenu; begin

ResetScreen; repeat

Menu := 1; DrawMenuScreen; HelpAsk; ClrScr; if CmdVal=MenuMax[1] then ExitSystem else if CmdVal<6 then begin

Shell(ComSpec, '/C •+MainExecs[CmdVal]) ; ResetScreen; end else if CmdVal=6 then UtilityMenu else if CmdVal=7 then DosMenu; until 0=1; { forever } end;

{ }

label

NoMoreSystemFile;

begin

SUBSTITUTE SHEET

-82.432-

CheckBreak := false; if InChildProcess then begin writeln('You are currently in a DOS Shell. ') ; writeln('Please use EXIT to return to the Menu System. *) ; halt(2); end;

Indent := (80-20) div 2; Nolnterval := false; IntervalHour := -1; IntervalMin := -1; for i:=l to 3 do

MenuPos[i] := 1; StartHistory := 1; EndHistory := 1;

SingleBar := many(#196,79) ; DoubleBar := many(#205,79) ;

SetSystemDateTime;

(SI-) assign(ErrorFile,ErrorFileName) ; erase(ErrorFile) ; IOerr := IOresult; {$I+>

{ read SIA-1 System File

}

($I-> assig (SystemFile,SystemFileName) ; reset(SystemFile) ; {$1+} if 10 resultoO then begin writeln('No system file. Stopping.'); halt(l) ;

SUBSTITUTE SHEET

-82.433- end; repeat readln(SystemFile,Line) ; until eof(SystemFile) or ((length(Line)>0) and (Line[l]o'I ')) ; if not eof(SystemFile) then begin Line := NoQuotes(Line) ; CheckForOptions(Line) ; i := 1; while (i<2) and not eof(SystemFile) do begin Line := ' • ; while (length(Line)=0) or (Line[l]=' ! ') do begin if eof(SystemFile) then goto NoMoreSystemFile; readln(SystemFile,Line) ; end;

Line := upper(Line) ; writeln( *line=' ,line) ; case i of 1: begin h := copy(Line,l,2) ; m := copy(line,4,2) ; if h[l]='X' then IntervalHour := -1 else val(h,IntervalHour,code) ; if m[l]='X' then IntervalMin := -1 else val(m,IntervalMin,code) ; end; end; inc(i) ; end; end;

No MoreSystemFile: close(SystemFile) ; ReadCommandine(Line) ; CheckForOption(Line) ; MainMenu; end.

ReadSystemFile;

SUBSTITUTE SHEET

-82.434-

ReadChronoFile; ReadCommandLine(Line) ; CheckForOptions(Line) ; MainMenu; end.

SUBSTITUTE SHEET

-82.435-

3D Systems Stereolithography System Software

PREPARE.BAS

SLA-1 Prepare for Part-Making Software

History: 11/12/87 Ver 2.30 first Beta software release 11/13/87 Ver 2.31 new material data input fix range manager and CalcSp fixes

12/02/87 Ver 2.32 removed Material Input capability 12/04/87 Ver 2.33 programmable block updating

BLOCK.ID file support

12/14/87 Ver 2.40 Material linewidths (min & max) support

12/17/87 Ver 2.41 no last material file condition handled

12/22/87 Ver 2.43 no blanking scan before report 1/06/88 Ver 2.50 update depth when changing step period value no overflow on step period input

1/11/88 Ver 2.51 BLOCK.ID looked for in \3DSYS too 1/20/88 Ver 2.54 paging occurs for more than 10 blocks support of new *.R Range

Control File added /SCAN option to force block scan l/25/8δ Ver 2.60 Calc SP placed under Range

Manager new Vector Manager (old Layer Edit) Range File and Layer File command update separated out PREPARE.PRM support

SUBSTITUTE SHEET

-32.436- different SS (Step Size) support for skins part file statistics

2/03/88 - old range files identified operator may proceed to build new range file

2/08/88 - different layer block cmds bug removed

2/12/88 Ver 2.61 Comments array indexing starts at

1 not 0 added Block Scan will wipe out commands warning query

2/26/δδ Ver 2.62 default UpdateCmds group is not 1 instead of 0

DIM ZStart [100] ,ZEndS[100],ZSpace![100] ,CureDepth![100] DIM BlockStart![100] ,BlockEnd![100] DIM BlockType$[3000] ,BlockCmd$[3000] DIM TBTypeS[30],TBCmd$[30] DIM SP[20],LH[20],WMIN[20],WMAX[20] DIM BlockGroupCount![10] ,BlockGroupId$[10,40] DIM Comments$[100]

Maxlnt = 32768 MaxUInt = 65535

TRUE = -1

FALSE = 0

ScanFlag! = FALSE

VersionId$ = "2.62" TitleS = "Prepare V" + VersionId$

HomeDir$ = "C:\3DSYS\"

ParamFileS = "PREPARE.PRM"

ON ERROR GOTO TryHome

OPEN ParamFileName$ FOR INPUT AS fl

SUBSTITUTE SHEET

-32.437-

GOTO ReadParams TryHome:

RESUME TryHome2 TryHome2: ON ERROR GOTO NoPara s

OPEN HomeDirS + ParamFileNameS FOR INPUT AS fl

GOTO ReadParams NoParams:

NormStepSizeS = "SS 2" FillStepSizeS = "SS 16"

RESUME Preparelnit

• read PREPARE's parameter file

ReadParams:

LINE INPUT fl,A$

IF LEN(A$)=0 OR LEFT$(A$,1)="!" THEN ReadParams I! = INSTR(2,A$,CHR$(34)) IF I! > 0 THEN A$ = LEFT$(A$,I!) CmdLine$ = FN NoQuotes$(A$) GOSUB CheckForOptions

FOR I!=l TO 2 ' change this when altering PREPARE.PRM format ReadNextLine: LINE INPUT fl,A$

IF LEN(A$)=0 OR LEFT$(A$,1)="!" THEN ReadNextLine V=VAL(A$) V$ = LEFT$(A$,1) IF V$=CHR$(34) THEN V! = INSTR(MID$(A$,2) ,CHR$(34)) + 1 S$ = MID$(A$,2,V!-2) ELSE

S$ = "" END IF IF I!=l THEN NormStepSizeS = S$_ ELSE IF I!=2 THEN FillStepSizeS = S$

SUBSTITUTE SHEET

-62.438-

NEXT I! CLOSE #1

Preparelnit:

SingleBar$ = STRINGS(45,196) RangeBarS - "" FOR I!=l TO 8 READ S!

IF I!>1 THEN RangeBarS = RangeBarS + CHR$(249) RangeBarS = RangeBarS + STRINGS(S!,196) NEXT I!

DATA 7,9,7,9,11,11,11,7 BlockBarS = "" FOR I!=l TO 3 READ S! IF I!>1 THEN BlockBar$ = BlockBarS + CHR$(249) BlockBar$ = BlockBarS + STRING$(S!,196) NEXT I! DATA 8,10,50 LayerBar$ = "" FOR I!=l TO 5 READ S!

IF I!>1 THEN LayerBar$ = LayerBar$ + CHR$(249) LayerBar$ = LayerBar$ + STRING$(S!,196) NEXT I! DATA 7,9,7,9,7 SpBarS = " FOR I!=l TO 8 READ- S!

IF I!>1 THEN SpBar$ = SpBar$ + CHR$(249) SpBar$ = SpBar$ + STRING$(S!,196)

NEXT I!

DATA 7,9,7,9,7,3,7,7 LayerTempFileName$ = "LAYER.TMP" PowerFile$ = "POWER.LST" LastMaterialFileS = "MATERIAL.LST" BlockIdFileName$ = "BLOCK.ID"

SUBSTITUTE SHEET

-82 .439-

MinSpS = 8 MaxSpS = 4000

COLOR 15 Restart: CLS

PRINT SingleBarS

PRINT " PREPARE, Part-Making Preparer" PRINT " 3D Systems Laser Stereolithography System" PRINT " Version ";VersionId$ 3D Systems, Inc." PRINT Single Bar$ PRINT PRINT

BlockGroups! = 0

ON ERROR GOTO TryHome3 OPEN BlockIdFileName$ FOR INPUT AS #1

GOTO ReadBlockId TryHome3:

ON ERROR GOTO NoBlockldFile

OPEN "C:\3DSYS\"+BlockIdFileName$ FOR INPUT AS #1 RESUME ReadBlockId ReadBlockId:

ON ERROR GOTO 0

IF EOF(l) THEN ProcessCmdLine

LINE INPUT #1,A$ IF LEN(A$)=0 OR LEFTS(A$,1)="!" THEN ReadBlockId

Index! = 1

CALL UnitValShortInt(Group!,A$,Index!)

CALL UnitStr(Block$,A$,Index!)

IF Group!<0 OR Group!>10 THEN CALL SystemError("Invalid block group number in Block Id File "_ +BlockIdFileName$) END

END IF

IF Group! > BlockGroups! THEN BlockGroups! = Group!

SUBSTITUTE SHEET

-82.440-

BlockGroupIdS[Group!,BlockGroupCount![Group!]]

UCASE$(BlockS)

INCR BlockGroupCount![Group!]

GOTO ReadBlockId

ProcessCmdLine: CLOSE #1

CmdLine$ = UCASE$(Commands) GOSUB CheckForOptions IF LEN(CmdLine$)=0 THEN PRINT "Part files in this directoryr" ON ERROR GOTO NoPartFiles FILES » *.V" GOTO AskForPartFile NoPartFiles: PRINT "- none -"

RESUME AskForPartFile AskForPartFile: PRINT

" INPUT "Part Name: ",CmdLine$ PRINT END IF

CmdLine$ = UCASE$(CmdLineS) GOSUB CheckForOptions I! = INSTR(CmdLine$,".") IF I!>0 THEN

PartName$ « LEFT$(CmdLineS,I!-1) ELSE

PartNameS = CmdLineS END IF IF LEN(PartNameS)=0 THEN END GOTO StartPrepare

CheckForOptions:

I! = INSTR(CmdLineS,"/SCAN") IF I!>0 THEN ForcedScan! = TRUE

SUBSTITUTE SHEET

-82.441-

CmdLineS = LEFT$(CmdLine$,l!-l)+MID$(CmdLine$,l!+5) END IF RETURN

StartPrepare:

PartRangeFileName$ = PartNameS + ".R"

PartLayerFileNameS = PartName$ + ".L"

BackupFileNameS ■ PartName$ + ".BAK"

ON ERROR GOTO NewPart OPEN PartRangeFileName$ FOR INPUT AS #10

ON ERROR GOTO 0

I! = 0 CheckOld:

IF EOF(10) THEN HaveOldRangeFile LINE INPUT #10,L$

Ll$ = UCASE$(LEFT$(L$,1))

IF Ll$="" OR Ll$="!" OR Ll$="*" THEN CheckOld

IF Ll$ >= "A" AND Ll$ <= "Z" THEN HaveNewRangeFile

INCR I! IF I! < 30 THEN CheckOld

HaveOldRangeFile: PRINT

PRINT "File ";PartRangeFileName$;" is an older Range File with a"; PRINT " different format."

PRINT "Do you wish to continue and build a new Range File from the Layer"

PRINT "File ";PartLayerFileNameS;"? "; INPUT "",Q$ IF UCASE$(LEFTS(Q$,1))="Y" THEN PRINT

GOTO BuildRangeTable ELSE STOP

SUBSTITUTE SHEET

-82.442- END IF

HaveNewRangeFile: CLOSE #10

OPEN PartRangeFileName$ FOR INPUT AS #10 I! = 0

GotBlocksFromRangeFile! = FALSE Co mentCount! = 0 RangeRead:

ON ERROR GOTO 0 LINE INPUT #10,L$

R$=UCASE$(LEFTS(L$,1) ) IF R$="*" THEN Index! = 2

WHILE MID$(L$,Index!,1)=" " Index! = Index! + 1 WEND

CALL UnitVal(SIiceRes,L$,Index!) CALL UnitVal(ZSpacing,L$,Index!) CALL UnitVal(Thickness,L$,Index!) GOTO RangeRead END IF

IF LEN(L$)=0 OR R$="!" THEN IF CommentCount! <= 100 THEN INCR CommentCount! Comments$[CommentCount!] = L$ END IF

GOTO RangeRead END IF

Rangelndex! = 1 IF R$>="0" AND R$<="9" THEN INCR I!

CALL UnitValInt(ZStart [I!] ,L$,Rangelndex!) CALL UnitValInt(ZEndS [I!] ,L$,Rangelndex!) CALL UnitValShortInt(ZSpace![I!] , L$,Rangelndex!) CALL UnitValShortInt(CureDepth![I!] ,L$,Rangelndex!) BlockStart![I!] = BlockEnd!

SUBSTITUTE SHEET

-82.443-

ELSE

GotBlocksFromRangeFile! = TRUE

CALL UnitStr(BlockType$[BlockEnd!] ,L$,Rangelndex!) T$ = FN NoSp$(MID$(L$,Rangelndex!)) J!=INSTR(T$,"!")

IF J!=0 THEN J!=LEN(T$)+1

BlockCmd$[BlockEnd!] = FN NoSp$(LEFTS(T$,J!-l) ) BlockEnd![I!] = BlockEnd! INCR BlockEnd! END IF

IF NOT EOF(10) THEN RangeRead RangeCount! = 1! CLOSE flO • backwards (pre V2.55) compatibility IF ForcedScan! OR NOT GotBlocksFromRangeFile! THEN GOSUB BlockScan GOTO MainMenu

NewPart:

RESUME BuildRangeTable

Bui1dRangeTab1e:

ON ERROR GOTO NoLayerFile

OPEN PartLayerFileNameS FOR INPUT AS #3

ON ERROR GOTO 0

PRINT "Reading ";PartLayerFileNameS;"..."

GetToControlTop: IF EOF(3) THEN

CALL SystemError("Error: "+PartLayerFileName$+" empty.")

END END IF

LINE INPUT #3,CONTROLS C$=LEFT$(CONTROLS,1) IF C$="!" THEN GetToControlTop IF C$="*" THEN

SUBSTITUTE SHEET

-82.444-

Index! — 2

WHILE MIDS(CONTROLS,Index!,1)=" "

Index! = Index! + 1 WEND CALL UnitVal(SliceRes,CONTROLS,Index!) CALL UnitVal(ZSpacing,CONTROLS,Index!) CALL UnitVal(Thickness,CONTROLS,Index!) GOTO GetToControlTop END IF

RangeCount! = 0

Blocklndex! = 0

TBIndex! = 0

First! = TRUE

Last! = FALSE GOTO AlreadyHaveBlock

ReadBlocks:

IF EOF(3) THEN Last! = TRUE GOTO CompareLayer END IF

LINE INPUT #3,CONTROLS AireadyHaveBlock:

IF LEN(CONTROLS)=0 OR LEFTS(CONTROLS,1)="!" THEN ReadBlocks

parse out layer number, name, command, and comment

Controllndex! = 1

CALL UnitValInt(ControlLayerS,CONTROLS,Controllndex!) CALL UnitStr(ControlTypeS,CONTROLS ,Controllndex!) T$ = FN NoSpS(MID$(CONTROLS,Controllndex!)) I!=INSTR(T$,"!") IF I!=0 THEN I!=LEN(T$)+1 ControlCmdS = FN NoSp$(LEFTS(T$,l!-l) )

SUBSTITUTE SHEET

-82.445- i

' store blocks in temporary array, loop until different layer

I StoreBlocks:

IF ControlType$="#CA" THEN ReadBlocks ' skip critical areas

IF First! THEN • handle first layer First! = FALSE RangeStep! = ZSpacing Layers = ControlLayerS GOSUB StartNewRange GOTO StoreBlock END IF IF ControlLayerS o Layers THEN EvaluateLayer StoreBlock:

TBType$[TBIndex!] = ControlTypeS TBCmd$[TBIndex!] = ControlCmd$ INCR TBIndex! GOTO ReadBlocks

' start a new layer range if the Z-spacing changes

I

EvaluateLayer: IF NeedStep! THEN

NeedStep! = FALSE

RangeStep! = ControlLayerS - Layers ZSpace![RangeCount!] = RangeStep! END IF TwoLayersBackS = OldLayerS OldLayerS = Layers Layers = ControlLayerS CD! = ControlLayerS - OldLayerS IF CD!<>RangeStep! THEN GOSUB StartNewRange GOTO UpdateRange

SUBSTITUTE SHEET

-82.446- END IF

I

' compare current layer's block commands against those of current range ' if there are two different commands for a particular layer, ' a new layer range must be started

I

CompareLayer: FOR I!=0 TO TBIndex!-l ' check each block of current layer

FOR J!=BlockStart![RangeCount!] TO

BlockEnd![RangeCount!]

IF TBType$[l!]=BlockType$[J!] THEN IF TBCmd$[I!]oBlockCmd$[J!] THEN

GOSUB StartNewRange

ZEndS [RangeCount!-l] = TwoLayersBackS

ZStartS[RangeCount!] = OldLayerS

ZEndS [RangeCount!] = OldLayerS GOTO UpdateRange

ELSE

GOTO NextCurrentBlock

END IF

END IF NEXT J!

NextCurrentBlock :

NEXT I! t

• layer checks out, add it to current range '

UpdateRange:

ZEnd [RangeCount!] = ControlLayerS

I

' add any new blocks to current range's block table '

FOR I!=0 TO TBIndex!-l • check each block of current layer

SUBSTITUTE SHEET

-82 .447-

FOR J!=BlockStart![RangeCount!] TO BlockEnd![RangeCount!]

IF TBType$[I!]=BlockType$[J!] THEN NextCurrentBlock2 NEXT J!

BlockType$[BlockIndex!] = TBType$[I!] BlockCmd$[BlockIndex!] = TBCmd$[I!] INCR Blocklndex! NextCurrentBlock2: NEXT I!

BlockEnd![RangeCount!] = BlockIndex!-l

I

set up the new layer

I TBIndex! = 0

IF Last! THEN LayerCleanUp GOTO StoreBlock

start a new range of layers

StartNewRange:

NeedStep! = TRUE

INCR RangeCount!

ZStartS [RangeCount!] = ControlLayerS ZEndS [RangeCount!] = ControlLayerS

RangeStep! = ControlLayerS - Layers

BlockStart![RangeCount!] = Blocklndex!

BlockEnd! [RangeCount!] = Blocklndex!

TBIndex! = 0 RETURN

LayerCleanUp: CLOSE #3 FOR I!=l TO RangeCount!

CureDepth![I!] = ZSpace![I!] NEXT I!

SUBSTITUTE SHEET

-82.448- GOTO MainMenu

NoBlockldFile:

CALL SystemError("Can't open Block Id File "+BlockIdFileName$) END

BadBlockldFile:

CALL SystemError("Bad format for Block Id File

"+BlockIdFileName$)

END

NoLayerFile:

CALL SystemError("Can't open Layer Control File

"+PartLayerFileName$)

END

NoRangeFile: CALL SystemError("Can't open Range File "+PartRangeFileName$) END

RangeFileProb:

CALL SystemError("Problem with Range File "+PartRangeFileName$) END

NoVectorFile:

CALL SystemError("Can't open Vector File "+PartVectorFileName$)

NoBackupFile:

CALL SystemError("Can't open Backup File

"+BackupFileName$)

END

NoTempFile:

SUBSTITUTE SHEET

-82 .449-

CALL SystemError("Can't open Temporary File

"+LayerTempFileName$)

END

i ________________________„.._..__________..__ _. '

' show PREPARE's Main Menu

I

MainMenu:

CLS 1$ = STRINGS(29," ")

MainBar$=STRING$(25,CHR$(196))

T$ = "MAIN MENU"

GOSUB CenterLine

T$ = Title$ GOSUB CenterLine

T$ = "working on part "+PartName$

GOSUB CenterLine

PRINT

PRINT T$ = MainBar$

GOSUB CenterLine

PRINT

PRINT

PRINT I$;"l. Parameters Manager" PRINT I$;"2. Range Manager"

PRINT I$;"3. Layer Manager"

PRINT I$;"4. Vector Manager"

PRINT I$;"5. Statistics"

PRINT I$;"X. Exit" PRINT

PRINT

T$ = MainBar$

GOSUB CenterLine

PRINT PRINT

PRINT 1$;"Which option? ";

SUBSTITUTE SHEET

-82.450-

LoopMain:

C$ = UCASES(INKEYS) IF LEN(C$)=0 THEN LoopMain IF C$="X" THEN END IF C$="l" THEN ParamsManager IF c$="2" THEN RangeManager IF c$="3" THEN LayerManager IF C$="4" THEN Vector Manager IF C$="5" THEN Statistics GOTO LoopMain

Parameters Manager:

ParamsManager: CLS

IF RangeCount! = 0 THEN PRINT "No layer ranges!" ELSE

T$ = "PARAMETERS MANAGER" GOSUB CenterLine T$ = Title$ GOSUB CenterLine T$ = "working on part "+PartName$ GOSUB CenterLine PRINT END IF INPUT 1$ GOTO MainMenu

Range Manager:

show layer range table

SUBSTITUTE SHEET

-82.451- a layer range is conditioned on the following: all layers must have the same z-spacing from the last layer they must have the same command strings for each type of block allow comments (stored in first layer only)

RangeManager: CLS IF RangeCount! = 0 THEN

PRINT "No layer ranges!" ELSE

T$ = "RANGE MANAGER"

GOSUB CenterLine

T$ = TitleS

GOSUB CenterLine

T$ = "working on file "+PartRangeFileName$

GOSUB CenterLine

PRINT

PRINT RangeBarS

PRINT " Range Z-Start Z-End Z-Space

CAD-Start CAD-End CAD-Space

PRINT RangeBarS

FOR I!=l TO RangeCount!

PRINT USING ### ";i%; PRINT USING ##### ";ZStartS[I!] ; PRINT USING #ffff » ;ZEndS[I!]; PRINT USING ##### ••;ZSpace![I!]; PRINT USING #####.###";ZStart [I!]/SliceRes; PRINT USING ffff#.###";ZEnd [I!]/SliceRes; PRINT USING #####•###";ZSpace![l!]/SliceRes; IF ZSpace![I!]>0 THEN

Z! = (ZEndS[l!]-ZStartS[I!])/ZSpace![I!] ELSE

Z! = 0

SUBSTITUTE SHEET

-82.452-

END IF PRINT USING " fffff";Z!+l NEXT I!

PRINT RangeBar$ END IF PRINT

PRINT " Press:"

PRINT " A to add range D to delete range E to edit range" PRINT " V to verify blocks R to make a report C to calc SP'S"

PRINT " X to exit Q to quit program U to update disk" LoopRange: C$=UCASE$(INKEYS)

IF LEN(C$)=0 THEN LoopRange IF C$="A" THEN AddRange IF C$="D" THEN DeleteRange IF C$="E" THEN EditRange IF C$="S" THEN ScanBlocks IF C$="R" THEN MakeReport IF C$="C" THEN CalcSp IF C$="U" THEN UpdateRangeFile IF C$="X" THEN MainMenu IF C$="Q" THEN END GOTO LoopRange

AddRange: PRINT PRINT

PRINT "Adding Range"

PRINT "Press Z to Enter Z-Layer or C to enter CAD Number: "; LoopAdd: C$=UCASE$(INKEYS)

SUBSTITUTE SHEET

-82.453-

IF LEN(C$)=0 THEN LoopAdd PRINT C$

PRINT "Enter break point, in ";

IF C$="C" THEN PRINT "CAD"; ELSE PRINT "Z-Layer"; INPUT " units: ",RangeBreak

IF LEN(C$)=0 THEN RangeManager IF C$="C" THEN

RangeBreakS = RangeBreak*SliceRes ELSE RangeBreakS = RangeBreak END IF

IF RangeBreakS <- ZStart [1] OR RangeBreakS > ZEndS[RangeCount!]_ THEN RangeManager FOR I!=l TO RangeCount!

IF RangeBreakS=ZStartS[I!] THEN RangeManager IF RangeBreakS<ZStartS[I!] THEN StartFound NEXT I! StartFound: DECR I!

ZNewS = ZStartS[I!] DO ' calc new range end OldZNewS = ZNewS ZNewS = ZNewS + ZSpace![I!] LOOP UNTIL ZNew >=RangeBreakS

IF ZNewSoRangeBreakS THEN RangeManager • invalid layer

FOR J!=RangeCount! TO I! STEP -1

ZStartS [J!+l] = ZStartS [J!] ZEndS [J!+l] = ZEndS [J!] ZSpace! [J!+l] = ZSpace! [J!] CureDepth! [J!+l] = CureDepth! [J!] BlockStart![J!+l] = BlockStart![J!] BlockEnd! [J!+l] = BlockEnd! [J!] NEXT J!

INCR RangeCount!

ZStartS[I!+l] = RangeBreakS

SUBSTITUTE SHEET

-82.454-

ZNewS = ZStartS[I!]

DO * calc new range end

OldZNewS = ZNewS

ZNewS = ZNewS + ZSpace![I!] LOOP UNTIL ZNewS>=RangeBreakS ZEndS[I!] = OldZNewS BlockStart![I!] = Blocklndex! FOR J!=BlockStart![I!+l] TO BlockEnd![I!+1]

BlockTypeS[Blocklndex!] = BlockType$[J!] BlockCmd$ [Blocklndex!] = BlockCmd$ [J!]

INCR Blocklndex! NEXT J!

BlockEnd! [I!] = BlockIndex!-l GOTO RangeManager

DeleteRange: PRINT PRINT

INPUT "Delete what range: ",Range! IF Range!<2 OR Range!>RangeCount!-l THEN RangeManager IF ZSpace![Range!] = ZSpace![Range!-1] AND _ ZSpace![Range!] = ZSpace![Range!+1] THEN PRINT "Consolidate with range f";FN NoSp$(STR$(Range!-1)) ; PRINT " or f";FN NoSp$(STR$(Range!+1) ) ;": "; INPUT "",C$

IF LEFT$(C$,l)= » f" THEN C$=MID$(C$,2) C! = VAL(C$)

IF C! = Range!-1 THEN C$="U"_ ELSE IF C!=Range!+l THEN C$="D"_ ELSE RangeManager ELSE

IF ZSpace![Range!] = ZSpace![Range!-1] THEN C$="U" ELSE C$="D"

SUBSTITUTE SHEET

-82.455-

END IF

I! = Range!

OldStartS = ZStartS[I!]

OldEndS = ZEnd [I!] FOR J!=BlockStart![l!] TO BlockEnd![I!]

BlockType$[Blocklndex!] = ••*** » • deleted

NEXT J!

FOR J!=I! TO RangeCount!

ZStartS [J!] = ZStartS [J!+l] ZEndS [J!] = ZEndS [J!+l] ZSpace! [J!] = ZSpace! [J!+l] CureDepth! [J!] = CureDepth! [J!+l] BlockStart![J!] = BlockStart![J!+l] BlockEnd! [J!] = BlockEnd! [J!+l] NEXT J!

DECR RangeCount!

IF C$="D" THEN

ZStartS[I!] = OldStartS

ELSE ZEndS[I!-l] - OldEndS

END IF

GOTO RangeManager

EditRange: PRINT

PRINT

INPUT "Edit what range? ",Range!

IF Range!<l OR Range!>RangeCount! THEN RangeManager

BlockBase! = Blockstart![Range!] BlockCount! = BlockEnd![Range!] - BlockStart![Range!]

+ 1 ShowBlocks:

CLS

T$ = "Layer Range Blocks" GOSUB CenterLine

SUBSTITUTE SHEET

-82.456-

T$ - "working on file "+PartLayerFileName$ GOSUB CenterLine PRINT

PRINT " Range #";Range! PRINT " Z-Levels: "?

PRINT USING "FROM ##### TO ##### BY

#####";_

ZStartS[Range!3 ,ZEndS[Range!],ZSpace![Range!] PRINT " CAD Units: ••; PRINT USING "FROM ### ' ##.### TO fffff.fff BY

###f#.###";_

ZStartS[Range!]/SliceRes,ZEndS[Range!]/SliceRes,_ ZSpace![Range!]/SliceRes PRINT PRINT " Block# Block Id Block Command" PRINT " ";BlockBarS IF BlockBase!+9 < BlockEnd![Range!] THEN

BlockTo! = BlockBase!+9 ELSE BlockTo! = BlockEnd![Range!] END IF FOR I!=BlockBase! TO BlockTo!

PRINT USING " ## ";l!-BlockStart![Range!]+l; PRINT " » ';BlockType$[l!] ;SPC(12-LEN(BlockType$[l!]) ) ; PRINT BlockCmd$[l!] NEXT I!

PRINT " ";BlockBarS IF BlockBase!+9 < BlockEnd![Range!] THEN PRINT " MORE BLOCKS "

IF BlockBase! > BlockStart![Range!] THEN PRINT " Enter B to go back.";

IF BlockBase!+9 < BlockEnd![Range!] THEN PRINT " Enter F to go forward."; PRINT

PRINT " Enter number of block to edit, just Return to stop: ";

SUBSTITUTE SHEET

-82.457- v! = CSRLIN h! = POS BlockAsk:

LOCATE v!,h! PRINT " ";

LOCATE v!,h! INPUT "",BlockS B$ = UCASE$(LEFTS(BlockS,1)) IF B$="B" THEN DECR BlockBase! ,10

IF BlockBase! < BlockStart![Range!] THEN BlockBase! = BlockStart![Range!] GOTO ShowBlocks END IF IF B$="F" THEN

IF BlockBase!+lO <= BlockEnd![Range!] THEN INCR BlockBase!,10 GOTO ShowBlocks END. IF IF LEN(Block$)=0 THEN RangeManager Block! = VAL(Block$)

IF Block!<l OR Block!>BlockCount! THEN PRINT " Invalid block number "; GOTO BlockAsk END IF

Index! = BlockStart![Range!]+Block!-l PRINT " Enter commands for ";BlockType$[Index!] ; LINE INPUT ": ",Cmd$ IF LEN(FN NoSp$(Cmd$))=0 THEN Cmd$ = "" ELSE

IF LEFTS (Cmd$,l)OCHR$(34) THEN Cmd$=CHR$(34)+Cmd$ IF RIGHTS(Cmd$,l)θCHR$(34) THEN Cmd$=CMD$+CHR$(34) END IF BlockCmd$[Index!] = UCASE$(Cmd$) GOTO ShowBlocks

SUBSTITUTE SHEET

-82.456-

ScanBlocks: PRINT PRINT PRINT "Rescanning will wipe out any existing commands. Continue? "; INPUT "",A$

IF UCASE$(LEFTS(A$,1))="Y" THEN GOSUB BlockScan GOTO RangeManager

BlockScan:

ON ERROR GOTO NoLayerFile OPEN PartLayerFileNameS FOR INPUT AS #3 ON ERROR GOTO 0

PRINT "Scanning ";PartLayerFileNameS;"..." Blocklndex! = 0

IF RangeCount!>0 THEN

R!=l

BlockStart![R!] = Blocklndex!

BlockEnd![R!] = BlockIndex!-l

ScanReadBlocks:

IF EOF(3) THEN ScanStartNewRange

LINE INPUT #3,CONTROLS ScanAlreadyHaveBlock:

T$ = LEFTS(CONTROLS,1) IF LEN(CONTROLS)=0 OR T$="!" OR T$="*" THEN

ScanReadBlocks

I

' parse out layer number, block name

I Controllndex! = 1 CALL UnitValInt(ControlLayerS,CONTROLS,Controllndex!)

CALL UnitStr(ControlTypeS,CONTROLS,Controllndex!) T$ = FN NoSp$(MID$(CONTROLS,Controllndex!))

SUBSTITUTE SHEET

-82.459-

I! = INSTR(T$,"!")

IF I!=0 THEN I!=LEN(T$)+1

ControlCmdS = FN NoSp$(LEFTS(T$,I!-1))

IF ControlType$="#CA" THEN ScanReadBlocks » skip critical areas

IF ControlLayerS < ZStart [R!3 THEN ScanReadBlocks IF ControlLayerS > ZEndS[R!] THEN ScanStartNewRange

add unique blocks to current range's block table

FOR J!=BlockStart![R!] TO BlockEnd![R!]

IF ControlType$=BlockType$[J!] THEN ScanReadBlocks NEXT J!

BlockType$[Blocklndex!] = ControlType$ BlockCmd$[Blocklndex!] = ControlCmd$ BlockEnd![R!] = Blocklndex! INCR Blocklndex! GOTO ScanReadBlocks

I ' set up the new layer

I

ScanStartNewRange: INCR R!

IF R!<=RangeCount! THEN BlockStart![R!] = Blocklndex! BlockEnd![R!] = BlockIndex!-l GOTO ScanAlreadyHaveBlock END IF END IF CLOSE #3 RETURN

MakeReport: PRINT

SUBSTITUTE SHEET

-82.460-

PRINT

PRINT "Press V to view report on screen, or P to print on printer: "; LoopReport: C$=UCASE$(INKEYS)

IF LEN(C$)=0 THEN LoopReport IF c$="V" THEN ViewReport IF c$="P" THEN PrintReport GOTO RangeManager

ViewReport: CLS

T$ = " PREPARE Report for "+PartLayerFileName$ T$ = T$ + STRINGS(59-LEN(T$) ," ") + DATE$+" "+TIME$ FOR I!=l! TO RangeCount! CLS

PRINT T$ PRINT

PRINT " Range Z-Start Z-End Z-Space CAD-Start CAD-End CAD-Space PRINT USING " ### ";I!;

PRINT USING " ##### ";ZStart [I!] ; PRINT USING " ffff ";ZEnd [I!] ; PRINT USING " fffff ";ZSpace![I!] ; PRINT USING " ff ff.fff";ZStartS[l!]/SliceRes; PRINT USING " #####. f ";ZEndS[I!]/SliceRes;

PRINT USING " #####.### « ;ZSpace![I!]/SliceRes;

PRINT USING "

##fff" ? (ZEndS[I!]-ZStartS[l!])/ZSpace! [I!]+l

PRINT " BlockCount! = 1

FOR J!=BlockStart![I!] TO BlockEnd![I!] PRINT " Block";BlockCount!;

PRINT " Type ";BlockType$[J!] ;SPC(6-LEN (BlockType$[J!]) ) ; IF LEN(BlockCmd$[J!]) THEN PRINT " Commands: ";BlockCmd$[J!];

SUBSTITUTE SHEET

-82.461-

PRINT

INCR BlockCount! NEXT J!

PRINT " PRINT

INPUT "Press Enter to continue—",A$ NEXT I! GOTO RangeManager

PrintReport: ON ERROR GOTO PrinterNotReady

LPRINT

LPRINT

T$ = " PREPARE Report for "+PartLayerFileName$

LPRINT T$ + STRING$(59-LEN(T$) ," ") + DATE$;" ";TIME$ LPRINT

LPRINT " Range Z-Start Z-End Z-Space CAD-Start

CAD-End CAD-Space

FOR I!=l! TO RangeCount!

LPRINT USING 1 fff ";ϋ; LPRINT USING ##### ";ZStart [I!] ; LPRINT USING ##### » ;ZEnd [I!]; LPRINT USING ##### » ;ZSpace![I!]; LPRINT USING #####.###";ZStart&[l!]/SliceRes; LPRINT USING #####.###";ZEnd [I!]/SliceRes; LPRINT USING #####.###";ZSpace![l!]/SliceRes; LPRINT USING #####"; (ZEnd [I!]-ZStartS[I!])/ ZSpace![I!]+l LPRINT "

BlockCount! = 1 FOR J!=BlockStart![l!] TO BlockEnd![I!]

LPRINT " Block";BlockCount!;

LPRINT " Type ";BlockType$[J!] ;SPC(6-LEN

(BlockType$[J!])) ;

IF LEN(BlockCmd$[J!]) THEN LPRINT " Commands: ";BlockCmd$[J!] ;

SUBSTITUTE SHEET

-82.462-

LPRINT

INCR BlockCount! NEXT J!

LPRINT " NEXT I!

LPRINT CHR$(12) ; GOTO RangeManager

PrinterNotReady: PRINT PRINT "Printer not ready. Press P to try again, or Q to quit: "; PrintNRLoop: DO

C$ = UCASES(INKEYS) LOOP UNTIL LEN(C$)>0 IF C$="P" THEN RESUME IF C$="Q" THEN RESUME RangeManager GOTO PrintNRLoop

UpdateRangeFile: PRINT PRINT

ON ERROR GOTO RangeFileProb OPEN PartRangeFileNameS FOR OUTPUT AS #10 PRINT "Updating ";PartRangeFileNameS;"..." FOR I!=l TO CommentCount!

PRINT #10,Comments$[I!] NEXT I!

PRINT #10,"* "; WRITE #10,SliceRes,ZSpacing,Thickness FOR I!=l! TO RangeCount!

WRITE #10,ZStartS[I!] ,ZEndS[I!] ,ZSpace![l!] ,

CureDepth![I!]

SUBSTITUTE SHEET

-82 .463-

FOR J!=BlockStart![I!] TO BlockEnd![I!] PRINT #10,BlockType$[J!]; IF LEN(BlockCmd$[J!])>0 THEN PRINT #10,",";Quote$;BlockCmd$[J!] ;Quote$; PRINT #10,"" NEXT J! NEXT I! CLOSE #10 GOTO RangeManager

Layer Manager

- allows editing of individual layers listing of layers having specified blocks

LayerManager: CLS IF RangeCount! = 0 THEN

PRINT "No layer ranges!" ELSE

T$ = "LAYER MANAGER"

GOSUB CenterLine

T$ = TitleS

GOSUB CenterLine

T$ = "working on file "+PartLayerFileName$

GOSUB CenterLine lndent$ = STRING$(18," ")

PRINT

PRINT Indent$;LayerBar$

PRINT Indent$;" Range Z-Start Z-End Z-Space

Count"

PRINT Indent$;LayerBar$

FOR I!=l TO RangeCount! PRINT Indents;

SUBSTITUTE SHEET

-82.464-

PRINT USING " ### ";I!; PRINT USING " ###f# ";ZStartS[I!] ; PRINT USING " fffff"?ZEndS[l!] ; PRINT USING " fffff ";ZSpace![I!] ; IF ZSpace![I!]>0 THEN

Z! = (ZEndS[I!]-ZStartS[I!])/ZSpace![I!] ELSE

Z! = 0 END IF PRINT USING " ff### » ;Z!+l NEXT I!

PRINT Indents LayerBar$ END IF PRINT PRINT " Press:"

PRINT " F to find blocks E to edit layer file U to update disk"

PRINT " X to exit Q to quit program" LoopLayer: C$=UCASE$(INKEYS)

IF LEN(C$)=0 THEN LoopLayer IF C$="F" THEN FindBlocks IF c$="E" THEN EditLayer IF C$="U" THEN UpdateLayerFile IF C$="X » THEN MainMenu IF C$="Q" THEN END GOTO LoopLayer

FindBlocks: PRINT

PRINT

INPUT "Find what blocks (separate by spaces)? ",B$

IF LEN(B$)=0 THEN LayerManager

TBIndex! = 0 WHILE LEN(B$)>0

SUBSTITUTE SHEET

-82.465-

I! = INSTR(B$," ") IF I!=0 THEN I!=LEN(B$)+1

TBType$[TBIndex!] = UCASE$(LEFTS(B$,I!-l) ) INCR TBIndex! B$ = MID$(B$,I!+1) WEND

PRINT "Look through what range of layers? Enter ALL, or enter number of the single" PRINT "range, or enter Z-Layer start,stop: "; LINE INPUT "",Z$

IF LEN(Z$)=0 THEN LayerManager IF LEFTS(UCASE$(Z$) ,1)="A" THEN MinLayerS = 0 MaxLayerS = 99999 ELSE

I! = INSTR(Z$,",") IF I! THEN

MinLayerS = VAL(LEFT$(Z$,I!-1) ) MaxLayerS = VAL(MID$(Z$,I!+1) ) ELSE

IF LEFT$(Z$,1)="#" THEN Z$=MID$(Z$,2) J! = VAL(Z$) MinLayerS = ZStart [J!] MaxLayerS = ZEnd [J!] END IF END IF

FindStart:

ON ERROR GOTO NoLayerFile OPEN PartLayerFileNameS FOR INPUT AS #3 ON ERROR GOTO 0

PRINT "Searching ";PartLayerFileNameS;"..."

FindLoop:

IF EOF(3) THEN FindDone LINE INPUT #3,CONTROLS L$ = LEFTS(CONTROLS,1)

SUBSTITUTE SHEET

-82.466-

IF LEN(CONTROLS)=0 OR L$="*" OR L$="!" THEN FindLoop Controllndex! = 1

CALL UnitValInt(ControlLayer ,CONTROLS,Controllndex!) CALL UnitStr(ControlTypeS ,CONTROLS,Controllndex!) IF ControlLayerS < MinLayerS OR ControlLayerS > MaxLayerS THEN FindLoop FOR I!=0 TO TBIndex!-l

IF ControlType$=TBType$[I!] THEN PRINT TBType$[I!];" block found on layer";ControlLayerS GOTO FindLoop END IF NEXT I! GOTO FindLoop

FindDone: CLOSE #3 PRINT

INPUT "Press Enter to continue... ",A$ GOTO LayerManager

EditLayer:

SHELL "EDIT "+PartLayerFileName$ GOTO LayerManager

UpdateLayerFile:

PRINT

PRINT

PRINT "About to update Layer File ";PartLayerFileNameS; INPUT " Okay? ",A$

IF A$="" OR UCASE$(LEFT$(A$,l))o"Y" THEN LayerManager

ON ERROR GOTO NoBackup

SUBSTITUTE SHEET

-82 .467-

KILL BackupFileName$ GOTO UpdateStart NoBackup:

RESUME UpdateStart

RenameError:

PRINT "Error trying to rename ";PartLayerFileNameS GotWarning! = TRUE NoLayerControl: RESUME UpdateDone

UpdateStart:

ON ERROR GOTO NoLayerControl

NAME PartLayerFileNameS AS BackupFileNameS

ON ERROR GOTO NoBackupFile

OPEN BackupFileNameS FOR INPUT AS #3 ON ERROR GOTO NoLayerFile

OPEN PartLayerFileNameS FOR OUTPUT AS #4

ON ERROR GOTO 0

PRINT "Updating ";PartLayerFileNameS;"..."

GotWarning! = FALSE

UpdateLoop:

IF EOF(3) THEN UpdateDone

LINE INPUT 3,CONTROL$

L$ = LEFTS(CONTROLS,1)

IF LEN(CONTROLS)=0 OR L$="*" OR L$="!" THEN PRINT f4,CONTROLS GOTO UpdateLoop

END IF

Controllndex! = 1

CALL UnitValInt(ControlLayerS ,CONTROLS,Controllndex!) CALL UnitStr(ControlTypeS,CONTROLS,ControlIndex!)

T$ = FN NoSp$(MID$(CONTROLS,Controllndex!))

I!=INSTR(T$,"!' » )

IF I!=0 THEN I!=LEN(T$)+1

ControlCmd$ = FN NoSp$(LEFT$(T$,l!-l) )

SUBSTITUTE SHEET

-32.466- ControlCommentS = MID$(T$,I!)

UpdateBlock:

IF ControlType$="fCA" THEN PRINT 4,CONTROLS GOTO UpdateLoop END IF FOR I!=l TO RangeCount!

IF ControlLayerS < ZStartS[I!] THEN UpdLayer NEXT I! IF ControlLayerS <= ZEnd [l!-l] THEN UpdLayer

PRINT "Warning: Layer";ControlLayerS;"not accounted for in table." BadUpdate:

GotWarning! = TRUE PRINT f4,CONTROLS GOTO UpdateLoop

UpdLayer: DECR I!

FOR J!=BlockStart![l!] TO BlockEnd![I!] IF BlockType$[J!]=ControlType$ THEN UpdBlock NEXT J!

PRINT "Warning: Layer";ControlLayer ;"Block ";ControlTypeS;_

" not accounted for in table." GOTO BadUpdate

UpdBlock:

PRINT f4,FN NoSp$(STR$(ControlLayerS) ) ;",";ControlTypeS;

IF LEN(BlockCmd$[J!])>0 THEN PRINT #4,",";BlockCmdS[J!] ;

IF LEN(ControlComment$) THEN PRINT #4,"

";ControlCommentS;

PRINT #4,""

GOTO UpdateLoop

SUBSTITUTE SHEET

-62 .469-

UpdateDone:

ON ERROR GOTO 0

CLOSE #3

CLOSE #4

IF GotWarning! THEN

INPUT "Press Enter to continue... ",A$ END IF GOTO LayerManager

' Vector Manager

- allows editing of individual vectors

Vector Manager: CLS IF RangeCount! = 0 THEN

PRINT "No layer ranges!" ELSE

T$ = "VECTOR MANAGER" GOSUB CenterLine T$ = TitleS

GOSUB CenterLine

T$ = "working on file "+PartVectorFileName$ GOSUB CenterLine Indent$ = STRING$(13," ") PRINT

PRINT Indents;LayerBar$

PRINT Indents;" Range Z-Start Z-End Z-Space Count"

PRINT Indents;LayerBar$ FOR I!=l TO RangeCount! PRINT Indent$; PRINT USING " ff# ";ϋ; PRINT USING " ##### ";ZStart![I!] ; PRINT USING " #####";ZEnd&[I!] ; PRINT USING " ##### ";ZSpace![I!] ;

SUBSTITUTE SHEET

-82 .470-

IF ZSpace![I!]>0 THEN

Z! = (ZEnd [I!]-ZStart [I!])/ZSpace![I!] ELSE

Z! = 0 END IF

PRINT USING " #####";Z!+1 NEXT I!

PRINT Indent$;LayerBarS END IF PRINT

PRINT " Press:" PRINT " E to edit Vector File PRINT " X to exit Q to quit program" LoopVector: C$=UCASE$(INKEY$)

IF LEN(C$)=0 THEN LoopVector IF C$="E" THEN EditVector IF C$="X" THEN MainMenu IF C$="Q" THEN END GOTO LoopVector

EditVector:

PRINT

PRINT INPUT "Edit starting at what z-layer? ",L$

L$ = FN NoSp$(L$)

IF LEN(L$)=0 THEN VectorManager

PRINT "Reading file, please wait...";

ON ERROR GOTO NoVectorFile OPEN PartVectorFileName$ FOR INPUT AS #4

ON ERROR GOTO NoBackupFile

OPEN LayerTempFileName$ FOR OUTPUT AS #5

StartLineCountS = 0

I ' Search for layer

SUBSTITUTE SHEET

-82.471- ι

EditVectorSearch:

IF EOF(4) THEN EditVectorNotFound LINE INPUT #4,A$ INCR StartLineCountS

IF LEFTS(A$,1)="L" THEN Tl$ = LEFT$(A$,1) T2$ = MID$(A$,2,1) T40N$ = MID$(A$,4,9) IF T1$="L" AND (T2$>="0") AND (T2$<="9") THEN IF T40N$=L$ THEN EditVectorSetup IF VAL(T40N$)>VAL(1$) THEN EditVectorNotFound END IF END IF GOTO EditVectorSearch

I

' setup for edit, max file size is 50K

I

EditVectorSetup: PRINT 5,A$

CharCountS = LEN(A$)+2 EndLineCountS = StartLineCountS WHILE CharCountS<50000 AND NOT EOF(4) LINE INPUT #4, A$ INCR EndLineCountS PRINT 5,A$

INCR CharCountS,LEN(A$)+2 WEND CLOSE #4 CLOSE #5

SHELL "EDIT "+LayerTempFileName$ CLS

LOCATE 12,1

PRINT "Update ";PartVectorFileName$;" file? "; EditVectorLoop:

C$ = UCASE$(INKEY$)

IF LEN(C$)=0 THEN EditVectorLoop

SUBSTITUTE SHEET

-82.472-

PRINT C$;

IF C$o"Y" THEN VectorManager

begin vector file update »

ON ERROR GOTO NoBackup2 ' remove backup file

KILL BackupFileNameS GOTO UpdateVectors NoBackup2: RESUME Update Vectors

UpdateVectors:

ON ERROR GOTO Rename Error

NAME PartVectorFileNameS AS BackupFileNameS ' juggle file names around ON ERROR GOTO NoBackupFile

OPEN BackupFileNameS FOR INPUT AS #4 ON ERROR GOTO NoVectorFile OPEN PartVectorFileNameS FOR OUTPUT AS #6 ON ERROR GOTO 0 FOR IS=1 TO StartLineCountS-1 ' copy part prior LINE INPUT #4,A$ PRINT #6,A$ NEXT IS

FOR IS=StartLineCountS TO EndLineCountS ' throw away original

LINE INPUT #4,A$ NEXT IS

ON ERROR GOTO NoTempFile OPEN LayerTempFileName$ FOR INPUT AS #5 ON ERROR GOTO 0

WHILE NOT EOF(5) ' replace with edited

LINE INPUT #5,A$ PRINT #6,A$ WEND CLOSE #5

SUBSTITUTE SHEET

-82 .473-

WHILE NOT EOF(4) • copy part after

LINE INPUT #4,AS

PRINT #6,A$ WEND CLOSE #4 CLOSE #6 GOTO VectorManager

EditVectorNotFound: PRINT INPUT "Can't find indicated layer. Press Enter to continue...",A$ GOTO VectorManager

• Calculate part's step period(s)

I

CalcSp:

ON ERROR GOTO NoPowerFile OPEN PowerFile$ FOR INPUT AS #8 INPUT #8,LaserPower CLOSE #8

GOTO CalcReadMaterialData NoPowerFile: LaserPower = 0 RESUME CalcReadMaterialData

CalcReadMaterialData:

ON ERROR GOTO NoLastMaterialFile OPEN LastMaterialFile$ FOR INPUT AS #9 LINE INPUT #9,MaterialFile$ CLOSE #9

GOSUB GetMaterialFileData GOTO ShowSp NoLastMaterialFile:

MaterialFile$ = "- none -"

SUBSTITUTE SHEET

-82.474-

FOR I!=l TO RangeCount! EstSpS[l!] = 0 SP(I!) = 0 : LH(I!) = 0 : WMIN(I!) = 0 : WMAX(I!) =

LHSlope = 0 LHYInt = 0 LHRval = 0 WMINSlope = 0 WMINYint = 0 WMINRval = 0 WMAXSlope = 0 WMAXYint = 0 WMAXRval = 0

NEXT I!

RESUME ShowSp

ShowSp: CLS

ON ERROR GOTO 0 IF RangeCount! = 0 THEN

PRINT "No layer ranges!" ELSE

T$ = "RANGE - CALC SP"

GOSUB CenterLine

T$ = TitleS

GOSUB CenterLine T$ = "working on file "+PartRangeFileName$

GOSUB CenterLine

Indents = STRINGS(6," ")

PRINT

T$ = "Laser Power Reading: "+STR$(INT(LaserPower*100)/ 100)+" mW"

GOSUB CenterLine

T$ = "using working curve data from material file:

* "+MaterialFile$

GOSUB CenterLine PRINT Indent$;SpBar$

PRINT IndentS;" Range Z-Start Z-End Z-Space

Depth Est SP W Min W Max"

PRINT Indents;SpBar$

FOR I!=l TO RangeCount! WMIN = FN GetLog(EstSpS[I!] ,WMINSlope,WMINYint) IF WMIN>999 THEN WMIN=999

SUBSTITUTE SHEET

-82.475-

IF WMIN<0 THEN WMIN=0

WMAX = FN GetLog(EstSpS[I!], MAXSlope,WMAXYint)

IF WMAX>999 THEN WMAX=999

IF WMAX<0 THEN WMAX=0

PRINT Indents;

PRINT USING ' ### ";i!; PRINT USING • fffff ";ZStartS[I!] ; PRINT USING ####f';ZEndS[I!]; PRINT USING • fffff « ;ZSpace![I!]; PRINT USING #####";CureDepth![I!] ; PRINT USING #####";EstSpS[I!]; PRINT USING ###.#";WMIN; PRINT USING ###.#";WMAX NEXT I!

PRINT Indent$;SpBar$ END IF PRINT

PRINT " Press:" PRINT " R to read material data U to update range commands" PRINT " C to change power rating E to edit cure depth/ step period" PRINT " V to view material data"

PRINT " X to exit Q to quit program"

LoopSp:

C$=UCASE$(INKEY$)

IF LEN(C$)=0 THEN LoopSp

IF c$= "R THEN ReadMaterial

IF c$= "C THEN ChangeSp

IF c$= "U THEN UpdateCmds

IF c$= "V THEN ViewMaterial

IF c$= "E THEN EditSpPara s

IF C$= "X THEN RangeManager

IF C$= "Q THEN END

GOTO LoopSp

SUBSTITUTE SHEET

-82.476-

ReadMaterial:

CLS

PRINT "Available Material Files:"

PRINT ON ERROR GOTO NoMaterialFiles

FILES "*.MAT"

GOTO GetMaterialAsk NoMaterialFiles:

PRINT "- no material files in working directory -" RESUME GetMaterialAsk GetMaterial sk:

PRINT

INPUT "Name of data file to read: ",MaterialFile$

IF LEN(MaterialFile$)=0 THEN ShowSp MaterialFileS = UCASE$(MaterialFile$)

IF INSTR(MaterialFile$,".")=0 THEN MaterialFile$ =

MaterialFileS + ".MAT"

ON ERROR GOTO CantReadMaterialFile

GOSUB GetMaterialFileData OPEN LastMaterialFileS FOR OUTPUT AS #9

PRINT #9,MaterialFile$

CLOSE #9

GOTO ShowSp

GetMaterialFileData: OPEN MaterialFile$ FOR INPUT AS #7 ON ERROR GOTO 0 INPUT #7,MaterialLaserPower INPUT #7,NumberOfPairs! FOR I! = 1 TO NumberOfPairs! INPUT #7,SP(I!) INPUT #7,LH(I!) SP(I!) = LOG(SP(I!))/LOG(10) INPUT #7,WMIN(I!) INPUT #7, MAX(I!) NEXT I! CLOSE #7

SUBSTITUTE SHEET

-82.477-

CALL Regression(LH() ,LHSlope,LHYint,LHRval) CALL Regression(WMINO ,WMINSlope, MINYint,WMINRval) CALL Regression(WMAX() ,WMAXSlope,WMAXYint,WMAXRval) GOSUB DoCalculation RETURN

CantReadMaterialFile:

PRINT "Can't read material file ";MaterialFile$

CLOSE #7

RESUME GetMaterialAsk

ChangeSp:

PRINT

INPUT "Enter new laser power reading (mW) ",LaserPower OPEN PowerFileS FOR OUTPUT AS #8 PRINT f8,LaserPower CLOSE #8

GOSUB DoCalculation GOTO ShowSp

UpdateCmds: CLS

PRINT "Update Range Commands" PRINT PRINT "Block Groups:" PRINT FOR I!=0 TO BlockGroups!

PRINT FN StrNθSp$(I!) ;". "; FOR J!=0 TO BlockGroupCount![I!]-l IF POS(0)>75 THEN PRINT PRINT " ";

SUBSTITUTE SHEET

-82.478-

END IF

PRINT BlockGroupId$[I!,J!] ;SPC(6-LEN(BlockGroupId$ [I!,J!])); NEXT J! PRINT NEXT I! PRINT

INPUT "Use which block group [1]? ",A$ IF LEN(A$)=0 THEN Group! = 1 ELSE Group! = VAL(A$) PRINT

INPUT "Update which merge-sets [all]? ",Upd$ Upd$ = UCASE$(Upd$)

IF LEN(Upd$)=0 OR LEFTS(Upd$,1)="A" THEN Upd$="A" FOR I!=l TO RangeCount! NewSp$ = "SP " + FN NoSpS(STR$(EstSpS[I!]) ) FOR J!=BlockStart![I!] TO BlockEnd![I!] B$ = BlockType$[J!] F$ = "«

WHILE RIGHTS(B$,1)<"A" F$ = F$+RIGHT$(B$,1)

B$ = LEFTS(B$,LEN(B$)-l) WEND

IF B$="L" OR (Upd$o » A" AND INSTR(Upd$,F$)=0) THEN NoUpdateCmdBlock K!=0

WHILE K! < BlockGroupCount![Group!] IF B$=BlockGroupId$[Group!,K!] THEN UpdateCmdBlock INCR K! WEND

GOTO NoUpdateCmdBlock UpdateCmdBloc :

IF RIGHT$(B$,1)="F" THEN NewSs$ = FillStepSizeS ELSE

NewSs$ = NormStepSizeS END IF

SUBSTITUTE SHEET

-82 .479-

IF NewSs$o"" THEN CALL UpdateBlockCommands

(J!,B$,NewSs$)

IF NewSp$<>"" THEN CALL UpdateBlockCommands

(J!,B$,NewSp$)

NoUpdateCmdBlock: NEXT J! NEXT I! PRINT

PRINT "Range commands updated in memory. Use Range Manager Update Disk Command"

INPUT "to update the Range File out on disk...",A$ GOTO ShowSp

SUB UpdateBlockCommands(Index!,Block$,Newltem$) LOCAL T$ ,ItemldS,I!,J!,K!,CmdLeft$,CmdRightS SHARED BlockCmd$[]

I! - INSTR(NewItem$," ") • get text up to first space (or end)

IF I!=0 THEN I!=LEN(NewItem$)+l ItemldS = LEFTS(Newltem$,l!-1) T$ = FN NoQuotes$(BlockCmd$[Index!]) IF LEN(T$)=0 THEN

T$ = NewItemS ELSE

J! = INSTR(T$,ItemldS) IF J! THEN

K! = INSTR(J!,T$,";") IF K!=0 THEN K! = LEN(T$) CmdLeft$ = LEFT$(T$,J!-1) CmdRightS = MID$(T$,K!+1,99) IF LEN(CmdRightS)=0 AND RIGHTS(CmdLeft$,1)=";" THEN_

CmdLeft$ - LEFT$(CmdLeft$,LEN(CmdLeft$)-l) T$ = CmdLeft$+CmdRight$ END IF IF LEN(T$) THEN

SUBSTITUTE SHEET

-82.480-

T$ = NewItemS + ";" + T$ ELSE

T$ = NewItemS END IF END IF

IF LEN(T$) THEN T$ = CHR$(34) + T$ + CHR$(34) BlockCmdS[Index!] = T$ UpdateBlocksEnd: END SUB

'■

ViewMaterial: CLS

PRINT "Data from Material File: ";MaterialFile$ PRINT PRINT

PRINT "Material Test Laser Power Reading: "; PRINT USING " ff.ff";MaterialLaserPower PRINT

PRINT NumberOfPairs!;"Material Data Pairs:" PRINT

FOR I! = 1 TO NumberOfPairs! PRINT USING "ff. ";I!;

PRINT USING " SP = f###.##";10 A SP(I!) ; LOCATE ,20 PRINT USING " LH = ####.##";LH(I!) ; LOCATE ,35

PRINT USING " WMIN = fff .f#";WMIN(I!) ; LOCATE ,52

PRINT USING " WMAX = ff##.##";WMAX(I!) NEXT I! PRINT

PRINT " LH: Slope =";

PRINT USING "### f. f";INT(LHSlope*1000)/1000; PRINT " Y-Intercept ="; PRINT USING "f ff .##";INT(LHYint*100)/100;

SUBSTITUTE SHEET

-82.481-

PRINT " R-Value =" ;

PRINT USING ••##### . ##" ; INT (LHRval*1000) /1000

PRINT "WMIN: Slope =" ;

PRINT USING "f f##.##";INT(WMINSlope*1000)/1000; PRINT " Y-Intercept =";

PRINT USING "#####.ff";INT(WMINYint*100)/100;

PRINT " R-Value =";

PRINT USING " ffff. f";INT(WMINRval*1000)/1000

PRINT "WMAX: Slope ="; PRINT USING "ff f.ff";INT(WMAXSlope*1000)/1000;

PRINT " Y-Intercept =";

PRINT USING "ff f .ff";INT(WMAXYint*100)/100;

PRINT " R-Value =";

PRINT USING "f fff. ";INT(WMAXRval*1000)/1000 PRINT

INPUT "Press Enter to continue... ",A$

GOTO ShowSp

EditSpParams: PRINT

PRINT "Enter C followed by range f,new cure depth PRINT " or S followed by range f,new step period: ", LINE INPUT "",A$ C$ = UCASE$(LEFT$(A$,1)) IF C$="S" THEN

ModingSp! = TRUE GOTO EditCont ELSEIF C$="C" THEN ModingSp! = FALSE GOTO EditCont END IF GOTO ShowSp EditCont:

A$ = MID$(A$,2,99) IF INSTR(A$,",")=0 THEN ShowSp

SUBSTITUTE SHEET

-82.482-

I! = INSTR(A$,",") Range! = VAL(LEFT$(A$,I!-1))

IF Range!<l OR Range!>RangeCount! THEN ShowSp Valuef = VAL(MID$(A$,I!+1)) IF Valuef <= Maxlnt THEN Value! = Valuef IF ModingSp! THEN

EstSp [Range!] = Value!

CureDepth![Range!] = FN GetLog(Value!,LHSlope, LHYint) ELSE

CureDepth![Range!] = Value!

EstSp [Range!] = FN GetEx (Value!,LHSlope,LHYint) END IF IF EstSpS[Range!] < MinSpS THEN EstSpS[Range!] = MinSpS

IF EstSPS[Range!] > MaxSpS THEN EstSpS[Range!] = MaxSpS END IF GOTO ShowSp

DoCalculation:

FOR I!=l TO RangeCount!

IF LaserPower < 1 THEN EstSpS[I!] « MinSpS_ ELSE EstSpS[I!] = FN GetExp(CureDepth![I!],LHSlope, LHYint)

IF EstSpS[I!] < MinSpS THEN EstSpS[l!] = MinSpS IF EstSPS[I!] > MaxSpS THEN EstSpS[l!] = MaxSpS NEXT I! RETURN

••

SUB Regression(Array(1) ,Slope,Yint,Rval) SHARED NumberOfPairs!,SP() XY = 0 SUMX = 0

SUBSTITUTE SHEET

-82.483-

SUMY = 0 SUMY2 = 0 XSQUARED = 0 IF NumberOfPairs!<l THEN Slope = 0 Yint = 0 Rval = 0 GOTO EndRegSub END IF FOR II = 1 TO NumberOfPairs! XY = XY + SP(I!) * Array(I!) SUMX = SUMX + SP(I!) SUMY = SUMY + Array(I!) SUMY2 = SUMY2 + Array(I!) 2 XSQUARED = XSQUARED + SP(I!) A 2 NEXT I!

Denom - XSQUARED - (SUMX A 2) / NumberOfPairs! IF Denom < 1E-5 THEN Slope = 0_

ELSE Slope = (XY - (SUMX*SUMY)/NumberOfPairs!) / Denom Yint = SUMY/NumberOfPairs! - Slope * SUMX/NumberOfPairs!

Denom = SUMY2 - SUMY A 2 / NumberOfPairs! IF Denom < 1E-5 THEN Rval = 0_

ELSE Rval = SQR(((Yint * SUMY + Slope * XY) - SUMY A 2/NumberOfPairs!) / Denom) EndRegSub: END SUB

DEF FN GetExp(DataPoint,Slope,Yint) IF (LaserPower>0) AND (Slope>0) THEN temp# - 10 A ((DataPoint - Yint) / Slope) * MaterialLaserPower / LaserPower

IF temp# <= MaxUInt THEN FN GetExp = temp# ELSE FN GetExp = MaxUInt ELSE FN GetExp = 0 END IF

SUBSTITUTE SHEET

-82.484-

END DEF

DEF FN GetLog(DataPoint,Slope,Yint)

IF (DataPoint>0) AND (MaterialLaserPower>0) AND (LaserPower>0) THEN FN GetLog = Slope * LOG10(DataPoint/

(MaterialLaserPower / LaserPower)) + Yint ELSE

FN GetLog = 0 END IF END DEF

Statistics: show full directory of all files involved with part

Statistics: CLS

PRINT "Statistics for part ";PartName$;":" SHELL "DIR "+PartName$+".*" LOCATE 23,1

INPUT "Press Enter to continue: ",A$ GOTO MainMenu

UTILITY FUNCTIONS AND PROCEDURES

Removes all double spaces in CmdLineS

RemoveDoubleSpaces:

WHILE INSTR(CmdLineS," ")>0 I = INSTR(CmdLineS," ")

SUBSTITUTE SHEET

-82.485-

CmdLineS = left$(CmdLineS,I) + mid$(CmdLine$,I+2,99) WEND RETURN

I ' Find any char of Char$ in Main$ starting at index Start

• Returns LEN(Main$)+l if no character of CharS in Main$

I DEF FN FindStr(Start!,Main$,Char$) LOCAL I!,J!,MIN! MIN! = LEN(Main$) + 1 FOR I!=l to LEN(Char$)

J! = INSTR(Start!,Main$,MID$(Char$,I!,l)) IF (J! > 0) AND (J! < MIN!) THEN MIN! = J! NEXT I!

FN FindStr = MIN! END DEF

' Make a string from a number without a leading space

I

DEF FN StrNoSp$(Num)

LOCAL A$

A$=STR$(Num) IF LEFT$(A$,1)=" " THEN A$=RIGHT$(A$,LEN(A$)-1)

FN StrNoSp$ = A$ END DEF

' Pick out a number from a string • starting at Index and going to the next space or comma or end-of-string

I

SUB UnitValShortInt(Storage!, ext$,Index!) Storage! = VAL(MID$(Text$,Index!) )

SUBSTITUTE SHEET

-82.486-

Index! = FN FindStr(Index!,TextS," ,") + 1 END SUB

SUB UnitValInt(Storages,TextS ,Index!) Storages = VAL(MID$(Text$,Index!)) Index! = FN FindStr(Index!,Text$," ,") + 1 END SUB

SUB UnitVal(Storage,TextS,Index!) Storage = VAL(MID$(Text$,Index!) ) Index! = FN FindStr(Index!,Text$," ,") + 1 END SUB

' Pick out text from a string

' starting at Index and going to the next comma or end-of-string

SUB UnitStr(Storages,Text$,Index!) LOCAL I!

I! = FN FindStr(Index!,Text$," ,") Storages = MID$(Text$,Index!,I!-Index!) Index! = I! + 1 END SUB

• Remove excess quote marks around string

I DEF FN NoQuotesS(Text$)

LOCAL S!,E!

S! = 1

IF LEFTS(Text$,1)=CHR$(34) THEN INCR S!

E! = LEN(TextS)+l IF RIGHTS(Text$,l)=CHR$(34) THEN DECR E!

FN NoQuotesS = MID$(Text$,S!,E!-S!) END DEF

SUBSTITUTE SHEET

-82.487-

' Remove excess spaces around string

I

DEF FN NoSp$(TextS) LOCAL S!,E!

IF LEN(Text$)>0 THEN S! = 1

WHILE MID$(TextS,S!,l)=" " INCR S! WEND

E! = LEN(Text$)

WHILE E!>S!+1 AND MID$(Text$,E!,1)=" "

DECR E! WEND FN NoSp$ = MID$(Text$,S!,E!-S!+1) ELSE

FN NoSp$ = "" END IF END DEF

I

' Can't open file. Report this to operator.

CantOpen:

CALL SystemError("Can't open file "+FileName$) END

' Show error and store it on disk

I SUB SystemError(Text$)

PRINT Text$

OPEN "C:\SYSTEM.ERR" FOR OUTPUT AS #9

PRINT #9,"PREPARE: ";Text$

CLOSE #9 END SUB

SUBSTITUTE SHEET

-82.488-

CenterLine:

LOCATE , (79-LEN(T$) )/2

PRINT T$

RETURN

SUBSTITUTE SHEET

-82 .489-

3D Systems Stereolithography System Software

POWER.PAS

SLA-1 Power Control Program

Recent History: 11/12/87 Ver 2.30 first Beta software release 1/08/88 Ver 2.50 retitled program 1/25/88 Ver 2.60 better messages 2/08/88 - converted from Turbo Basic to

Turbo Pascal Version 4.0 better Laser Board I/O power status line display support of toggling-Laser power

2/26/88 Ver 2.62 fix for toggling Laser power 3/09/88 Ver 2.80 added copyright notice 4/04/88 Ver 3.00 change menus

uses Crt,Dos;

const

Versionld = '2.62'; LaserBoardAddress = $300;

PowerPort = $304;

_INIT_0UT = $01; { outputs }

_ZSTAGE_OUT = $02;

_SHUTTER_OUT = $04;

_IASER_OUT = $08;

_INIT_IN = $10; { inputs }

SUBSTITUTE SHEET

-82.490-

_DOOR_IN = $20;

_SHUTTER_IN = $40;

_LASER_IN = $80;

Indent = 22;

LASERVECTOR = = $64;

STEREOVECTOR = = $65;

HomeDirectory = 'C:\3DSYSV;

FixFileName = •FIX.DAT';

ParamFileName = 'POWER.PRM';

ErrorFileName = 'C:\SYSTEM.ERR';

CtrlC = A C;

type str4 = string[4]; str16 = string[16]; LaserPowerType = (_Unknown,_Level,_Toggle) ; OnOffType = (On,Off) ;

var key: Char; regs: Registers; LaserVersion,StereoVersion: str4;

ParamFile,ErrorFile,FixFile: Text; temp,Indentstr,FixFileLine,ParamFileLine: String;

LaserOff,ShowStuff: Boolean;

QSize: Longint; i,IOerr: Integer;

LaserPower: LaserPowerType;

{

Cursor on / off routines

}

procedure CursorOff; begin with regs do begin AH := 3;

SUBSTITUTE SHEET

-82.491-

BH := 0; Intr($10,regs) ; AH := 1;

CH := CH or $20; Intr($10,regs) ; end; end;

procedure CursorOn; begin with regs do begin AH := 3; BH := 0; Intr($10,regs) ; AH := 1; CH := CH and $DF; Intr($10,regs) ; end; end;

procedure beep; begin sound(1000) ; delay(500) ; NoSound; end;

{

Show error and store it on disk

} procedure SystemError(Text: string) ; begin writeln('ERROR: '+Text) ; beep; assign(ErrorFile,ErrorFileName) ; rewrite(ErrorFile) ; writeln(ErrorFile, 'POWER: ' ,Text) ;

SUBSTITUTE SHEET

-82.492- close(ErrorFile) ; end;

{

Describe Error to Operator } procedure PrintError(Text: String) ; begin if whereX>l then writeln; writeln('*** • ,Text) ; " end;

function upper(text: string) : string; var i: Integer; temp: string; begin temp := text; for i := 1 to length(temp) do temp[i] := upcase(temp[i]) ; upper := temp; end;

function many(Ch: Char;num: Integer) : string; var temp: string; i: Integer; begin temp := ' • ; for i:=l to num do temp := temp+Ch; many := temp; end;

function IntStr(num: Integer) : str16; var temp: str16; begin

SUBSTITUTE SHEET

-82 .493- if num>=0 then Str(num,temp) else Str(num+$8000,temp) ; IntStr := temp; end;

procedure Abort; var key: Char; begin while keypressed do key := ReadKey; CursorOn; halt(127); end;

procedure HandleKeyboardRequest; begin while keypressed do begin key := ReadKey; if key = CtrlC then Abort; if (key = #0) and keypressed then key := ReadKey; end; end;

procedure DrawBox( l,y1,x2,y2: integer;BoxType: integer) ; type

BoxMode = array[1..4] of Char; {

Box Types:

1: Single Line all around 2: Double Line all around

3: Single Line horizontal. Double Line vertical 4: Double Line horizontal. Single Line vertical

} const

{ Type 1 2 3 4

)

SUBSTITUTE SHEET

-82.494-

UpperLeftCorner : BoxMode = (#218,#201,#214,#213) UpperRightCorner: BoxMode = (#191,#187,#183,#184) LowerLeftCorner : BoxMode = (#192,#200,#211,#212) LowerRightCorner: BoxMode = (#217,#188,#lδ9,#190) HorzBar : BoxMode = (#196,#205,#196,#205) VertBar : BoxMode = (#179,#186, l86, l79) var i: integer; FullHorzBar: String; begin gotoxy(xl,yl) ; if xl<x2 then FullHorzBar

:= Many(HorzBar[BoxType] ,x2-xl-l) else FullHorzBar := '•; if xlox2 then write(UpperLeftCorner[BoxType]) ; write(FullHorzBar) ; if xloχ2 then write(UpperRightCorner[BoxType]) ; for i:=yl+l to y2-l do begin gotoxy(xl,i) ; write(VertBar[BoxType]) ; gotoxy(x2,i) ; write(VertBar[BoxType]) ; end; gotoxy(xl,y2) ; if xloχ2 then write(LowerLeftCorner[BoxType]) ; write(FullHorzBar) ; if xloχ2 then write(LowerRightCorner[BoxType]) ; end;

{Si lctrl.inc}

procedure ShowPowerStatus; begin gotoxy(12,24) ; case LaserPower of _Unknown: write('U') ; _Level : write('L » ) ;

SUBSTITUTE SHEET

-82 .495-

_Toggle : write(•T') ; end; write(•-Laser ') ; if port[PowerPort + 2] and _LASER_IN = 0 then write('On') else write(Off); write(• Shutter ') ; if port[PowerPort + 2] and _SHUTTER_IN = 0 then write( 'Open ') else write('Closed') ; write(' Door ) ; if port[PowerPort + 2] and _DOOR_IN = 0 then write(•Open ') else write('Closed') ; write(' Z-Stage •); if port[PowerPort + 2] and _ZSTAGE_OUT = 0 then write( 'Off') else write(On '); end;

procedure SendLaserCommand(cmd: String) ; begin

ShowError(STEREO(cmd) ) ; end;

procedure PowerControl(bit: Integer;Op: OnOffType); begin if Op = On then port[PowerPort + 2] := port[PowerPort + 2] or bit else port[PowerPort + 2] := port[PowerPort + 2] and ($FF-bit) ; end;

procedure ToggleLaserPowerOn; var loopl: Longint;

SUBSTITUTE SHEET

-82.496- begin

PowerControl(_LASER_0UT,On) ; loopl := 0; repeat inc(loopl) ; until (port[PowerPort + 2] and _LASER_IN = 0) or (loopl > 100000) ; PowerControl(_LASER_OUT,Off) ; if (loopl > 100000) then PrintError(•Can* 't detect laser toggle feedback.'); end;

procedure ToggleLaserPowerOff; var loopl: Longint; begin

PowerControl(_LASER_OUT,On) ; loopl := 0; repeat inc(loopl) ; until (port[PowerPort + 2] and _LASER_IN > 0) or (loopl > 100000) ; PowerControl(_LASER_0UT,Off) ; if (loopl > 100000) then

PrintError('Can' 't detect laser toggle feedback.*); end;

procedure TurnOnLaser; var loop: Longint; begin if LaserPower = _Toggle then begin if port[PowerPort + 2] and _LASER_IN > 0 then ToggleLaserPowerOn; end else PowerControl(_LASER_0UT,On) ; if LaserPresent and StereoPresent then begin SendLaserCommand( l HR;CL;MD BL +');

SUBSTITUTE SHEET

-82 . 497- assign(FixFile,FixFileName) ;

{$1-} reset(FixFile) ; IOerr := IOresult; if IOerr o 0 then begin assign(FixFile,HomeDirectory + FixFileName) ; reset(FixFile) ; IOerr := IOresult; end; {$1+} if IOerr = 0 then begin while not eof(FixFile) do begin readln(FixFile,FixFileLine) ; if (FixFileLine o •') and (FixFileLine[1] <> •!•) then

SendLaserCommand(FixFileLine) ; end; close(FixFile) ; end; end; end;

procedure TurnOnElevator; begin

PowerControl(_ZSTAGE_OUT,On) ; end;

procedure OpenShutter; begin

PowerControl(_SHUTTER_OUT,On) ; end;

procedure TurnOffLaser; begin gotoxy(18,17) ; write( ' WARNING ') ; gotoxy(18,18) ;

SUBSTITUTE SHEET

-82.498- write('The laser may take half an hour to restart!'); gotoxy(18,19) ; write('Are you sure you want to turn the laser off?

')? repeat

ShowPowerStatus; until keypressed; HandleKeyboardRequest; if upcase(key)='Y' then if LaserPower = _Toggle then begin if port[PowerPort + 2] and _LASER_IN = 0 then ToggleLaserPowerOff; end else PowerControl(_IASER_OUT,Off) ; end;

procedure TurnOffElevator; begin

PowerControl(_ZSTAGE_OUT,Off) ; end;

procedure CloseShutter; begin

PowerControl(_SHUTTER_OUT,Off) ; end;

procedure GetSelection; begin repeat repeat

ShowPowerStatus; until keypressed; HandleKeyboardRequest; key := upcase(key) ; if key in ['1'.. •6•, 'X'] then exit; until false; end;

SUBSTITUTE SHEET

-82 . 499- procedure ShowPowerMenu; begin window(1,1,80,21) ;

ClrScr; writeln(IndentStr, • SLA-1 POWER CONTROL'); writeln(IndentStr, • Version '+VersionId) ; for i:=l to 5 do writeln;

DrawBox(Indent-l,7,80-Indent,15,l) ; window(Indent,8,80-Indent-l,14) ; ClrScr; writeln( 1. Turn Laser and Mirror Drive On•) ; writeln( 2. Turn Elevator On*) ; writeln( 3. Open Shutter') ; writeln( 4. Turn Laser and Mirror Drive Off); writeln( 5. Turn Elevator Off') ; writeln( 6. Close Shutter') ; write(' X. Exit') ; window(1,1,80,25) ; gotoxy(28,19) ; write('Please make a selection.'); DrawBox(10,23,69,25,1) ; end;

procedure HardReset; begin port[PowerPort + 3] := $98; { init 8255 chip } port[PowerPort + 3] := $98; end;

procedure InitPowerPort; begin PowerControl(1,Off) ; if port[PowerPort + 2] and _INIT_IN > 0 then HardReset else begin

PowerControl(1,On) ; if port[PowerPort + 2] and _INIT_IN = 0 then HardReset;

SUBSTITUTE SHEET

-82.500- end; end;

procedure ReadParams; begin assign(ParamFile,ParamFileName) ;

{$1-} reset(ParamFile) ; IOerr := IOresult; if IOerr o 0 then begin assign(ParamFile,HomeDirectory + ParamFileName) ; reset(ParamFile) ;

IOerr := IOresult; end;

{$1+} LaserPower := _Unknown; if IOerr = 0 then begin while not eof(ParamFile) do begin readln(ParamFile,ParamFileLine) ; ParamFileLine := upper(ParamFileLine) ; if (ParamFileLine o •') and (ParamFileLine[1] o * ! •) then begin if copy(ParamFileLine,1,15) = 'LASERPOWERTYPE=' then begin temp := copy(ParamFileLine,16,3); if temp = 'LEV then LaserPower :*= _Level else if temp = 'TOG' then LaserPower := _Toggle; end; end; end; close(ParamFile) ; end; end;

begin CheckBreak := false;

SUBSTITUTE SHEET

-82.501-

ShowStuff := false;

LaserOff := false;

ClrScr;

InitPowerPort;

IndentStr := manyC ',Indent);

ReadParams;

CursorOff; repeat

ShowPowerMenu; GetSelection; gotoxy(l,22) ; ClrEol; case key of

•1' TurnOnLaser;

'2' TurnOnElevator;

•3' OpenShutter;

•4 » TurnOffLaser;

•5' TurnOffElevator;

•6' CloseShutter;

'X' Abort; end; until false; end.

SUBSTITUTE SHEET

-82.502-

3D Systems Stereolithography System Software

SERVICE.PAS

SLA-1 Special Services Provider

Compile with TBM - Modified Turbo Basic - not TB!

Recent History: 11/20/87 Ver 2.30 under development 12/06/87 Ver 2.31 Error output shows SERVICE, not

MERGE

/I in command line causes all errors to be ignored

/T in command line for transparent operation

1/25/δδ Ver 2.60 version update only 2/24/68 Ver 2.61 converted to Turbo Pascal

Version 4.0 added program title header added invalid command error

uses Dos;

const

Versionld = '2.61';

MSDOS = $21; { interrupt vectors } LASERVECTOR = $64;

ErrorFileName = 'C:\SYSTEM.ERR';

SUBSTITUTE SHEET

-82.503- type str4 = string[4] ; str16 = string[16];

var i: Integer;

ErrorFile: Text; regs: Registers; LaserVersion: str4; SingleBar,CmdLine,cmd: String; ShowErrors,NoText: Boolean;

function upper(text: string) : string; var i: Integer; temp: string; begin temp := text; for i := 1 to length(temp) do temp[i] := upcase(temp[i]) ; upper := temp; end;

function many(Ch: Char;num: Integer) : string; var temp: string; i: Integer; begin temp := ' ' ; for i:=l to num do temp := temp+Ch; many := temp; end;

function CleanUpSpaces (Text: String) : String; var

Temp : String ; i : Integer ;

SUBSTITUTE SHEET

-82.504-

HaveSpace: Boolean; begin i := 1; while (i < length(Text)) and (copy(Text,1,1)=' ') do inc(i) ;

HaveSpace := false;

Temp := • •; while i <= length(Text) do begin if Text[i]=' ' then HaveSpace := true else begin if HaveSpace then begin

Temp := Temp + • ' + Text[i] ; HaveSpace := false; end else Temp := Temp + Text[i]; end; inc(i) ; end; {while i} CleanUpSpaces := Temp; end;

{ convert integer to a string

> function IntStr(num: Integer) : strl6; var temp: str16; begin if num>=0 then Str(num,temp) else Str(num+$8000,temp) ;

IntStr := temp; end;

{

Tell user if not transparent

> procedure Tell(Text: String); begin if not NoText then writeln(Text) ;

SUBSTITUTE SHEET

-82.505- end;

{ read DOS command line

} procedure ReadCommandLine(var line: string); var i: Integer; begin line := ParamStr(l) ; for i:=2 to ParamCount do line := line + ' • + ParamStr(i) ; end;

{

Show error and store it on disk } procedure SystemError(Text: string) ; begin writeln(Text) ; assign(ErrorFile,ErrorFileName) ; rewrite(ErrorFile) ; writeln(ErrorFile, 'SERVICE: ' ,Text) ; close(ErrorFile) ; end;

{-- —

Laser Controller Routines

—)

SUBSTITUTE SHEET

-82.506-

{

Check for Memory-Resident Laser Controller System

} function LaserOk: Boolean; type

CopyType = array[1..20] of char; var

CopyPtr: A CopyType; CopyStr: string[20] begin with regs do begin

AX := ($35 shl 8) or LASERVECTOR; Intr($21,regs) ; CopyPtr := Ptr(ES,BX-19) ; end; move(CopyPtr A [1] ,CopyStr[1] ,18) ; CopyStr[0] := #18; if CopyStr = *Tarnz Technologies' then begin LaserOk := true; with regs do

CopyPtr := Ptr(ES,BX-46) ; move(CopyPtr A [1] ,LaserVersion[1] ,4) ; LaserVersion[0] := f4; end else begin LaserOk := false;

LaserVersion := •?.??'; end; end;

function LaserPresent: Boolean; begin if LaserOk then LaserPresent := true else begin

LaserPresent := false;

SystemError(*LASER system not installed.'); end; end;

SUBSTITUTE SHEET

-82 .507- { }

procedure TurnLaserControllerOff; var

Er: Integer; begin with regs do begin AX := $0100; Intr(LASERVECTOR,regs) ; Er := AL; if ShowErrors then begin if Er=0 then Tell('Laser Controller turned off.') else Tell('Error'+IntStr(Er)+' attempting to turn laser off.'); end; end; end;

procedure TurnLaserControllerOn; var

Er: Integer; begin with regs do begin AX := $0000;

BX := 1190; { 1 ms step period } Intr(LASERVECTOR,regs) ; Er := AL; if ShowErrors then begin if Er=0 then Tell('Laser Controller turned on.') else Tell(•Error'+IntStr(Er)+* attempting to turn laser on. *) ; end; end; end;

procedure ShowHeader; begin

SUBSTITUTE SHEET

-82.508-

SingleBar := many(chr(196) ,45) ; writeln; writel (SingleBar) ; writelnC SERVICE, SLA Resource Utility') ; writelnC 3D Systems Laser Stereolithography System') ; writelnC Version ' ,VersionId, * 3D Systems, Inc.'); writeln(SingleBar) ; writeln; end;

{ - - - M A I N P R O G R A M - - }

begin

ShowErrors := true; NoText := false; ReadCommandLine(CmdLine) ; cmd := CleanUpSpaces(upper(CmdLine) ) ; i := pos('/I* ,cmd) ; if i>0 then begin ShowErrors := false; delete(cmd,i,2) ; end; i := pos('/T' ,cmd) ; if i>0 then begin NoText := true; delete(cmd,i,2) ; end; if not NoText then ShowHeader; if not LaserPresent then halt(l) ; if length(cmd)>0 then begin if copy(cmd,1,5)='LASER' then begin if copy(cmd,7,2)='ON' then TumLaserControllerOn else if copy(cmd,7,3)='OFF' then

TurnLaserControllerOff else Tell('Invalid LASER request.');

SUBSTITUTE SHEET

-82 .509- end else Tell('Unrecognized command.'); end; halt(0) ; end.

SUBSTITUTE SHEET

-82.510-

/******************************************************/

/* */

/*PFP */

/* */

/*PFP Main module */

/* */ /* MODIFICATION LOG */

/* */

/*date who what */

/* */

/* JP. Stinebaugh {original code V18 */ /* */

finclude <stdio.h> finclude <time.h> finclude "pfp.h" finclude "pfptri.h" #include "pfphi.h" #include "pfpseg.h" #include "pfputl.h"

fdefine VERSION "2.60"

fdefine BANNER "3D Systems Slice Program"

/*

Version 18a - corrected border/skin alignment 18b - implemented 120 degree hatching 18c - corrected memory usage reporting I8d - corrected up/down facets on binary input slice 1 unit above level 18e - modified Z spacing table logic for greater number of slice levels

SUBSTITUTE SHEET

-82 .511-

18f - corrected skin border 18g - filtered output segments

(Point Segments, Duplicate Segments) modified output of • . • to numbers (layer count)

19 - implemented Style I processing changed output block mnemonics 19a - Style IA implemented, having the NFUB block 19b - Implemented segment file post processing

Allowed Z to range up to 65535 with 16334 layers

Added Attributed binary input option 19c - Added holding layer in memory.

Allow upper or lower case for ASCII files 19d - Add -ARIES -X -Y -C options Delete -NC option Redo intra-layer vector processing

20 - Implement Normal Code new version number scheme - V20 also known as V2.30 20a - Modify to work with Unix

232 - Standardize Version number

Implement Style IB Correct Var Z Spacing Table Setup Add check for Z table ranges Correct Sorting of Hatch and Fill Segments

Correct ASCII input routines to handle •\r's

233 - Allow broken parts in the slice axis

234 - Optional internal triangle database output

Eliminate collapsed line triangles

SUBSTITUTE SHEET

-82.512-

Align border segments so they will be eliminated 240 - output slice command line to slice output file second major software release

250 - Implement Cross Hatch endpoint counting

Recompute normal vectors of deformed triangles Eliminate triangle counting

251 - Experimental (No version released) 260 - Recognize Ctrl-Z as EOF in ASCII file input Change "read" references (was "scaled") Error check output to SLI file

(I/O, disk full ...) Only recompute X S Y normal information

*/

INPUT_TRI_STRUC *tri_bucket_array [MAX_ _Z_INDEX] OUT_SEG_STRUC *FU_seg_bucket_array [MAX_ Z_INDEX] OUT_SEG_STRUC *FD_seg_bucket_array [MAX_ Z_INDEX] OUT_SEG_STRUC *NFU_seg_bucket_array [MAX_ Z_INDEX] OUT_SEG_STRUC *NFD_seg_bucket_array [MAX_ Z_INDEX] OUT_SEG_STRUC *post_LB_seg_list = NULL_SEG OUT_SEG_STRUC *post_LH_seg_list = NULL_SEG OUT_SEG_STRUC *post_NFDB_seg_list = NULL_SEG OUT_SEG_STRUC *post_NFDH_seg_list = NULL_SEG OUT_SEG_STRUC *post_NFDF_seg_list = NULL_SEG OUT_SEG_STRUC *post_NFUB_seg_list = NULL_SEG OUT_SEG_STRUC *post_NFUH_seg_list = NULL_SEG OUT_SEG_STRUC *post_NFUF_seg_list = NULL_SEG OUT_SEG_STRUC *post_FUB_seg_list = NULL_SEG OUT_SEG_STRUC *post_FUH_seg_list = NULL_SEG OUT_SEG_STRUC *post_FUF_seg_list = NULL_SEG OUT SEG STRUC *post_FDB_seg_list = NULL SEG

SUBSTITUTE SHEET

-82. 513-

OUT_SEG_STRUC *post_FDH_seg_l1st = NULL_SEG; OUT_SEG_STRUC *post_FDF_seg_list = NULL SEG;

UINT16 z_control_table[MAX_Z_INDEX3 ; unsigned long post_z_level = 0;

UINT16 all_min_z, all_max_z, all_min_z_index, all max z index;

UINT16 post_file_number;

FILE *post_process_seg_file[2] ;

STRING *post_process_filename[2] ;

long max_mem_alloc = 0; long total_mem_alloc = 0; long curr mem alloc = 0;

unsigned long temp_count = 0;

extern INT16 slice count;

/******************************************************* local procedure

print_user_info

*******************************************************/

static void print_user_info (outfile, user_info)

FILE *outfile;

USER_INFO_STRUC *user_info;

{ fprintf (outfile, "\n resolution value !f",

SUBSTITUTE SHEET

-82.514- user_info-> res_value) ; fprintf (outfile, "\n x hatch spacing !u", user_info-> x_hatch_spacing) ; fprintf (outfile, "\n y hatch spacing !u", user_info-> y_hatch_spacing) ; fprintf (outfile, "\n flat x fill spacing !u", user_info-> x_flat_fill_spacing) ; fprintf (outfile, "\n flat y fill spacing !u", user_info-> y_flat_fill_spacing) ; fprintf (outfile, "\n 60/120 degree angle hatch spacing .. !u", user_info-> angle_hatch_spacing) ; fprintf (outfile, "\n min surface angle !u", user_info-> min_surface_angle) ; fprintf (outfile, "\n min intersect angle !u", user_info-> min_intersect_angle) ; fprintf (outfile, "\n input file format !s", user_info-> binary_input ? "binary" : "ascii") ; fprintf (outfile, "\n centering !s", user_info-> centering_off ? "off" : "on") ; fprintf (outfile, "\n output file section codes..!s", user_info-> section_codes_off ? "off" : "on") ; fprintf (outfile, "\n segment output file !s",

((*(user_info-> segfile_name) == •\0') ? "- not used -"

: user_info-> segfile_name) ) ; if (*(user_info-> internal_filename) > '\0') fprintf (outfile, "\n internal triangles output file !s", user_info-> internal_filename) ; if (*(user_info-> z_space_filename) == '\0')

fprintf (outfile, "\n z spacing !u\n", user_info-> z_spacing) ;

SUBSTITUTE SHEET

-82 .515- else

fprintf (outfile, "\n z spacing control file !s\n", user_info-> z_space_filename)

} /* print_user_info */

local procedure

get_space_line

*******************************************************/

static void get_space_line (z_space_file, z_change, new_z_spacing, eof, z)

FILE *z_space_file;

UINT16 *z_change;

UINT16 *new_z_spacing; BOOLEAN *eof;

UINT16 z;

{ short read_status; short read_count = 2; unsigned int tempi,temp2;

read_status = fscanf (z__space_file, "!u !u", Stempl, Stemp2) ;

*z_change = (INT16) tempi;

SUBSTITUTE SHEET

-82.516- *new_z_spacing = (INT16) temp2 ;

if (read_status != read_count)

{ if (read_status = EOF) *eof = TRUE; else

( fprintf (stderr, "\n error - invalid format in z spacing file\n") ; exit (SYS_FAILURE) ;

} } else if ((z != MAX_Z_VAL) SS (*z_change <= z) )

{ fprintf (stderr,

"\n error - z value (!u) in spacing file is out of sequence \n", *z_change) ; exit (SYS_FAILURE) ; } else if ((*z_change < 0) Jj (*new_z_spacing < 0))

{ fprintf (stderr, "\n error - invalid value in z spacing file") ; exit (SYS_FAILURE) ; }

} /* get_space_line */

local procedure

get_space_file_data

SUBSTITUTE SHEET

-82.517-

static void get_space_file_data (z_space_file)

FILE *z_space_file;

{

UINT16 new_z_spacing, z_change, z_count = 0, z;

BOOLEAN eof = FALSE; unsigned long zi;

UINT16 last_z_change, last_new_z_spacing;

get_space_line (z_space_file, Sz_change, Snew_z_spacing,

Seof, MAX_Z_VAL) ; while ((!eof) SS (z_count < MAX_Z_INDEX) ) { last_z_change = z_change; last_new_z_spacing = new_z_spacing; z = z_change; get_space_line (z_space_file, Sz_change,

Snew_z_spacing, Seof, z) ; zi = last_z_change; while (zi < z_change) { z_control_table [z_count++] = zi; zi += last_new_z_spacing; } } while ((zi < MAX_Z_VAL) SS (z_count < MAX_Z_INDEX) ) { z_control_table [z_count++] = zi; zi += last_new_z_spacing;

} while (z_count < MAX_Z_INDEX) z_control_table [z_count++] = MAX_Z_VAL;

} /* get_space_file_data */

SUBSTITUTE SHEET

-82 .518-

static build_constant_spacing(user_info)

USER_INFO_STRUC *user_info;

{ UINT16 z_count=0; long zi = 0;

While ((zi < MAX_Z_VAL) SS (z_COUnt < MAX_Z_INDEX) ) { z_control_table [z_count++] = zi; zi += user_info-> z_spacing; } while (z_count < MAX_Z_INDEX) z_control_table [z_count++] = MAX_Z_VAL;

} /* build_constant_spacing */

/** " ************************************************* local procedure

set_z_spacing

*******************************************************/

static void set_z_spacing (user_info)

USER_INFO_STRUC *user_info;

{

FILE *z_space_file;

if (*(user_info-> z_space_filename) != *\0') {

SUBSTITUTESHEET

-82.519- openfile (user_info-> z_space_filename,

Sz_space_file, "r") ; get_space_file_data (z_space_file) ;

> else { build_constant_spacing(user_info) ; }

} /* set_z_spacing */

local procedure

get_min_max_z

static void single_min_max_z (a_seg_bucket_array) OUT_SEG_STRUC *a_seg_bucket_array[] ; {

INT16 i,j;

for (i = 0; i < MAX_Z_INDEX; i++) { j = z_control_table [i]; if (a_seg_bucket_array [i] != NULL_SEG) { if (j > all_max_z) { all_max_z_index = i; all_max_z = j;

> ; if (j < all_min_z) { all_min_z_index = i; all_min_z = j ; }

SUBSTITUTE SHEET

-82.520-

} } } /* single_min_max_z */

static void get_min_max_z () {

INT16 i,j;

all_min_z_index = MAX_Z_INDEX-1; all_min_z = z_control_table [MAX_Z_INDEX-1] ;

for (i = 0; i < MAX_Z_INDEX; i++) { j = z_control_table [i]; if (tri_bucket_array [i] != NULL_INPUT_TRI) { all_max_z_index = i; all_max_z = j; if (j < all_min_z) { all_min_z_index = i; all_min_z = j; } } } single_min_max_z(FU_seg_bucket_array) ? single_min_max_z(FD_seg_bucket_array) ; single_min_max_z(NFU_seg_bucket_array) ? single_min_max_z(NFD_seg_bucket_array) ;

/*****************************************************

procedure

comb_list

Combines segment list into one big list. Save the type

SUBSTITUTE SHEET

-82.521- of list in segment structure for later extraction. Does not add point or duplicate segments

******************************************************/ void comb_list(main_list,new_list,list_code)

OUT_SEG_STRUC **main_list;

OUT_SEG_STRUC **new_list;

UINT16 list_code;

{

OUT_SEG_STRUC *new_jptr,*scan_ptr,*end_ptr;

BOOLEAN delete_seg;

new_ptr = *new_list; *new list = NULL SEG;

while (new_ptr != NULL_SEG) { if ( (new_ptr-> x__l == new_ptr-> x_2) SS (new_ptr-> y_l == new__ptr-> y_2)) delete_seg = TRUE; else { scan_ptr = *main_list; end_ptr = NULL_SEG; while ((scan__ptr != NULL_SEG) SS

! ((new_ptr->x_l == scan ptr->x_l) SS

(newjptr->y_l == scan_ptr->y_l) SS

(new_ptr->x_2 — scan_ptr->x_2) SS

(new_ptr->y_2 == scan_ptr->y_2) ) SS ! ((new_ptr->x_l == scan_ptr->x_2) SS

(new_ptr->y_l == scan_ptr->y_2) SS (riewjptr->x_2 == scan_ptr->x_l) SS (new_ptr->y_2 == scan_ptr->y_l) ) ) { end_ptr = scan_ptr; scan_ptr = scan_ptr-> next_seg;

} if (scan_ptr != NULL_SEG) delete_seg = TRUE] else delete_seg = FALSE;

>

SUBSTITUTE SHEET

-82.522- scan_ptr = new__ptr-> next_seg; if (delete_seg) mem_free(new_ptr,sizeof

(OUT_SEG_STRUC)) ? else { if (*new_list = NULL_SEG) { *new_list = new_ptr; if (*main_list = NULL_SEG) *main_list =new_ptr;

> if (end_ptr != NULL_SEG) end_ptr-> next_seg = new_ptr;

/* Use "normal_info" to store list type */ new_ptr-> normal_info = list_code; new_ptr-> next_seg = NULL_SEG;

> new_ptr = scan_ptr;

}

}

procedure

write_post

Writes a segment list to a temp file for disk processing. Save type of list in Segment structure.

void write_post(seg_ptr,out_file,type_code) OUT_SEG_STRUC *seg_ptr; FILE *out_file; UINT16 type_code;

{ OUT_SEG_STRUC *temp_ptr;

while (seg_ptr != NULL_SEG) {

/* Use "normal_info" to store list type */

SUBSTITUTE SHEET

-82.523- seg_ptr-> normal_info = type_code; fwrite(seg_ptr,sizeof(OUT_SEG_STRUC) ,l,out_file) ; temp_ptr = seg_ptr; seg_ptr = seg_ptr-> next_seg; mem_free(temp_ptr,sizeof(OUT_SEG_STRUC) ) ;

>

}

/***************************************************** procedure

read_post

Read all segment list from prev. layer into post segment lists.

void read_post(in_file) FILE *in_file; {

OUT_SEG_STRUC *seg_ptr; OUT_SEG_STRUC *end_LB_seg_list = NULL_SEG OUT_SEG_STRUC *end_LH_seg_list = NULL_SEG OUT_SEG_STRUC *end_NFDB_seg_list = NULL_SEG OUT_SEG_STRUC *end_NFDH_seg_list = NULL_SEG OUT_SEG_STRUC *end_NFDF_seg_list = NULL_SEG OUT_SEG_STRUC *end_NFUB_seg_list = NULL_SEG OUT_SEG_STRUC *end_NFUH_seg_list = NULL_SEG OUT_SEG_STRUC *end_NFUF_seg_list = NULL_SEG OUT_SEG_STRUC *end_FDB_seg_list = NULL_SEG OUT_SEG_STRUC *end_FDH_seg_list = NULL_SEG OUT_SEG_STRUC *end_FDF_seg_list = NULL_SEG OUT_SEG_STRUC *end_FUB_seg_list = NULL_SEG OUT_SEG_STRUC *end_FUH_seg_list = NULL_SEG OUT_SEG_STRUC *end_FUF_seg_list = NULL SEG post_LB_seg_list = NULL_SEG; post_LH_seg_list = NULL_SEG;

SUBSTITUTE SHEET

-82.524- post_NFDB_seg_list = NULL_SEG; post_NFDH_seg_list = NULL_SEG; post_NFDF_seg__list = NULL_SEG; post_NFUB_seg_list = NULL_SEG; post_NFUH_seg_list = NULL_SEG; post_NFUF_seg_list = NULL_SEG; post_FDB_seg_list = NULL_SEG; post_FDH_seg_list = NULL_SEG; post_FDF_seg_list = NULL_SEG; post_FUB_seg_list " = NULL_SEG; post_FUH_seg_list = NULL_SEG; post_FUF_seg_list = NULLJSEG;

if (in_file != (FILE *) NULL) { seg_ptr = (OUT_SEG_STRUC *) mem_alloc (sizeof(OUT_SEG_STRUC)) ; while (( read(seg_ptr,sizeof(OUT_SEG_STRUC) , l,in_file) == 1) SS

(feof(in_file) = 0)) { seg_ptr-> next_seg = NULL_SEG; switch (seg_ptr-> normal_info) { /* "normal_info" has list type */ case LB_C0DE : if (end_LB_seg_list != NULL_SEG) end_LB_seg_list-> next_seg = seg_ptr; else post_LB_seg_list = seg_ptr; end_LB_seg_list = seg__ptr; break; case LH_C0DE : if (end_LH_seg_list != NULL_SEG) end_LH_seg_list-> next_seg = seg_ptr; else post_LH_seg_list = seg_ptr; end_LH_seg_list = seg_ptr; break; case NFDB_C0DE : if (end_NFDB_seg_list != NULL_SEG) end_NFDB_seg_list-> next_seg = seg_ptr;

SUBSTITUTE SHEET

-82.525- else post_NFDB_seg_list = seg_ptr; end_NFDB_seg_list = seg_ptr; break; case NFDH_CODE : if (end_NFDH_seg_list != NULL_SEG) end_NFDH_seg_list-> next_seg = seg_ptr; else post_NFDH_seg_list = seg_ptr; end_NFDH_seg_list = seg__ptr; break; case NFDF_CODE : if (end_NFDF_seg_list != NULL_SEG) end_NFDF_seg_list-> next_seg = seg_ptr; else post_NFDF_seg_list = seg_ptr; end_NFDF_seg_list = seg_ptr; break; case NFUB_CODE : if (end_NFUB_seg_list != NULL_SEG) end_NFUB_seg_list-> next_seg = seg__ptr; else post_NFUB_seg_list = seg_ptr; end_NFUB_seg_list = seg_ptr; break; case NFUH_CODE : if (end_NFUH_seg_list != NULL_SEG) end_NFUH_seg_list-> next_seg = seg_ptr; else post_NFUH_seg_list = seg_ptr; end_NFUH_seg_list = seg_ptr; break; case NFUF_CODE : if (end_NFUF_seg_list != NULL_SEG) end_NFUF_seg_list-> next_seg = seg__ptr; else post_NFUF_seg_list = seg_ptr; end_NFUF_seg_list = seg_ptr; break; case FDB_CODE : if (end_FDB_seg_list != NULL_SEG) end_FDB_seg_list-> next_seg = seg_ptr; else post_FDB_seg_list = seg_ptr;

SUBSTITUTE SHEET

-82.526- end_FDB_seg_list = segjptr; break; case FDH_CODE : if (end_FDH_seg_list != NULL_SEG) end_FDH_seg_list-> next_seg = seg_ptr; else post_FDH_seg_list = segjptr; end_FDH_seg_list = seg__ptr; break; case FDF_CODE : if (end_FDF_seg_list != NULL_SEG) end_FDF_seg_list-> next_seg = seg_ptr; else post_FDF_seg_list = segjptr; end_FDF_seg_list = seg_ptr; break; case FUB_CODE : if (end_FUB_seg_list != NULL_SEG) end_FUB_seg_list-> next_seg = seg_ptr; else post_FUB_seg_list = seg_ptr; end_FUB_seg_list = seg__ptr; break; case FUH_CODE : if (end_FUH_seg_list != NULL_SEG) end_FUH_seg_list-> next_seg = seg_ptr; else post_FUH_seg_list = seg_ptr; end_FUH_seg_list = seg_ptr; break; case FUF_CODE : if (end_FUF_seg_list != NULL_SEG) end_FUF_seg_list-> next_seg = seg__ptr; else post_FUF_seg_list = seg_ptr; end_FUF_seg_list = segjptr; break; default : fprintf(stderr,"Unknow Section Code (read_post)

!u\n",seg_ptr->normal_info) ; exit(l) ;

SUBSTITUTE SHEET

-82.527- break;

} segjptr = (OUT 3EG_STRUC *) mem_alloc(sizeof(OUT_SEG_STRUC) ) ;

} mem_free(seg_ptr,sizeof(OUT_SEG_STRUC) ) ;

} }

local procedure

process_output_section

*******************************************************/

static void process_output_section (LB_seg_list, z_index, z, user_info, main_seg_file)

OUT_SEG_STRUC **LB_seg_list;

UINT16 z_index,z;

USER_INFO_STRUC *user_info;

FILE *main_seg_file;

OUT_SEG_STRUC *master_seg_list = NULL_SEG; OUT_SEG_STRUC *LH_seg_list = NULL_SEG; OUT_SEG_STRUC *NFUH_seg_list = NULL_SEG; OUT_SEG_STRUC *NFUF_seg_list = NULL_SEG; OUT_SEG_STRUC *NFDH_seg_list = NULL SEG;

SUBSTITUTE SHEET

-82.528-

OUT_SEG_STRUC *NFDF_seg_list = NULL_SEG;

OUT_SEG_STRUC *FDH_seg_list = NULL_SEG;

OUT_SEG_STRUC *FDF_seg_list = NULL_SEG;

OUT_SEG_STRUC *FUH_seg__list = NULL_SEG; OUT_SEG_STRUC *FUF_seg_list = NULL_SEG;

OUT_SEG_STRUC *temp_ptr;

INT16 loop count = 0;

BOOLEAN doJatch_flag,do_fill_flag;

UINT16 last_z_level;

if (post_z_level > (unsigned long) MAX_Z_VAL) { pfp_delete_seg_list(LB_seg_list) ; pfp_delete_seg_list(Spost_LB_seg_list) ; pfp_delete_seg_list(Spost_LH_seg_list) ; pfp_delete_seg_list(Spost_NFDB_seg_list) ; pfp_delete_seg_list(Spost_NFDH_seg_list) ; pfp_delete_seg_list( post_NFDF_seg_list) ; pfp_delete_seg_list(Spost_NFUB_seg_list) ; pfp_delete_seg_list(Spost_NFUH_seg_list) ; pfp_delete_seg_list(Spost_NFUF_seg_list) ; pfp_delete_seg_list(Spost_FDB_seg_list) ; pfp_delete_seg_list(Spost_FDH_seg_list) ; pfp_delete_seg_list(Spost_FDF_seg_list) ; pfp_delete_seg_list(Spost_FUB_εeg_list) ; pfp_delete_seg_list(Spost_FUH_seg_list) ; pfp_delete_seg_list(Spost_FUF_seg_list) ;

} else { last_z_level = (UINT16) post_z_level; do_hatch_flag = (user_info-> y_hatch_spacing) I I I I (user_info-> x_hatch_spacing) I I

I I

(user_info-> angle_hatch_spacing) ;

SUBSTITUTE SHEET

-82.529- do_fill_flag = (user_info-> y_flat_fill_spacing) \ \

(user_info-> x_flat_fill_spacing) ;

if (!do_hatch_flag SS !do_fill_flag) { pfp_delete_seg_list(SFU_seg_bucket_array[z_index]) ; pfp_delete_seg_list(SFD_seg_bucket_array[z_index]) ;

pfp_delete_seg_list(SNFU_seg_bucket_array[z_index]) ;

pfp_delete_seg_list(SNFD_seg_bucket_array[z_index]) ; } else { pfp_remove_duplicate_edges(SFU_seg_bucket_ array[z_index]) ; Pfp_remove_duplicate_edges(SFD_seg_bucket _array[z_index]) ; pfp_remove_duplicate_edges(SNFU_seg_bucket

_array[z_index]) ; pfp__remove_duplicate_edges(SNFD_seg_bucket _array[z_index]) ; }; pfp_remove_duplicate_edges(LB_seg_list) ;

pfp_sort_seg_list (LB_seg_list, Sloop_count) ; pfp_sort_seg_list (SFU_seg_bucket_array[z_index] , S Slloooopp__ccoouunntt)) ;; pfp_sort_seg_list (SFD_seg_bucket_array[z_index] ,

Sloop_count) ; pfp_sort__seg_list ( NFU_seg_bucket_array[z_index] ,

Sloop_count) ; pfp_sort_seg_list (SNFD_seg__bucket_array[z_index] , Sloop_count) ;

/* if (user_info->cure) { cure_compensate(LB_seg_list) ; cure_compensate(SFU_seg_bucket_array[z_index]) ;

SUBSTITUTE SHEET

-82.530- cure_compensate(SFD_seg_bucket_array[z_index] ) ; cure_compensate(SNFU_seg_bucket_array[z_index] ) ; cure_compensate (SNFD__seg_bucket_array[z_index] ) ;

} ? */

if (do_hatch_flag) { pfp_get_hatch_lines (*LB_seg_list, SLH_seg_list, user_info-> x_hatch_spacing, user_info-> y_hatch_spacing, user info-> angle_hatch_spacing, user info-> min_intersect_angle,

FALSE) ; pfp_get_hatch_lines (NFD_seg_bucket_array[z_index] ,

SNFDH_seg_list, user_info-> x_hatch_spacing, user_info-> y_hatch_spacing, user info-> angle_hatch_spacing, user_info-> min_intersect_angle, TRUE) ;

> if (do_fill_flag) { pfp_get_hatch_lines (FU_seg_bucket_array[z_index] , SFUF_seg_list, user_info-> x_flat_fill_spacing, user_info-> y_flat_fill_spacing, 0, 0, TRUE) ; pfp_get_hatch_lines (FD_seg_bucket_array[z_index] , SFDF_seg_list, user_info-> x_flat_fill_spacing, user_info-> y_flat_fill_spacing, 0, 0, TRUE) ; pfp_get_hatch_lines (NFU_seg_bucket_array[z_index] ,

SUBSTITUTE SHEET

-82 . 531-

SNFUF_seg_list, user_info-> x_flat_fill_spacing, user_info-> y_flat_fill_spacing, 0, 0, TRUE) ; pfp_get_hatch_lines (NFD_seg_bucket_array[z_index] , SNFDF_seg_list, user_info-> x_flat_fill_spacing, user_info-> y_flat_fill_spacing, 0, 0, TRUE) ; };

if (main_seg_file != (FILE *) NULL) { if (!user_info-> in_mem) { post ?rocess_seg_file[post_file_number] = fopen(postj?rocess_filename[post_file_ number] ,"wb") ; writejpost(*LB_seg_list, postjprocess seg_file[post_file_number] , LB_CODE) ; writejpost(LH_seg_list, post_process_seg _file[post_file_number] ,LH_CODE) ; write post(NFD_seg_bucket_array[z_index] , post_process_seg_file[post_file_number] , NFDB_C0DE) ; write_post(NFDH_seg_list, post_process_seg file[post_file_number],NFDH_CODE) ; writejpost(NFDF_seg_list, post_process

_seg_file[post_file_number] ,NFDF_C0DE) ; writejpost(NFU_seg_bucket_array[z_index] , postjprocess_seg_file[post_file_number] , NFUB_CODE) ; write_post(NFUH_seg_list, post_process

_seg_file[post_file_number] ,NFUH_CODE) ; write_post(NFUF_seg_list, postjprocess _seg_file[post_file_number] ,NFUF_CODE) ; /*

SUBSTITUTE SHEET

-82.532- writejpost(FD_seg_bucket_array[z_index] , post_process_seg_file[post_file_number] , FDBjCODE) ; write_post(FDH_seg_list, postj?rocess_seg_file [post_file_number],FDH_CODE) ;

* / write_post(FDF_seg_list, post_process_seg_file [post_file_number],FDF_CODE) ;

/* writejpost(FU_seg_bucket_array[z_index] , post_process_seg_file[post_file number] ,FUB_CODE) ; writejpost(FUH_seg_list, postjprocess _seg_file[post_file_number] ,FUH_CODE) ; writejpost(FUF_seg_list, postjprocess

_seg_file[post_file_number] ,FUF_C0DE) ,*

V fclose(post_process_seg_file[post_file_number])

post_file_number = (++post_file umber)!2; postjprocess_seg_file[post_file_number] = fopen(post_process_filename [post_file umber] ,"rb") ;

readjpost(postjprocess_seg_file[post_file_number]) ; fclose(postjprocess_seg_file[post_file_number]) ; }

comb_list(Smaster_seg_list,Spost_LB_seg_list,

LB_CODE) ; comb_list(Smaster_seg_list,Spost_LH_seg_list , LH_C0DE) ; comb_list(Smaster_seg_list,Spost_NFDB_seg_list,

NFDB_CODE) . comb_list( master_seg_list,Spost_NFDH_seg_list,

NFDH_CODE) ;

SUBSTITUTE SHEET

-82.533- comb_list(Smaster_seg_list,Spost_NFDF_seg_list, NFDF_CODE) ; comb_list( master_seg_list , post_NFUB_seg_list,

NFUB_CODE) ; comb_list(Smaster_seg_list,Spost_NFUF_seg_list,

NFUF_CODE) ; comb_list(Smaster_seg__list,Spost_FDB_seg_list,

FDB_CODE) ; comb_list(Smaster_seg_list,Spost_FDF_seg_list, FDF_CODE) ; comb_list(Smaster_seg__list,SFU_seg_bucket_array

[z_index] ,FUB_CODE) ; comb_list(Smaster_seg_list, FUF_seg_list,

FUF_CODE) ;

if (master_seg_list != NULL_SEG) {

pfpjprint_seg_list(Spost_LB_seg_list,last_z_level, main_seg_file,LB_CODE,user_info) ;

pfp_print_seg_list(Spost_LH_seg_list,last_z_level, main_seg_file,LH_CODE,user_info) ;

pfpjprint_seg_list(Spost_NFDB_seg_list,last_z_level, main_seg_file,NFDB_CODE,user_info) ;

pfpj?rint_seg_list(Spost_NFDH_seg_list,last_z_level, main_seg_file,NFDH_CODE,user_info) ;

pfpjprint_seg_list(Spost_NFUB_seg_list,last_z_level, main_seg_file,NFUB_CODE,user_info) ;

pfp_print_seg_list(Spost_FDB_seg_list,last_z_level, main_seg_file, FDB_CODE,user_info) ;

pfp_print_seg_list(&post_FDF__seg_list,last_z_level, main_seg_file, FDF_CODE,user_info) ;

-82.534-

pfp_print_seg_list(Spost_NFDF_seg_list,last_z_level, main_seg_file,NFDF_CODE,user_info) ;

pfp_print_seg_list(Spost_NFUF_seg_list,last_z_level, main_seg_ ile,NFUF_CODE,user_info) ; pfpjprint_seg_list(SFU_seg_bucket_array[z_index] , last_z_level, main_seg_file, FUB_CODE, user_info) ; pfp_print_seg_list(SFUF_seg_list, last_z_level, main_seg_file, FUF_CODE, user_info) ; fflush(main_seg_file) ; }

post_z_level = (unsigned long) z;

if (user_info-> in αem) { post_LB_seg_list = *LB_seg_list; post_LH_seg_list = LH_seg_list; post_NFDB_seg_list = NFD_seg_bucket_array[z_index] ; post_NFDH_seg_list = NFDH_seg_list; post_NFUB_seg_list = NFU_seg_bucket_array[z_index] ; post_FDB_seg_list = FD_seg_bucket_array[z_index] ; post_FDF_seg_list = FDF_seg_list; post_NFDF_seg_list = NFDF_seg_list; post_NFUF_seg_list = NFUF_seg_list; } } FD_seg_bucket_array[z_index] = NULL_SEG; FU_seg_bucket_array[z_index] = NULL_SEG; NFD_seg_bucket_array[z_index] = NULL_SEG; NFU_seg_bucket_array[z_index] = NULL_SEG;

}; } /* process_output_section */

SUBSTITUTE SHEET

-82. 535-

/****************************************************** local procedure

generate_cross_sections

******************************************************** */

static void generate_cross_sections (seg_file, user_info)

FILE *seg_file;

USER_INFO_STRUC *user_info;

{

INPUT_TRI_STRUC **tri_bucket_ptr; OUT_SEG_STRUC *border_seg_list; VECT_TRI_STRUC *z_active_list; UINT16 zi, zon, section_count = 0;

z_active_list = NULL_VECT_TRI;

get_min_max_z (); /* sets all_'s */ zi = all_min_z_index; do { zon = z_control_table [zi]; section_count++; if (!user_info-> display_on)

SUBSTITUTE SHEET

-82 .536- fprintf(stderr," generating cross section !u level

!u\r",section_count,zon) ; tri_bucket_ptr = stri_bucket_array [zi]; border_seg_list = NULL_SEG; pfp_update_z_active_list (tri_bucket_ptr,

Sborder_seg_list, Sz_active_list) ; pfpjprocess__z_active_list (Sz_active_list, zon, Sborder_seg_list) ;

process_output_section (Sborder_seg_list, zi, zon, user_info, seg_file) ; zi++; } while ((zi <= alljmax_z_index) j{ (z_active_list != NULL_VECTJΓRI)) ,-

fprintf(stderr,"\n") ;

} /* generate_cross_sections */

/****************************************************** local procedure

init_s1ice_output_file

*******************************************************/

static void init_slice_output_file (user_info, seg_file)

USER_INFO_STRUC *user_info; FILE *seg_file;

SUBSTITUTE SHEET

-82.537-

fprintf(seg_file,"!3DSYS SLA-1 SLICE FILE\n") ; fprintf(seg_file,"!SLICE= -VER !s",VERSION) ; fprintf(seg_file," !s !f",RES_OPTION,user_info-> res_value) ; fprintf(seg_file," !s !u",X_HATCH_SPACE_OPTION, user_info-> x_hatch__spacing) ; fprintf(seg_file," !s !u",Y_HATCH_SPACE_OPTION, user_info-> y_hatch__spacing) ; fprintf(seg_file," !s !u",XF_HATCH_SPACE__OPTION, user_info-> x_flat_fill_spacing) ; fprintf(seg_file," !s !u",YF_HATCH_SPACE_OPTION, user_info-> y_flat_fill_spacing) ; fprintf(seg_file," !s !u",ANGLE_HATCH_SPACE_OPTION, user_info-> angle_hatch_spacing) ; fprintf(seg_file," !s !u",MIN_SURFACE_ANGLE_OPTION, user_info-> min_surface_angle) ; fprintf(seg_file," !s !u",MIN_INTERSECT_ANGLE_OPTION, user_info-> min_intersect_angle) ; if (*(user_info-> z_space_filename) > '\0') fprintf(seg_file," !s !s",Z_SPACE_FILE_OPTION, user_info-> z_space_filename) ; else fprintf(seg_file," !s !u",Z_SPACE_OPTION, user_info-> z_spacing) ; if (*(user_info-> internal_filename) > '\0') fprintf(seg_file," !s !s",INTERNAL_OPTION, user_info-> internal_filename) ; if (user_info-> axis == 1) fprintf(seg_file," !s",X_AXIS_OPTION) ; if (user_info-> axis = 2) fprintf(seg_file," !s",Y_AXIS_OPTION) ; if (user_info-> binary_input) fprintf(seg_file," !s",BINARY_INPUT_OPTION) ; if (user_info-> centering_off == FALSE) fprintf(seg_file, » !s",CENTER_OPTION) ; if (user_info-> section_codes_off == FALSE)

SUBSTITUTE SHEET

-82.538- fprintf(seg_file," !s",SECTION_CODES_OFF_OPTION) ; if (user_info-> injmem = FALSE) fprintf(seg_ ile," !s",DISKjOPTION) ; if (user_info-> attrib = FALSE) fprintf(seg_file," !s",ARIES_OPTION) ; fprintf(seg_file,"\n") ; } /* init_slice_output_file */

/*******************************************************

Main procedure for PFP

*******************************************************/

main (argc, argv)

INT16 argc; STRING *argv[];

{

USER__INFOjSTRUC user_info ;

FILE *seg_file;

STRING start_time [100],end_time[100] ;

STRING line[80],file_str0[16] ,file_strl[16] ; INT16 i;

OUT_SEG_STRUC *dummy_seg;

get__timestamp (start_time) ;

fprintf (stderr, "\n !s Version !s !s",

BANNER, VERSION, start_time) ;

SUBSTITUTESHEET

-82.539-

temp_count = 0 ;

pfp_get_user_info (argc, arg , Suser_info) ; print_user_info (stderr, Suser_info) ; set_z_spacing ( Suser_info) ; if ( * (user_inf o . segf ile_name) ! = • \0 ' ) openfile (user_info .segfile iame, Sseg_file, "w") ; else seg_file = stdout; init_slice_output_file (Suser_info,seg_file) ;

pfp_get_input_database (stdin, Suser_info) ;

if (user_info .display_on) init_graphics () ;

postjprocess_filename[03 = file_str0; post_process_filename[l] = file_strl; if (!user_info.in_mem) for (i=0; i<2; i++) { strcpy(post_process_filename[i] ,"SLICEXXXXXX") ; mktemp(postjprocess_filename[i]) ; post_process_seg_file[i] = fopen(postjprocess _filename[i] ,"wb") ; fclose(post__process_seg_file[i]) ; }

generate_cross_sections (seg_file, Suser_info) ;

if (user_info .display_on) end_graphics () ;

post_z_level += ((unsigned long) MAX_Z_VAL + 1) ; dummy_seg = NULL_SEG; process_output_section(Sdummy_seg,1,0,Suser_info, seg_file) ; if (!user_info.in_mem) for (i=0; i<2; i++) {

SUBSTITUTE SHEET

-82.540- strcpy(line,"rm ") ; strcat(line,postjprocess_filename[i]) ; syste (line) ;

);

fprintf (stderr, "\n max memory allocation : !ld bytes\n", max mem_alloc) ; fprintf (stderr, " total memory allocation

: !ld bytes\n", total nem_alloc) ? if (curr_mem_alloc != 0) fprintf(stderr," warning: !ld bytes not freed\n",curr nem_alloc) ; get_timestamp (end_time) ; fprintf (stderr, "\n") ; fprintf (stderr, " Start Time: !s",start_time) ; fprintf (stderr, " End Time: !s",end_time) ; exit(SYS_SUCCESS) ;

SUBSTITUTE SHEET

-82.541-

/*****************************************************/

/* */

/* PFP.H */

/* */

/* */

/* MODIFICATION LOG */ /' V

/* date who what */

/* */

/* JP. Stinebaugh J original code */ /*****************************************************/

typedef unsigned long UINT32; typedef unsigned short UINT16; typedef short INT16; typedef unsigned char BOOLEAN; typedef unsigned char UINT8; typedef char STRING;

fdefine SYS_SUCCESS 0 fdefine SYS FAILURE 1

fdefine DISPLAYJDFF 0 fdefine DISPLAY ON 1

#define LB_CODE 1 #define LH_CODE 2 fdefine NFUB_CODE 3 fdefine NFUH_CODE 4 fdefine NFUF_CODE 5 #define NFDB_CODE 6 #define NFDH_CODE 7 fdefine NFDF_CODE 8 fdefine FDB_CODE 9 fdefine FDH_CODE 10 fdefine FDF CODE 11

SUBSTITUTE SHEET

-82.542

#define FUB_CODE 12 fdefine FUH_CODE 13 fdefine FUF_CODE 14

fdefine TRUE 1 fdefine FALSE 0

fdefine MAX POINTER INDEX 16383

fdefine MAX_Z_VAL 65535 define MAX_Z_INDEX 16383 #define MAX_X_VAL 65535 fdefine MAX Y VAL 65535

fdefine MAX_DBL 1E+38 fdefine MAX_UINT 65535 fdefine ZERO_DEF 1E-5 fdefine RADIANS PER DEGREE 0.01745329266666666666

SUBSTITUTE SHEET

-82.543-

/******************************************************/ /* */

/* PFPCHL.C */

/* */

/* PFP Cross-Hatch Line Module */

/* */ /* MODIFICATION LOG */

/* */

/* date who what */

*/

/* |P. Stinebaugh original code */ /* JR. Harlow new code */ * */

/******************************************************/

finclude <stdio.h> finclude <math.h>

finclude "pfp.h" finclude "pfpseg.h" finclude "pfpchl.h" finclude "pfputl.h"

fdefine IN_FLAG 1 fdefine OUT FLAG 2

double hatch_angle; double hatch_m; double hatch_b_value; double hatch_b_spacing; double hatch_bottom; UINT16 hatch_max_index; BOOLEAN elim_flat_tri; INT16 incount;

SUBSTITUTE SHEET

-82.544- static HATCH_POINT_STRUC *hatch_point_table [MAX_POINTER

_INDEX] ; static BOOLEAN hatch_clear = FALSE;

static HATCH_POINT_STRUC *scan_x(point) HATCH_POINT_STRUC **point;

{

HATCH_POINT_STRUC *back_ptr = NULL_HATCH_POINT; UINT16 min_angle,curr_x;

UINT8 flag;

if (*point != NULL_HATCH_POINT) { incount = 0; min_angle = MAX_UINT; curr_x = (*point)->x_val; do { if ((*point)->enter_flagSIN_FLAG) incount++; else incount—; if ((*point)->angle < min_angle) min_angle

= (*point)->angle; back__ptr = *point; *point = (*point)->next_point

} while ( (*point != NULL_HATCH_POINT) SS (curr_x

== (*point) ->x_val) ) ; back_ptr->angle = min_angle;

} ; return (backjptr) ;

} ;

/****************************************************** local procedure

locate_segmentjpoints

Returns two hatch line endpoints from hatch point table

SUBSTITUTE SHEET

-82.545- of a valid hatch line. Looks for one "in" and one "out" point to make segment. Uses in/out area count to evaluate critical points.

******************************************************/ static void locate_segment_points (hatch_index,point1, point2)

UINT16 hatch_index;

HATCH_POINT_STRUC **pointl; HATCH_POINT_STRUC **point2; {

HATCH_POINT_STRUC *scan_ptr,*back_ptr;

scanjptr = hatchjpoint_table [hatch_index] ;

/* Find first IN point */ do *pointl = scan_x(Sscan__ptr) ; while ((*pointl != NULL_HATCH_POINT) SS (incount <= o));

/* Look for next X where only OUT points exist */ if (*pointl != NULL_HATCH_POINT) { *point2 = NULL_HATCH_POINT; while ((scan_ptr != NULL_HATCH_POINT) SS (*point2 = NULL_HATCH_POINT) ) { *point2 = scan_x( scanj?tr) ; if (incount >= 0) *point2 = NULL_HATCH_POINT; };

};

if ((*pointl == NULL_HATCH_POINT) JJ (*point2 == NULL_HATCH_POINT) ) { *pointl = NULL_HATCH_POINT; *point2 = NULL__HATCH_POINT; while (hatch_point__table[hatch_index] != NULL _HATCH_POINT) {

SUBSTITUTE SHEET

-82.546- back_ptr = hatchj?oint_table[hatch_index] ; hatchjpoint_table[hatch_index] = back j?tr->nextjpoint; mem_free (back_ptr,sizeof(HATCH_POINT_STRUC)) ; };

} else while (hatchjpoint_table[hatch_index] -- (*point2)->next__point) { backjptr = hatchjpoint_table[hatch_index] ; hatch_point_table[hatch_index] = back_ptr-> next_point; if ((back_ptr != *pointl) SS (back_ptr != *point2)) mem_free (back_ptr,sizeof(HATCH_POINT_STRUC) ) ;

}

}; /* locate_segmentjpoints */

/A******************************************************

exchange_xy_normal_info

Exchanges the X and Y normal information in a normal_info byte. Used for 90 degree rotation (swapping X S Y values)

*******************************************************/ static void exchange_xy ormal_info(normal_info) UINT8 *normal_info;

{

UINT8 new_norm;

new_norm = *normal_infoS(255 - NORMAL_X_NEGATIVE - NORMAL_X_P0SITIVE

- NORMAL_Y_NEGATIVE

SUBSTITUTE SHEET

-82.547-

- NORMAL_Y_POSITIVE) ; if (*normal_infoSNORMAL_X_POSITIVE) new_norm

J= NORMAL_Y_POSITIVE; if (*normal_infoSNORMAL_X_NEGATIVE) new_norm

J= NORMAL_Y_NEGATIVE; if (*normal_infoSNORMAL_Y_POSITIVE) new_norm

J= NORMAL_X_POSITIVE; if (*normal_infoSNORMAL_Y_NEGATIVE) new_norm

J= NORMAL_X_NEGATIVE; *normal_info = new_norm;

};

/******************************************************

compute_b_value

Finds B intersect of hatch line on or below a point

******************************************************/ static double compute_b_value(x,y) UINT16 x,y; {

retur ((double) (y - hatch_m * x)) ; };

/******************************************************

compute_b_index

Returns the index value in the hatch point table for the hatch B value.

******************************************************

SUBSTITUTE SHEET

-82.548- static UINT16 compute_b_index(b) double b;

{ double round_dbl() ;

return((UINT16) round_dbl((b-hatch_bottom) /hatch_b_spacing)) ; }?*/

/**********************&********************************

compute_low_b_index

Returns the index value in the hatch point table on or below for the hatch B value.

******************************************************** static UINT16 compute_low_b_index(b) double b; { double round dbl() ;

return((UINT16) floor((b-hatch_bottom)/hatch_b_spacing) ) ;

>?*/

/******************************************************

get_segment

Goes threw hatch point list (locate_segj?oints) and adds a hatch line to segment list if one is found.

******************************************************/ static void get_segment (hatch_index, hatch_list, min_intersect_angle,

SUBSTITUTE SHEET

-82 .549- hat ch_l ine_f ound )

UINT16 hatch_index;

OUT_SEG_STRUC **hatch_list;

UINT16 min_intersect_angle; BOOLEAN *hatch_line_found;

{

OUT_SEG_STRUC *seg_ptr;

HATCH_POINT_STRUC *pointl_ptr, *point2_ptr;

*hatch_line_found = FALSE;

locate_segmentj?oints (hatch_index, &pointl_ptr, Spoint2_ptr) ;

if ((pointl_ptr != NULL_HATCH_POINT) SS

(pointljptr-> angle >= min_intersect_angle) && (point2_ptr-> angle >= min_intersect_angle) ) { seg_ptr = (OUT_SEG_STRUC *) mem_alloc (sizeof (OUT_SEG_STRUC) ) ; seg_ptr-> x_l = pointl_ptr-> x_val; seg_ptr-> x_2 = point2_ptr-> x_val; seg_ptr-> y_l = pointl_ptr-> y_val; seg_ptr-> y_2 = point2_ptr-> y val; seg_ptr-> next_seg = *hatch_list; *hatch_list = seg j ptr; *hatch_line_found = TRUE; )

if (pointl_ptr != NULL_HATCH_POINT) { mem_free (pointl_ptr,sizeof(HATCH_POINT_STRUC) ) ; mem_free (point2_ptr,sizeof(HATCH_POINT_STRUC)) ;

};

} /* get_segment */

SUBSTITUTE SHEET

-82.550-

/****************************************************** local procedure

addjpoint__to_table

Adds a hatch point to hatch point table

******************************************************/ static void add_point_to_table (x,y,new_angle, new_enter_f1ag) UINT16 x,y;

INT16 new_angle; UINT8 new_enter_flag;

(

HATCH_POINT_STRUC *front ptr, *back_ptr,*newj?ointj?tr;

UINT16 hatch_index; BOOLEAN add_flag;

hatch_index = floor((hatch_b_value - hatch_bottom + hatch_b_spacing/2)

/hatch_b_spacing) ;

if (hatch_index >= MAX_POINTER__INDEX) { fprintf (stderr, "\n error - number of hatch lines exceeds limit of !u\n", (UINT16) MAX_POINTER_INDEX) ; exit (SYS_FAILURE) ;

};

front_ptr = hatch_point_table [hatch_index] ; back_ptr = NULL_HATCH_POINT;

/* Search List for X value */ while ((front_ptr != NULL_HATCH_POINT) SS (front_ptr-> x_val < x) ) {

SUBSTITUTE SHEET

-82 .551- backjptr = front ptr; front_ptr = front_ptr-> next_point;

};

new__point_ptr = (HATCH_POINT_STRUC *) mem_alloc (sizeof(HATCH_POINT_STRUC)) ; if (back_ptr == NULL_HATCH_POINT) { new_pointjptr->nextjpoint = hatch_point_table

[hatch_index] ; hatch_point_table[hatch_index] = new_point_ptr; } else { new_point_ptr->next_point = frontjptr; backjptr->nextjρoint = new_point_ptr;

); new_point_ptr-> x_val = x; new_point_ptr-> y_val = y; new_point_ptr-> angle = new_angle; new_point_ptr-> enter_flag = new_enter_flag; if (hatch_index > hatch_max_index) hatch_max_index = hatch_index;

} ; /* add_point_to_table */

/******************************************************

compute_line

Compute M and B for line between two points

*******************************************************/ static void compute_line(xl,yl,x2,y2,m,b)

UINT16 χi,yi;

UINT16 x2,y2; double *m; double *b;

{

SUBSTITUTE SHEET

-82.552- if (Xl == X2) {

*m = (double) MAX_DBL; *b = (double) xl ;

} else {

*m = ( (double) y2 - yl) / ( (double) x2 - xl) ;

*b = (double) yl - (*m) * (double) xl;

} } ;

/*******************************************************

get_hatch_bottom

Finds lowest b a segment point and a hatch line will generate so we know what to start point array at.

******************************************************** **/ static get_hatch_bottom(seg_list,swap_xy) OUT_SEG_STRUC *seg_list; BOOLEAN swap_xy;

{ double b;

hatch_bottom = MAX_DBL;

while (seg_list != NULL_SEG) { if (swap_xy) b = compute_b_value (seg_list->y_l,seg_list->x_l) ; else b = compute_b_value(seg_list->x_l,seg_list->y_l) ; if (b < hatch_bottom) hatch_bottom = b; if (swap_xy) b = compute_b_yalue(seg_list->y_2, seg_list->x_2) ;

SUBSTITUTE SHEET

-82.553- else b = compute_b_value(seg_list->x_2,seg_list->y_2) ; if (b < hatchjDOttom) hatch_bottom = b; seg_list = seg_list-> next_seg;

} hatch_bottom = ceil(hatch_bottom/hatch_b_spacing) * hatch_b_spacing;

>

******************************************************

10 compute_intersect

Finds intersect point of hatch line and passed line.

******************************************************/ static BOOLEAN compute_intersect(m,b,min_max_info,x,y) double m,b; 15 MIN_MAX_STRUC *min_max_info;

UINT16 *x,*y;

{ double dx,dy; double round_dbl() ;

20. if (m != hatch m) { if (m = MAX_DBL) dx = b; else dx = (b-hatch_b_value)/(hatch_m-m) ; dy = round_dbl(hatch_m*dx + hatch_b_value) ; dx = round_dbl(dx) ; 25 if ( (dx >= min_max_info->min_x) SS

(dx <= min_max_info->max_x) SS (dy >= min nax_info->min_y) SS (dy <= min_max_info->max_ ) ) { *x = (UINT16) (dx) ; 30 *y = (UINT16) (dy) ;

SUBSTITUTE SHEET

-82.554- return(TRUE) ? }

}; return(FALSE) ; >

/******************************************************

get_hatch_points

Gets hatch intersect points for border segment and stores into hatch level

******************************************************/ static void get_hatchjpoints(segjptr,swap_xy) OUT_SEG_STRUC *seg ptr;

BOOLEAN swap_xy;

{ UINT16 xl,yl,x2,y2;

UINT16 hatch_x,hatch__y; double seg n,seg_b;

INT16 angle;

UINT16 start_b_index,end_b_index; double b_val_l,b_val_2;

UINT8 enter_flag;

MIN_MAX_STRUC min_max_info; double temp_dbl;

enter_flag = seg_ptr->normal_info; if (!swap_xy) { xl = seg_ptr->x_l yl = seg__ptr->y_l x2 = seg_ptr->x_2 y2 = seg__ptr->y_2

SUBSTITUTE SHEET

-82.555-

) else { xl = seg_ptr->y_l yl = seg_ptr->x_l x2 = segjptr->y_2 y2 = seg_ptr->x_2 exchange_xy_normal_info(Senter_flag) ;

>

b_val_l = compute_b_value(xl,yl) ; b_val_2 = compute_b_value(x2,y2) ; if (b_val_l < b_val_2) { start_b_index = ceil ((b_val_l-hatch_bottom)

/hatch_b_spacing) ; end_b_index = floor((b_val_2-hatch_bottom) /hatch_b_spacing) ;

} else { start_b_index = ceil ((b_val_2-hatch_bottom) /hatch_b_spacing) ; end_b_index = floor((b_val_l-hatch_bottom) /hatch_b_spacing) ;

}; if (end_b_index > MAX_POINTER_INDEX) end_b_index = 0;

compute_line(xl,yl,x2,y2,Sseg_m,Sseg_b) ; min_max_info.min_x = xl; min_max_info.max_x = x2;

} else { min nax_info.min_x = x2; min_max_info.max_x = xl;

} if (yl<y2) { min_max_info.min_ = yl; min_max_info.max_y = y2;

SUBSTITUTE SHEET

-82.556-

> else { min__max_info.min_y = y2; minjmax_info.max_y = yl; };

angle = fabs((hatch_angle - atan(seg α))

/RADIANS_PER_DEGREE) ; if (angle > 90) angle = 180-angle;

if (seg n = 0.0) { enter_flag S= NORMAL_Y_POSITIVE; if (hatch_m < 0.0) enter_flag A = NORMAL_Y_POSITIVE;

} else { enter_flag S= NORMAL_X_POSITIVE; temp_dbl = fabs(hatch α) ; /* For Microport Bug */ if ((sign(hatch α) == sign(seg ιι) ) SS (temp_dbl > fabs(seg_m))) enter_ lag A = NORMAL_X_POSITIVE; }; if (enter_flag) enter_flag = OUT_FLAG; else enter_flag = IN_FLAG; enter_flag {= (segj?tr->normal_infoS (FLAT_TRI+NEAR_FLATJTRI)) ;

while (start_b_index <= end_b_index) { hatch_b_value = start_b_index * hatch_b_spacing

+ hatch_bottom; if (((fabs(seg n-hatch_m) > ZERO_DEF) JJ

(fabs(seg_b-hatch_b_value) > ZERO_DEF) ) SS compute_intersect(seg α,seg_b,Smin nax_info, Shatch_x,Shatch_y)) add_point_to_table(hatch_x,hatch_y,angle, enter_flag) ; start_b_index++;

SUBSTITUTE SHEET

-82.557-

} ;

/******************************************************* *

get_hatchj?attern

Takes border list and generates hatch segments

*******************************************************/

static void get_hatch_pattern(border_seg_list,hatch_list,spacing, mia,rot_angle)

OUT_SEG_STRUC *border_seg_list; OUT_SEG_STRUC **hatch_list; UINT16 spacing; UINT16 mia; UINT16 rot_angle;

(

UINT16 i,temp_uint; int loop_start,loop_end,pointer,direction;

BOOLEAN hatch_found,swap_xy,reverse; OUT_SEG_STRUC *hatch_ptr;

if (rot_angle == 90) { swap_xy = TRUE; rot_angle = 0;

} else swap_xy = FALSE;

hatch_angle = (double) rot_angle * RADIANS_PER_DEGREE; hatch_m = tan(hatch_angle) ; hatch j b_spacing = spacing/cos(hatch_angle) ;

SUBSTITUTE SHEET

-82.558- if (hatch_b_spacing < 0) hatch_b_spacing = -hatch_b_spacing;

get_hatch_bottom(border_seg_list,swap_xy) ; hatch nax_index = 0; while (border__seg__list != NULL_SEG) { get_hatch_points(border_seg_list,swap_xy) ; border_seg_list = border_seg_list-> next_seg;

}?

reverse = FALSE; loop_start = 0 ; loop_end = hatch αax_index; pointer = loop_start; direction = 1 ; do { do { get_segment (pointer , hatch List , mia , Shatch_f ound) ; if (hatch_found) { hatch__ptr = *hatch_list; if (swap_xy) { temp iint = hatch__ptr->x_l ; hatch_ptr->x_l = hatch j?tr->y_l ; hatch_ptr->y_l = tempjiint; tempjiint = hatch_ptr->x_2 ; hatch__ptr->x_2 = hatch_ptr->y_2 ; hatchj?tr->y_2 = tempjiint;

} ? if (reverse) { tempjiint = hatchjptr->x_l hatchj?tr->x_l = hatch_ptr->x_2 ; hatch j?tr->x_2 = tempjiint; tempjiint = hatchjptr->y_l ; hatch_ptr->y_l = hatchj?tr->y_2 ; hatch_ptr->y_2 = temp iint;

} ? reverse = ! reverse;

SUBSTITUTE SHEET

-82.559-

} pointer += direction;

} while ((pointer >= loop_start) SS (pointer <= loop_end) ) ;

while ((hatch_point_table[loop_start] == NULL _HATCH_POINT) SS

(loop_start != loop_end)) loop_start++; while ((hatch_point_table[loop_end] == NULL _HATCH_POINT) SS

(loop_end != loop_start) ) loop_end—;

if (pointer < loop_start) { pointer = loop_start; direction = 1;

} else { pointer = loop_end; direction = -1; };

} while (hatch_point_table[loop_start] != NULL HATCH_POINT) ;

/******************************************************* exported procedure

pfp_get_hatch_lines

SUBSTITUTE SHEET

-82.560- *******************************************************/ void pfp_get_hatch_lines (border_seg_list, hatch_list, horiz_spacing, vert_spacing, angle_spacing, min_iήtersect angle,elim_flat_tri_flag)

OUT_SEG_STRUC *border_seg_list; OUT_SEG_STRUC **hatch_list; UINT16 horiz_spacing; UINT16 vert_spacing; UINT16 angle_ipacing;

UINT16 min_intersect_angle; BOOLEAN elim_flat_tri_flag;

{

UINT16 i;

if (border_seg_list != NULL_SEG) {

elim_flat_tri = elim_flat_tri_flag;

if (!hatch_clear) { for (i=0; i < MAX_POINTER_INDEX;i++) hatch_point _table[i] = NULL_HATCH_POINT; hatch_clear = TRUE;

};

if (horiz_spacing) { get_hatch_pattern (border_seg_list, hatch_list, horiz_spacing, min_intersect _angle,0) ;

} if (vert_spacing) { get atch_pattern (border_seg_list, hatch_list, vert_spacing, min_intersect _angle,90);

SUBSTITUTE SHEET

-82 .561-

} if (angle_spacing) { get_hatch_pattern (border_seg_list, hatch_list, angle_spacing, min_intersect _angle,60) ; get_hatchjpattern (border_seg_list, hatch_list, angle_spacing, min_intersect _angle,120) ;

}

} /* pfp_get_hatch_lines */

SUBSTITUTE SHEET

-82.562-

/*****************************************************/

/* */

/* PFPCHL.H */

/* */ /* PFP Cross-Hatch Line Header */

/* */

/*****************************************************/

struct hatchjpoint {

UINT16 x_val; UINT16 y_val;

UINT16 angle;

UINT8 enter_flag;

UINT16 triangle_number; struct hatch_point *next_point; }; typedef struct hatch_point HATCH_POINT_STRUC;

struct min aax_type {

UINT16 min_x;

UINT16 max_x;

UINT16 min__y;

UINT16 max__y;

};

typedef struct min aax_type MIN_MAX_STRUC;

fdefine NULL_HATCH_POINT (HATCH_POINT_STRUC *) NULL

SUBSTITUTE SHEET

-82.563-

/*******************************************************

*/ /*

*/ /* PFPGRAF.C

*/ /*

*/

/* PFP graphics module */ /*

*/

/* MODIFICATION LOG

* /*

*/

/* date who what

*/ z * : */

/* JP. Stinebaugh J original code

*/

/* ! !

*/ /******************************************************* */

finclude "pfp.h"

fdefine Z_IABEL_Z_POSITION 5500 fdefine Z_LABEL_X_POSITION MAX_X_VAL + 3000

fdefine Z_VAL_Z_POSITION 50

#define Z_VAL_X_POSITION MAX_X_VAL + 2000

#define LOOP_VAL_Z_POSITION 50000

SUBSTITUTE SHEET

-82.564- #define LOOP_VAL_X_POSITION MAX_X_VAL + 4000

#define HORIZ_MARGIN 17000

#define LEFT_EDGE_COORD 0.0 - HORIZ_MARGIN

#define RIGHT EDGE COORD MAX X VAL + HORIZ MARGIN

void init_graphics ()

( /* pBegin ("ibm_cga") ? */ /* ?? pBegin ("hgc") ; pSetActivePage (0) ; pSetDisplayPage (0) ; pDefineWindow ((double) LEFT_EDGE_COORD, (double) 0, (double) RIGHT_EDGE_COORD, (double)

MAX_Y_VAL) ; pDefineViewPort ((double) 0, (double) 0, (double) 1.0, (double) 1.0); pAllowMappingDistortion (1) ; pEnableWindowClipping (0) ; pSetColor (1) ; pSetCharSize (1, 2) ;

?? */

} /* init graphics */

SUBSTITUTE SHEET

-82.565- void pfp_display_section_code (section_code)

UINT8 section_code;

{

STRING code_string [10];

/* ?? sprintf (code_string, "!c", section_code) ;

pMove ( (double) LOOP_VAL_X_POSITION, (double)

LOOP_VAL_Z_POSITION) ; pString (code_string) ; ?? */

} /* pfp_display_section_code */

void setup_screen (z_val, loop_count)

INT16 z_yal; INT16 loop_count;

{

STRING string_buf [ 100] ;

/* if (debug node) pPause (1) ; */

/* ?? pSetColor (1) ; pDrawRectangle ((double) 0.0, (double) 0.0, (double) MAX_X_VAL, (double) MAX_Y_VAL) 7 pMove ((double) Z_LABEL_X_POSITION, (double) Z_LABEL_Z_POSITION) ;

SUBSTITUTE SHEET

-82.566- pString ("Z") ; pMove ((double) Z_VAL_X_POSITION, (double)

Z_VAL_Z_POSITION) ; sprintf (string_buf, "!d", z_val) ; pString (string_buf) ;

pMove ((double) LOOP_VAL_X_POSITION, (double)

LOOP_VAL_Z_POSITION) ; sprintf (string_buf, "!d", loop_count) ; pString (string_bufj ; ?? */

} /* setup_screen */

void draw_line (xl, zl, x2, z2)

UINT16 xl, zl, x2, z2;

{

/* ?? pMove ((double) (UINT16) xl, (double) (UINT16) zl) ; pDrawLine ((double) (UINT16) x2, (double) (UINT16) z2); ??? */

} /* draw_line */

void set_display_mode (display mode)

INT16 display αode;

{ /* ?? pSetColor (display_mode) ; ?? */

SUBSTITUTE SHEET

-82 .567-

} /* set_display_mode */

void end_graphics ()

{

/* ?? pEnd () ; ?? */

} /* end_graphics */

SUBSTITUTE SHEET

-82.568-

/*****************************************************/ /* */

/* PFPHI.C */

/* */ /* PFP human interface module */

/* */

/* MODIFICATION LOG */ * */

/* date who what */ /* */

/* j P. Stinebaugh J original code */

/* i i */

/*****************************************************/

/******************************************************

PFPHI.C contains the following routines:

get_arg_code converts command line arg string to code not_a_number checks a string for a legal numeric value get_float_arg processes a command line arg float parameter get_int_arg processes a command line arg integer parameter get_filename_arg processes an arg that has a filename parameter get_user_info_cmd_line.. gets all user info from the command line init_user_info initializes user_info structure to standard defaults print_cmd_line_help prints command line help text to the screen

SUBSTITUTE SHEET

-82 .569- check_user_info retrieves and processes user option input get_user_info retrieves and processes user option input

******************************************************** */

#include <stdio.h>

#include "pfp.h" #include "pf hi.h"

/******************************************************* ** local procedure

get_arg_code

Takes a command line arg and returns the code value of the arg or an unknown arg code value.

*******************************************************/

static void get_arg_code (input_arg, arg_code)

STRING *input_arg; INT16 *arg_code;

{

SUBSTITUTE SHEET

-82.570-

STRING arg[100] ; INT16 i;

strcpy (arg, input_arg) ;

for (i = 0; i < strlen (arg) ; i++) arg [i] = toupper (arg [i]);

if (!strcmp (arg, RES_OPTION)) *arg_code = RES_OPTION_CODE;

else if (1strcmp (arg, HELP_OPTION) ) *arg_code = HELP_OPTION_CODE;

else if (!strcmp (arg, SEGFILE_OPTION) ) *arg_code = SEGFILE_OPTION_CODE;

else if (!strcmp (arg, DISPLAY_0PTI0N) ) *arg_code = DISPLAY_OPTION_CODE;

else if (!strcmp (arg, Z_SPACE_0PTI0N)) *arg_code = Z_SPACE_OPTION_CODE;

else if (!strcmp (arg, Z_SPACE^FILE_OPTION) ) *arg_code = Z_SPACE_FILE_OPTION_CODE;

else if (!strcmp (arg, XF_HATCH_SPACE_OPTION) ) *arg_code = XF_HATCH_SPACE_OPTION_CODE;

else if (!strcmp (arg, YF_HATCH_SPACE_OPTION) ) *arg_code = YF_HATCH_SPACE_OPTION_CODE;

else if (!strcmp (arg, Y_HATCH_SPACE_OPTION) ) *arg_code = Y_HATCH_SPACE_OPTION_CODE;

SUBSTITUTE SHEET

-82.571-

else if (!strcmp (arg, X__HATCH_SPACE_OPTION) ) *arg_code = X_HATCH_SPACE_OPTION_CODE;

else if ('strcmp (arg, ANGLE_HATCH__SPACE_OPTION) ) *arg_code = ANGLE_HATCH_SPACE_OPTION_CODE;

else if (!strcmp (arg, CENTERJDPTION) ) *arg_code = CENTER_OPTION_CODE;

else if (!strcmp (arg, SECTION_CODES_OFF_OPTION) ) *arg_code = SECTION_CODES_OFF_OPTION_CODE;

else if (!strcmp (arg, MIN_SURFACE_ANGLE_OPTION) ) *arg_code = MIN_SURFACE_ANGLE_OPTION_CODE;

else if (!strcmp (arg, MIN_INTERSECT_ANGLE_OPTION) ) *arg_code = MIN_INTERSECT_ANGLE_OPTION_CODE;

else if (!strcmp (arg, X_AXIS_OPTION) ) *arg_code = X_AXIS_OPTION_CODE;

else if (!strcmp (arg, Y_AXIS_OPTION) ) *arg_code = Y_AXIS_OPTION_CODE;

else if (!strcmp (arg, BINARY_INPUT_OPTION)) *arg_code = BINARY_INPUT_OPTION_CODE;

else if (!strcmp (arg, DEBUG_OPTION)) *arg_code = DEBUG_OPTION_CODE;

else if (!strcmp (arg, DISK_OPTION) ) *arg_code = DISK_OPTION_CODE;

else if (!strcmp (arg, ARIESjDPTION) ) *arg_code = ARIES_OPTION_CODE;

SUBSTITUTE SHEET

-82.572- else if (!strcmp (arg, INTERNAL_OPTION) ) *arg_code = INTERNAL_OPTION_CODE;

else

*arg_code = UNKNOWN J5PTI0N_C0DE ;

} /* get_arg_code */

/***************************************************** local function

not_a umber

Takes a character string and determines if it represents a legal integer or real value. A legal number contains only the chars •0' through '9' with at most one decimal point and possibly a '-' sign at the beginning of the string.

******************************************************** */

static INT16 not_a_number (number_string)

STRING *number_string;

{ BOOLEAN decimal_point_found = FALSE; BOOLEAN not_a_num = FALSE;

short number_length;

SUBSTITUTE SHEET

-82.573- short i = 0;

number_length = strlen (number_string) ;

SUBSTITUTE SHEET

-82.574- if (number_length = 0) not_a_num = TRUE;

else if (( umber_string[i] = '-') JJ (number_string[i] == '.'))

{ i++; not_a_num = (i == number_length) ; }

while ((i < number_length) -.& !not_a_num)

{ if (number_string[i] = '.')

( not_a_num = decimal_point_found; decimaljpoint_found = TRUE;

} else not_a_num = ((number_string[i] < '0') [J (number_string[i] > '9•) ) ; i++; }

return ((short) not_a_num) ;

} /* not_a_number */

/****************************************************** local procedure

get_float_arg

SUBSTITUTESHEET

-82.575-

Gets the float parameter of the command line option identified by option_name and arg_index. Checks for error. Increments arg_index if appropriate.

******************************************************/

static void get_float_arg (floatjval, argc, argv, arg_index, option ame, error)

float *float_val;

INT16 argc;

STRING *argv[];

INT16 *arg_index;

STRING *option_name;

BOOLEAN *error;

short arg_code;

if ((*arg_index + 1) == argc)

{ *error = TRUE; fprintf (stderr, "\n error - missing parameter for

!s option \n", option_name) ;

} else

{ if (not_a_number (argv [*arg_index + 1]))

{ *error = TRUE; get_arg_code (argv [*arg_index + 1], Sarg_code) ;

SUBSTITUTE SHEET

-82.576- if (arg_code = UNKNOWN_OPTION_CODE)

{ fprintf (stderr, "\n error - invalid parameter for !s option \n", option_name) ;

(*arg_index)++ ;

} else fprintf (stderr, "\n error - missing parameter for !s option \n", option_name) ;

} else

{ if (strlen (argv [*arg_index + 1]) >

MAX_FLOAT_LENGTH)

{

*error = TRUE; fprintf (stderr, " \n error - real number

length exceeds limit") ; fprintf (stderr, " for !s option \n", option_name) ;

} else sscanf (argv [*arg_index + 1], "!f", float_val) ;

(*arg_index)++ ;

} }

} /* get_float_arg */

SUBSTITUTE SHEET

-82.577-

/****************************************************** local procedure

get_int_arg

Gets the int parameter of the command line option identified by option_name and arg_index. Checks for error. Increments arg_index if appropriate.

****************************************************** /

static void get_int_arg (int_val, argc, argv, arg_index, option_name, error)

INT16 *int_val;

INT16 argc;

STRING *argv[] ;

INT16 *arg_index;

STRING *option_name;

BOOLEAN *error;

short arg_code;

if ((*arg_index + 1) = argc) {

*error = TRUE; fprintf (stderr, "\n error - missing parameter for !s option \n", option iame) ;

} else

{

SUBSTITUTE SHEET

-82.578- if (not_a_number (argv [*arg_index + 1]))

{ ♦error — TRUE; get_arg_code (argv [*arg_index + 1] , Sarg_code) ; if (arg_code = UNKNOWN_OPTION_CODE)

{ fprintf (stderr, "\n error - invalid parameter for !s option \n", option_name) ;

(*arg_index)++ ;

} else fprintf (stderr, "\n error - missing parameter for !s option \n", option_name) ;

} else

{ if (strlen (argv [*arg_index + 1]) >

MAX_INT_LENGTH)

{ *error = TRUE; fprintf (stderr, " \n error - number length exceeds limit") ; fprintf (stderr, " for !s option \n", option_name) ;

} else sscanf (argv [*arg_index + 1], "!d", int_val) ; (*arg_index)++ ; }

} /* get_int_arg */

SUBSTITUTE SHEET

-82.579-

/******************************************************* local procedure

get_filename_arg

Gets the filename parameter of the command line option identified by option_name and arg_index and copies it to the filename parameter. Checks for error. Increments arg_index if appropriate.

******************************************************/

static void get_filename_arg (filename, argc, argv, arg_index, option iame, error)

STRING *filename; INT16 argc; STRING *argv[]; short *arg_index; STRING *option_name; BOOLEAN *error;

{ short arg_code;

if ((*arg_index + 1) = argc)

{

*error = TRUE; printf ("\n error - missing filename parameter for !s option \n", option_name) ; }

SUBSTITUTE SHEET

-82.580- else

{ get_arg_code (argv [*arg_index + 1] , Sarg_code) ;

if (arg_code != UNKNOWN_OPTION_CODE) {

*error = TRUE; printf ("\n error - missing filename parameter for !s option \n", option_name) ; }

else

{ strcpy (filename, argv [*arg_index + 1]); (*arg_index)++ ; }

}

} /* get_filename_arg */

/****************************************************** local procedure

get ιser_info_cmd_line

Reads the command line information and stores the data into the structure user_info. Checks for error.

******************************************************/

SUBSTITUTE SHEET

-82 .581-

static void get_user_info_cmd_line (user_info, argc, argv, cmd_line_help_needed, cmd_line_help_requested)

USER_INFO_STRUC *user_info;

INT16 argc;

STRING *argv[];

BOOLEAN *cmd_line_help_needed;

BOOLEAN *cmd_line_help_requested;

{ float float_arg; INT16 int_arg; STRING filename_arg [100]; INT16 arg_index,arg_code;

*cmd_line_help_needed = FALSE; *cmd_line_help_requested = FALSE;

arg_index = 1;

while (arg_index < argc)

{ get_arg_code (argv[arg_index], Sarg_code) ;

switch (arg_code)

{ case RES_OPTION_CODE : get_float_arg (Sfloat_arg, argc, argv, Sarg_index, RES_OPTION, cmd_line help_needed) ; user_info-> res_value = float_arg; if (user_info->res_value <= 0.0) { fprintf (stderr,"\n error - res

SUBSTITUTE SHEET

-82.582- value out of range - !-1.3f \n", user_info->res_value) ; exit(SYS_FAILURE) ;

} 5 break;

case Z_SPACE_OPTION_CODE : get_int_arg (Sint_arg, argc, argv, Sarg_index, Z_SPACE_OPTION, cmd_line_help_needed) ; 10 user_info->z_spacing = int_arg; if (user_info->z_spacing <= 0) { fprintf (stderr,"\n error - z spacing value out of range - !u \n", 15 user_info->z_spacing) ; exit(SYS_FAILURE) ;

) break;

case YF_HATCH_SPACE_OPTION_CODE : 20 get_int_arg (Sint_arg, argc, argv,

Sarg_index, YF_HATCH_SPACE_OPTION, cmd_line_help_needed) ; user_info-> y_flat_fill_spacing = int_arg; break?

25 case XF_HATCH_SPACE_OPTION_CODE : get_int_arg (Sint_arg, argc, argv, Sarg_index, XF_HATCH_SPACE_OPTION, cmd_line_help_needed) ; user_info-> x_flat_fill_spacing = int_arg; 30 break;

case Y_HATCH_SPACE_OPTION_CODE : get_int_arg (Sint arg, argc, argv, Sarg_index, Y_HATCH_SPACE_OPTION,

SUBSTITUTE SHEET

-82.583- cmd_line__help_needed) ; user_info-> Y_hatch_spacing = int_arg; break;

case X_HATCH_SPACE_OPTION_CODE : get_int_arg (Sint_arg, argc, argv,

Sarg_index, X_HATCH_SPACE_OPTION, cmd_line_help_needed) ; user_info-> x_hatch_spacing = int_arg; break;

case ANGLE_HATCH_SPACE_OPTION_CODE : get_int_arg (Sint_arg, argc, argv,

Sarg_index, ANGLE_HATCH_SPACE_OPTION, cmd_line_help_needed) ; user_info-> angle_hatch_spacing = int_arg; break;

case MIN_SURFACE_ANGLE_OPTION_CODE : get_int_arg (Sint_arg, argc, argv,

Sarg_index, MIN_SURFACE_ANGLE_OPTION, cmd_line_help_needed) ; user_info-> min_surface_angle = int_arg; break;

case MIN_INTERSECT_ANGLE_OPTION_CODE : get_int_arg (Sint_arg, argc, argv,

Sarg_index, MIN_INTERSECT_ANGLE_OPTION, cmd_line_help_needed) ; user_info-> min_intersect_angle = int_arg; break;

case X_AXIS_OPTION_CODE : user_info-> axis = 1; break;

case Y_AXIS_OPTION_CODE :

SUBSTITUTE SHEET

-82.584- user_info-> axis = 2; break;

case BINARY_INPUT_OPTION_CODE : user_info-> binary_input = TRUE; break;

case SEGFILE_OPTION_CODE : get_filename_arg (filename_arg, argc, argv.

Sarg_index, SEGFILE_OPTION, cmd_line Jιelp_needed) ; strcpy (user_info-> segfile_name, filename_arg) ; break;

case Z_SPACE_FILE_OPTION_CODE : get_filename_arg (filename_arg, argc, argv, Sarg_index, Z_SPACE_OPTION, cmd_line ιelp_needed) ; strcpy (user_info-> z_space_filename, filename_arg) ; break;

case HELP_OPTION_CODE :

*cmd_line_help_requested = TRUE; break;

case DEBUG_OPTION_CODE : user_info-> debug node = TRUE; break;

case CENTER_OPTION_CODE : user_info-> centering_off = FALSE ; break?

case SECTION_CODES_OFF_OPTION_CODE :

SUBSTITUTE SHEET

-82.585- user_info-> section_codes_off = TRUE; break;

case DISPLAY_OPTION_CODE : user_info-> display_on = TRUE; break;

case DISK_OPTION_CODE : user_info-> in_mem = FALSE; break;

case ARIES_OPTION_CODE : user_info-> binary_input = TRUE; user_info-> attrib = FALSE; break;

case INTERNAL_OPTION_CODE : get_filename_arg (filename_arg, argc, argv,

Sarg_index, INTERNAL_OPTION, cmd_line help_needed) ; strcpy (user_info-> internal_filename, filename_arg) ; break;

case UNKNOWN_OPTION_CODE :

{

*cmd_line_help_needed = TRUE; fprintf (stderr,

"\n error - unknown option - !s \n", argv [arg_index]) ; > ) arg_index++ ;

}

} /* get_user_info_cmd_line */

SUBSTITUTE SHEET

-82.586-

/******************************************************* local procedure

init ιser_info

Initializes user_info structure to default values.

******************************************************** /

static void init ιser_info (user_info)

USER_INFO_STRUC *user_info;

{ user_info-> res_value = DEFAULT_RES_VALUE; strcpy (user_info-> segfile_name, DEFAULT_SEGFILE_NAME) ; user_info-> debug αode = FALSE; user_info-> display_on = FALSE; user_info-> centering_off = TRUE; user_info-> section_codes_off = FALSE; user_info-> axis = 0; user_info-> binary_input = FALSE; user_info-> attrib = TRUE; user_info-> in nem = TRUE; user_info-> z_spacing = 1; user_info-> y_flat_fill_spacing = 0; user_info-> x_flat_fill_spacing = 0; user_info-> y_hatch_spacing = 0;

SUBSTITUTE SHEET

-82.587- user_info-> x_hatch_spacing = 0; user_info-> angle_hatch_spacing = 0; user_info-> min_surface_angle = 0; user_info-> min_intersect_angle = 0; *(user_info-> z_space_filename) = '\0'; *(ύser_info-> internal_filename) ='\0';

} /* init_user_info */

/****************************************************** local procedure

print_cmd_line_help

Prints command line help message explaining command line syntax.

******************************************************/

static void print_cmd_line_help ()

{ fprintf (stderr, "\n PFP Command Line Syntax: \n") ; fprintf (stderr, "\n PFP < input_file <options>

\n » ); fprintf (stderr, "\n where <options> indicates any of the following:\n") ; fprintf (stderr, "\n -res <res_value>") ; fprintf (stderr, "\n Used to specify a real number resolution value that") ;

SUBSTITUTE SHEET

-82.588- fprintf (stderr, "\n will be used to scale the input file coordinates.") ; fprintf (stderr, "\n The default resolution value is

!f\n", DEFAULT_RES_VALUE) ; fprintf (stderr, "\n -sf <segment output file>") ; fprintf (stderr, "\n Used to specify an output file for") ; fprintf (stderr, " z plane intersection segments."); fprintf (stderr, "\n The default is to not generate a segment") ; fprintf (stderr, " output file\n") ; fprintf (stderr, "\n -zs <z spacing value>") ; fprintf (stderr, "\n Used to indicate the constant z spacing of the") ; fprintf (stderr, '• output cross-sections.\n") ; fprintf (stderr, "\n -hy <hatch spacing value>") ; fprintf (stderr, "\n Used to set spacing of hatch lines parallel") ; fprintf (stderr, " to the y axis.\n"); fprintf (stderr, "\n -hx <hatch spacing value>") ; fprintf (stderr, "\n Used to set spacing of hatch lines parallel") ; fprintf (stderr, " to the x axis.\n") ; fprintf (stderr, "\n -ha <hatch spacing value>") ; fprintf (stderr, "\n Used to set spacing of 60 degree angle") ; fprintf (stderr, " hatch lines.\n") ; fprintf (stderr, "\n -hfy <hatch spacing value>") ; fprintf (stderr, "\n Sets spacing of hatch lines parallel") ? fprintf (stderr, " to the y axis on flat surfaces.\n") ; fprintf (stderr, "\n -hfx <hatch spacing value>") ; fprintf (stderr, "\n Sets spacing of hatch lines parallel") ; fprintf (stderr, " to the x axis on flat surfaces.\n") ; fprintf (stderr, "\n -zsf <z spacing control file>") ;

SUBSTITUTE SHEET

-82.589- fprintf (stderr, "\n Used to specify the file containing variable") ; fprintf (stderr. " z spacing information.\n") ; fprintf (stderr. "\n -c' » ); fprintf (stderr. "\n Centering option."); fprintf (stderr. "\n Center object coordinates\n") ; fprintf (stderr. "\n -nsc") ; fprintf (stderr. "\n No section codes option."); fprintf (stderr. "\n Suppresses section codes in the output file\n") ; fprintf (stderr. "\n - sa") ; fprintf (stderr. "\n Minimum surface angle option.") ; fprintf (stderr, "\n Indicates minimum surface angle for scanned") ;

SUBSTITUTE SHEET

-82.590- fprintf (stderr, "\n facets. Legal values are between 0 and 90") ; fprintf (stderr, " degrees.\n") ; fprintf (stderr, "\n -mia") ; fprintf (stderr, "\n Minimum intersect angle option.") ; fprintf (stderr, "\n Indicates minimum intersect angle for hatch") ; fprintf (stderr, "\n lines. Legal values are between 0 and 90") ; fprintf (stderr, " degrees.\n") ; fprintf (stderr, "\n -b") ; fprintf (stderr, "\n Binary input option."); fprintf (stderr, "\n Indicates that the input file is in binary") ; fprintf (stderr, " attributed format."); fprintf (stderr, "\n -aries") ; fprintf (stderr, "\n ARIES attributed binary input option.") ; fprintf (stderr, "\n Used when binary file is ARIES and attributed.\n") ; fprintf (stderr, "\n -d") ? fprintf (stderr, "\n. Display option."); fprintf (stderr, "\n Causes the program to display cross-sections"); on the screen as they are generated.\n") ; fprintf (stderr, "\n -h") ; fprintf (stderr, "\n Help option."); fprintf (stderr, "\n Causes the program to print this help") ; fprintf (stderr, " message and then stop.\n") ; fprintf (stderr, "\n -disk") ;

SUBSTITUTE SHEET

-82 .591- fprintf (stderr, "\n Disk option."); fprintf (stderr, "\n Causes the program save layers on disk rather") ; than in memory.

Use for large files.\n"); fprintf (stderr, "\n -x or -y") ; fprintf (stderr, "\n Slice Axis option."); fprintf (stderr, "\n Changes the Slice axis from the Z to X or Y\n") ; fprintf (stderr, "\n -internal <triangle analysis file>") ; fprintf (stderr , "\n Generates a special binary file consisting of"); Slice's own internal representation of triangles,") ; fprintf (stderr, "\n useful for analysis purposes\n") ; fprintf (stderr.

} /* print_σmd_line_help */

/******************************************************* local procedure

check_user_info

Checks user_info structure for legal values. Sets display_on option if not set and no segment file was specified.

SUBSTITUTE SHEET

-82.592- *******************************************************/

static void check ιser_info (user_info, cmd_line _help_needed)

USER_INFO_STRUC *user_info;

BOOLEAN *cmd_line_help_needed;

{ if (!user_info-> display_on && (*(user_info-> segfile_name) = '\0•))

user_info-> display_on = TRUE;

if ((user_info-> min_surface_angle < 0) JJ

(user_info-> min_surface_angle > MAX_ANGLE) )

( fprintf (stderr,

"\n error - minimum surface angle (!d) must be between 0 and !d \n", user_info-> min_surface_angle, MAX_ANGLE) ; *cmd_line_helpjneeded = TRUE;

} if ((user_info-> min_intersect_angle < 0) JJ (user_info-> min_intersect_angle > MAX_ANGLE) )

{ fprintf (stderr,

"\n error - minimum intersect angle (!d) must be between 0 and !d \n", user_info-> min _intersect angle, MAX_ANGLE) ; *cmd_line elp_needed = TRUE; }

} /* check ιser_info */

SUBSTITUTE SHEET

-82.593-

/******************************************************* *** exported procedure

pfp_get_user_info

Gets user input from the command line.

Returns user input in the structure user_info.

******************************************************** **/

void pfp_get_user_info (argc, argv, user_info)

INT16 argc;

STRING *argv[]; USER_INFO_STRUC *user_info;

{

BOOLEAN cmd_line_help_needed, cmd_line_help_requested;

init_user_info (user_info) ;

get_user_info_cmd_line (user_info, argc, argv, Scmd_line_help_needed, Scmd_line _help_requested) ;

check_user_info (user_info, Scmd_line_help_needed) ;

if (cmd_line_help_requested)

SUBSTITUTE SHEET

-82.594-

( print_cmd_line_help ( ) ; exit (SYS_FAILURE) ;

) else if (cmd_line_help_needed)

{ fprintf (stderr, "\n — for command line help try the !s option \n", HELP_OPTION) ; exit (SYS_FAILURE) ; }

} /* pfp_get ιser_info */

SUBSTITUTE SHEET

-82.595-

/*******************************************************

*/ /* */ /* PFPHI.H

*/ /*

*/

/* PFP Human Interface header file */ /* */

/* MODIFICATION LOG

* /* ' • */

/* date who what

*/

/* */

/* JP. Stinebaugh J original code

*/

*/ /*******************************************************

*/

#define FILE NAME LENGTH 100

typedef struct

{ float res_value;

UINT16 y_flat_fill_spacing;

UINT16 x_flat_fill_spacing;

UINT16 y_hatch_spacing;

UINT16 x_hatch_spacing;

SUBSTITUTE SHEET

-82.596-

UINT16 angle_hatch_spacing;

UINT16 z_spacing;

UINT16 min_surf ace_angle ?

UINT16 min_intersect_angle ;

UINT16 axis;

STRING z_space_filename [FILE_NAME_LENGTH] ;

STRING internal_filename[FILE_NAME_LENGTH] ;

STRING segfile iame [FILE_NAME_LENGTH] ;

BOOLEAN binary_input;

BOOLEAN debug node;

BOOLEAN display_on;

BOOLEAN centering_off;

BOOLEAN section_codes_off;

BOOLEAN attrib;

BOOLEAN in mem;

} USER_INFO_STRUC;

fdefine RES_OPTION "-RES" fdefine SEGFILE_OPTION "-SF" fdefine HATCH_FILE_OPTION "-HF" fdefine Y_HATCH_SPACE_OPTION "-HY" fdefine X_HATCH_SPACE_OPTION "-HX" fdefine ANGLE_HATCH_SPACE_OPTION "-HA" fdefine YF_HATCH_SPACE_OPTION "-HFY" fdefine XF_HATCH_SPACE_OPTION "-HFX" fdefine HELP_OPTION "-H" fdefine DISPLAY_OPTION "-D" fdefine Z_SPACE_OPTION • « -ZS" fdefine Z_SPACE_FILE_OPTION "-ZSF" fdefine CENTERJDPTION «« -C" fdefine SECTION_CODES_OFF_OPTION "-NSC" fdefine MIN_SURFACE_ANGLE_OPTION "-MSA" fdefine MIN_INTERSECT_ANGLE_OPTION "-MIA" fdefine X_AXIS_OPTION "-X" fdefine Y AXIS OPTION ιι_γιι

SUBSTITUTE SHEET

-82.597- fdefine BINARY_INPUT_OPTION II_B" fdefine DEBUG_OPTION "-DEBUG" fdefine DISK_OPTION "-DISK" fdefine ARIES_OPTION "-ARIES" fdefine INTERNAL OPTION "-INTERNAL"

fdefine RES_OPTION_CODE 1 fdefine SEGFILE_OPTION_CODE 2 fdefine Y_HATCH_SPACE_OPTION_CODE 3 fdefine X_HATCH_SPACE_OPTION_CODE 4 fdefine ANGLE_HATCH_SPACE_OPTION_CODE 5 fdefine YF_HATCH_SPACE_OPTION_CODE 6 #define XF_HATCH_SPACE_OPTION_CODE 7 #define HELP_OPTION_CODE 8 fdefine DEBUG_OPTION_CODE 9 #define DISPLAY_OPTION_CODE 10 fdefine Z_SPACE_OPTION_CODE 11 fdefine Z_SPACE_FILE_OPTION_CODE 12 fdefine CENTER_OPTION_CODE 13 fdefine SECTION_CODES_OFF_OPTION_CODE 14 fdefine MIN_SURFACE_ANGLE_OPTION_CODE 15 fdefine MIN_INTERSECT_ANGLE_OPTION_CODE 16 fdefine X_AXIS_OPTION_CODE 17 fdefine Y_AXIS_OPTION_CODE 18 #define BINARY_INPUT_OPTION_CODE 19 fdefine DISK_OPTION_CODE 20 fdefine ARIES_OPTION_CODE 21 fdefine INTERNAL_OPTION_CODE 22 fdefine UNKNOWN OPTION CODE 23

fdefine DEFAULT_RES_VALUE 1.0 fdefine DEFAULT SEGFILE NAME ""

fdefine MAX_FLOAT_LENGTH 9 fdefine MAX_INT_LENGTH 5 fdefine MAX ANGLE 90

SUBSTITUTE SHEET

-82.598-

{

Redraw function causes the background task to perform a multi-pass redraw operation when it is encountered in the Background Command Queue.

Redraw also marks so as to minimize use of commands.

returns error code

}

function Redraw: Integer; begin with IntReg do begin

AX := $0804; Intr(_LASERVECTOR, IntReg) ;

Redraw := AL; end; end;

{ end of LASER, INC } Program SLAGRAPH;

{ 3D Systems SLA Graphics Software

Change Log:

2/16/88 - Original Release

} {$V-} uses

Crt,Dos,Graph?

const

SUBSTITUTE SHEET

-82. 599-

VERSION : String = 'Test260a'; MAX_WORD : Word = 65535; MAX_REAL : Real = 1.7E37; MIN_REAL : Real = -1.7E37; ZERO_DEF = 1E-5; ESC : Char = f27; CR : Char = fl3; LF : Char = flO; BUF_SIZE = 4095; Spaces : String =

MAX_PTR_ARRAY = 16382;

{ Slice Constants }

MAX_LAYERS = 16382;

LAYER_SIZE = 16; MAX_SECTIONS = 5;

SliceBlocks : Array [0..4] of String[33 = ('L', 'FU', 'FD', 'NFU', 'NFD') ;

L_SECTIONS = $0007;

L_SECTION = $8000; LB_SECTION = $0001;

LH_SECTION = $0002;

FU_SECTIONS = $0038;

FD_SECTIONS = $01C0;

NFU_SECTIONS = $0E00; NFD_SECTIONS = $7000;

F_SECTIONS = $01F8;

NF_SECTIONS = $7E00;

{ Triangle Constants } MAX_TRIANGLES = 10921; TRIANGLE_SIZE = 10;

ASC_FILE = 1; { File Type Constants }

BINARY_FILE = 2;

ARIES_FILE = 3;

COOR_CHAR : Array [ 1. . 3 ] of Char = ( ' X ' , ' Y ' , ' Z ' ) ;

SUBSTITUTE SHEET

-82.600- type

DynamicSLWordArray = Array [0..16382] of Word;

Dyna icSLLonglntArray = Array [0..16382] of Longint;

DynamicTRILongIntArray= Array [0..10921] of Longint;

DynamicTRIRealArray = Array [0..6552] of Real;

PointerStruct = Array [0..255] of Byte; PointerType = A PointerStruct;

var

ExitSave Pointer; HeapTop Pointer; InBuffer Array [0. BUF_SIZE] of Char; InBufStr String; InBufEnd Integer; InBufPtr Integer; CurrFilePos Longint; StartLinePos Longint; EndOfFile Boolean; FileError Boolea ; ErrLine String; ch Char; re Integer; iw,jw Word; Templnt Integer; TempByte Byte; . TempWord Word;

TempBoolean Boolean; TempReal Real; TempLong Longint; TempStr String; TempChar Char; InputLine String; MonoDisplay Boolean; GraphDriver, GraphMode: Integer; SizeX,SizeY Integer; AspectRatio Real GraphScale Real;

SUBSTITUTE SHEET

-82 . 601-

GraphCenterX,GraphCenterY : Word; GrOffsetX,GrOffsetY,GrOffsetz : Real;

{ Triangle File Global Vars } TriangleFile File; TriangleFilename String; { Filename of Triangle

File }

TriangleFilename Byte { File Type of Input File

} TrianglePtr A DynamicTRILongIntArray;

{ Pointers to Tria

TriangleAxisValue A DynamicTRIRealArray; { Z values of each

TriangleNormal Array [1..3] of Real; TriangleVertex Array [1..3,1..3] of Real; TriangleAttrib Word; TriangleTotal Longint; TriangleFileMin Array [1..3] of Real; TriangleFileMax Array [1..3] of Real; TriangleSelected Longint; TriangleSelectStart Real; TriangleSelectEnd Real; TriangleSelectMin Array [1..3] of Real; TriangleSelectMax Array [1..3] of Real; TriangleWindowingFile Boolean; TriangleAngle Array [1..3] of Byte; TriangleAxis Byte; Gr3DMat Array [0..2,0..2] of Real; Total_Triangles Longint;

{ Slice File Global Vars } SliceFile : File;

SliceFilename : String; { Filename of Slice

File } SliceFileXMin,SliceFileXMax : Word; { File Max and Min values } SliceFileYMin,SliceFileYMax : Word;

SUBSTITUTE SHEET

-82.602-

S1iceLastLayer : Integer; { Pointer to last layer } S1iceLayerValue : A DynamicSLWordArray; { Layer

Values } SliceLayerPtr : DynamicSLLongIntArray; {

Pointer to Layer

SliceLayerBlocks : DynamicsLWordArray; { Layer

Blocks } SliceLayerXMin, S1iceLayerXMax : A DynamicSLWordArray; { Layer

Max and Min SliceLayerYMin,SliceLayerYMax : A DynamicSLWordArray; SliceLayer : Word; { Current Layer }

SliceWindowingFile : Boolean; SliceOutputBlocks : Word; Total_Layers : Longint;

{$F+} procedure MainExit: {$F-} begin

{$1-} Close(SliceFile) ; Close(TriangleFile) ; {$1+} RestoreCrtMode; TextBackground(Black) ; TextColor(White) ; ClrScr?

ExitProc:=ExitSave; end;

procedure ProgramError(ErrorLine : String) ; { Print Program Error and exits program } begin

RestoreCrtMode; TextBackground(Black) ; TextColor(White) ; ClrScr; writelnC*** SLAGRAPH ERROR: ' ,ErrorLine, ***'); ch:=ReadKey;

SUBSTITUTE SHEET

-82. 603-

Halt (l) ; end;

procedure Reallocate(ch : Char;Alloc : Longint) ; { Allocates the array space to suggested number } var

MemoryAvail : Longint; begin

{ Free Heap } Release(HeapTop) ; SliceFilename := * ' ;

TriangleFilename:= • ' ; MemoryAvail := MemAvail - 32768;

if ch='S' then begin

{ Don't allow more than machine can handle } if Alloc>MAX_LAYERS then Total_Layers:=MAX_LAYERS else Total_Layers:=Alloc; { Make sure you can allocate that many alone. If not, set maximum } if Total_Layers*LAYER_SIZE>MemoryAvail then Total_Layers:=Round(Memory Avail/L

{ Given number of Layers, fill rest of memory with

Triangles } Total_Triangles:=Round( (MemoryAvail-Total_ Layers*LAYER_SIZE)/TRIANGLE_SIZE) ; if Total_Triangles>MAX_TRIANGLES then Total_ Triangles:=MAX_TRIANGLES; end else begin

{ Don't allow more than machine can handle} if Alloc>MAX_TRIANGLES then Total_ Triangles:=MAX_TRIANGLES else Total_Triangles:=Alloc;

{ Make sure you can allocate that many alone. If not, set maximum } if Total_Triangles*TRIANGLE_SIZE>MemorγAvail then Total_Triangles:=Round(Memo

SUBSTITUTE SHEET

-82.604-

{ Given number of Triangles, fill rest of memory with Layers } Total_Layers:=Round((MemoryAvail-Total_Triangles* TRIANGLE_SIZE)/LAYER_SIZE; if Total_Layers>MAX_LAYERS then Total_Layers:= MAX_LAYERS; end;

GetMem(SIiceLayerValue,Total_Layers*2) ? GetMem(SIiceLayerPtr,Total_Layers*4) ; GetMem(SliceLayerBlocks,Total_Layers*2) ; GetMem(S1iceLayerXMin,Total_Layers*2) ; GetMem(SIiceLayerXMax,Total_Layers*2) ; GetMem(SIiceLayerYMin,Total_Layers*2) ; GetMem(SIiceLayerYMax,Total_Layers*2) ; GetMem(TrianglePtr,Total_Triangles*4) ;

GetMem(TriangleAxisValue,Total_Triangles*6) ; Dec(Total_Triangles) ; Dec(Total_Layers) ; end; procedure OutTextLn(aline:String) ; { "writeln" for graphics } begin

OutText(aline) ;

MoveTo(1,GetY+TextHeight(' ')+2) ; end;

procedure GrTextXY(aline:String;x,y : Byte); { writes text at XY char on graphic screen } begin

OutTextXY((x-1)*(TextWidth(• ')+2) , (y- l)*(TextHeight( » » )+2) ,aline) ; end;

procedure ConvertStoR(s,r : PointerType) ;

{ Converts a Single type (4 byte) number to a Real (6 byte) } begin

SUBSTITUTE SHEET

-82 . 605- r A [0] :=(((s A [33 shl 8) + s A [2] shr 7) and $FF; r A [l] :=0; r A [2] :=0; r A [3] ;=s A [0] r A [4] :=s A [l]; r A [5] :=(s A [3] and $80) or (s A [2] and $7F) ; if r A [0]<>0 then Inc(r A [0],2) ; { e offset } end;

procedure ConvertRtoS(r,s : PointerType) ; { Converts a Real type (6 byte) number to a Single (4 byte) } var e : Byte; begin e:=r [0]; if eoO then Dec(e,2); { e offset } s A [3] :=(r A [5] and $80) or ((e shr 1) and $7F) ; s A [2]:=((e shl 7) or (r A [5] and $7F) ) and $FF; s A [l]:=r A [4]; s [0] :=r A [3] ; end;

procedure ToUpper(var aline : String) ; { Converts a string to upper case } var i : Integer; begin for i:=l to Length(aline) do aline[i] := UpCase(aline[i]) ; end;

procedure Center(str : String;linenum Byte) { Centers text on screen line } begin

GotoXY(1,linenum) ; ClrEol;

SUBSTITUTE SHEET

-82.606- if Length(str)>79 then GotoXY(1,linenum) else GotoXY(40-(Length(str) div 2), linenum); write(str) ? end;

procedure WaitKey;

{ Waits for a key press while prompting } var ch : Char? begin CenterC<Press a y key to continue>' ,25) ; ch:=ReadKey; end;

procedure SelectTxtColor(select : Integer) ;

{ Sets text color requested or White for non-color displays } begin if MonoDisplay then TextColor (White) else TextColor(select) ; end;

procedure SelectGraphColor(select : Integer) ;

{ Sets graphic color. If black and white, uses dashed lines, etc. } var

LineType : Integer; begin if MonoDisplay then begin SetColor(White) case select of

1 : LineType:=SolidLn; 2 : LineType:=CenterLn; 4 : begin

LineType:=CenterLn; SetColor(LightGray) ;

SUBSTITUTE SHEET

-82. 607- end;

9 : begin

LineType:=SolidLn; SetColor(LightGray) ; end;

10 : LineType:=DashedLn; 12 : begin

LineType:=DashedLn; SetColor(LightGray) ; end;

ELSE LineType:=CenterLn; end;

SetLineStyle(LineType,0,NormWidth) ; end else SetColor(select) ; end;

procedure PrintHeader;

{ Prints general 3D header at top of screen } begin

TextColor(White) ; if Not MonoDisplay then TextBackground(Blue) else TextBackground(Black) ; ClrScr;

Center('3D Systems Graphis Display Program (Version '+VERSION+') ',1) ; Center('Copyright (C) 1988 3D Systems Inc',2); SelectTxtColor(LightGreen) ; end;

procedure PrintSliceHeader;

{ Print Slice Screens header } begin

PrintHeader;

SelectTxtColor(LightRed) ; Center('Slice File Control Functions',3) ; TextColor(White) ; end;

SUBSTITUTE SHEET

-82.608- procedure PrintTriHeader;

{ Print Triangle Screens header } begin

PrintHeader; SelectTxtColor(LightRed) ?

Center('Triangle File Control Functions• ,3) ? TextColor(White) ? end;

function GetFilename(var FileName : String; sel : Integer) : Boolean;

{ Displays file with SLI or STL extensions and allows user to select a file to use. } var

DirRec : SearchRec; CurrFileName : String; Extn : String; row,col : Integer; count : Integer; begin if sel = 1 then begin Extn := '.STL'; PrintTriHeader; GotoXY(l,6) ; write('Triangle') ; end else begin

Extn := '.SLI'; Prints1iceHeader; GotoX (1,6) ; write('Slice') ; end?

{ Display the entries } write(' Files in current directory:'); row := 0; col := 0; count := 0;

SUBSTITUTE SHEET

-82 . 609-

FindFirst('*'+Extn,AnyFile,DirRec) ; while (DosError = 0) and (count < 75) do begin GotoXY(3+col*15.8+row) ; write(Copy(DirRec.name,1,Pos) ' . ' .DirRec.name)-1) ) ; col := col + 1; if col = 5 then begin col := 0; row := row + 1; end; FindNext(DirRec) ; end;

{ Read the filename } repeat

GotoXY(1,24) ; ClrEol; write('Enter File Name: '); Readln(CurrFilename) ; ToUpper(CurrFilename) ; if CurrFilename o ' ' then begin { Find in directory } if Pos( » . • ,CurrFilename) = 0 then CurrFilename :=

CurrFilename + Extn; if Pos('*' ,CurrFilename)=0 then begin FindFirst(CurrFilename,AnyFile,DirRec) ; if DosError o 0 then CenterC****

" » +CurrFilename+"' File Not Found **** end else begin DosError:=1;

CenterC*** No Wild cards allowed ***',25); end; end; until (CurrFilename = '') or (DosError = 0) ; if CurrFilename = ' • then GetFilename:=FALSE else begin FileName := CurrFilename; GetFilename:=TRUE; end;

SUBSTITUTE SHEET

-82.610- end;

procedure ASCError(FileName : String) ; { Prints ASC file error } begin Str(StartLinePos.TempStr) ?

Center('Error found in Text file "'+FileName+•" at position'+TempStr,23) ? Center(*Line: '+ErrLine,24) WaitKey; end?

procedure CheckBuffer(var InFile : File) ;

{ Makes sure the input buffer has enough data in it.

If not, it reads more in. } var NumRead : Word; begin if InBufPtr > InBufEnd-160 then begin { Reload Buffer } if InBufPtr > InBufEnd then InBufEnd := 0 { Buffer Empty } else begin

{ Buffer almost empty } InBufEnd := InBufEnd - InBufPtr + 1; Move(InBuffer[InBufPtr],InBuffer[0],InBufEnd) ; end;

{ Fill rest of buffer } if Not Eof(InFile) then BlockRead(InFile,InBuffer

[InBufEnd],BUF_SIZE-InBufEnd else NumRead:=0; { Set buffer pointers } if InBufEnd+NumRead=0 then EndOfFile:=TRUE else Inc(InBufEnd,NumRead - 1) ; InBufPtr := 0; end; end;

SUBSTITUTE SHEET

-82 . 611- procedure ResetFile(var InFile : File) ; { Resets input file to top of file } begin

Reset(InFile,1) ; Seek(InFile,0) ; CurrFilePos:=0; InBufPtr := BUF_SIZE+1; InBufEnd := BUF_SIZE; EndOfFile:=FALSE; FileError;=FALSE; end;

procedure PositionFile(var InFile : File;charnum : Longint) ;

{ Positions input buffer to specific character of file. If not in buffer reads from file } begin if (charnum>=CurrFilePos-InBufPtr) AND (charnum<= CurrFilePos-InBufPtr+InBufEnd) InBufPtr:=InBufPtr+charnum-CurrFilePos else begin

Seek(InFile,charnum) ; InBufPtr := BUF_SIZE+1; InBufEnd := BUF_SIZE; EndOfFile:=FALSE; end;

CurrFilePos:=charnum; CheckBuffer(InFile) ; end;

procedure ReadLine(var InFile : File) ; { Reads a line from input file into a string } var

CRPos,i : Integer; begin

InputLine:=• ' ; if (NotFileError) AND (Not EndOfFile) then repeat

SUBSTITUTE SHEET

-82.612-

CheckBuffer(InFile) ; { Search for CR } if Not EndOfFile then begin i := InBufEnd-InBufPtr+1? if 1 > 255 then i := 255; InputLine[0] := Char (i) ; Move(InBuffer[InBufPtr],InputLine[1],i) ; CRPos := Pos(CR,InputLine)-1; if CRPos < 0 then CRPos := length(InputLine) ; InputLine[0] := Char (CRPos) ; StartLinePos:=CurrFilePos; PositionFile(InFile,CurrFilePos+CRPos+1) ; if InBuffer[InBufPtr] = LF then PositionFile (InFile,CurrFilePos+1) ; end else InputLine := • ' ; until EndOfFile OR (InputLine o ''); ToUpper(InputLine) ; ErrLine:=InputLine; end;

function ParseLine(var aline : String) : String;

{ Parses first word from string and truncs off from original string } var parsed : String; i,j : Integer; begin i: L; while (i<=Length(aline)) AND (aline[i]= « ') do Inc(i) ; if i>Length(aline) then begin aline:=' ' ; parsed:=' ' ; end else begin j:=i; while (j<=Length(aline)) AND (aline[j]<>' ') do Inc(j);

SUBSTITUTE SHEET

-82 . 613-

Move(aline[i] ,Parsed[l],j-i) ; parsed[0] :=Char (j-i) ; if j>=Length(aline) then aline:=' • else begin Move(aline[j+1] ,aline[l],Length(aline)-j ; aline[0]:=Char (Length(aline)-j) ; end; end;

ParseLine:=parsed; end;

procedure SetMinMax(var num,min,max : Word) ; { Updates Min and Max values with given data } begin if num>max then max:=num; if num<min then min:=num; end;

procedure SetGraph;

{ Finds what type of video hardware is installed and picks best graphics screen. Sets screen definition information. } var aspectx,aspecty : Word; begin

DetectGraph(GraphDriver,GraphMode) ; if GraphDriver < 0 then ProgramError('Graphics - •+GraphErrorMsg(Graph Driver)) ; GetModeRange(GraphDriver,Templnt,GraphMode) ; if GraphMode>3 then GraphMode:=3; { for CGA } InitGraph(GraphDriver, GraphMode, •c:\tp') ; re := GraphResult; if re o GrOk then ProgramError(•Graphics -

'+GraphErrorMsg(re)) ; if (GraphDriver <5) or (GraphDriver=8) then MonoDisplay:=FALSE else MonoDisplay:=TRUE;

SUBSTITUTE SHEET

-82.614-

GetAspectRatio(aspectx,aspecty) ; AspectRatio := aspectx/aspecty; SizeX := GetMaxX + 1? SizeY := GetMaxY + 1; GraphCenterX:= Round(SizeX/2) ; GraphCenterYt= Round(SizeY/2) ; end;

procedure SetupGraphic (MinX,MaxX,MinY,MaxY : Word) ; { Sets up graphic vars using Integer(Word) proposed ranges } var scalex : Real; begin

GraphScale:=(SizeX-4)/((MaxX-MinX)/AspectRatio) ; if Integer (MaxY-MinY)*GraphScale>SizeY then GraphScale:=(SizeY-4)/Integer (Max GrOffsetX:=MinX+Round((MaxX-MinX)/2) ; GrOffsetY:=MinY+Round((MaxY-MinY)/2) ; SetGraphMode(GraphMode) ; SetColor(White) ;

SetBkColor(Black) ; SetLineStyle(SolidLn,0,NormWidth) ; end;

procedure SetupGraphicR(MinX,MaxX,MinY,MaxY,MinZ,MaxZ : Real) ;

{ Sets up graphic vars using Real values and assuming rotations } var

RangeX,RangeY,RangeZ : Real; begin

RangeX:=(MaxX-MinX)*1.42; { 1.42 = 1/Sin(45deg) = worst expansion diag } RangeY:=(MaxY-MinY)*1.42; RangeZ:=(MaxZ-MinZ)*1.42; GraphScale:=SizeY/RangeX;

SUBSTITUTE SHEET

-82. 615- if RangeY*GraphScale>SizeY then GraphScale:=

SizeY/RangeY; if RangeZ*GraphScale>SizeY then GraphScale:= SizeY/RangeZ; GrOffsetX:=MinX+(MaxX-MinX)/2; GrOffsetY:=MinY+(MaxY-MinY)/2; GrOffsetZ:MinZ+(MaxZ-MinZ)/2; SetGraphMode(GraphMode) ; SetColor(White) ; SetBkColor(Black) ;

SetLineStyle(SolidLn,0,NormWidth) ; end;

procedure DrawLine(xl,yl,x2,y2 : Word) ;

{ Draws a line on graphics screen (no rotation) } begin xl:=GraphCenterX+Round(Round(xl-GrOffsetX)*

GraphScale/AspectRatio) ; x2:=GraphCenterX+Round(Round(x2-GrOffsetX)* GraphScale/AspectRatio) ; yl:=GraphCenterY-Round(Round(yl-GrOffsetY)* GraphScale) ; y2:=GraphCenterY-Round(Round(y2-GrOffsetY)*

GraphScale) ; Line(xl,yl,x2,y2) ; end;

procedure Compute3D(x,y,z : Real;var new_x,new_z : Integer) ;

{ Maps a 3D point into 2D graphics screen } begin x:=x-GrOffsetX; y:=y-GrOffsetY; z:=z-GrOffsetz; new_x := GraphCenterX + Round(GraphScale*(x*Gr3DMat [0,0]+y*Gr3DMat[l,0]+z *Gr3DM

SUBSTITUTE SHEET

-82.616-

{ Have Y mapping just for reference. new_y := GraphCenterY - Round(GraphScale*(x*Gr3DMat [0,l]+y*Gr3DMat[l,l]+z *Gr3DM } new_z := GraphCenterY - Round(GraphScale* (x*Gr3DMat [0,2]+y*Gr3DMat[l,2]+z *Gr3DM end;

procedure Draw3D(xl,yl,zl,x2,y2,z2 : Real);

{ Takes 2 3D points and draws line between them } var coorxl,coory1,coorx2,coory2 : Integer; begin Compute3D(xl,yl,zl,coorxl,cooryl) ; Compute3D(x2,y2,z3,coorx2,coory2) ; Line(coorxl,coory1,coorx2,coory2) ? end;

procedure Init3D; { Sets up 3D transformation matrix for mapping 3D to 2D } var txy,txz,tyz : Real; begin txy := TriangleAngle[3]*0.0175; { Z Axis } txz := TriangleAngle[2]*0.0175; { Y Axis } tyz := TriangleAngle[1]*0.0175; { X Axis }

Gr3DMat[0,0]:= Cos(txz)*Cos(txy) ;

Gr3DMat[l,0]:= Cos(tyz)*Sin(txy)-Sin(tyz)*Sin(txz)* Cos(txy);

Gr3DMat[2,0]:= Sin(tyx)*Sin(txy)-Cos(tyz)*Sin(txz)*

Cos(txy) ; Gr3DMat[0,l]:= Cos(txz)*sin(txy) ;

SUBSTITUTE SHEET

-82.617-

Gr3DMat[l,l]:= Cos(tyz)*Cos(txy)+Sin(tyz)*Sin(txz)*

Sin(txy) ; Gr3DMat[2,l]:= Sin(tyz)*Cos(txy)+Cos(tyz)*Sin(txz)* Sin(txy) ; Gr3DMat[0,2]:= Sin(txz) ;

Gr3DMat[l,2]:= Sin(tyz)*Cos(txz) ; Gr3DMat[2,2]:= Cos(tyz)*Cos(txz) ; end;

{ Start of Main Triangle Routines

}

function FindTriangleLevel(value : Real;highlo : Byte) Word; { Binary search for value and then file lowest or highest common index } var low,mid,high,index : Word; begin low:=0; high:=TriangleTotal; index:=MAX_WORD; repeat mid:=(low+high) div 2; if value<TriangleAxisValue A [mid] then high:=mid else if value>TriangleAxisValue [mid] then low:=mid else index:=mid; until (high-low=l) or (index<MAX_WORD) ; if highlo=l then begin if index=MAX__WORD then index:=high; while (index>0) and (TriangleAxisValue [index-l]= TriangleAxisValue [index]) d end else begin if index=MAX_WORD then index:=low;

SUBSTITUTE SHEET

-82. 618- while (index<TriangleTotal) and (TriangleAxisValue A [index+1]=TriangleAxisValue end;

FindTriangleLevel:=inde ; end;

function ReadTriangle : Boolean;

{ Read in one triangles data from input files current location } var ParsingLine : String; i,j : Word; begin if TriangleFiletype=ASC_FILE then begin TriangleAttrib:=0; ReadLine(TriangleFile) ; { FACET NORMAL i j k } TempStr:=ParseLine(InputLine) ; if TempStr=•END' then begin if ParseLine(InputLine)<>•SOLID' then FileError:= TRUE; EndOfFile:=TRUE; end else begin if (TempStro'FACET') OR (ParseLine(InputLine)<>

'NORMAL') then FileError:=T if Not FileError then for i:= 1 to 3 do begin

Val(ParseLine(InputLine) ,TriangleNormal[i] ,re) ; if rcoo then FileError:=TRUE; end;

ReadLine(TriangleFile) ; { OUTER LOOP } if (ParseLine(InputLine)<>'OUTER') OR (ParseLine (InputLine)o'LOOP') then

ReadLine(TriangleFile) ; { VERTEX } if ParseLine(InputLine)o'VERTEX' then FileError :=TRUE else for j:= 1 to 3 do begin

SUBSTITUTE SHEET

-82. 619-

Val(ParseLine(InputLine) ,TriangleVertex[i,j ]

, re) ; if rcoo then FileError:=TRUE; end; end; end;

ReadTriangle:=Not (FileError or EndOfFile) ; end else begin { A Binary File } for i:=0 to 2 do begin

ConvertStoR(§InBuffer[InBufPtr+i*4] , §Triangle Normal[i+1]) ; end; for i:=0 to 2 do for j:=0 to 2 do ConvertStoR§InBuffer[InBufPtr+ 12+i*12+j*4] ,§TriangleVerte ReadTriangle:=Not EndOfFile; end; end;

procedure GraphTriangles;

{ Graph the selected triangles to screen } var index : Longint; min,max : Real; begin min:=MAX_REAL; max:=MIN_REAL; if TriangleWindowingFile then

SetupGraphicR(TriangleFileMin[1] ,TriangleFileMax[l] , TriangleFileMin[2] ,TriangleFileMax[2] ,

TriangleFileMin[3] ,TriangleFileMax[3] , else

SetupGraphicR(TriangleSeleetMin[1] , TriangleSelect Max[l], TriangleSeleetMin[2] ,TriangleSelectMax[2] ,

SUBSTITUTE SHEET

-82.620-

TriangleSelectMin[3] ,TriangleSelectMax[3] , Init3D; GrTextXY('Triangle Filename : '+TriangleFilename, ι,i) Str(TriangleSelected,TempStr) ;

GrTextXY('Triangles Displayed : •+TempStr,1,2); index:=0 repeat if (TriangleAxisValue [index]>TriangleSelectstart) and

(TriangleAxisValue [index]<=TriangleSelectEnd) then begin PositionFile(TriangleFile,TrianglePtr A [index]) ; TempBoolean:=ReadTriangle; if abs(TriangleNormal[TriangleAxis])>l-ZERO_DEF then if TriangleNormal[TriangleAxis]>0 then

SelectGraphColor(LightGreen) {FU} else SelectGraphColor(LightBlue) {FD} else if TriangleNormal[TriangleAxis] .0 then

SelectGraphColor (Green) {U} else SelectGraphColor(Blue) ; {D}

Draw3D(TriangleVertex[1,1],TriangleVertex[1,2], TriangleVertex[1,3],

TriangleVertex[2,1],TriangleVertex[2,2],

TriangleVertex[2,3]; Draw3D(TriangleVerte [2,1],TriangleVertex[2,2] ,

TriangleVertex[2,3], TriangleVertex[3,1],TriangleVertex[3,2],

TriangleVertex[3,3]; Draw3D(TriangleVertex[3,1],TriangleVertex[3,2],

TriangleVertex[3,3], TriangleVertex[1,1],TriangleVertex[1,2], TriangleVertex[1,3]); end; if Not KeyPressed then Inc(Index)

SUBSTITUTE SHEET

-82. 621- else Index:=TriangleTotal+l; until Index>TriangleTotal; SetColor(LightGray) ; if KeyPressed then begin TempChar:=ReadKey;

GrTextXY(•Drawing ABORTED',1,3); end else GrTextXY('Drawing Complete',1,3); end;

procedure PrintRealRange(Strl,Str2 : String;min,max : Real) ;

{ Prints Range values on line for parameters } begin

GotoXY(3,WhereY) ; TextColor(LightGray) ; write(Copy(Strl+' ',1,12),': ); TextColor(White) ; write(min:16:8) ; GotoXY(42, hereY) ; TextColor(LightGray) ; write(Copy(Str2+' ',1,12),': ); TextColor(White) ; write(max:16:8) ; end;

procedure PrintTriangleMenu; { Print out Triangle Main Menu } var i : Word; begin

PrintTriHeader; GotoXY(3,5);

TextColor(LightGray) ; write('Triangle Filename : '); TextColor(White) ; write(TriangleFilename) ; GotoXY(3 ,WhereY+l) ;

SUBSTITUTE SHEET

-82.622-

TextColor(LightGray) ; write('Total Triangles: '); TextColor(White) ? writeln(TriangleTotal+1) ; for i:= 1 to 3 do begin GotoXY(1,WhereY+1) ;

PrintRealRange(•File '+COOR_CHAR[i]+' Min• , •File » +COOR_CHAR[i]+' Max', Triang end; GotoXY(3,WhereY+2)

TextColor(LightGray) ; write('Total Selected : *) ; TextColor(White) ; writeln(TriangleSelected) ; PrintRealRange('Selected Min' , 'Selected Max' ; TriangleSelectStart,TriangleSelectEnd) ; for i:= 1 to 3 do begin GotoXY(1,WhereY+l) ;

PrintRealRange(•Sel. •+C00R_CHAR[i]+' Min• , 'Sel. '+C00R_CHAR[i]+' Max',

TriangleSeleetMin[i] ,TriangleSelectMax[i] ; end;

TextColor(LightGray) ; GotoXY(3,WhereY+2) ; for i:=l to 3 do write(C00R_CHAR[i], ' '); write('Axis Rotation: '); TextColor(White) ; for i:= 1 to 3 do write(TriangleAngle[i] , ' '); GotoXY(60,WhereY) ; TextColor(LightGray) ; write('Windowing by •); TextColor(White) ; if TriangleWindowingFile then write('File') else write('Range') ; GotoXY(3,WhereY+2) ;

TextColor(LightGray) ; write('Slice Axis is ');

SUBSTITUTE SHEET

-82.623-

TextColor(White) ; write(COOR_CHAR[TriangleAxis]) ; GetXY(l,24) ; TextColor(White) ; write(•Commands: (New file. Select range, Windowing, Rotation, Axis, Graph):'); end;

procedure Switch(var First : Word ; var Second : Word) ; begin TempReal := TriangleAxisValue A [First] ;

TriangleAxisValue A [First] :=TriangleAxisValue A [Second] ; TriangleAxisValue A [Second] :=TempReal; TempLong := TrianglePtr A [First] ; TrianglePtr A [First] :=TrianglePtr [Second] ; TrianglePtr A [Second] :=TempLong; end;

procedure Quicksort(Left,Right : Word) ; var

Leftlndex,Rightlndex : Word; KeyValue : Real; begin if Left < Right then begin Leftlndex := Left ; Rightlndex := Right + 1 ; KeyValue := TriangleAxisValue A [Left] ; repeat repeat Inc(Leftlndex) until TriangleAxisValue A [Leftlndex] >= KeyValue; repeat Dec(Rightlndex) ; until TriangleAxisValue A [Rightlndex] <= KeyValue; if Leftlndex < Rightlndex then Switch(Leftlndex, Right Index) ; until Leftlndex >= Rightlndex;

SUBSTITUTE SHEET

-82.624-

Switch(Left, Rightlndex) ; Quicksort(Left,Rightlndex - 1) ; Quicksort(Rightlndex + 1 , Right); end; end;

procedure GetTrianglelnfo;

{ Read in Triangle Database } var

FacetCount : Longint; i,j : Word; begin

Center(•<Scanning Triangle File>',25); { Open triangle file } Assign(TriangleFile,TriangleFilename) ; ResetFile(Trianglefile) ; TriangleTotal:=0; for i:= 1 to 3 do begin

TriangleFileMin[i] :=MAX_REAL; TriangleFileMax[i] :=MIN_REAL; TriangleSeleetMin[i] :=MAX_REAL; TriangleSelectMax[i] :=MIN_REAL; end; repeat

{ Skip over file header } if TriangleFiletype=ASC_FILE then begin RealLine(TriangleFile) ; if ParseLine(InputLine)<>'SOLID'then FileError: TRUE;. end else PositionFile(TriangleFile,CurrFilePos+80) ;

{ Read in the triangles } if Not FileError then repeat

TrianglePtr A [TriangleTotal]:=CurrFilePos; { Currently pointing to first tri if ReadTriangle then begin

SUBSTITUTE SHEET

-82 . 625- if (TriangleNormal[1]<>0) or

(TriangleNormal[2]<>0) or (Triangle Normal[3]

TriangleAxisValue A [TriangleTotal] :=MAX_REAL; { set Axis Value to smalle

{ Set Min and Max Values } for i:= 1 to 3 do begin if TriangleVertex[i,TriangleAxis]

<TriangleAxisValue A [Triangle Total] t TriangleAxisValue A [TriangleTotal] :=

TriangleVertex[i, TriangleAxis]; for j:=l to 3 do begin if TriangleVertex[i,j]<TriangleFileMin[j] then TriangleFile Min[j]:= if TriangleVertex[i,j]>TriangleFileMax[j] then TriangleFile Max[j]:= if

TriangleVertex[i,j]<TriangleSelectMin[j] then Triangle SelectMin[ if

TriangleVertex[i,j]>TriangleSelectMax[j] then Triangle SelectMax[ end; end; Inc(TriangleTotal) ; end;

{ Move to next triangle } if TriangleFiletype=ASC_FILE then begin ReadLine(TriangleFile) ; if ParseLine(InputLine)<>•ENDLOOP' then

FileErro:=TRUE; ReadLine(TriangleFile) ; if ParseLine(InputLine)o'ENDFACET' then FileError:=TRUE; end else begin

Move(InBuffer[InBufPtr+48] ,TriangleAttrib.2) ;

SUBSTITUTE SHEET

-82.626-

PositionFile(TriangleFile,CurrFilePos+ TriangleAttrib+50) ; end; end; until (TriangleTotal>Total_Triangles) or FileError or EndOfFile; until (TriangleTotal>Total_Triangles) or FileError or

EndOfFile; if TriangleTotal>Total_Triangles then begin Str(TriangleTotal,TempStr) ;

Center('*** Warning: Maximum of '+TempStr+' triangles read in. Ignoring rest. WaitKey;

FileError:=False; end; if Not FileError then begin

TriangleSelected:=TriangleTotal; Dec(TriangleTotal) ; { Quicksort(0,TriangleTotal) ; } TriangleSelectStart:=TriangleFileMin[TriangleAxis] ; TriangleSelectEnd:=TriangleFileMax[TriangleAxis] ; end; end;

procedure DoTriangle; { User selected Triangle option of Main Menu } var ch : Char; TempReal1 : Real; i,j,k : Word; begin ch := ' '; FileError:=FALSE; repeat if TriangleFilename = • • then ch := 'N' else begin

ResetFile(TriangleFile) ;

SUBSTITUTESHEET

-82 . 627-

PrintTriangleMenu; if ch=' • then repeat ch:= UpCase(ReadKey) ; until (ch = ESC) or (Pos(ch, 'NWSRAG') > 0) ; TextColor(White) ; end; case ch of 'N' : begin if GetFilename(TriangleFilename, 1) then begin

GotoXY(1,24) ; write( 'File " ' ,TriangleFilename, ' " selected.

File type ASCII, Bin repeat TriangleFiletype:=Pos(UpCase(ReadKey) , 'ABR' )

until TriangleFiletype>0

TriangleAxis:=2; { Assume Y }

GetTrianglelnfo; TriangleWindowingFile:=TRUE; for i:= 1 to 3 do TriangleAngle[i] :=0; end; ch:=' •; end; 'W' : begin

TriangleWindowingFile:=Not TriangleWindowing File; ch:=' '; end; 'S' : begin

GotoXY(1,24) ;

ClrEol; write('Select Range Start:'); readln(TempStr) ; ToUpper(TempStr) ; if TempStr='RESET' then begin

SUBSTITUTE SHEET

-82. 628-

TriangleSelectStart := TriangleFileMin

[TriangleAxis] ? TriangleSelectEnd := TriangleFileMax [TriangleAxis]? end else begin

Val(TempStr,TempReal,re) ? if rc=0 then begin GotoXY(l,24) ? ClrEol? writ ('Select Range End: 1 ); readln(TempStr) ; Val(TempStr,TempReal1,re) ; if rc=0 then begin if TempReaKTempReall then begin TriangleSelectStart:=TempReal;

TriangleSelectEnd:=TempReall; end else begin

TriangleSelectStart:=TempReall; TriangleSelectEnd:=TempReal; end; end; end; for i:=l to 3 do begin

TriangleSeleetMin[i] :=MAX_REAL; TriangleSelectMax[i] :=MIN_REAL; end;

TriangleSelected:=0; for i:=0 to TriangleTotal do begin if (TriangleAxisValue A [i]>=TriangleSelect Start) and

(TriangleAxisValue [i]<=TriangleSelectEnd) then begin PositionFile(TriangleFile,TrianglePtr [i]) ; TempBoolean:=ReadTriangle; TempBoolean:=FALSE; for j:=1 to 3 do for k:= 1 to 3 do begin

SUBSTITUTE SHEET

-82 . 629- if TriangleVertex[j ,k]<TriangleSelect

Min[k] then Triangle if TriangleVertex[j ,k]>TriangleSelect Max[k] then Triangle end;

Inc(TriangleSelected) ; end; end; end; ch:=« •; end; •R' : begin

GotoXY(1,24) ; ClrEol; for i:=l to 3 do write(COOR_CHAR[i] , ' •); write('Axis Rotation: '); readln(TempStr) ; for i:=l to 3 do begin

Val(ParseLine(TempStr) ,TempReal,re) ; if (rcoO) or (TempReadoO) or (TempReal>180) then TriangleAngle[i else TriangleAngle[i] :=Round(TempReal) ; end; ch:=' • ; end;

'A' : begin

GotoXY(1,24) ; ClrEol; write( •New Axis: • ) ; repeat

TempByte:=Pos(UpCase(ReadKey) , 'XYZ' ) ; until TempByte>0 if TempByteoTriangleAxis then begin TriangleAxis:=TempByte; Close(TriangleFile) ;

GetTrianglelnfo; end;

SUBSTITUTE SHEET

-82.630- ch:=' '; end; 'G' : begin repeat GraphTriangles; ch:=UpCase(ReadKey) ; until cho'G* ; RestoreCrtMode; end; ELSE if choESC then ch:=' . '; end; until FileError OR (ch = ESC) OR (TriangleFilename=' » ) ; if FileError then begin ASCError(TriangleFilename) ; TriangleFilename:=• ' ; end; end;

{ Start of Main Slice Routines

}

function FindZLayer(value : Word) : Word; { Binary search for Z Value } var low,mid,high,index : Word: begin low:=0; high:=SliceLastLayer? index:=MAX_W0RD if (value>=SliceLayerValue [low]) AND (value<=

SliceLayerValue A [high]) then while (low<=high) AND (index=MAX_WORD) do begin mid:=(low+high) div 2; if value<SliceLayerValue [mid] then high:=mid-l

SUBSTITUTE SHEET

-82 . 631- else if value>SliceLayerValue [mid] then low:=mid+l else index:=mid; end; if index=MAX_WORD then FindZLayer:=high else FindZLayer:=index; end;

function BlockType(var line : String) : Word; { Returns Block Type of String in Word bits B H F

L 0 1 2 (Bits Set)

FU 3 4 5

FD 6 7 8 NFU 9 10 11

MFD 12 13 14

L(level) = 15

Not Found = None

} var bitword : Word; i : Word; begin if Copy(line,1,2)=*L ' then bitword := L_SECTI0N else begin i:=0; While (i<MAX_SECTIONS) AND

(Copy(1ine,1,Length(SIiceBlocks[i]) ) <> SliceBlocks[i] do Inc(i) ; if (i=MAX_SECTIONS) OR (Length(1ine)=Length (SliceBlocks[i]) ) then bitword := $0000 else case (line[Length(SliceBlocks[i]+l]) of « B' : bitword:=l shl (i*3) ;

'H' : bitword:=l shl (i*3+l) ;

SUBSTITUTE SHEET

-82.632-

•F' : bitword:=l shl (i*3+2) ; else bitword:=$0000; end; end;

BlockType:=bitword? end;

function BitOnfnum : Word? bit : Byte) : Boolean; { Tells if a bit is on in number } begin if ((1 shl bit)and num)>0 then BitOn:=True else BitOn:=FALSE; end;

procedure PrintWordRange(Strl,Str2 : String;min,max : Word;control : Longint) ; { Prints Range values . on line for parameters } begin

GotoXY(3, hereY) ; TextColor(LightGray) ; Write(Copy(Strl+' ' ,1,12) , • ; ') ; TextColor(White) ; if control < 0 then write ('Undetermined') else write(min) ; GotoXY(53,WhereY) ; TextColor(LightGray) ; write(Copy(Str2+ « ' ,1,12) , * : •) ; TextColor(White) ; if control < 0 then write('Undetermined') else write(max) ; end;

procedure PrintBlockTable(section : Word) ;

{ Prints the Block table for menu from section value at current location } var

XPos,YPos : Byte;

SUBSTITUTE SHEET

-82.633- i,j : Word; begin

XPos:=WhereX; YPos:=WhereY; for i:= 0 to 4 do begin GotoXY(XPos,YPos+i) ; TextColor(LightGray) ; write(SliceBlocks[i]) ; GotoXY(XPos+4, hereY) ; for j:= 0 to 2 do begin if BitOn(section,i*3+j) then TextColor(White) else if Not MonoDisplay then TextColor(Blue) else TextColor(Black) ; if ((i <> 0) or (j o 2)) then case j of 0 : writeC B') ;

1 : write(• H•) ;

2 : write(' F*) ; end; end; end;

TextColor(White) ; end;

procedure PrintSliceMenu:

{ Prints Slice Menu Screen with all information } begin

PrintsliceHeader; GotoXY(l,5) ; TextColor(LightGray) ; write('Slice Filename : '); TextColor(White) ; write(SliceFilename) ; GotoXY(1,6) ;

PrintWordRange('Layer Start' , 'Layer End , SliceLayerValue A [0] ,SliceLayerValue [S GotoXY(l,7);

SUBSTITUTE SHEET

-82.634-

PrintWordRange('File X Min', 'File X Max',

SliceFileXMin,SliceFileXMax,1) ; GotoXY(1,8) ;

PrintWordRange('File Y Min', 'File Y Max', SliceFileYMin,SliceFileYMax,1) ; GotoXY(1,10) ; TextColor(LightGray) ; write(•Selected Layer : ') ; TextColor(White) ; if SliceLayer=MAX_WORD then..write( None*) else begin write(SliceLayerValue [SliceLayer]) ; GotoXY(1,11) ;

PrintWordRange(•Layer X Min', •File X Max' , SliceLayerXMin [SliceLayer],SliceLa GotoXY(1,12) ;

PrintWordRange( » Layer Y Min', 'File Y Max', SliceLayerYMin A [SliceLayer],SliceLa end; GotoXY(l,14) ;

TextColor(LightGray) ; write('Windowing by *); TextColor(White) ; if SliceWindowingFile then write('File') else write('Layer') ; TextColor(LightGray) ; GotoXY(1,16) ; write('Layer Blocks: •) ; GotoXY(53,16) ; - write('Display Blocks:') ; if SliceLayer<MAX_WORD then begin GotoXY(2,17);

PrmtBlockTable(SliceLayerBlocks A [SliceLayer]) ; GotoXY(54,17) ; PrintBlockTable(SliceOutputBlocks) ; end; GotoXY(l,24);

SUBSTITUTE SHEET

-82.635-

TextColor(White) ; write('Commands: (New file, Layer select, Blocks, Windowing, Graph) : ') ; end;

function ParseSegment(line : String;var xl,yl,x2,y2 Word) : Boolea ; { Parses out a line that should contain 4 segment coords. } var trv : Integer; num : Word; good : Boolean; code : Word; oldlen : Char j : Word; begin good:=TRUE; try:=1; repeat if line[0]=f0 then good:=FALSE else begin if line [1]=' ' then line[l]:='θ'; j:=Pos( ' ' ,line) ; if j+0 then j:=Length(line)+l; oldlen := line[0]; line[0] := Char (j-1) ; Val(line,num,code) ; line[0] := oldlen; if code>0 then good:=FALSE else case (try) of

1 : xl:=num;

2 : yl:=num;

3 : x2:=num;

4 : y2:=num; end; if j>=Length (line) then line:= ' '

SUBSTITUTE SHEET

-82.636- else begin line[0] := Char (Length(line)-j) ; Move(line[j+l],line[l],Integer (line[0])) ; end; end;

Inc(try) ; until (Not good) OR (try>4) ; ParseSegment := good; end;

procedure GetSlicelnfo;

{ Reads a Slice File and sets up Range and Layer information } var sectype : Word; xl,yl,x2,y2 : Word; begin

SliceFileXMin := MAX_WORD; SliceFileXMax := 0; SliceFileYMin := MAX_W0RD; SliceFileYMax := 0;

SliceLayer := MAX_WORD; SliceLastLayer := -1; Assign(SliceFile,SliceFilename) ; Reset(SliceFile,1) ; ResetFile(SliceFile) ; ReadLine(SliceFile) ; repeat if (Not EndOfFile) AND (InputLine[1]<>' ! ') then begin sectype := BlockType(InputLine) ; It sectype = 0 then if (Not ParseSegment(InputLine,xl,y1,x2,y2)) or (SliceLastLayer<0) then else begin { A Segment }

SUBSTITUTE SHEET

-82 . 637-

SetMinMax(xl,SIiceLayerXMin A [SIiceLastLayer]

, SliceLayerXMax A [SliceLas SetMinMax(x2,SliceLayerXMin A t [SliceLastLayer], SliceLayerXMax A [SliceLas

5 SetMinMax(yl,SliceLayerYMin A

[SliceLastLayer] , SliceLayerYMax [SliceLas SetMinMax(y2,SliceLayerYMin A

[SliceLastLayer] , SliceLayerYMax A [SliceLas end 10 else

{ A Block line } if sectype=L_SECTION then begin if SliceLastLayer>=0 then begin if SliceLayerXMin A [SliceLastLayer]< 15 SliceFileXMin then SliceFileXMin if SliceLayerXMax A [SliceLastLayer> SliceFileXMax then SliceFileXMax if SliceLayerYMin [SliceLastLayer]< SliceFileYMin then SliceFileYMin 20 if SIiceLayerYMax A [SliceLastLayer]>

SliceFileYMax then SliceFileYMax end;

Inc(SliceLastLayer) ; if SliceLastLayer>Total_Layers then begin 25 Str(SliceLastLayer,TempStr) ;

Center('Warning - Maximum number of '+TempStr+* Slice layers read', WaitKey;

* end else begin

30 Val(Copy(InputLine,3,255),TempWord,re) ;

* if rcoo then FileError:=TRUE else begin

SliceLayerValue [SliceLastLayer]:=TempWord; 35 SIiceLayerBlocks [S1iceLastLayer] :-$0000;

SIiceLayerPtr A [SliceLastLayer] :=CurrFilePos;

SUBSTITUTE SHEET

-32 . 63δ-

SliceLayerXMin [SliceLastLayer] :=MAX_WORD; SliceLayerXMax [SliceLastLayer] :=0; SliceLayerYMin A [SliceLastLayer] :=MAX_WORD; SliceLayerYMax A [SliceLastLayer] :=0; end; end; end else SliceLayerBlocks [SliceLastLayer] := SliceLayerBlocks [SliceLast end; ReadLine(SliceFile) ; until FileError OR EndOfFile OR (SliceLastLayer>

Total_Layers) ; if Not FileError then begin if SliceLastLayer>Total_Layers then SliceLastLayer:= Total_Layers; if SIiceLayerXMin A [SliceLastLayer]<SliceFileXMin then S1iceFileXMin:=S1iceL if SIiceLayerXMax [SliceLastLayer]>SliceFileXMax then SliceFileXMax:=SliceL if SliceLayerYMin A [SliceLastLayer]<SliceFileYMin then SliceFileYMin:=SliceL if SIiceLayerYMax A [SliceLastLayer]>SliceFileYMax then SliceFileYMax:=SliceL end; end;

procedure GrphS1iceLayer; var sectype,currentsection : Word; xl,yl,x2,y2 : Word; begin if SliceWindowingFile then

SetupGraphicW(SliceFileXMin,SliceFileXMax, SliceFileYMin,SliceFileYMax) else SetupGraphic (SliceLayerXMin A [SliceLayer] , SliceLayer

SUBSTITUTE SHEET

-62. 639-

XMax A [SliceLayer],SliceLayerYMin A [SliceLayer] , SIiceLayerYMax A [SliceLayer]) ; OutTextLn( » Filename: •+SliceFilename) ; Str(SliceLayerValue [SliceLayer] ,TempStr) ; OutTextLn('Layer : *+TempStr) ;

PositionFile(SliceFile,SliceLayerPtr A [SliceLayer]) ; repeat

ReadLine(SliceFile) ; if (Not EndOfFile) AND (InputLine[1]o• ! •) then begin sectype := BlockType(InputLine) ; if sectype=0 then begin { A Segment } if (currentsection>0) AND ParseSegment(InputLine, xl,yl,x2,y2)then

DrawLi end else begin { A Block line } currentsection:=sectype AND SliceOutputBlocks; if currentsection>0 then if currentsection=LB_SECTION then

SelectGraphColor(Blue) else if currentsection=LH_SECTION then SelectGraphColor(LightBlue) else if (currentsection and NFD_SECTIONS)>0 then SelectGraphColor(Red) else if (currentsection and NFUJSECTIONS)>0 then SelectGraphColor(Green) else if (currentsection and FD_SECTIONS)>0 then SelectGraphColor(Light else if (currentsection and FU_SECTIONS)>0 then SelectGraphColor(Light else SelectGraphColor(White) ; end; end; until (sectype=L_SECTION) OR EndOfFile; end;

SUBSTITUTE SHEET

-82.640- procedure DoSlice;

{ User selected Slice option of Main Menu } var ch : Ctiar; i,j : Word? index : Integer; begin ch := « '; repeat if SliceFilename = ' • then ch := 'N' else begin

ResetFile(SliceFile) ; PrintSliceMenu; if ch=' • then repeat ch:= UpCase(ReadKey) ; until (ch = ESC) or (Pos(ch, 'NLBWG') > 0) ; TextColor(White) ; end; case ch of 'N « : begin if GetFilename(SliceFilename,2) then begin Center('<Scanning Slice File>',25); GetSlicelnfo; SliceWindowingFile:=TRUE; SliceLayer:=0

SliceOutputBlocks:=SliceLayerBlocks A [Slice LayerJ; end; ch:= » •; end;

'L' : begin index:=0; Templnt:=l; repeat if Templntoindex then begin

ClrScr; Center('Slice Layer Select',1);

SUBSTITUTE SHEET

-82. 641- for j:=0 to 15 do if j+indez<= SliceLastLayer then begin GotoXY(l+(j mod 4)*20,2+(j div 4)*5); write(SliceLayerValue A [j+index] :5, ' •) ;

PrmtBlockTable(SliceLayerBlocks [j+index]) ; end;

GotoXY(1,24) ; write('+ or - to move forward or back. ENTER to select Level');

Templnt:=index; end; ch:=ReadKey; if (ch='+') and (index+16<=SliceLastLayer) then Inc(index,16) ; if (ch='-' and (index-16>=0) then Dec(index,16) ; until ch=CR; GotoXY(1,24) ; ClrEol; write(•Enter Layer Number: *) ; readln(TempStr) ; if TempStro' ' then begin Val(TempStr,iw,re) ; jw:=FindZLayer(iw) ; if (rcoO) OR (jw=MAX_WORD) then begin Center(•Layer "•+TempStr+•" Not Found' ,24) ; WaitKey; end else begin SliceLayer:=jw

SliceOutputBlocks:=SliceLayerBlocks A [Slice

Layer] ; end; end; ch:=' '; end; •B* : begin

SUBSTITUTE SHEET

-82.642-

GotoXY(l,24) ; ClrEol; write('Enter Block Type to Toggle: ); readln(TempStr) ; ToUpper(TempStr) ;

SliceOutputBlocks:=SliceOutputBlocks xor Block

Type(TempStr) ; ch:=' •; end; 'W' : begin

SliceWindowingFile := not SliceWindowingFile; ch:= » '; end; 'G' : if SliceLayer<MAX_WORD then begin repeat

Graphs1iceLayer; ch:=UpCase(ReadKey) ; until cho*G' ; RestoreCRTMode; end else ch:=* • ;

ELSE if choESC then ch:=' •; end; until (ch = ESC) OR (SliceFilename=' ') ; end;

{

Start of Main Program

> begin

{ Setup Exit routine } ExitSave:=ExitProc; ExitProc:=@MainExit;

{ Determine graphics screen to use } GraphDriver := Detect;

SUBSTITUTE SHEET

-82.643-

SetGraph; RestoreCrtMode;

{ Use this heap location as top of heap for rest of program } Mark(HeapTop) ;

{ Allocate Memory for arrays }

ReAllocate('S' ,16382) ; if Total_Triangles<5000 then ReAllocate('T' ,5000) ;

repeat

PrintHeader;

10 GotoXY(31,WhereY+2) ; write('Graphic Card: •) ; Case GraphDriver of

1 : write('CGA') ;

2 : write('MCGA') ;

15 3 : write('EGA') ;

4 : write('EGA 64') ;

5 : write('EGA Mono•) ;

6 : write( » Reserved') ;

7 : write( 'Hercules Mono') ;

20 8 : write(•ATT400') ;

9 : write('VGA') ;

10: write('PC3270') ; else write( 'Unknown Type ',GraphDriver) ; end;

25 GotoXY(28,WhereY+l) ; write('Graphics Mode: • ,GraphMode, ' ( ' ,SizeX, ' 1

SizeY, •) ') ; * *

GθtθXY(l,25) ; write('Maximum Triangles: ' ,Total_Triangles+l) ;

30 GotoXY(57,25) ; write( •Maximum Layers: ' ,Total_Layers+l) ;

SUBSTITUTE SHEET

-82.644-

GotoXY(29,10) ; write('I. Triangle File Display'); GotoXY(29, hereY+2) ; write(•2. Slice File Display') ; GotoXY(29,WhereY+2) ; write('3. Reallocate f Layers•) ; GotoXY(29,WhereY+2) ; writeCQ. Quit*);

GotoXY(28,WhereY+3) ; write('Enter Selection: •); repeat ch := UpCase(ReadKey) ; until Pos(ch, » 123Q')>0 Case ch of 'l' : if Total_Triangles>=0 then DoTriangle; •2' : if Total_Layers>=0 then DoSlice; •3' : begin

ClrScr; GotoXY(1,24) ; write('Enter number of Slice Layers desired: ') ; readln(TempStr) ; if TempStro' • then begin Val(TempStr,TempReal,re) ; TempLong:=Round(TempReal) ; if (rc=0) and (TempLong>=0) then ReAllocate CS•,TempLong) ; end; end; end; until (ch = 'Q*); TextBAckground(Black) ; TextColor(White) ; ClrScr; end.

SUBSTITUTE SHEET

-82.645- Page 60,132 Title 3D Systems Laser Driver Package

LASER 3D Systems Laser Controller Driver Package Version 2.60

This code constitutes levels 1 and 2, the lowest software levels, of the Laser Controller System.

Copyright (C) Tarnz Technologies, 1987

History:

8/17/87 Ver 2.02 LASER released new identifcation schemes

8/22/87 Ver 2.03 version number updated only

8/25/87 Ver 2.04 version number updated only

11/12/87 Ver 2.30 first Beta software release, version update only

1/25/88 Ver 2.60 version update only

System Equates

current_version equ 0200h ;current software version debug equ 0 ;debug flag

Public And External Declarations

; public code references

SUBSTITUTE SHEET

-82.646-

public laser_entry ;only callable entry point to this pkg public enddata ;segment ends for residency size calc public endqueue public endbkgtask public endcode

public variable references

public laser_int,old_tv,oldjtv,current_status public sys_int_count,sint_counter,bkgnd_int_time

external references

extrn bkg_ins:far ;install background task extrn bkg_insl:far ;change timebase extrn bkg_rmv:far ;remove background task

subttl Operating System Equates page

IBM PC and Compatible Operating System Equates

Equates defining 8259 (Programmable Interrupt

Controller) and 8253 (Programmable Interval Timer) ports and constants.

intaOO equ 2Oh ;8259 PORT intaOl equ 21h ;YET ANOTHER 8259 PORT time_cmd_reg equ 43h ;8253 command register

SUBSTITUTE SHEET

-82..647- tim_ch2 equ 42h ;8253 channel two ppi_port-A equ 6Oh ;8255 port A ppi_port_B equ 61h ;8255 port B ext_bkg equ 4 ;ext background intr signal ppi_port_C equ 62h ;8255 port C

subttl Laser I/O Card Equates page

Laser I/O Card Equates

using John Bell Engineering Card "Universal I/O" 83-064

laserlO equ 300h portAl equ laserlO ;DAC value low byte portBl equ laserIO+1 ;DAC value high byte portCl equ laserIO+2 ; outputs strobeX = ;X-axis DAC strobe (falling edge) strobeY = ;Y-axis DAC strobe (falling edge) strobeZ = ;Z-axis DAC strobe (falling edge) shutter_ctrl = ;laser shutter control (open/ closed)

: inputs posackXY = 16 ;X and Y-axis position acknowledge posackZ = 32 ;Z-axis position acknowledge ctrll eeqquu laserIO+3 ;control fl byte (write only! )

SUBSTITUTE SHEET

-82.648 portA2 equ laserIO+4 portB2 equ laserIO+5 portC2 equ laserIO+6 ctrll2 equ laserIO+7 portA3 equ laserIO+8 portB3 equ laserIO+9 portC3 equ laserIO+10 ctrl3 equ laserIO+11

Miscellaneous

ExtSigs segment at OF600h ;for debugging IntBeg db ? IntEnd db ? ExtSigs ends

subttl Miscellaneous Other Equates And Structures page

; Error codes

err_none equ 0 ;no error err_no_card equ 1 ;no laser interface card found err_not_open equ 2 ;laser channgel not open err_queue_full equ 3 ;background command queue is full err_bad_time equ 4 ;invalid interrupt time err_not_block equ 5 ;not in block mode err_exec_limit equ 6 ;exec limit (f EC S EX's) reached err aadjparam equ 127 ;some other bad parameter err_bad_code equ 255 ;internal code error all equ OFFFFh ;for turning flags off (all- flag)

SUBSTITUTE SHEET

-82 . 649- subttl Structures page

The stack frame defines the locations of the parameters on the stack

stack_frame struc

P_bP dw 0

10 p_dx dw 0 p_cx dw 0 p_bx dw 0

P_ax dw 0

P_ds dw 0

15 p_si dw 0

P_di dw 0 p_es dw 0 p_flags dw 0

P_ip dw 0

20 p_cs dw 0 stack_framd ends

subttl LASER code segment page

ifl

25 !out - Starting pass 1 endif a if2

!out - Starting pass 2

endif

30 subttl Data Segments page LaserData segment public 'DATA'

SUBSTITUTE SHEET

-82. 650-

Block Variables

Execute Queue (must be first item in segment)

- 10 entries of StarPtr [2 bytes], EndPtr [2 bytes]

exec_queue_sιze = 200 ;max f of blocks awaiting processing exec_entry_len = 4 exec_queue_limit = exec_queue_size*exec_entry_len exec_queue db exec_queuβ_limit dup (?) ;queue space

exec_queue_start dw 0 exec_queue_end dw 0

Background Command Queue Variables

bcmd_queue_start dw 0 ;command queue's "hard" limits bcmd_queue_end dw 0 ;real start and end of queue

Execution Block Variables

queue_start dw 0 ;command queue's "soft" limits queue_end dw 0 ;start and end of current block

rem_queue_start dw 0 ;redraw storage of the queue_start rem_queue_end dw 0 ; and queue_end pointers

Background Task Variables

static = 0 ;in static state _off_delay 2 ;in laser turn-off state idle 4 ;in laser system fully idle state

SUBSTITUTE SHEET

-82.651-

_pos_ack = 6 ;in position acknowledge state

_on_delay = 8 ;in laser turn-on state _moving = 10 ;in moving state jpausing = 12 ;in pausing state redrawjpausing = 14 ;redrawing pause state bkgnd node dw _static ;execution mode bkgnd_intr_time dw 1190 ;interrupt interval time sys_int_count dw 10 ;sys int routine tick count sint_counter dw 10 ;sys. int down-counter clear_pointer dw 0 ;start of command queue block delay dw 0 ;general delay downcounter off_delay_count dw 0 ;laser turn-off delay count value on_delay_count dw 0 ;laser turn-on delay count value

HomeXpos dw 0 ;laser beam (X,Y) home position

HomeYpos dw 0

RemXpos dw 0 ;remember beam (X,Y) position here

RemYpos dw 0

XposFract db 0 ;current vector's variables Xpos dw 0

YposFract db 0

Ypos dw 0 deltaX dw 0 deltaY dw 0 steps dw 0 signX db 0 ;sign-extends signY db 0 dummy dw 0 ut_steps dw 0 ;utility downcounting steps

redraw count dw 1 ;redraw pass count

SUBSTITUTE SHEET

-82.652- redraw_delay dw 0 ;redraw delay step_periods dw 10 dup ?multi-pass Step Periods array (1190) markjposition dw 0 ?redraw mark position pass dw 0 ;redraw pass number

Software Interrupt Variables

swi_int dw 0 ;interrupt vector number swi_ofs dw 0 ;old SWI vector swi_seg dw 0

return_code db 0 ;function return code

ls_open s 1 ;laser system initialized ls_interrupt = 2 ;software interrupt vector set bkgήd_idle = 4 ;background in idle state flag redrawing = 8 ;doing redraw operation need tojpause = 16 ;need to pause flag (redraw) current_status dw 0 ;general status register autoshut aode = 1 ;automaticallyopen/close shutter on idle posack node = 2 ;wait for X-Y mirrors position acknowledge block node = 4 ;execution block mode (EX/EC/CL active) shutter = 16 ?open/closed shutter flag laser control dw sshhutter ;laser control word

enddata label far LaserData ends

LaserQueue segment public 'DATA'

SUBSTITUTE SHEET

-82 . 653-

Background Command Queue

6OK workspace can hold approximately 3750 move entries

brand jueue_size = 60000 ;vector circular queue size bcmd_queue_li it = bcmd_queue_size-32 bcmd_queue db bcmd_queue_size+16 dup (?) move_size = 13 ;background command sizes open_shutter_size = 1 close_shutter_size = 1 change_timebase_size = 3 pause_size = 3 setjperiods_size = 2 + 2 * num set_redraw_count_size = 3 set_redraw_delay_size = 3 mark_size = 1 redraw size = 1

endqueue label far LaserQueue ends

subttl Laser Background Task page

Laser Control Background Task

responsible for:

- updating x-axis S y-axis DACs every 100 us

(typ.)

- moving of laser beam

- geometric correction

- shutter control

- idling system while command queue is empty

SUBSTITUTE SHEET

-82.654-

LaserGroup group LaserBackground,LaserCode

LaserBackground segment public 'CODE' assume cs: aserBackground,ds: aserData

high-speed timer 0 interrupt

typically 100 us, settable via software interrupt

laser_int proc far assume cs:LaserBackground,ds:LaserData,es:LaserData

set for interrupt service

push ax in al,ppi_port_B ; signal start of background interrupt and al,all-ext_bkg out ppijport B,al push ds push bx push ex push dx push es push di - push si

background task interrupt service

mov ax,LaserData ;point to laser system variables

SUBSTITUTE SHEET

-82.655- mov ds,ax mov ax,LaserQueue ;point to laser command queue mov es,ax eld ;for block moves moc bx,bkgnd_mode jmp word ptr sc: [bx + offset bkgnd_states]

Background State Address Table

bkgnd_states label word dw static dw off_delay dw idle dw pos_ack dw on_delay dw moving dw pausing dw redrawjpausing

old system timer interrupt vector must be in CS for indirect intersegment jump to

BIOS

old_tv dd ;called every sys_int_count ticks

static state - determine processing

static: test laser_control,block node jnz block

; STREAM MODE

SUBSTITUTE SHEET

-82 . 656- laser commands executed as they are added to table for best throughout and easiest control

stream: mov si,bcmd_queue_start ;any entries in queue? cmp si,bcmd_queue_end jz prep_idle jmp read_queue 7yes, go execute command

BLOCK MODE laser commands executed in blocks to prevent intermediate idles multi-pass redraw of small sets of vectors supported

block: mov ax,queue_start ;finished processing block? cmp ax,queue_end jz blockl jmp readjqueue blockl: test current_status,redrawing ;redrawing? jnz go_redraw mov si,exec_queue_start ;no, something in exec queue? cmp si,exec_queue_end jz prep_idle ;no, idle jmp blockjproc 7yes, go process next block

go_redraw: jmp redrawjpass ;multiple passes

; prepare to idle

SUBSTITUTE SHEET

-82. 657-

prep_idle: test laser_control,autoshut_mode ;if autoshutter mode, close shutter jz home or laser 3ontrol,shutter call set_ctrlj?ort jmp laser off home: mov ax,Xpos ; else remember current position mov RemXpos,ax mov ax,Ypos mov RemYpos,ax mov ax,HomeXpos and home laser beam mov Xpos,ax mov ax,HomeYpos mov Ypos,ax call update_DACs

laser_off: mov ax,off_delay_count ;observe laser turn- off delay cmp ax,0 je set_idle ;if 0, don't delay at all mov delay,ax mov bkgnd node , _of f _delay sdone:jmp int fini

laser turn-off delay state

off_delay: dec delay jnz sdone

SUBSTITUTE SHEET

-82.658- set_idle: mov bkgnd ιιode,_idle ; set idle state

laser system fully idle state

idle: test laser_control,block node jz idlejstream

idle_block: mov si,exec_queue_start ;wait for something in exec queue cmp si,exec_queue_end jnz out_of_idle

idle_set: or current_status,bkgnd_idle ;make sure idle flag is on jmp int_fini

idle_stream: mov si,bcmd_queue_start ;wait for something in command queue cmp si,bcmd_queue_end jz idle_set

out__of_idle and current_status,all-bkgnd_idle ;turn off idle flag test laser_control,autoshut node ;if autoshut mode, open shutter jz repos and laser control,all-shutter call set_ctrl_port jmp laser on

SUBSTITUTE SHEET

-82.659- repos: mov ax,RemXpos ; else reposition laser beam mov Xpos ,ax mov ax,RemYpos mov Ypos,ax call update_DACs

test laser_control,posack node jz laser_on mov dx,portCl ;wait for position acknowledgement in al,dx and dx,posackXY jz laser_on mov bkgnd_mode,_pos_ack

position acknowledge state

pos_ack: mov dx,portCl in al,dx and dx,posackXY jnz sdone mov bkgnd_mode,_static

laser_on: mov ax,on_delay_count ;o: delay cmp ax,0 je set_proc ; :iif 0, don't delay mov delay,ax mov bkgnd node,_on_delay jmp int_fini

SUBSTITUTE SHEET

-82.660- 7 laser turn-on delay state

on_delay: dec delay jz setjproc jmp int_fini

set_proc: mov bkgnd_mode,_static 7set for normal processing test laser_control,block node jz read_queue 7start processing commands immediately

setup for block mode processing

blockjproc: mov si,exec 5ueue_start mov ax, [si] get start index mov bcmd_queue_start,ax 7update command queue's hard start mov queue_start,ax ;set exec block start add si,2 mov ax, [si] ;get end index mov queue_end,ax ;set exec block end add si,2 cmp si,exec_queue_limit ;next index jb blockjprocl mov si,0 blockjprocl: mov exec jueue_start,si jmp block ;catch O-length blocks

; begin processing background command from command queue

SUBSTITUTE SHEET

-82.661-

read jueue: test laser_control,block node jz read_stream read_block: mov si,queue_start ;use right pointer jmp read_queuel read_stream: mov si,bcmd_queue_start read_queuel: mov al,es:[si] ;read next background command inc si ;point to command parameters inc al ; + 1 so that FF becomes 0 xor ah,ah ;computer jump table offset shl ax,l cmp ax.bkgnd_ops_end ;don't use to increase throughout jae ski_bad_token mov bx,ax jmp word ptr cs:[bx + offset bkgnd_ops_tbl]

skip_bad_token: mov bx,l ;skip past bad token jmp end_read_queue ; hope we resync on next byte

bkgnd_ops_tbl label word dw reset jueue ;FF dw move ;0 dw open_shutter ;1 dw close_shutter ;2 dw change_timebase ;3 dw pause ;4 dw set_periods ;5

SUBSTITUTE SHEET

-82.662- dw set_redraw_count ;6 dw set_redraw_delay ?7 dw mark ?8 dw redraw ?9 bkgnd_ops_end equ $-bkgnd_ops_tbl

reset to beginning of command queue Background Command FF (Internal)

reset queue: mov queue_start,0 7zero start pointer jmp static 7go process next command, if any

move/draw vector Background Command 0

move: mov bx,dx ?swap DS SES temporarily for movsw mov ax,es mov ds,ax mov es,bx mov di,offset XposFract mov ex, (move_size+l)/2 ;copy packet from queue to workarea rep movsw mov bx,ds ;swap segments back mov ax,es mov ds,ax mov es,bx mov al,byte ptr deltaX+1 ;computer sign-extends

SUBSTITUTE SHEET

-82.663-

Cbw mov signX,ah mov al,byte ptr deltaY+l cbw mov signY,ah test current_status,need_to__paus jz movel jmp redrawjpause movel: mov bkgnd node, noving mov bx, ove_size

end of reading queue

end_read_queue: text laser_control,block_mode jz end_stream

end_block: mov ax,queue_start add ax,bx cmp ax,bcmd_queue_size ;next start index jb end_read_queuel mov ax,0 ;wraparound command queue (soft) end_read_queue1: mov queue_start,ax jmp set_DACs

end_stream: mov ax,bcmd_queue_start add ax,bx cmp ax,bcmd_queue_size ;next start index jb end_read jueue2 mov ax,0 ;wraparound command queue (hard)

SUBSTITUTE SHEET

-82.664- end_read_queue2: mov bcmd_queue_start,ax jmp set_DACs

moving state - vector processing

movingJ mov ax,word ptr XposFract ;compute new X position add ax,deltaX ;add fract S 1st byte of integer mov word ptr XposFract,ax mov al,bγte ptr Xpos+1 ;add carry to 2nd byte of integer adc al,signX mov byte ptr Xpos+l,al

mov ax,word ptr YposFract ;compute new Y position add ax,deltaY mov word ptr YposFract,ax mov al,byte ptr Ypos+1 adc al,signY ;0 for + deltas, FFh for deltas mov byte ptr Ypos+l,al

dec steps ;count down f steps jnz set_DACs mov bkgnd node,_static ;static state next tick

set laser mirror DACs to appropriate values

set_DACs: call update_DACs

SUBSTITUTE SHEET

-82 . 665-

; return from interrupt

int_fini: dec sint_counter ;call system timer interrupt routine mov ax,sint_countεr ; every (sys_int_count) # ticks cmp ax, 0 je sys_fini pop si ;normal, non-sys interrupt return pop di pop es pop dx pop ex pop bx pop ds mov al,20h acknowledge interrupt out 020h,al sti pop ax iret

sys_fini: mov ax,sys_int_ _count ;reload downcounter mov sint_counter,ax pop si pop di pop es pop dx pop ex pop bx pop ds mov al,20h ; ;rreessiet interrupt to allow laser out 020h,al ;;iinnttierrupts during BIOS operation

SUBSTITUTE SHEET

-82.666- sti pop ax jmp old tv ;continue timer interrupt in

VIOS

bkgnd_local_sbrs proc near page

; Set Output Control Port - shutter control ; set_ctrl port: mov dx,portCl in al,dx ;read existing port

Cl bits test laser_control,shutter ;update for shutter jnz shut_c1osed shut_open: and al,all-shutter_ctrl imp shut_str shut_closed: ;shutter closed if shutter not 0 or al,shutter_ctrl shut_str: out dx,al ret

Update laser beam X and Y Digital to Analog Converters

update_DACs:

set_XDAC: mov ax,Xpos ;output X-pos to laser X asix DAC mov dx,portAl out dx,al inc dx

SUBSTITUTE SHEET

-82 . 667- mov al,ah out dx,al inc dx ;port Cl has strobe lines in al-dx and al,all-strobeX ;falling edge out dx,al or al,strobeX out dx,al

set_YDAC: mov ax,Ypos ;output Y-pos to laser Y-axis= DAC mov d ,portAl out dx,al inc dx mov al,ah out dx,al inc dx ;port Cl has strobe lines in al,dx and al,all-strobeY ;falling edge out dx,al or al,strobeY out dx,al

mov ax,OFFh mov dx,portAl out dx,al inc dx out dx,al ret

pkgnd_local_sbrs endp page

open laser beam shutter Background Command 1

SUBSTITUTE SHEET

-82 . 668-

open_shutter: and laser_control,all-shutter call far ptr set_ctrl mov bx,open_shutter_size jmp end_read_queue

close laser beam shutter Background Command 2

close_shutter: or laset_control,shutter call far ptr set_ctrl mov bx,close_shutter_size jmp end_read_queue

change interrupt time base Background Command 3

change_timebase: mov bx,es: [si] mov ste jperiods,bx ;just alter first step period call bkg_insl ;change time base now mov b ,change_timebase_siz jmp end_read_queue

pause queue processing

SUBSTITUTE SHEET

-82 . 669-

Background Command 4

pause: mov ax,es: [si] mov ut_steps,ax mov bkgnd_mode,jpausing ;set for pausing state mov bx,pause_size jmp end_read_queue

pausing: dec ut_steps ;count down # steps jnz pausingl mov bkgnd_mode,_static ;static state next tick pausingl: jmp int fini

set_periods Background Command 5

set periods: mov cl,es: [si] ;get sp count [1 byte] inc si mov ch,0 ;set high byte to 0 push ex cmp paa,0 ;read sp only on redraw/pass 0 jnz set_periods_skip mov di,offset stepjperiods mov bx,ex:[si] ;get spO mov [di],bx push es call bkg_insl ;set new timer interrupt pop es jmp set_periods_next

SUBSTITUTE SHEET

-82.670- set ?eriods_loop: mov ax,es: [si] ;copy spl, sp2... mov [di],ax ; to step periods array set__periods_next: add si,2 add di,2 dec cl jnz set_periods_loop set_periods_ski: pop bx ;calc size of sp command shl bx,l add bx,set_periods_size jmp end_read_queue

set_redraw_count Background Command 6

set_redraw_count: mov ax,es: [si] mov redraw_count,ax mov bx,set_redraw_count_size jmp end_read_queue

set_redraw_delay Background Command 7

set_redraw_delay: mov ax,es: [si] mov redraw_delay,ax mov bx,set_redraw_delay_size jmp end_read_queue

SUBSTITUTE SHEET

-82.671-

mark

Background Command 8

mark: mov ax,queue_start ;remember current queue position mov mark__position,ax mov bx,mar_size jmp end_read_que

redraw

Background Command 9

set up for redraw

redraw test last_control,block_mode jz no_redraw ;make sure task in block mode mov ax,queue_start mov rem_queue_start,ax ;remember current queue start / end mov ax,queue_end mov rem_queue_end,ax or current_status,redrawing ;turn on redrawing flag

; start a redraw pass

SUBSTITUTE SHEET

-82.672-

redraw pass:

inc pass ;next pass number mov di,pass cmp di-redraw_count ;all passes done? jae finish_redraw shl di,l ; x 2 mov bx,step_periods[di] ;no, change step period

(1..) call bkg_insl cmp redraw_delay,0 ;if redraw_delay > 0, je r draw_pass1 or current_status,need_to_pause ;pause on next vector pos redrawjpass1: mov ax,markjposition ;set redraw start / end mov queue_start,ax mov a ,rem_queue_start mov queue_end,ax mov bx,mark_size ;skip mark or last redraw instruction jmp end_read_queue

finish up redraw

finish__redraw: mov ax,rem_queue_start ;restore queue start / end mov queue_start,ax mov mark_position,ax ;update mark position mov ax,rem_queue_end mov queue_end,ax mov current_status,all-redrawing-need_to_pause ;turn off flags

SUBSTITUTE SHEET

-82.673- ov pass,0 ;set redraw pass to 0 mov bx,step_periods ;set step period 0 call bkg_insl

no_redraw: mov bx,redraw_size ;skip redraw instruction jmp end_read_queue

redrawjpause: mov ax,redraw_delay ;delay this number of timer ticks mov ut_steps,ax mov bkgnd_mode,_redraw_pausing jmp set_DACs ;update DACs with first move position

redraw pausing: dec ut_steps ;count down # steps jz redrawjpausingl jmp int_fini

redrawjpausingl: and current_status,all-need_to_pause ;turn off need-to- pause flag jmp movel ;now, go do vector move

laser_int endp

endbkgtask label far

LaserBackground ends

subttl Copyright Notice page

LaserCode segment public 'CODE' assume cs: LaserCode,ds:Laser Data

SUBSTITUTE SHEET

-82 . 674-

IASER SYSTEM INFORMATION AREA

dw current_version ;current version number dw LaserData ; emory-resident segments dw LaserQueue dw LaserBackground dw LaserCode db 16 dup (0)

COPYRIGHT NOTICE

db 'LASER Controller Version 2.60 Copyright (C) 1988 by Tarnz Technolo subttle Software Interrupt Service page

Laser Software Interrupt Functions

These functions can be called from any high-level language having software interrupt capability.

AH AL

00 — open laser DAC channel and initialize

01 — close laser DAC channel and restore system

02 xx add command to background command queue 02 00 move/draw vector

02 01 shutter open 02 02 shutter closed 02 03 change time base

02 04 pause

03 — reset background command queue

SUBSTITUTE SHEET

-82.675-

04 — get background command queue size

05 xx get_option

05 00 get software interrupt vector number

05 01 get background task interval time

05 02 get laser control word

05 03 get laser status

05 04 get laser turn-off (active to idle) delay

05 05 get laser turn-on (idle to active) delay

05 06 get laser home position

06 xx set_option

06 00 set software interrupt vector number

06 01 set background task interval time

06 02 set laser control word

06 03

06 04 set laser turn-off delay

06 05 set laser turn-on delay

06 06 set lase home position

07 xx background task execution control

07 00 execute command queue to current point and stop 07 01 execute command queue to current point, stop, and clear

07 02 clear command queue (reset queue's start pointer)

08 xx background task redraw control 08 00 set multi-pass step periods

08 01 set redraw pass count

08 02 set redraw delay

08 03 mark position

08 04 perform multi-pass redraw

page

Laser Controller Software Interface Interrupt Handler

SUBSTITUTE SHEET

-82.676-

All calls have the following format:

ah = function code al = sub-function code if applicable

bx..dx are call dependent

On return, the following is always true:

al = error code: 0 - operation was successful

255 - internal error, please report

software interrupt entry point

laser_swi: call far ptr laser_entry iret

laser_entry proc far

; save the working registers on the user's stack for

; the moment until we can switch to the internal stack

pushf push es push di push si push ds push ax push bx push ex

SUBSTITUTE SHEET

82 . 677- push dx push bp mov bp,sp

mov ax,LaserData ;point to laser system variables mov ds,ax mov ax,LaserQueue ;point to laser system queue mov es,ax

decode the function call and dispatch it

mov ax, [bp] .p_ax mov return_code,err_none

convert AH into an index into the function table

mov al,ah ;computer jump table offset xor ah,ah shl ax,l cmp ax,funct_tbl_end jc entry_l mov return_code,err_bad__param ;invalid function code jmp entry_2

call the appropriate procedure

entry_l: mov bx,ax call word ptr sc: [bx + offset funct_tbl]

return to caller with return code

SUBSTITUTE SHEET

-82.678- entry_2: mov ax, [bp] .p_ax mov al,return_code mov [bp] .p_ax,ax mov sp,bp pop bp pop dx

Pop ex pop bx pop ax pop ds pop si pop di pop es popf ret

laser_entry endp

funct tbl label word dw open_laser_and_init ;0 dw close_laser_and_reset ;l dw add_to_bcmd_queue ;2 dw reset_bcmd_queue ;3 dw get_bcmd_queue_size ;4 dw get_option ;5 dw set_option 76 dw bkgnd_exec_ctrl ;7 dw redraw ctrl 78 funct_tbl_end equ $-funct_tbl

subttle setinterrupt page

Set an interrupt vector. The register programming is:

SUBSTITUTE SHEET

-82 . 679-

; BX:AX = CS:IP for the Interrupt Service Routine

DX = interrupt type (number)

Upon return, BX:AX contains the previous interrupt vector

setinterrupt proc near push ds push es push ex push dx push bx push ax mov ax,dx ;first return old vector mov ah,35h ;it will be in ES:BX int 21h mov cx,bx ;save BX mov ax,dx ;now set the new vector mov ah,25h pop dx ;pop AX into DX and so that pop bx ;DS:DX is the desired value mov ds,bx push es ;save ES and CX push ex int 21h pop ax ;restore ES:CX as BX:AX and pop bx ;return pop dx pop ex pop es pop ds ret

setinterrupt endp

subttle Software Interrupt Functions

SUBSTITUTE SHEET

-82 . 680- page

soft_fns proc near

AH = 00: open_laser_and_init

Install background task and initialize variables.

if BX > 0 then use BX to set new background interrupt interval else use previously defined time interval value

open_laser_and_init: call reset_bcmd_(jueue mov bx, [bp] .p_bx or bx,bx jnz open_l mov bx,bkgnd_intr_time open_l: call setjports call set_ctrl call set_bkgnd_time ret

set up 8255 ports on John Bell I/O Card

Al(0-7) output mode 0 7 Bl(0-7) output mode 0

Cl(0-3) output mode 0

Cl(4-7) input mode 0

setjports

SUBSTITUTE SHEET

-82..681- mov dx,ctrll mov al,10001000b ;output control1 byte out dx,al 7doing so reset ports mov dx,portAl ;init ports mov al,00h out dx,al 7port Al, DAC value of 0 inc dx out dx,al ;port Bl inc dx mov dx,portCl mov al,OFFh out dx,al ;port Cl, strobes high ret

page

AH = 01: close_laser_and_reset

Stop background task and clean-up system as much as possible.

close_laser_and_reset: call bkg_rmy mov bkgnd_mode,_static ;static state ret

page

AH = 02: add command to background task's queue

AL COMMAND TYPE ADDED 00 vector move/draw

SUBSTITUTE SHEET

-82 . 682-

01 shutter open

02 shutter closed

03 change time base

? 04 pause

addbcmd tbl label word dw add_vector dw add_shutter_open dw add_shutter_close dw add_change_timebase dw addjpause addbcmd_tbl_end equ $-addbcmd_tbl

add_to_bcmd queue: test current_status,ls_open ;only add vector if. channel open jnz add_bcmdl __ mov return_code,err_not_open ret add_bcmdl: call get_size ;check for near-full background queue cmp a ,bcmd_queue_limit jb add_bcmd2 mov return_code,err_queue_full ret add_bcmd2: mov ax, [bp] .p_ax mov di,bcmd_queue_end mov es:[di],al ;store command type inc di xor ah,ah shl ax,l cmp ax,addbcmd_tbl_end jo add bcmd3

SUBSTITUTE SHEET

-82.683- mov return_code, rr_bad_param ;invalid function ret

; call appropriate function

7 add bcmd3: mov bx,ax call word ptr cs: [bx + offset addbcmd_tbl] ret

AX = 0200: add_vector

Add vector to background command queue.

ES:BX points to vector packet: byte 0 - startX fractional (start coordinates) 1,2 - startX integer

3 - startY fractional 4,5 - startY integer

6,7 - deltaX tract/int (change coordinates) 8,9 - deltaY fract/int 10,11 - incr (# of steps)

add_vector: push ds mov ds,[bp].p_es ;ES:BX point to vector packet mov si,[bp].p_bx eld mov ex, (move_size+l)/2 rep movsw pop ds mov bx,move_size jmp end_store

SUBSTITUTE SHEET

-82 . 684-

AX = 0201: background shutter open

Open laser beam shutter in-line with background sequencing.

add_shutter_open: mov bx,open_shutter_size jmp end_store

AX - 0202: background shutter closed

Close laser beam shutter in-line with background sequencing. add_shutter_close: mov bx,close_shutter_size jmp end_store

AX = 0203: background change time base

Change interrupt time base in-line with background sequencing. add_change_timebase: mov bx, [bp] .p_bx mov es:[di],bx mov bx,change_timebase_size jmp end_store

AX = 0204: temporarily pause background task

Pause background processing in-line with background ; sequencing, addjpause:

SUBSTITUTE SHEET

-82 . 685- mov bx,[bp].p_bx mov es: [di] ,bx mov bx,pause_size

finishing off storing to background queue

end_store: mov ax,bcmd_queue_end ;next end index add ax,bx cmp ax,bcmd_queue_limit ;next start index jb end_storel mov di,ax ;store queue max token mov es:[di],byte ptr OFFh mov ax,0 ; raparound queue end_storel: mov bcmd_queue_end,ax ret page

AH = 03: reset_bcmd_queue

Throw away all commands currently in background command queue. Current background task operations are suspended.

reset_bcmd_queue: pushf ;will stop current operation cli mov a ,exec_queue_end mov exec_queue_start,ax mov ax,bcmd_queue_end ;force queues to zero length

SUBSTITUTE SHEET

-82.686- mov bcmd_queue_start,ax ;and make background routine idle mov clearjpointer,ax mov ax,queue_end mov queue_start,ax and current_status,all-redrawing-need_to pause

7no redraw mov pass,0 mov bkgnd mode,_static ;will enter idle state popf ret

page

AH = 04: get_bcmd_queue_size

Return the number of bytes currently used by background command queue in BX.

get_bcmd_queue_size: call get_size mov [bp] .p_b ,ax ret

get_size: pushf cli mov ax,bcmd_queue_end 7try end-start sub ax,bcmd_queue_start jnc get_sizel

.

7 add in background command queue size for negative numbers 7 won't be perfectly accurate on queue wraparound

SUBSTITUTE SHEET

-82.687-

. add ax,bcmd_queue_size get_sizel: popf ret

page

AH = 05 : get_option

; Return laser control option:

AL OPTION RETURNED

00 Software interrupt vector number

01 background task interval time

02 laser control word

03 laser status

04 laser turn-off delay tick count

05 laser turn-on delay tick count

06 laser beam home position

goptn_tbl label word dw get_int_vector dw get_bkgnd_time dw get_laser_ctrl dw get_status dw get_off_count dw get_on_count dw get_home_pos goptn_tbl_end equ $-goptn_tbl

get_option: mov ax, [bp] .p_ax xor ah,ah

SUBSTITUTE SHEET

-82.688- shl ax,l cmp ax,goptn_tbl_end jo go_l mov return_code,err_bad para ;invalid function ret

go_l: call appropriate function

mov bx,ax call word ptr cs:[bx + offset goptn_tbl] ret

AX - 0500: get software interrupt vector number

BL gets interrupt vector number

get__int_vector: mov ax,swi_int mov bx, [bp] .p_bx mov bl,al mov [bp] .p_bx,bx ret

AX - 0501: get background task interrupt interval time

BX gets timer parameter: intr freq = BX / 1.19 MHz (e.g. if BX = 119, freq is 100 us)

get_bkgnd_time: mov bx,bkgnd_intr_time

SUBSTITUTE SHEET

-82.689- ov [bp] .p_bx,bx ret

AX = 0502: get laser control word

get_laser_ctrl: mov bx,laser_control mov [bp] .p_bx,bx ret

AX = 0503: get laser status

get_status: mov ax,current_status ;return current_status in BX mov [bp] .p_b ,ax mov dx,portCl ;return Port Cl inputs in Cx in al,dx shl al,l shl al,l shl al,l shl al,l mov ah,0 mov [bp] .p_cx,ax ret

AX = 0504: get laser turn-off delay count

get_off_count: mov bx,off_delay_count ; return off tick count mov [bp] .p_bx,bx ret

AX = 0505: get laser turn-on delay count

SUBSTITUTE SHEET

-82. 690-

get_on_count: mov bx,on_delay_count ;return on tick count mov [bp].p_bx,bx ret

AX = 0506: get laser home position

get_homejpos: mov b ,HomeXpos mov [bp] .p_bx,bx ;home X-posi ion in BX mov cx,HomeYpos mov [bp] .p_cx,cx ;home Y-position in CX ret page

AH = 06: set_option

; Change laser control option:

AL OPTION CHANGED

00 software interrupt vector number

01 background task interval time

02 laser control word

03 -

04 laser turn-off delay tick count

05 laser turn-on delay tick count

06 laser beam home position

soptn_tbl label word dw set_int_vector dw set_bkgnd_time dw set_laser_ctrl dw no so

SUBSTITUTE SHEET

-82 . 691- dw set_off_count dw set_on_count dw set_home_pos soptn_tbl_end equ $-soptn_tbl

set_option: mov ax, [bp] .p_ax xor ah,ah shl ax, 1 cmp ax,soptn_tbl_end jc so_l mov return_code,err_bad_param ;invalid function ret

so 1: call appropriate function

mov bx,ax call word ptr cs:[bx + offset soptn_tbl] no so: ret

AX = 0600: set software interrupt vector number

if BL = 0, ; then if vector previously set, then restore old vector ; else do nothing

; else use BL to set software interrupt vector number

set_int__vector: mov bx, [bp] .p_bx or bl,bl jz set_int_l

SUBSTITUTE SHEET

-82.692- xor bh,bh mov swi_int,bx mov dx,bx mov ax,offset laser_swi mov bx,cs call setinterrupt or current_status,ls_interrupt mov swi_seg,bx mov swi_ofs,ax ret

set int l:

restore old interrupt vector

test current_status,ls_interrupt jnz set_int_2 ret

set_int_2: mov bx,swi_seg mov ax,swi_ofs mov dx,swi_int call setinterrupt and current_status,all-ls_interrupt ret

AX = 0601: set background task interrupt interval time activate background task if not already running

BX has timer parameter: intr freq = BX / 1.19 MHz

(e.g. if BX = 119, freq is 100 us)

SUBSTITUTE SHEET

-82 . 693-

set_bkgnd_time: mov bx, [bp] .p_bx mov stepjperiods,bx call bkg_ins ret

AX = 0602: set laser control word

set_laser_ctrl: mov bx, [bp] .p_bx mov laser_control,bx

set control bits

set ctrl mov dx, ortCl in al,dx ; read existing port Cl bits test laser_control,shutter ;update for shutter jnz shutter_closed shutter_open: and al,all-shutter_ctrl jmp shutter_str shutter_closed: ;shutter closed if shutter not 0 or al,shutter_ctrl shutter_str: out dx,al ret

AX = 0604: set laser turn-off delay count

SUBSTITUTE SHEET

-82.694- εet_of _count: mov bx, [bp] .p_bx ;set off tick count mov off_delay_count,bx ret

7 AX = 0605: set laser turn-on delay count

set_on_coun : mov bx, [bp] .p_bx ;set on tick count mov on_delay_count,bx ret

AX = 0606: set laser home position

set_homejpos: mov bx, [bp] .p_bx ;home X-position in BX mov HomeXpos,bx mov ex, [bp] -p_cx ;home Y-position in

CX mov HomeYpos,ex ret page

AH = 07: control background task's execution

only functional when Block Mode is on (laser_control bit 2)

AL EXECUTION CONTROL ESTABLISHED

00 execute command block

01 execute and clear command block

SUBSTITUTE SHEET

-82.695-

02 clear command block

exec_ctrl_tbl label word dw exec dw exec_clear dw clear exec_ctrl_tbl_end equ $-exec_ctrl_tbl

bkgnd_exec_ctrl: test current_status,ls_open ;continue only if channel open jnz exec_ctrll mov return_code,err_not_open ret exec_ctrll: test laser_control,block_mode ; and in block mode

]nz exec_ctrl2 mov return_code,err_not_block exec_ctrl2: mov ax, [bp] .p_ax mov di,bcmd_queue_end xor ah,ah shl ax,l cmp ax,exec_ctrl_tbl_end jo exec_call mov return_code,err_badjparam invalid function ret

call appropriate function

exec_call: mov bx,ax call word ptr cs: [bx + offset exec_ctrl_tbl] ret

SUBSTITUTE SHEET

-82 . 696-

AX = 0700: execute command block

Execute command queue entries from last Clear Operation to the last command entered.

exec: mov bx,exec_queue_end 7check for full exec queue mov si,bx add bx,exec_entry_len cmp bx,exec_queue_limit jb execl mov bx,0 7 raparound execl: cmp bx,exec_queue_start; full if indexes are equal jne exec2 mov return_code,err_exec_limit ret exec2; mov ax,clearjpointer mov [si],ax ?establish block to execute: add si,2 ; from clearjpointer (set by clear mov ax,bcmd_ _queue_eϊnd routine) to current end of mov [si] ,ax 7 command queue mov exec_queue_ _end, ,bx t • ret

AX = 0701: execute and clear command block

Execute command queue entries from last Clear

SUBSTITUTE SHEET

-82.697- Operation and then Clear.

exec_clear: call exec set up exec block cmp return_code,0 je clear ;fall into clear if no error ret

AX = 0702: clear command block

Reset the start of the command block for future Execute Operations.

clear: mov ax,bcmd_queue_end ;set clear pointer to current end mov clear_pointer,ax ; of command queue ret page

AH = 08: background task's redraw control

AL REDRAW CONTROL ESTABLISHED

00 set multi-pass step periods

01 set redraw count

02 set redraw delay

03 mark position

04 perform multi-pass redraw

redraw_ctrl_tbl label word dw add_set_periods dw add set redraw count

SUBSTITUTE SHEET

-82 . 698- dw add_set_redraw_delay dw add_mark_position dw add_redraw redraw_ctrl_tbl_end equ $-redraw_ctrl_tbl

redraw_ctrl: test current_status,ls_open ;continue only if channel open jnz redraw_ctr11 mov return_code, rr_not_open ret redraw_ctrl1: test laser_control,block_mode ;and in block mode jnz redraw_ctr12 mov return_code,err_not_block redraw_ctrl2: call get_size ;check for near-full queue cmp a ,bcmd_queue_limit jb redraw_ctr13 mov return_code,err_queue_full ret redraw_ctrl3: mov ax, [bp] .p_ax add al,5 ;token val = subcmd # + 5 mov di,bcmd_queue_end mov es:[di],al ;store token inc di mov ax, [bp] .p_ax xor ah,ah shl ax,l cmp ax,redraw_ctrl_tbl_end jc redraw_call mov return_code, rr_bad_param ;invalid function ret

SUBSTITUTE SHEET

-82 . 699-

; call appropriate function

. redraw_call: mov bx,ax call word ptr cs:[bx + offset redraw_ctrl_tbl] ret

AX = 0800: add set multi-pass step periods to command queue

Add the set multi-pass step periods token and the variable size argument to the Background Command Queue

ES:BX points to step periods array: byte 0 - number of step periods (byte) 1,2 - step period pass 0 (word) 3,4 - step period pass 1 (word) etc.

add_set_periods: push ds mov ds,[bp].p_es ;ES:BX points to step periods array mov si, [bp] .p_bx eld ;for movsw, DS:SI+ ->

ES:DI+ mov cl,ds: [si] ;get # step periods, word count mov ch,0 mov es: [di] ,cl inc si inc di cmp ex,10 ; ;mmax of 10 passes jbe add_set_periodsl mov ex,10

SUBSTITUTE SHEET

-82 .700- add set periods1: mov bx,cx shl bx,l 7compute laser command size add bx,set_periods_size rep movsw pop ds jmp end_store

; AX = 0801: add set redraw count" to command queue

7 Add the set redraw count token and argument to the 7 Background Command Queue

. add_set_redraw_count: mov bx, [bp] .p_bx mov es: [di] ,bx mov bx,set_redraw_count_size jmp end_store

; AX = 0802: add set redraw delay to command queue ;

; Add the set redraw delay token and argument to the

; Background Command Queue

. add_set_redraw_delay: mov bx, [bp] .p_bx mov es : [di] ,bx mov bx , s et_redraw_delay_s i z e jmp end_store

SUBSTITUTE SHEET

-82 . 701-

AX = 0803: add mark position to command queue

Add the mark position token to the Background Command Queue

add_mark_position: mov bx,mark_size jmp end_store

AX = 0804: add redraw to command queue

Add the redraw token to the Background Command Queue ; add_redraw: mov bx,redraw_size jmp end_store

soft_fns endp

endcode label far

LaserCode ends

end

SUBSTITUTE SHEET

-82.702- DISKOFF.ASM

Page 60,132

Title DISKOFF Turn Floppy Disk's Motor Off

DISKOFF Turn Floppy Disk's Motor Off

This program turns off the floppy disk drive's motor which isn't automatically turned off by the OS. By installing the variable-speed sterolithography laser controller code, we have trapped out the system clock which would have automatically time-out the floppy disk drive(s) .

Version 1.00 (c) Copyright Tarnz Technologies, 1987

name diskoff

System Data

sysdata segment at 4Oh org 03Fh motor_status db ? motor_eount db ? sysdata ends

subttl DiskOff Code page

DiskOff Code

SUBSTITUTE SHEET

-82 .703-

DiskOffCode segment public 'CODE' assume cd:DiskOffCode,ds:sysdata,ss:stack

nomotor proc far mov ax,sysdata mov ds,ax mov motor_count,0 and motor_status,OFOh ;turn off motor running bits mov al,OCh mov dx,03f2h ;FDC control port out dx,al ;turn off the motor

mov ax,4DOoh ;exit back to DOS int 21h ret

nomotor endp

DiskOffCode ends

stack segment para stack 'STACK' db 32 dup (0) stack ends

end nomotor

3D Systems Stereolithography System Software

MATERIAL.BAS

SLA-1 Material Manager Software

History:

12/01/87 Ver 2.30 first release

SUBSTITUTE SHEET

-82.704-

' 12/14/87 Ver 2.40 handles line widths min and max, computes MSA 12/17/87 Ver 2.41 FN zero conditions handled

(divide, LOG)

' 1/08/88 Ver 2.50 relabeled Calc MSA due to MSA concept problems ' 1/25/88 Ver 2.60 version update only

DIM SP[20] ,LH[20] ,WMIN[20] ,WMAX[20]

VersionId$ = "2.60" TRUE = -1 FALSE = 0 ScanFlag! = FALSE

SingleBar$ = STRING$(45,196) PowerFile$ = "POWER.LST" LastMaterialFileS = "MATERIAL.LST"

COLOR 15 MatAsk:

CLS

PRINT SingleBar$

PRINT " MATERIAL, Material Manager"

PRINT " 3D Systems Laser Stereolithography System" PRINT " Version "+VersionId$+" 3D Systems, Inc."

PRINT SingleBar$

PRINT

IF LEN(MaterialFile$)>0 THEN PRINT " Material File:

";MaterialFile $

PRINT

PRINT " 1. Load Material Data"

PRINT " 2. View Material Data"

SUBSTITUTE SHEET

-82.705-

PRINT " 3. Input New Material Data" PRINT " 4. Layer Thickness Information" PRINT " Q. Quit" PRINT PRINT " Option: MatAskLoo :

A$ = UCASE$(INKEY$)

IF LEN(A$)=0 THEN MatAskLoop

PRINT A$;

IF A$="l" THEN LoadMaterial

IF A$="2" THEN ViewMaterial

IF A$="3" THEN InputMaterial

IF A$="4" THEN Layerlnfo

IF A$="Q" THEN END

LoadMaterial:

CLS

PRINT "Available Material Files:"

PRINT ON ERROR GOTO NoMaterialFiles

FILES "*.MAT"

GOTO GetMaterialAsk NoMaterialFiles:

PRINT "- no material files in working directory -" RESUME GetMaterialAsk GetMaterialAsk:

PRINT

INPUT "Name of data file to read: ",MaterialFile$

IF LEN(MaterialFile$)=0 THEN MatAsk MaterialFile$ = UCASE$(MaterialFile$)

IF INSTR(MaterialFile$,".")=0 THEN MaterialFile$ = MaterialFile$ + ".MAT"

ON ERROR GOTO CantReadMaterialFile

GOSUB GetMaterialFileData OPEN LastMaterialFileS FOR OUTPUT AS #9

SUBSTITUTE SHEET

-82 .706-

PRINT #9,MaterialFile$ CLOSE #9 GOTO MatAsk

GetMaterialFileData: OPEN MaterialFile$ FOR INPUT AS #7 ON ERROR GOTO 0 INPUT #7,MaterialLaserPower INPUT 7,NumberOfPairs! FOR I! = 1 TO NumberOfPairs! INPUT #7,SP(I%) INPUT 7,LH(I!) INPUT #7,WMIN(I!) INPUT #7,WMAX(I!) SP(I!) = LOG(SP(I!) )/LOG(10) NEXT I! CLOSE #7

CALL Regression(LH() ,LHSlope,LHYint,LHRval) CALL Regression(WMINO ,WMINSlope,WMIN int,WMINRval) CALL Regression(WMAX() , MAXS1ope, MAXYint, MAXRval) RETURN

CantReadMaterialFile:

PRINT "Can't read material file ";MaterialFile$

CLOSE #7

RESUME GetMaterialAsk

InputMaterial: CLS

PRINT "INPUT MATERIAL DATA" PRINT PRINT

INPUT "Name of Material Data File: ",MaterialFile$ MaterialFile$ = UCASE$(MaterialFile$)

SUBSTITUTE SHEET

-82 . 707-

IF LEN(MaterialFile$)=0 THEN MatAsk

IF INSTR(MaterialFile$,".")=0 THEN MaterialFile$ = MaterialFile$ + ".MAT" PRINT INPUT "Enter Material Test Laser Power Reading (mW) :

",MaterialLaserPower INPUT "How many Step Period/Line Height data pairs?

",NumberOfPairs! PRINT ON ERROR GOTO 0

FOR I! = 1 TO NumberOfPairs! PRINT "Data pair #"?I%?": ";

INPUT "SP = ",SP(I!)

LOCATE CSRLIN-1,30 INPUT " LH = ",LH(I!)

IF SP(I!)=0 OR LH(I!)=0 THEN MatAsk • abort

SP(I!)=LOG(SP(l!) )/LOG(10) • convert to log(sp)

LOCATE CSRLIN-1,45

INPUT "WMIN = ",WMIN(I%) LOCATE CSRLIN-1,60

INPUT "WMAX = ",WMAX(I!) NEXT I!

OPEN MaterialFile$ FOR OUTPUT AS #7 PRINT #7,MaterialLaserPower PRINT #7,NumberOfPairs!

FOR I! = 1 TO NumberOfPairs!

PRINT #7,10 A SP(I!)

PRINT #7,LH(I!)

PRINT #7, MIN(I!) PRINT #7,WMAX(I!) NEXT I! CLOSE #7

OPEN LastMaterialFile$ FOR OUTPUT AS #9 PRINT f9,MaterialFile$ CLOSE #9

CALL Regression(LH() ,LHSlope,LHYint,LHRval)

CALL Regression(WMINO ,WMINSlope, MINYint, MINRval)

SUBSTITUTE SHEET

-82 .708-

CALL Regression(WMAXO ,WMAXSlope,WMAXYint,WMAXRval) GOTO MatAsk

ViewMaterial: CLS

PRINT "Data from Material File: ";MaterialFile$ PRINT PRINT

PRINT "Material Test Laser Power Reading: "; PRINT USING ••###.## » ; aterialLaserPower PRINT

PRINT NumberOfPairs!;"Material Data Pairs:" PRINT

FOR I! = 1 TO NumberOfPairs! PRINT USING "ff. ";I!;

PRINT USING " SP = ####.##";10 A SP(I!) ; LOCATE ,20

PRINT USING " LH = ####.## » ;LH(I!) ? LOCATE ,35 PRINT USING " WMIN = ### .ff";WMIN(I!) ; LOCATE ,52

PRINT USING " WMAX = f ##.##";WMAX(I!) NEXT I! PRINT PRINT " LH: Slope .=";

PRINT USING "#####.##";INT(LHSlope*1000)/1000; PRINT " Y-Intercept =";

PRINT USING "#####.##";INT(LHYint*100)/100; PRINT " R-Value ="; PRINT USING "#####.#f"7INT(LHRval*1000)/1000 PRINT "WMIN: Slope ="?

PRINT USING " ###.##" INT(WMINSlope*1000)/1000; PRINT " Y-Intercept =' » ;

PRINT USING "ff ff.##";INT(WMINYint*100)/100; PRINT " R-Value =";

SUBSTITUTE SHEET

-82 .709-

PRINT USING "#####.##";INT(WMINRval*1000)/1000 PRINT "WMAX: Slope =";

PRINT USING "#### . ";INT(WMAXSlope*1000)/1000? PRINT " Y-Intercept =", PRINT USING "#### .##";INT(WMAXYint*100)/100; PRINT " R-Value =";

PRINT USING "#####.##";INT(WMAXRval*1000)/1000 PRINT

INPUT "Press Enter to continue... ",A$ GOTO MatAsk

Layerlnfo: CLS

PRINT "LAYER THICKNESS INFORMATION" PRINT PRINT

INPUT "Desired max layer thickness (mils): ",T$ T = VAL(T$) ' to simulate cure depth IF T=0 THEN GOTO MatAsk PRINT

PRINT

WMIN = FN GetLog(T+6,WMINSlope, MINYint)

WMAX = FN GetLog(T+6,WMINSlope, MINYint) 1 MSA = 180/3.1415926535*(2*T/(WMIN+WMAX) ) ' wrong » IF MSA<0 THEN MSA=0

1 IF MSA>89.999 THEN MSA=90

PRINT USING "WMIN = ####.##";WMIN;

PRINT USING " WMAX = ####.##",'WMAX 1 PRINT USING " MSA = ###.##";MSA don't show yet PRINT

INPUT "Press Enter to continue... ",A$ GOTO MatAsk

SUBSTITUTE SHEET

-82 . 710-

SUB Regression(Array(1) ,Slope, int,Rval) SHARED NumberOfPairs!,SP() XY = 0 SUMX = 0 SUMY = 0 SUMY2 = 0 XSQUARED = 0

IF NumberθfPairs!<l THEN Slope = 0 Yint = 0 Rval = 0 GOTO EndRegSub END IF

FOR I! = 1 TO NumberOfPairs! XY = XY + SP(I!) * Array(I!) SUMX = SUMX + SP(I!) SUMY = SUMY + Array(I!) SUMY2 = SUMY2 + Array(l!) A 2 XSQUARED = XSQUARED + SP(I!) A 2 NEXT I!

Denom = XSQUARED - (SUMX 2) / NumberOfPairs! IF Denom < 1E-5 THEN Slope = 0_

ELSE Slope = (XY - (SUMX*SUMY)/NumberOfPairs!) / Denom Yint = SUMY/Nu berOfPairs! - Slope * SUMX/NumberOfPairs!

Denom = SUMY2 - SUMY A 2 / NumberOfPairs! IF Denom < 1E-5 THEN Rval = 0_

ELSE Rval = SQR(((Yint * SUMY + Slope * XY) - SUMY A 2/NumberOfPairs!) / Denom) EndRegSub: END SUB

DEF FN GetLog(DataPoint,Slope,Yint) IF DataPoint > 0 THEN

FN GetLog = Slope * L0G10(DataPoint) + Yint ELSE

FN GetLog = 0

SUBSTITUTE SHEET

-82.711-

END IF END DEF

UTILITY FUNCTIONS AND PROCEDURES

Removes all double spaces in CmdLine$

RemoveDoubleSpaces:

WHILE INST (CmdLine$," ")>0 I = INSTR(CmdLine$," ")

CmdLine$ = left$(CmdLine$,I) + mid$(CmdLine$,1+2,99) WEND

RETURN

' Find any char of Char$ in Main$ starting at index Start » Returns LEN(Main$)+l if no character of Char$ in Main$

I

DEF FN Findstr(Start%,Main$,Char$) LOCAL I!,J!,MIN! MIN! = LEN(Main$) + 1 FOR I!=l to LEN(Char$)

J! = INSTR(Start!,Main$,MID$(Char$,I!,l)) IF (J! > 0) AND (J! < MIN%) THEN MIN! = J! NEXT I! FN FindStr = MIN! END DEF

Make a string from a number without a leading space

SUBSTITUTE SHEET

-82 .712-

DEF FN StrNoSp$(Num)

LOCAL A$

A$=STR$(Num)

IF LEFTS(A$,1)=" " THEN A$=RIGHT$(A$,LEN(A$)-1)

FN StrNoSp$ = A$ END DEF

' Pick out a number from a string

' starting at Index and going to the next space or comma or end-of-string

I

SUB UnitValInt(Storages,Text$,Index!) Storages = VA (MID$(Text$,Index!)) Index! = FN FindStr(Index!, ext$," ,") + 1 END SUB

SUB UnitVal(Storage,Text$,Index!) Storage = VAL(MID$(TextS,Index!) ) Index! = FN FindStr(Index!,TextS," ,") + 1

END SUB

' Pick out text from a string

' starting at Index and going to the next comma or end-of-string

I SUB UnitStr(Storages,Text$,Index!)

LOCAL I!

I! = FN FindStr(Index!,Text$," ,")

Storage$ = MID$(Text$,Index!,I!-Index!)

Index! = I! + 1 END SUB

Remove excess spaces around string t

SUBSTITUTE SHEET

-82 .713-

DEF FN NoSp$(Text$) 'LOCAL S!,E! IF LEN(Text$)>0 THEN S! = 1 WHILE MID$(TextS,S!,l)=" " INCR S! WEND

E! = LEN(Text$)

WHILE E!>S!+1 AND MID$(Text$,E!,1)=" " DECR E! WEND

FN NoSp$ = MID$(TextS,S!,E!-S!+1) ELSE

FN NoSp$ = " » END IF END DEF

' Can't open file. Report this to operator.

I CantOpen:

CALL SystemError("Can't open file "+FileName$) END

i

I ' Show error and store it on disk

I

SUB SystemError(Text$)

PRINT TextS

OPEN "C:\SYSTEM.ERR" FOR OUTPUT AS #9 PRINT #9,"PREPARE: ";Text$

CLOSE #9 END SUB

/******************************************************* */

SUBSTITUTE SHEET

-82.714-

/*

*/

/* PFPIDB.C

*/ /*

*/

/* PFP Input Database Module

*/

/* */

/* MODIFICATION LOG

*/

/* */ /* date who what

*/ *

*/

/* JP. Stinebaugh J original code */

*/ /*******************************************************

*/

finclude <stdio.h> finclude <math.h> #include <malloc.h>

finclude "pfp.h" finclude "pfphi.h" finclude "pfptri.h" finclude "pfpseg.h" finclude "pfputl.h"

SUBSTITUTE SHEET

-82 . 715- extern INPUT_TRI_STRUC *tri_bucket_array[] ; extern OUT_SEG_STRUC *FD_seg_bucket_array[] ; extern OUT_SEG_STRUC *FU_seg_bucket_array[] ; extern OUT_SEG_STRUC *NFU_seg_bucket_array[] ; extern OUT_SEG_STRUC *NFD_seg_bucket_array[] ; extern UINT16 z_control_table[] ; extern UINT16 all_min_z, all_max_z, all_min_z_index, all_max_z_index;

/***************************************************** general procedure

find_z_binarily - binary search of z_control_table for layer z

*******************************************************/

UINT16 get_z_binarily(z)

UINT16 z;

{

UINT16 low = 0, mid, high = MAX_Z_INDEX-1;

while (low <= high) { mid = (low + high) / 2; if (z < z_control_table [mid]) high = mid - 1; else if (z > z_control_table [mid]) low = mid + 1; else return(mid) ;

} if (z_control_table [low] > z) return(low) ;

SUBSTITUTE SHEET

-82 .716- else return (high) ;

} /* get_z_binarily */

/******************************************************* * local procedure

get_offsets

******************************************************** */

static void get_offsets (min_x, min_y, min_z, max_x, max_y, max_z, res_value, x_offset, y_offset, z_offset)

float min_x, min y, min_z, max_x, max_y, max_z, res_value; float *x_offset, *y_offset, *z_offset;

{

BOOLEAN res_errorl,res_error2; float x_range, y_range, z_range; float round_flt()

x_range = (max_x - min_x) * res_value; y_range = (max_y - min_y) * res_value; z_range = (max_z - min_z) * res_value;

res_errorl = ((x_range > MAX_X_VAL) J { (y_range > MAX_Y_VAL) JJ (z_range > MAX_Z_VAL) ) ;

SUBSTITUTE SHEET

-82 . 717- res_error2 = (z_range > z_control_table [MAX_Z_INDEX-1]) ;

if (res_errorl J J res_error2) { if (res_errorl) { fprintf (stderr, "\n error - resolution value too large for this") ; fprintf (stderr, " part\n") ;

> if (res_error2) { fprintf (stderr, "\n error - z-value would require more than") ; fprintf (stderr, " %u layers.\n",MAX_Z_INDEX) ;

} fprintf (stderr.,

" min x = !f max x = !f min y = !f max y = !f min z = !f max z = !f\n", min_x, max_x, min_y, max_y, min_z, max_z) ; exit (SYS_FAILURE) ; }

*x_offset = round_fIt( ( (MAX_X_VAL - x_range) / 2.0)

- (min_x * res_value) ) ;

*y_offset = round_fIt( ( (MAX_Y_VAL - y_range) / 2.0)

- (min_y * res_value) ) ; *z_offset = round_flt( ( (z_control_table [MAX_Z_INDEX-1]

- z_range) / 2.0) - (min_z * res_value) ) ;

} /* get_offsets */

/******************************************************

SUBSTITUTE SHEET

-82 .71δ- local procedure

check tri dimensions

******************************************************/

static void check_tri_dimensions (tri_ptr)

INPUT_TRI_STRUC *tri_ptr;

if ((tri_ptr-> xl > MAX_X_VAL) (tri_ptr-> xl < 0.0)

(tri_ptr-> X2 > MAX_X_VAL) (tri_ptr-> x2

< 0.0) J (tri_ptr-> X3 > MAX_X_VAL) (tri_ptr-> x3

< 0.0) J (tri_ptr-> yl > MAX_Y_VAL) (tri_ptr-> yl

< 0.0) { (trijptr-> y2 > MAX_Y_VAL) (tri_ptr-> y2

< 0.0) J (tri_ptr-> y3 > MAX_Y_VAL) (tri_ptr-> y3

< 0.0) (tri_ptr-> zl > z_control_table [MAX_Z_INDEX-1]) j (tri_ptr-> zl < 0.0) JJ

(tri_ptr-> z2 > z_control_table [MAX_Z_INDEX-1])

JJ (tri_ptr-> z2 < 0.0) JJ

(tri_ptr-> z3 > z_control_table [MAX_Z_INDEX-1])

JJ (tri_ptr-> z3 < 0.0))

{ fprintf (stderr, "\n error - dimensions of uncentered object") ; fprintf (stderr, " exceed limits. Check Resolution value. \n") ; exit (SYS_FAILURE) ?

SUBSTITUTE SHEET

-82 . 719-

} /* check_tri_dimensions */

/****************************************************** local procedure

res_triangles

******************************************************/

static void res_triangles (tri_list, x_offset, y_offset, z_offset,res_value, centering_off)

INPUT_TRI_STRUC *tri_list; float x_offset, y_offset, z_offset, res_value;

BOOLEAN centering_off;

{

INPUT_TRI_STRUC *tri_ptr; float round_flt();

tri_ptr = tri_list;

if (centering_off) while (tri_ptr != NULL_INPUT_TRI) { tri_ptr-> xl = round_flt(tri_ptr-> xl *

SUBSTITUTE SHEET

-82 .720- res_value) ; tri_ptr-> x2 = round_flt(tri_ptr-> x2 * res_value) ; tri_ptr-> x3 = round_flt(tri_ptr-> x3 * res_value) ;

tri_ptr-> yl = round_flt(tri_ptr-> yl * res_value) ; tri_ptr-> y2 = round_fIt(tri_ptr-> y2 * res_value) ; tri_ptr-> y3 = round_flt(tri_ptr-> y3 * res_value) ;

tri_ptr-> zl = round_flt(tri_ptr-> zl * res_value) ; tri ptr-> z2 = round_flt(tri_ptr-> z2 * res_value) 7 trij?tr-> z3 = round_flt(tri_ptr-> z3 * res_value) ;

check_tri_dimensions (tri_ptr) ; trijptr = trij?tr-> next_input_tri; } else while (tri_ptr != NULL_INPUT_TRI)

{ tri_ptr-> xl = round_flt( (tri ptr-> xl * res_value) + x_offset) ; tri_ptr-> x2 = round_fIt( (tri_ptr-> x2 * res_value) + x_offset) ; tri_ptr-> x3 = round_flt((tri_ptr-> x3 * res_value) + x_offset) 7

tri_ptr-> yl = round_flt( (tri_ptr-> yl * res_value) + y_offset) tri_ptr-> y2 = round_flt( (tri_ptr-> y2 * res_value) + y_offset) ;

SUBSTITUTE SHEET

-82 . 721- tri_ptr-> y3 = round_flt( (tri_ptr-> y3 * res_value) + y_offset) ;

tri ptr-> zl = round_flt( (tri_ptr-> zl * res_value) + z_offset) ; tri ptr-> z2 = round_flt( (tri_ptr-> z2 * res_value) + z_offset) ; tri_ptr-> z3 = round_flt( (tri_ptr-> z3 * res_value) + z_offset) ; tri_ptr = tri_ptr-> next_input_tri;

} /* res_triangles */

/******************************************************* * local procedure

remove_collapsed_triangles

******************************************************** *

static void remove_collapsed_triangles (tri_list)

INPUT_TRI_STRUC **tri_list;

{

INPUT_TRI_STRUC *tri_ptr, *back_ptr; INPUT_TRI_STRUC head_rec; float Ax,Ay,Az; float Bx,By,Bz;

SUBSTITUTE SHEET

-82.722- float Cx,Cy,Cz; unsigned long - point_count = O,line_count = 0;

BOOLEAN delete tri;

trijptr = *tri_list; head_rec .next_input_tri = trijptr; backjptr = Shead_rec;

while (tri_ptr != NULL_INPUT_TRI) { delete_tri = FALSE; if ((tri_ptr->xl == trijptr->x2) && (trijptr->x2 == tri_ptr->x3) SS

(trijptr->yl == tri_ptr->y2) && (tri_ptr->y2 == trijptr->y3) SS (tri_ptr->zl == tri_ptr->z2) &s (tri_ptr->z2 == tri_ptr->z3)) { delete_.tri = TRUE; point_count++;

} else {

Ax = tri_ptr-> x2 - tri ptr-> xl ; Ay = tri_ptr-> y2 - tri_ptr-> yl ;

Az = tri_ptr-> z2 - tri_ptr-> zl ;

Bx = tri_ptr-> x3 - trijptr-> xl;

By = tri_ptr-> y3 - tri_ptr-> yl;

Bz = tri_ptr-> z3 - tri_ptr-> zl; Cx = fabs(Ay*Bz-Az*By) ;

Cy = fabs(Az*Bx-Ax*Bz) ;

Cz = fabs(Ax*By-Ay*Bx) ; if ((Cx < ZERO_DEF) SS (Cy < ZERO_DEF) SS (Cz < ZERO_DEF) ) { delete_tri = TRUE; line_count++;

};

}? if (delete_tri) {

SUBSTITUTE SHEET

-82 . 723- backjptr-> next_input_tri = tri__ptr-> next input_tri; mem_free (tri_ptr,sizeof(INPUT_TRI_STRUC) ) ; tri_ptr = back_ptr-> next_input_tri; } else { trijptr = trijptr-> next_input_tri ; back ptr = back__ptr-> next_input_tri ;

} ; } ;

*tri_list = head_rec .next_input_tri;

if (point_count > 0) fprintf (stderr, "\n warning - !lu collapsed point triangles removed \n", point_count) ; if (line_count > 0)

SUBSTITUTE SHEET

-82.724- fprintf (stderr, "\n warning - !lu collapsed line triangles removed \n", line_count) ;

} /* remove_collapsed_triangles */

/****************************************************** local procedure

get_z_output_coord

******************************************************** /

static UINT16 get_z_output_coord (z)

UINT16 z;

{

UINT16 i, greater_z, lesser_z;

i = get_z_binarily(z) ; greater_z = z_control_table [i] ; if (z == z_control_table [i]) lesser_z = z_control_table [i] ; else lesser_z = z_control_table [i-1] ; /* printf("get_z_output_coord: z=!u i=!u lesser_z=!u greater_z=!u\n",z,i,lesser_z,greater_z) ; */

if ((lesser_z == 0) JJ (((greater_z - z) <- (z -

SUBSTITUTE SHEET

-82 . 725- lesser_z) ) SS (greater_z != z_control_table [MAX_Z_INDEX-1])))

return (greater_z) ; else return (lesser_z) ;

} /* get_z_output_coord */

/****************************************************** local procedure

adjust_z_coords

*******************************************************/

static void adjust_z_coords (tri_list, z_spacing)

INPUT_TRI_STRUC *tri_list; UINT16 z_spacing;

{ INPUT_TRI_STRUC *tri_ptr; float round_fIt() ;

UINT16 get_z_coord() ;

if (z_spacing != 1)

{ trijptr = tri_list; while (tri_ptr != NULL_INPUT_TRI) {

SUBSTITUTE SHEET

-82.726- tri_ptr-> zl = round_flt((float) tri_ptr-> zl / z_spacing) * z_spacing; tri_ptr-> z2 = round_flt((float) tri_ptr-> z2 / z_spacing) * z_spacing; trijptr-> z3 = round_flt((float) tri_ptr-> z3 / z_spacing) * z_spacing? tri_ptr = tri_ptr-> nεxt_input_tri;

}

> else

{ trijptr = tri_list; while (tri_ptr != NULL_INPUT_TRI)

{ tri_ptr-> zl = get_z_output_coord ((UINT16) tri_ptr-> zl) ; tri_ptr-> z2 = get_z_output_coord ((UINT16) trijptr-> z2) ; tri_ptr-> z3 = get_z_output_coord ((UINT16) tri_ptr-> z3) ; tri_ptr = tri_ptr-> next_input_tri; } }

} /* adjust_z_coords */

/******************************************************* local procedure

output_internal_triangles

SUBSTITUTE SHEET

-82 . 727- *******************************************************/

static void output_internal_triangles (user_info,tri_list)

USER_INFO_STRUC *user_info; INPUT_TRI_STRUC **tri_list;

(

FILE *InternalFile; INPUT_TRI_STRUC *tri_ptr; UINT32 count,tri_count; float zero,i,j,k;

zero = 0; trijptr = *tri_list; tri_count = 0; while (tri_ptr != NULL_INPUT_TRI) { tri_count++; tri_ptr = tri_ptr-> next_input_tri;

) if (tri_count>0) { fprintf(stderr, " writing internal triangles output file ...\n");

InternalFile = fopen(user_info-> internal _filename,"wb") ;

fprintf(InternalFile,"Slice Internal Triangle File") ; count = 28; while (count<80) { /* should write out copy of org header */ fprintf(InternalFile," ") ; count++; } fwrite(Stri_count,4,1,InternalFile) ; /* write out

SUBSTITUTE SHEET

-δ2 . 728- f of triangle facets */ trijptr = *tri_list; while (tri_ptr i= NULL_INPUT_TRI) { count = 3; if (tri_ptr->normal_infoSNORMAL_X_POSITIVE) i

17 else if (tri_ptr->normal_infoSNORMAL_X_NEGATIVE) i = -17 else { i = 0; count—;

} ; if (tri_ptr->normal_infoSNORMAL_Y_POSITIVE) j l? else if (tri_ptr->normal_infoSNORMAL_Y_NEGATIVE) j = -17 else { j = 0,- count—

} ; if (tri_ptr->normal_infoSNORMAL_Z_POSITIVE) k l; else if

(trij?tr->normal_infoSNORMAL_Z_NEGATIVE) k = -17 else { k = 0,- count—

switch (count) { case 2 : i *= 0.707106781; j *= 0.707106781; k *= 0.707106781; break; case 3 : i *= 0.577350269;

SUBSTITUTE SHEET

-82 . 729- j *= 0.577350269; k *= 0.577350269; break;

> fwrite(Si,4,1,InternalFile) ; fwrite(Sj ,4,1,InternalFile) ; fwrite(Sk,4,1,InternalFile) ;

fwrite(trijptr,36,1,InternalFile) ; /* write out triangle vertices */ fwrite(Szero,2,1,InternalFile) ;

/* attribute data (none) */ trijptr = tri ?tr-> next_input_tri;

} fclose(InternalFile) ;

/****************************************************** local function

flat tri

******************************************************/

static flat_tri (tri_ptr)

INPUT_TRI_STRUC *tri_ptr;

SUBSTITUTE SHEET

-82.730-

C return ((tri_ptr-> zl == tri_ptr-> z2) s (tri_ptr-> z2 == tri_ptr-> z3))?

} /* flat_tri */

/******************************************************* local function

near flat tri

*******************************************************/

static near_flat_tri (trijptr, min_angle)

INPUT_TRI_STRUC *tri_ptr,- INT16 min_angle7

{ double dxl, dyl, dzl, dx2, dy2, dz2, dx, dy, dz, d, angle?

if (!min_angle) return (FALSE) 7 else

{ dxl = tri_ptr-> xl - trijptr-> x2 ,- dyl = tri_ptr-> yl - tri_ptr-> y2 ; dzl = trij?tr-> zl - tri_ptr-> z2 ;

SUBSTITUTE SHEET

-82 . 731-

dx2 = trijptr-> xl - tri_ptr-> x3; dy2 = tri_ptr-> yl - tri_ptr-> y3; dz2 = tri_ptr-> zl - tri_ptr-> z3;

dx = dyl * dz2 - dzl * dy2; dy = dzl * dx2 - dxl * dz2; dz = dxl * dy2 - dyl * dx2;

d = sqrt (dx * dx + dy * dy) ;

if (d == 0) angle = 0; else angle = 90.0 - fabs (atan (dz / d) / RADIANS_PER_DEGREE) ?

return (angle < (double) min_angle) ; }

} /* near_flat_tri */

/******************************************************* ** recompute ormals

Recomputes the normals of the triangles after they have been deformed by adjusting the Z coords.

Version 252 - Only recompute X and Y

*******************************************************/

static recomputejiormals(tri_list,axis) INPUT_TRI_STRUC *tri_list; INT16 axis;

SUBSTITUTE SHEET

-82.732-

UINT8 flag; double al,a2,a3; double bl,b2,b3? double i,j,k; double temp;

/'

Vector A - Vertex 2 to Vertex 3 of input Vector B - Vertex 2 to Vertex 1 of input Normal i,j,k - AxB = (a2*b3 - a3*b2)i + (a3*bl - al*b3)j + (al*b2 - a2*bl)k

Note: Vectors change if axis is not inputs (-x -y) Must adjust for these cases.

*/ fprintf(stderr," recomputing normals \n") ; while (tri_list != NULL_INPUT_TRI) { switch (axis) { case 0 : al = tri_list->x3 - tri_list->x2; /* No axis swap */ a2 = tri_list->y3 - tri_list->y2; a3 = tri_list->z3 - tri_list->z2 bl = tri_list->xl - tri_list->x2; b2 = tri_list->yl - tri_list->y2; b3 = tri_list->zl - tri_list->z2 break; case l : a3 = tri_list->x3 - tri_list->x2;

/* X and Z axis swapped */ a2 = tri_list->y3 - tri_list->y2; al = tri_list->z3 - tri_list->z2 b3 = tri_list->xl - tri_list->x2; b2 = tri_list->yl - tri_list->y2; bl = tri_list->zl - tri_list->z2 break? case 2 : al = tri_list->x3 - tri_list->x2; /* Y and Z axis swapped */ TUTE SHEET

-82.733- a3 = tri_list->y3 - tri_list->y2; a2 = tri_list->z3 - tri_list->z2 bl = tri_list->xl - tri_list->x2; b3 = tri_list->yl - tri_list->y2; b2 = tri_list->zl - tri_list->z2 break;

};

i = a2*b3 - a3*b2; j = a3*bl - al*b3; k = al*b2 - a2*bl;

switch (axis) { /* reswap flag info */ case 1: temp = k; k = i; i = temp; break; case 2: temp = k; k = j; j = temp; break;

};

flag = tri_list->normal_info S (NORMAL_Z_POSITIVE+ NORMAL_Z_NEGATIVE) ;

if (fabs(i) > ZERO_DEF) { if (i < 0) flag j= NORMAL_X_NEGATIVE; else flag j= NORMAL_X_POSITIVE;

};

if (fabs(j) > ZERO_DEF) { if (j < 0) flag J= NORMAL_Y_NEGATIVE; else flag J= NORMAL_Y_POSITIVE;

)

/'

SUBSTITUTE SHEET

-82.734- if (fabs(k) > ZERO_DEF) { if (k < 0) flag {= NORMAL_Z_NEGATIVE; else flag j= NORMAL_Z_POSITIVE;

*/

tri_list->normal_info = flag? tri_list = tri_list->next_input_tri;

};

}?

/****************************************************** local procedure

******************************************************** /

static void get_tri_lists (in_file, user_info, res_value, min_angle, centering_off, z_spacing, scan_.tri_list, lat_tri_list, near_flat_tri_list)

FILE *in_file;

USER_INFO_STRUC *user_info; float res_value?

INT16 min_angle?

BOOLEAN centering_off;

UINT16 z_spacing?

INPUT_TRI_STRUC **scan_tri_list; INPUT_TRI_STRUC **flat_tri_list?

INPUT TRI STRUC **near flat tri list?

{

INPUT_TRI_STRUC *input_tri_list, *tri_ptr, *temp_ptr; unsigned long up_scan_tri_count = 0,

SUBSTITUTE SHEET

-82 .735- dn_scan_tri_count = 0; unsigned long up_flat_tri_count = 0, dn_flat_tri_count = 0; unsigned long up_near_flat_tri_count = 0, dn_near_flat_tri_count = 0; float min_x, min_y, min_z, max_x, max_y, max_z; float x_offset, y_offset, z_offset; long resoluted_min_z,resoluted_max_z;

min_x = MAX_X_VAL; min_y = MAX_Y_VAL? min_z = z_control_table [MAX_Z_INDEX-1] ;

max_x = 0.0 - MAX_X_VAL; max_y = 0.0 - MAX_Y_VAL; max_z = 0.0 - z_control_table [MAX_Z_INDEX-1] ;

/* printf ("\n get_tri_lists - begin \n") ; */ fprintf (stderr, "\n loading input database ...\n");

if (user_info-> binary_input) pfp_get_input_tri_list_bin (in_file, Sinput_tri_list,

Smin_x, Smin_y, Smin_z, Smax_x, Smax_y, &max_z, user_info) ; else pfp_get_input_tri_list (in_file, Sinput_tri_list, Smin_x, Smin_y, Smin_z, Smax_x, Smax_y, Smax_z,user_info) ?

resoluted_min_z = round_fIt(min_z * res_value) ? resoluted_max_z = round_fIt(max_z * res_value) ? if (resoluted_min_z < z_control_table[0] ) { if (*(user_info-> z_space_filename) != '\0')

SUBSTITUTE SHEET

-82 .736- fprintf(stderr,"\nError - Part begins below Variable Z Spacing Table\n") ? else fprintf(stderr,"\nError - Part begins below minimum Z value\n") ? fprintf(stderr," Z Spacing Table: !u Part:

!ld\n",z_control_table[0] ,resoluted_min_z) ? exit (SYS_FAILURE) ;

}; if (resoluted_max_z > z_control_table[MAX_Z_INDEX-l])

{ if (*(user_info-> z_space_filename) != '\0') fprintf(stderr,"\nError - Part extends past the Variable Z Spacing Table of !u layers\n", (MAX_Z_INDEX-1) ) ? else fprintf(stderr,"\nError - Part extends past the maximum Z value of !u layers\n", (MAX_Z_INDEX-1) ) ? fprintf(stderr," Z Spacing Table: !u Part: !u\n",z_control_table[MAX_Z_INDEX-l] , resoluted ιιax_z) ? exit (SYS_FAILURE) ?

};

get_offsets (min_x, min_y, min_z, max_x, max_y, max_z, res_value, Sx_offset, Sy_offset, Sz_offset) ?

res_triangles (input_tri_list, x_offset, y_offset, z_offset, res_value, centering_off) ?

adjust_z_coords (input_.tri_list, z_spacing) ?

remove_collapsed_triangles ( input_.tri_list) ?

recompute_normals(input_tri_list,user_info->axis) ;

SUBSTITUTE SHEET

-82.737-

if (*(user_info-> internal_filename) > '\0') output_internal_triangles (user_info, Sinput_tri_list) ?

while (input_tri_list != NULL_INPUT_TRI) { trijptr = input_tri_list? input_tri_list = input_tri_list-> next_input_tri;

if (flat_tri (tri_ptr) )

{ tri_ptr->normal_info = (tri_ptr->normal_info

S(255-NORMAL_X_NEGATIVE-NORMAL_X_POSITIVE -NORMAL_Y_NEGATIVE-NORMAL_Y_POSITIVE) )

J FLATJTRI; tri_ptr-> next_input_tri = *flat_tri_list; *flat_tri_list = trijptr; if (tri_ptr-> normal_info S NORMAL_Z_POSITIVE) up_flat_tri_count++; else dn_flat_tri_count++;

} else if (near_flat_tri (tri_ptr, min_angle) )

{ tri_ptr->normal_info J= NEAR_FIAT_TRI; temp_ptr = (INPUT_TRI_STRUC *) ' mem_alloc

(sizeof (INPUT_TRI_STRUC) ) ; copy (trijptr, tempjptr, sizeof

(INPUT_TRI_STRUC) ) ? temp_ptr-> next_input_tri = *scan_tri_list; *scan_tri_list = tempjptr? trijptr-> next_input_tri = *near_flat_tri_list?

*near_flat_tri_list = tri_ptr;

SUBSTITUTE SHEET

-82.738- if (tri_ptr-> normal_info S NORMAL_Z_POS ITIVE ) up_near_f lat_tri_count++ ; else dn_near_f lat__tri_count++ ;

} else

{ tri_ptr-> next_input_tri = *scan_tri_list; *scan_tri_list = tri_ptr; if (tri_ptr-> normal_info s NORMAL_Z_POSITIVE) up_scan_tri_count++; else dn_scan_tri_count++?

} }

fprintf (stderr, "\n !51u scan triangles loaded

(!51u up facing, !5lu down facing)\n", up_scan_tri_count + dn_scan _tri_count, up_scan_tri_count, dn_scan _tri_count) ? fprintf (stderr, " !51u near flat triangles loaded

(!51u up facing, !51u down facing)\n", up_near_flat _tri_count + dn_near_flat_tri_count, up_near_flat_tri_count, dn_near_flat _tri_count) ? fprintf (stderr, " !51u flat triangles loaded

(!51u up facing, !51u down

SUBSTITUTE SHEET

-82 . 739- facing)\n\n", up_flat_tri_count + dn_flat_tri_count, up_flat tri_count, dn_flat_tri_count) ;

/* printf ("\n get_tri_lists - end \n") ?

*/

} /* get_tri_lists */

/******************************************************* ** local procedure

insert tri

******************************************************** **/

static void insert_tri (input_tri, z_bucket_array)

INPUT_TRI_STRUC *input_tri? INPUT_TRI_STRUC **z_bucket_array?

{ float min_z; UINT16 min_z_value;

UINT16 i;

pfp_get_min_z (input_tri, Smin_z) ; min_z_value = (UINT16) min_z;

SUBSTITUTE SHEET

-82 .740- i = get_z__binarily (min_z_value) ?

input_tri-> next_input_tri = z_bucket_array [i] ? z_bucket_array [i] = input_tri;

} /* insert_.tri */

void tri_bucket_sort (tri_list, a_tri_bucket_array)

INPUT_TRI_STRUC **tri_list; INPUT_TRI_STRUC **a_tri_bucket_array;

{ INPUT_TRI_STRUC *tri_ptr, **bucket_ptr; INT16 i?

/* printf ("\n tri_bucket_sort - begin \n") ? */ bucketjptr = a_tri_bucket_array?

for (i = 0? i < MAX_Z_INDEX? i++, bucket_ptr++) *bucket_ptr = NULL_INPUT_TRI?

while (*tri_list != NULL_INPUT_TRI)

{ trijptr = (*tri_list)-> next_input_tri? insert_tri (*tri_list, a_tri_bucket_array) ?

*tri_list = trijptr; >

*tri_list = NULL_INPUT_TRI?

SUBSTITUTE SHEET

-82.741-

/* printf ("\n tri_bucket_sort - end \n") ?

*/

} /* tri_bucket_sort */

void pfp_get_input_database (in_file, user_info)

FILE *in_file?

USER_INFO_STRUC *user_info?

{

INPUT_TRI_STRUC *scan_tri_list; INPUT_TRI_STRUC *flat_tri_list?

INPUT_TRI_STRUC *near_flat_tri_list; UINT16 z?

scan_tri_list = NULL_INPUT_TRI; flat_tri_list = NULL_INPUT_TRI; near_flat_tri_list = NULL_INPUT_TRI;

get_tri_lists (in_file, user_info, user_info-> res__value, user_info-> min_surface_angle, user_info-> centering_off, user_info-> z_spacing, Sscan_tri_list, Sflat_tri_list,

Snear_flat_tri_list) ;

for (Z = 0? Z < MAX_Z_INDEX? Z++)

{ FU_seg_bucket_array[z] = NULL_SEG; FD_seg_bucket_array[z] = NULL_SEG? NFU_seg_bucket_array[z] = NULL_SEG; NFD_seg_bucket_array[z] = NULL_SEG?

SUBSTITUTE SHEET

-82 .742- }

if (scan_tri_list != NULL_INPUT_TRI) tri_bucket_sort ( scan_tri_list, tri_bucket_array) ;

if (flat_tri_list != NULL_INPUT_TRI) process_flat_tri_list (flat_tri_list) ;

if (near_flat_tri_list != NULL_INPUT_TRI) process ιear_flat_tri_list (near_flat_tri_list) ;

} /* pfp_get_input_database */

SUBSTITUTE SHEET

-82.743- /******************************************************/ y* * *>

/* PFPRIE.C */

/* */ j- -pγ-p Remo e 1 *c.erτγ2Λ. *»•)

/* */ /* MODIFICATION LOG */ j * H.)

/* date who what */ * */ /* l I */

/***************************************************** */

finclude <stdio.h> finclude <math.h> finclude "pfpseg.h" finclude "pfputl.h"

fdefine MAX_HASH_INDEX 1501

static OUT_SS.G_STOHC static OUT_SEG_STRUC * en d_hash_ table [MAX_HASH_INDEX] ; static BOOLEAN hash_table_initialized = FALSE;

/A****************************************************** local procedure

order_seg_points

*******************************************************

static oi or e."r_s.&g p n.s. s^g p .t.^ OUT_SEG_STRUC *seg_ptr; (

SUBSTITUTE SHEET

-82. 744- UINT16 temp;

if C(seg_jptr-> x_l > seg_ptr-> x_2) i I I 1

y_l > seg_ptr->y_2) ; ; {

seg_ptr-> x_l = seg_jptr-> x_2 ; seg_ptr-> x_2 = temp;

seg_ptr-> y_l — seg_ptr-> y_2 ; seg_ptr-> y_2 = temp;

) .

} /* order__seg_points */

fcrk^k-fc-fe-fc-fe-fc-fe-k-fc-k-k-fc-fe-fc-fe-fc-fc-fe -k-fc-k^-fc^-fe-fc-k-fc^^ local procedure

i" sex"t_segss>SiTΛ.

******************************************************* /

static void insert_segment (seg_ptr) OUT_SEG_STRUC *seg_ptr;

I OUT_SEG_STRUC *scan_ptr,*baαk_ptr; double hash_key;

hash_key = (double) MAX_Y_VAL * εeg__ptr-> x_l

SUBSTITUTE SHEET

-82.745- + seg_ptr-> y_l;

hash_index = (UINT16) fmod (hash_key, (double) MAX_HASH_INDEX) ;

scan_ptr = hash_table [hash_index] ;

! ( (scan_ptr-> x_l == seg_jptr-> x_l) && (scan__ptr-> y_l == seg_ptr-> y__l) && scan_ptr-> y_2 == seg_ptr-> y_2) ) ) { back_ptr = scan_ptr;

);

if (hash_table[hash_indexj == NULL) hash_table [hash_indexj = εeg_ptr;

= seg ptr; seg_jptr->next_seg = NULL_SEG ; en hasi_ aY>i.e ias , n_ ndexr) =• s.^ .τ-, } else { if [\ [ \s g_ tτ- τ\oτ^a _ τ\ϊo^sc^τ\_p^- \o^^ & (FLAT_TRI+NEAR_FLAT_TRI) ) ) { if (hash_table[hash_indexj == scan_ptr) hash_table fhash_ϊn&ex ' ) = scanjptr->τιe"x , t._seg> else { back_ptr->next_seg = scan ptr->next seg; if (end_has _table[ ash_ϊnaex] == scan_ptr end_hash_tableζhash_index^ = baαk jtr; }; mem_free (scan_ptr,sizeof(OUT_SEG_STRUC ) ;

\ - mem_f ree (seg_ptr, sizeof (OUT_SEG_STRUC) ) ;

SUBSTITUTE SHEET

-82. 746-

} ; f* inse t_s 5Ci. tΛ. * {

/******************************************************* exported procedure

pfp_remove_duplicate_edges

*******************************************************/

void pfp_remove_duplicate_edges (seg_list)

{ OϋT_SEG_STRUC *seg_ptr;

OXΪJT 6 i?

if ( I hash fcabl e_initialized) { for ( i = 0 ; i < MAX_HASH_INDEX; Ϊ++) hash_table (_L\ = NULL_SEG{ hash_table_initialized = TRUE;

} ;

while (*seg_list l =- NULL_SEG) { seg_ptr = *seg_list; *seg_list =• s^jp^ -^^^x^ s.^"-, if ((segjptr->x_l == seg_ptr->x_2 && (εeg_ptr->y_l == εeg_ptr->y_2 ) ) {

> else { order_seg_points (segjptr) ;

SUBSTITUTE SHEET

-82.747- insert_segment (seg_ptr) ;

>

r (i = 0; i < iaKXjaASΗ_T " HT3EX. ; i+V) if (hash_table;i] .'= NULL_SEG) ( end_hash_table[i]->next_seg = *seg_list; *seg_list = has _talle[i ; hash_table Ci 1 = NULL_SEG;

} r

pfp_remove 3uρlicate_edqes *

SUBSTITUTE SHEET

-82.748-

/*****************************************************/

/* */

/* PFPRIF.C */

/* */

/* PFP Read Input File Module */

/* */ /* MODIFICATION LOG */ * *

/* date who what */

/* */

/* JP. Stinebaugh j original code */ /* j j */

/*****************************************************/

finclude " <stdio.h> finclude "pfp.h" finclude "pfphi.h" finclude "pf tri.h" finclude "pfpseg.h" finclude "pfputl.h"

fdefine NORMAL_FIAG_CHAR 'f fdefine NORMAL_MIN 1E-05

static UINT16 tri_count = 0;

/****************************************************** local function

is_legal_char

Returns a value that indicates if the char parameter is within the legal character set.

SUBSTITUTE SHEET

-82 . 749- ******************************************************

static BOOLEAN is_legal_char (ch)

STRING ch;

return ( (ch >= • ) && (ch <= '-'));

/* the next line of code stops the '+' and '-' illegal char messages but causes other problems: run fl: got memory parity error, system halted run #2: got 'invalid input file format' after several minutes and program stopped, no other information then commented out line and recompiled to make it like it was before */

} /* is_legal_char */

/****************************************************** local procedure

get_line

Reads characters from the input file into a line buffer up to the next newline char. Checks for error. Indicates if the file is eof.

SUBSTITUTE SHEET

-82 .750- ******************************************************/

static void get_line (input_file, line_buf, error, eof)

FILE *input_file? STRING *line_buf; BOOLEAN *error; BOOLEAN *eof;

{ short status; BOOLEAN eoln; BOOLEAN char_error = FALSE;

BOOLEAN leading_blanks_skipped = FALSE;

do { do { status = fscanf (input_file, "%c", line_buf) ; } while (!leading_blanks_skipped && (*line_buf

== ' ') && (status == 1)); leading_blanks_skipped = TRUE; *eof = (status != 1) j j (*line_buf == 26) ; eoln = (*line_buf = « \n') {{ (*line_buf == '\r') j J (*eof) ; if (!(eoln [j *eof) && (!is_legal_char (*line_buf) ) )

{ char_error = TRUE; fprintf (stderr, " Error - Illegal char found in triangle %u: %02X (Hex)\n' » , tri_count, (unsigned char) *line_buf) ;

} line_buf++; } while (!*eof && ieoln) ; *—line_buf = '\0';

*error = *error [ } char_error; } /* get_line */

SUBSTITUTE SHEET

-82.751- /******************************************************* local procedure

swapjvert

*******************************************************/

void swap_vert(x,y,z,user_info) float *x; float *y; float *z;

USER_INFO_STRUC *user_info; { float temp;

if (user_info-> axis == 1) { temp = *z; *z = *x; *x = temp;

} else if (user_info-> axis == 2) { temp = *z; *z = *y; *y = temp; }

);

/****************************************************** local procedure

get_input_.tri_asc

******************************************************/

SUBSTITUTE SHEET

-82.752- static void get_input__tri_asc (in_ ile, tri_ptr, user_info, error)

FILE *in_file; INPUT_TRI_STRUC *tri_ptr; USER_INFO_STRUC *user_info; BOOLEAN *error;

{

UINT16 items_read;

tri_ptr-> next_input_tri = NULL_INPUT_TRI;

fscanf (in_file, "%*s %f %f %f", &tri_ptr->xl, &tri_ptr->yl, &tri_ptr->zl) ; swap_vert(&trijptr->xl, &trijptr->yl,&trijptr->zl,user_info) ;

fscanf (in_file, "%*s %f f %f", &tri_ptr->x2, &tri_ptr->y2, &tri ptr->z2) ; swap_vert(&tri_ptr->x2, &trijptr->y2,&tri_ptr->z2,user_info) ;

items_read = fscanf (in_file, "%*s %f %f %f", &tri_ptr->x3, &tri_ptr->y3, &tri_ptr->z3) ; swap vert(&tri_ptr->x3,&tri_ptr-> y3,&tri_ptr->z3,user_info) ;

*error = (items_read != 3) ;

if (*error) if (feof(in_file)) fprintf (stderr, "\n Error - Premature end of input file at triangle %u\n",tri_count) ; else fprintf (stderr, "\n Error - I/O error in reading input file at triangle %u\n",tri_count) ;

} /* get_input_tri_asc */

SUBSTITUTE SHEET

-82.753- /****************************************************** local procedure

update_min_max_values

*******************************************************/

void update_min_max_values (tri_ptr, min_x, min_y, min_z, max_x, max y, max_z)

INPUT_TRI_STRUC *tri_ptr; float *min_x, *min_y, *min_z, *max_x, *max_y, *max_z;

{ if (tri_ptr-> xl < *min_x)

*min_x = tri_ptr-> xl ; if (tri_ptr-> x2 < *min_x) *min_x = trijptr- > x2 ; if (trijptr-> x3 < *min_x) *min_x = tri_ptr-> x3 ;

if (tri_ptr-> yl < *min_y)

*min_y = tri_ptr-> yl ; if (tri_ptr-> y2 < *min_y)

*min_y = tri_ptr-> y2 ; if (tri_ptr-> y3 < *min_y)

*min_y - tri_ptr-> y3 ;

if (tri_ptr-> zl < *min_z) *min_z = tri_ptr-> zl ; if (tri_ptr-> z2 < *min_z ) *min_z = tri_ptr-> z2 ;

SUBSTITUTE SHEET

-82.754- if (trij ? tr-> z3 < *min_z) *min_z = tri_ptr-> z3 ;

if (trijptr-> xl > *max_x)

*max_x = tri ptr-> xl; if (tri_ptr-> x2 > *max_x)

*max_x = tri_ptr-> x2; if (trijptr-> x3 > *max_x)

*max_x = tri_ptr-> x3;

if (tri_ptr-> yl > *max_y) *max_y = tri_ptr-> yl; if (tri_ptr-> y2 > *max_y)

*max_y = tri_ptr-> y2; if (tri_ptr-> y3 > *max_y)

*max_y = tri_ptr-> y3;

if (tri_ptr-> zl > *max_z) *max_z = tri_ptr-> zl; if (tri_ptr-> z2 > *max_z)

*max_z = trijptr-> z2; if 0trijptr-> z3 > *max_z) *max_z = tri_ptr-> z3;

} /* update_min_max_values */

static void check_normal(i,j,k) float i,j,k;

{ float len;

len = i*i+j*j+k*k;

if ((len != 0) && ((len < .9) JJ (len > 1.1))) { fprintf(stderr,"\n Error reading normal for triangle %u.\n",tri_count) ; fprintf(stderr," Normal %g %g %g not a unit

SUBSTITUTE SHEET

-82.755- normal.\n",i,j ,k) ; exit(SYS_FAILURE) ; ) .

};

*

5 static void set_normal_info(i,j,k,normal_info) float i,j,k; UINT8 *normal_info;

{ if ((i > -NORMAL_MIN) && (i < NORMAL_MIN) ) i = 0.0;

10 if ((j > -NORMAL_MIN) && (j < NORMAL_MIN) ) j = 0.0; if ((k > -NORMAL_MIN) && (k < NORMAL_MIN) ) k = 0.0;

*normal_info = 0;

if (i > 0.0) *normal_info ]= NORMAL_X_POSITIVE; else if (i < 0.0) *normal_info j= NORMAL_X_NEGATIVE;

15 if (j > 0.0) *normal_info j= NORMAL_Y_POSITIVE; else if (j < 0.0) *normal_info J= NORMAL_Y_NEGATIVE;

if (k > 0.0) *normal_info |= N0RMAL_Z_P0SITIVE; else if (k < 0.0) *normal_info J= NORMAL_Z_NEGATIVE;

}

20 static void get_normal_asc(1ine_buff,normal_info,user_info)

STRING *line_buff;

UINTδ *normal_info;

USER_INFO_STRUC *user_info; 25 {

INT16 items_read;

INT16 items_expected = 3;

SUBSTITUTE SHEET

-82.756- float normal_i,normal_j,normal_k;

items_read = sscanf(line ouff,"%*s %*s %f %f

%f",&normal_i,&normal_j ,&normal_k) ; check_normal(normal_i,normal_j,normal_k) ;

swap_vert(Snormal_i,&normal_j,&normal_k,user_info) ;

if (items_read != items_expected) { fprintf(stderr,"\n Error - I/O error trying to read normal in triangle %u\n",tri_count) ; exit(SYS_FAILURE) ; }

set_normal_info(normal_i,normal_j ,normal_k,normal_info) ;

};

/****************************************************** exported procedure

pfp_get_input_tri_list

******************************************************/

void pfp_get_input_tri_list (in_file, tri_list, min_x, min_y, min_z, max_x, max_y, max_z, user_info)

FILE *in_file;

INPUT_TRI_STRUC **tri_list; float *min_x, *min_y, *min_z, *max_x,

*max_y, *max_z;

SUBSTITUTE SHEET

-82.757- USER INFO STRUC *user info;

STRING line_buf[200] ; BOOLEAN error = FALSE; BOOLEAN eof = FALSE; UINT8 normal info;

INPUT_TRI_STRUC *tri ?tr, *back_ptr;

*tri_list = (INPUT_TRI_STRUC *) mem_alloc (sizeof (INPUT_TRI_STRUC) ) ; tri_ptr = *tri_list; get_line (in_file, line_buf, &error, &eof) ; while (ieof && !error)

( while (leof && !error && (tolower(*line_buf) != NORMAL_FLAG_CHAR) ) get_line (stdin, line_buf, &error, &eof) ;

if (!eof && !error)

{ tri_count++; get_normal_asc(line_buf, &normal_info,user_info) ; get_line(stdin, line_buf, Serror, Seof) ; get_input_tri_asc (stdin, tri_ptr, user_info, &error) ; tri ptr-> normal_info = normal_info; if (!error)

{ update_min_max_values (tri_ptr, min_x, min_y, min_z, max_x, max_y, max_z) ; tri_ptr-> next_input_tri = (INPUT_TRI . STRUC *) mem_alloc (sizeof

(INPUT_TRI_STRUC) ) ; back_ptr = tri_ptr; trijptr = tri_ptr-> next_input_tri;

SUBSTITUTE SHEET

-82 .758- get_line (stdin, line_buf, &error, &eof) ; } } }

if (error) exit (SYS_FAILURE) ;

if (tri_count > 0)

{ back__ptr-> next_input_tri = NULL_INPUT_TRI; mem_free (trijptr,sizeof(INPUT_TRI_STRUC) ) ;

} else

{ fprintf (stderr, "\n Error - No triangles found in input file") ; exit (SYS_FAILURE) ; }

} /* pfp_get_input_tri_list */

/***************************************************** local procedure get_normal_bin

******************************************************/

get_normal_bin(in_file,trijptr,user_info) FILE *in_file; INPUT_TRI_STRUC *tri_ptr;

USER_INFO_STRUC *user_info; {

SUBSTITUTE SHEET

-82.759- float normal_i,normal_j ,normal_k;

fread (&normal_i, sizeof(float) , 1, in_file) ; fread (&normal_j, sizeof(float) , 1, in_file) ; fread (&normal_k, sizeof(float) , 1, in_file) ; check ormal(normal_i,normal_j ,normal_k) ; swap_vert(&normal_i,&normal_j ,&normal_k,user_info) ;

set_normal_info(normal_i,normal_j ,normal_k,&tri _ptr->normal_info) ;

return (normal_i != 0.0 jj normal_j != 0.0 j j normal_k " != 0.0) ;

)/* get_normal_bin */

/******************************************************* local procedure

get_input_tri_bin

******************************************************/

void get_input_tri_bin (in_file, tri_ptr, user_info, error)

FILE *in_file; INPUT_TRI_STRUC *tri_ptr; USER_INFO_STRUC *user_info; BOOLEAN *error;

{

INT16 items read;

SUBSTITUTE SHEET

-82.760- tri_ptr-> next_input_tri = NULL_INPUT_TRI;

items_read = fread (trijptr, sizeof(float) , ,in_file) ; swap_vert(&tri_ptr->xl, &tri_ptr-> 1, &tri_ptr->zl, user__info) ; swap_vert(&trij?tr->x2, &tri_ptr->y2, &tri_ptr->z2, user_info) ; swap_vert(Stri_ptr->x3, &tri_ptr->y3, &trijptr->z3, user_info) ;

*error = (items_read != 9) ;

if (*error) { if (feof(in_file)) fprintf (stderr, "\n Error - Premature end of input file at triangle %u\n",tri_count) ; else fprintf (stderr, "\n Error - I/O error reading verticies in triangle %uinvalid format in binary input file\n") ; exit (SYS_FAILURE) ; }

} /* get_input_tri_bin */

/****************************************************** exported procedure

pfp_get_input_tri_list_bin

******************************************************/

SUBSTITUTE SHEET

-82 . 761- void pfp_get_input_tri_list_bin (in_file, tri_list, min_x, min_y, min_z, max_x, max_y, max_z, usεr_info)

FILE *in_file; INPUT_TRI_STRUC **tri_list; float *min_x, *min_y, *min_z, *max_x, *max_y,

*max_z; USER_INFO_STRUC *user_info;

(

BOOLEAN error = FALSE; INPUT_TRI_STRUC *tri_ptr, *back_ptr; STRING record[81]; unsigned long facet_records; UINT16 attrib_size;

*tri_list = (INPUT_TRI_STRUC *) mem_alloc (sizeof (INPUT_TRI_STRUC) ) ;

tri_ptr = *tri_list; record[80] = '\0' ; while (lerror && (fread(record,80,1,in_file) > 0) ) if (user_info->attrib) { fread(&facet_records,4,l,in_file) ; while (lerror && (facet_records 1= 0) ) { tri_count++; facet_records—; get_normal_bin (in_file,tri_ptr,user_info) ; get_input_tri_bin (in_file, tri_ptr, user_info, &error) ; if (!error) { fread(&attrib_size,2,1,in_file) ; while (attrib_size 1= 0) ( attrib_size—; fread(record,1,1,in_file) ;

) update_min_max_values (tri_ptr, min_x, min_y,

SUBSTITUTE SHEET

-82 .762- min_z, max_x, max_ , max_z) ; tri_ptr-> next_input_tri = (INPϋT_TRI_STRUC *) mem_alloc (sizeof (INPUT_TRI_STRUC) ) ; back_ptr = tri_ptr; tri_ptr = tri_ptr-> next_input_tri; } } } else while (lerror && get_normal_bin (in_file,trijptr, user_info) ) { tri_count++; get_input_tri_bin (in_file, tri_ptr, user_info, δerror) ; if (l rror) { fread(&attrib_size,2,1,in_file) ; while (attrib_size > 0) { fread(record,1,1,in_file) ; attrib_size—;

} update_min_max_values (trijptr, min_x, min_y, min_z, max_x, max_y, max_z) ; tri_ptr-> next_input_tri = (INPUT_TRI_STRUC *) mem_alloc (sizeof (INPUT_TRI_STRUC) ) ; backjptr = trijptr; trijptr = trij?tr-> next_input_tri; } } if (error) exit (SYS_FAILURE) ;

if (tri_count > 0) { back_ptr-> next_input_tri = NULL_INPUT_TRI; . mem_free (tri_ptr,sizeof(INPUT_TRI_STRUC) ) ;

> else { fprintf (stderr, "\n Error - No triangles found in

SUBSTITUTE SHEET

-82.763- input file") ; exit (SYS_FAILURE) ;

} /* pfp_get_input_tri_list_bin */

SUBSTITUTE SHEET

-82.764-

/*****************************************************/ /* */

/* PFPSEG.C */

/* */

/* PFP Segment utility module */

/* */ /* */

/* MODIFICATION LOG */ * *

/* date who what */

/* */ /* JP. Stinebaugh j original code */

/* j J */

/*****************************************************/

finclude <stdio.h> finclude "pf .h" finclude "pfphi.h" finclude "pfptri.h" finclude "pfpseg.h"

/****************************************************** exported procedure

Output_Error

*******************************************************/

void Output_Error()

SUBSTITUTE SHEET

-82.765-

{ fprintf(stderr,"\n*** I/O Error in Slice output file ***\n") ; exit(SYS_FAILURE) ; };

/****************************************************** exported procedure

pfp_print_seg_list

*******************************************************/

void pfp_print_seg_list (seg_list, z, seg_file, section_type, user_info)

OUT_SEG_STRUC **seg_list; UINT16 z; FILE *seg_file; UINT16 section_type; USER_INFO_STRUC *user_info;

{

OUT_SEG_STRUC *seg_ptr,*tempjptr;

if (section_type == LB_CODE) { if (fprintf(seg_file, "%s %u\n", L_TEXT, z) 1=0) Output_Error; if (*seg__list 1= NULL_SEG) if (fprintf(seg_file, "%s\n", LB_TEXT) 1=0) . Output_Error; )

if ((*seg_list 1= NULL_SEG) &&

SUBSTITUTE SHEET

-82.766-

((*seg_list)-> normal_info == section_type) ) { (!user_info-> section_codes_off) switch (section_type)

{ case (LH_CODE) : if (fprintf(seg_file, "%s\n", LH_TEXT) i=0) Output_Error; break; case (NFDB_CODE) : if (fprintf(seg_file, "%s\n", NFDBJTEXT) 1=0) Output_Error; break; case (NFDH_CODE) : if (fprintf(seg_file, "%s\n", NFDH_TEXT) 1=0) Output_Error; break; case (NFDF_CODE) : if (fprintf(seg_file, '^sVn", NFDF_TEXT) 1=0) Output_Error; break; case (NFUB_CODE) : if (fprintf(seg_file, "%s\n", NFUB_TEXT) 1=0) Output_Error; break; case (NFUH_CODE) : if (fprintf(seg_file, "%s\n", NFUH_TEXT) 1=0) Output_Error; break; case (NFUF_CODE) : if (fprintf(seg_file, "%s\n", NFUF_TEXT) 1=0) Output_Error; break; case (FUB_CODE) : if (fprintf(seg_file, "%s\n", FUBJTEXT) 1=0) Output_Error; break; case (FUH_CODE) : if (fprintf(seg_file, "%s\n", FUH_TEXT) 1=0) Output_Error; break; case (FUF_CODE) : if (fprintf(seg_file, "%s\n", FUFJTEXT).1=0) Output_Error; break; case (FDB_CODE) :

SUBSTITUTE SHEET

-82 . 767- if (fprintf(seg_file, "%s\n", FDB_TEXT) 1=0) Output_Error; break; case (FDH_CODE) : if (fprintf(seg_file, "%s\n", FDH_TEXT) 1=0) Output_Error; break; case (FDF_CODE) : if (fprintf(seg_file, "%s\n", FDF_TEXT) 1=0) Output_Error; break; }

seg_ptr = *seg_list;

while ((seg_ptr 1= NULL_SEG) &&

(seg_ptr-> normal_info == section_type) ) { if (fprintf(seg_file, " %u %u %u %u\n", seg_ptr-> χ _l, seg_ptr-> y_l, seg_ptr-> x_2 , seg_ptr-> y_2 ) 1 =0 ) Output_Error ; temp ptr = segjptr ; segjptr = segjptr-> next_seg; mem_free (temp_ptr, sizeof (OUT_SEG_STRUC) ) ; )

*seg_list = NULL_SEG ; }

} /* pfp_print_seg_list */

****************************************************** exported procedure

pfp_display_seg_list

SUBSTITUTE SHEET

-82 .768-

void pfp_display_seg_lis-t (seg_list, displayjnode)

OUT_SEG_STRUC *seg_list; INT16 displayjnode;

{

OUT_SEG_STRUC *seg_ptr;

set_display_mode (displayjnode) ;

segjptr = seg_list;

while (seg_ptr 1= NULL_SEG) { draw_line (seg_ptr-> x_l, seg_ptr-> y_l, seg_ptr-> x_2, seg_ptr-> y_2) ; seq ptr = segjptr-> next_seg; }

} /* pfp_display_seg_list */

/****************************************************** exported procedure

pfp_delete_seg_list

SUBSTITUTE SHEET

-82 . 769- **************** ***************************************/

void pfp_delete_seg_list (seg_list)

OUT_SEG_STRUC **seg_list;

{ OUT_SEG_STRUC *next_ptr,*seg_ptr;

seg_ptr = *seg_list;

while (seg_ptr 1= NULL_SEG)

{ next_ptr = seg_ptr-> next_seg; mem_free (seg_ptr,sizeof(OUT_SEG_STRUC) ) ; segjptr = next_ptr; }

*seg_list = segjptr;

} /* pfp_delete_seg_list */

/****************************************************** local procedure

swap oints

*******************************************************/

SUBSTITUTE SHEET

-82.770- static void swap points (segjptr)

OUT_SEG_STRUC *seg_ptr;

UINT16 temp;

temp = segjptr-> x_l; seg_ptr-> x_l = seg_ptr-> x_2; seg_ptr-> x_2 = temp;

temp = seg_ptr-> y_l; seg_ptr-> y_l = seg_ptr-> y_2; seg_ptr-> y_2 = temp;

} /* swapjpoints */

/****************************************************** local procedure

get_next_seg

*******************************************************/

static void get_next_seg (seg_ptr, seg_list, next_seg_ptr)

OUT_SEG_STRUC *seg_ptr;

SUBSTITUTE SHEET

-82 .771-

OUT_SEG_STRUC **seg_list; OUT_SEG_STRUC **next_seg_ptr;

OUT_SEG_STRUC *list_ptr, *back_ptr; OUT_SEG_STRUC head_rec;

BOOLEAN seg_found = FALSE;

*next_seg_ptr = NULL_SEG; backjptr = &head_rec head_rec .next_seg = *seg_list; list_ptr = *seg_list;

while ((list_ptr 1= NULL_SEG) && !seg_found)

{ seg_found = (((seg_ptr-> x_l == list_ptr-> x_2) && (seg_ptr-> y_l == list_ptr-> y_2)) J j ((seg_ptr-> x_l == list_ptr-> x_l) &&

(seg_ptr-> y_l == list_ptr-> y_l) ) ) ;

if (1seg_found)

{ backjptr = listjptr; listjptr = listjptr-> next_seg; } }

if (seg_found) { if (1 ( (seg_ptr-> x_l == list_ptr-> x_2) && (seg_ptr-> y_l == list_ptr-> y_2))) swap_points (list_ptr) ;

back_ptr-> next_seg = list_ptr-> next_seg; *next_seg_ptr = list_ptr; }

SUBSTITUTE SHEET

-82 .772- *seg_list = head_rec .next_seg;

} /* get_next_seg */

/****************************************************** exported procedure

pf _sort_seg_list

*******************************************************/

void pfp_sort_seg_list (list_l_ptr, loop_count)

OUT_SEG_STRUC **list_l_ptr; INT16 *loop_count;

{

OUT_SEG_STRUC *list_2_ptr, *seg_ptr, *next_seg_ptr;

segjptr = NULL_SEG; next_seg_ptr = NULL_SEG; list_2_ptr = NULL_SEG;

*loop_count = 0;

while (*list_l_ptr != NULL_SEG)

{ (*loop_count)++;

SUBSTITUTE SHEET

-82.773- seg_ptr = *list_l_ptr;

*list_l_ptr = (*list_l_ptr)-> next_seg; seg_ptr-> next_seg = list_2jptr; list_2jptr = seg_ptr; do

( get_next_seg (seg_ptr, list_l_ptr,

&next_seg_ptr) ; if (next_seg_ptr 1= NULL_SEG) { next_seg_ptr-> next_seg = list_2_ptr; list_2_ptr = next_seg_ptr; seg_ptr = next_seg_ptr;

} } while (next_seg_ptr 1= NULL_SEG) ;

>

*list_l_ptr = list_2_ptr;

) /* pfp_sort_seg_list */

****************************************************** procedure

append_seg_list

*******************************************************/

void append_seg_list (listl, list2)

OUT_SEG_STRUC **listl; OUT SEG STRUC **list2;

SUBSTITUTE SHEET

-82.774-

{

OUT_SEG_STRUC *Iistijptr;

if (*listl == NULL_SEG) *listl = *list2; else

{ listl_ptr = *listl; while (listl_ptr-> next_seg 1= NULL_SEG) listl_ptr = listljptr-> next_seg; listl_ptr-> next_seg = *list2;

} *list2 = NULL_SEG;

} /* append__seg_list */

SUBSTITUTE SHEET

-82.775-

/******************************************************/ /* */

/* PFPSEG.H */

/* */

/* PFP segment header file */

/* */ /* MODIFICATION LOG */ * */

/* date who what */

/* */

/* j j */ /* j J */ ******************************************************

fdefine NORMAL_X_POSITIVE 1 fdefine NORMAL_X_NEGA IVE 2 fdefine NORMAL_Y_POSITIVE 4 fdefine NORMAL_Y_NEGATIVE 8 fdefine NORMAL_Z_POSITIVE 16 fdefine NORMAL_Z_NEGATIVE 32 fdefine FLAT_TRI 64 fdefine NEAR FLAT TRI 128

struct out_seg

{ UINT16 x_l;

UINT16 y_ι?

UINT16 x_2;

UINT16 y_2;

UINT8 normal info; struct out_seg *next_seg;

};

typedef struct out_seg OUT_SEG_STRUC;

fdefine NULL_SEG (OUT_SEG_STRUC *) NULL

SUBSTITUTE SHEET

-82 .776- fdefine L_TEXT "L" /* Layer Header */ fdefine LB_TEXT "LB" /* border */ fdefine LH_TEXT "LH" /* border hatching */ fdefine NFDB TEXT "NFDB" /* Near-Flat Down skin

Border */ fdefine NFDH TEXT "NFDH" /* Near-Flat Down skin

Hatch */ fdefine NFDFJTEXT "NFDF" /* Near-Flat Down skin Fill */ fdefine NFUB_TEXT "NFUB" /* Near-Flat Up skin Border */ fdefine NFUH_TEXT "NFUH" /* Near-Flat Up skin Border */ fdefine NFUF_TEXT "NFUF" /* Near-Flat Up skin Fill */ fdefine FDB_TEXT "FDB" /* Flat Down skin Fill */ fdefine FDHJTEXT "FDH" /* Flat Down skin Fill */ fdefine FDF_TEXT "FDF" /* Flat Down skin Fill */ fdefine FUB_TEXT "FUB" /* Flat Down skin Fill */ fdefine FUH_TEXT "FUH" /* Flat Down skin Fill */ fdefine FUF TEXT "FUF" /* Flat Down skin Fill */

SUBSTITUTE SHEET

-82.777-

/*****************************************************/

/* *

/* PFPTRI.C */

/* *

/* PFP Process Triangles Section */

/* * /* MODIFICATION LOG */ * */

/* date who what */

/* */

/ * j J * /*****************************************************/

finclude <stdio.h> finclude <math.h>

finclude "pfp.h" finclude "pfphi.h" finclude "pfptri.h" finclude "pfpseg.h" finclude "pfputl.h"

extern INPUT_TRI_STRUC *tri_bucket_array[] ; extern OUT_SEG_STRUC *FD_seg_bucket_array[] ; extern OUT_SEG_STRUC *FU_seg_bucket_array[] ; extern OUT_SEG_STRUC *NFU_seg_bucket_array[] ; extern OUT_SEG_STRUC *NFD_seg_bucket_array[] ; extern UINT16 z_control_table[] ;

/****************************************************

local procedure

add_near_flat_segment

SUBSTITUTE SHEET

-82.778- Adds a segment list

*****************************************************/

static void add_near_flat_segment(segment,zi) OUT_SEG_STRUC **segment; UINT16 zi;

{

OUT_SEG_STRUC *seg_ptr;

seg ptr = *segment; *segment = NULL_SEG;

if (seg_ptr->normal_info&NORMA_Z_.POSITIVE) { seg_ptr->next_seg = NFU_seg_bucket_array[zi] ; NFU_seg_bucket_array[zi] = seg_ptr;

} else { seg_ptr->next_seg = NFD_seg_bucket_array[zi] ; ~ NFD_seg_bucket_array[zi] = segjptr;

} }

/******************************************************

procedure

process_flat_tri_list

Takes each flat triangle and generates segments for z level and adds to FU or FD segment lists

*******************************************************/

void process_flat_tri_list(flat_tri_list)

SUBSTITUTE SHEET

-82 . 779-

INPUT_TRI_STRUC *flat_tri_list;

{

OUT_SEG_STRUC *seg_list; INPUT_TRI_STRUC *temp_tri_ptr; UINT16 flat_tri_count = 0;

UINT16 zi;

while (flat_tri_list 1= NULL_INPUT_TRI) { flat_tri_count++; if (flat_tri_count%10 == 0) fprintf(stderr, " processing flat triangles (%u)\r",flat_tri_count) ;

seg_list = NULL_SEG; pfp_convert_tri_to_segs(flat_tri_list,&seg_list) ; zi = get_z_binarily((UINT16) flat_tri_list->zl) ;

if (flat_tri_list->normal_info&NORMAL_Z_POSITIVE) {

append_seg_list(&seg_list,&FU_seg_bucket_arra [zi] ) ; FU_seg_bucket_array[zi] = seg_list;

} else {

append_seg_list(&seg_list,&FD_seg_bucket_array[zi] ) ; FD_seg_bu * cket_array[zi] = seg_list;

};

temp_tri_ptr = flat_tri_list; flat_tri_list = flat_tri_list->next_input_tri; mem_free(temp_.tri_ptr,sizeof(INPUT_TRI_STRUC) ) ;

} fprintf (stderr, " processing flat triangles (%u) \n" , flat_tri_count) ;

}

SUBSTITUTE SHEET

-82.780- /****************************************************

procedure

process_near_flat_tri_list

Takes each near flat triangle and breaks into polygon for each z level and adds to NFU or NFD segment lists

*******************************************************/ void process_near_flat_tri_list(near_flat__tri_list) INPUT_TRI_STRUC *near_flat_tri_list; {

OUT_SEG_STRUC *sidel_seg,*side2_seg,*top_seg,*bot_seg; INPUT_TRI_STRUC *temp_tri_ptr; VECT_TRI_STRUC vect_tri; UINT16 near_tri_count = 0;

UINT16 zi;

top_seg = NULL_SEG; bot_seg = NULL_SEG;

while (near_flat_tri_list 1= NULL_INPUT_TRI) { near_tri_count++; if (near_tri_count%10 == 0) fprint (stderr," processing near flat triangles (%u)\r",near_tri_count) ;

pfp_convert_tri_tojvect(near_flat_tri_list,Svect _tri) ; zi = get_z_binarily((UINT16) vect_tri.vertl_z) ;

while (z_control_table[zi+l] <= vect_tri.vert3_z) { pfp_get_intersection_segment(&vect__tri,z_control table[zi] , &bot_seg) ; pfp_get_intersection_segment(&vect_tri,z_control

SUBSTITUTE SHEET

-82 . 781- table[zi+l] ,&top_seg) ; sidel_seg = (OUT_SEG_STRUC *) mem_alloc(sizeof

(OUT_SEG_STRUC) ) ; sidel_seg->x_l = bot_seg->x_l sidel_seg->y_l = bot_seg->y_l sidel_seg->x_2 = top_seg->x_l sidel_seg->y_2 = top_seg->y_l side2_seg = (OUT_SEG_STRUC *) mem_alloc(sizeof (OUT_SEG_STRUC) ) ; side2_seg->x_l = bot_seg->x_2 side2_seg->y_l = bot_seg->y_2 side2_seg->x_2 = top_seg->x_2 side2_seg->y.2 = top_seg->y_2 sidel_seg->normal_info = bot_seg->normal_info; side2_seg->normal_info = bot_seg->normal_info;

/* Check for point segments in Top and Bottom. If so, at a vertex */ if ( (bot_seg->x_l == bot_seg->x_2) && (bot_seg->y_l == bot_seg->y_2) ) { pfp_get_xy_normal_info

((float) sidel_seg->x_l, (float) sidel_seg->y_l,

(float) sidel_seg->x_2, (float) sidel_seg->y_2, (float) top_seg->x_2, (float) top_seg->y_2,

&sidel_seg->normal_info) ; pfp_get_xy_normal_info

((float) side2_seg->x_l, (float) side2_seg->y_l, (float) side2_seg->x_2, (float) side2_seg->y_2,

(float) top_seg->x_l, (float) top_seg->y_l, &side2_seg->normal_info) ; pfp_get_xy_normal_info

((float) top_seg->x_l, (float) top_seg->y_l, (float) top_seg->x_2, (float) top_seg->y_2,

(float) bot_seg->x_l, (float) bot_seg->y_l, &top_seg->normal_info) ;

SUBSTITUTE SHEET

-32 .7δ2- add_near_flat_segment(&top_seg,zi) ;

> else { pfp_get_xy_normal_info ((float) sidel_seg->x_l, (float) sidel_seg->y_l,

(float) sidel_seg->x_2, (float) sidel_seg->y_2, (float) bot_seg->x_2, (float) bot_seg->y_2, &sidel_seg->normal_info) ; pfp_get_xy_normal_info

((float) side2__seg->x_l, (float) side2_seg->y_l,

(float) side2_seg->x_2, (float) side2_seg->y_2, (float) bot_seg->x_l, (float) bot_seg->y_l, &side2_seg->normal_info) ; pfp_get_xy_normal_info

((float) bot_seg->x_l, (float) bot_seg->y_l, (float) bot_seg->x_2, (float) bot_seg->y_2, (float) top_seg->x_l, (float) top_seg->y_l, &bot_seg->normal_info) ; if ( (top_seg->x_l 1= top_seg->x_2) J J (top_seg->y_l 1= top_seg->y_2) ) { pfp_get_xy_normal_info

((float) top_seg->x_l, (float) top_seg->y_l, (float) top_seg->x_2, (float) top_seg->y_2,

(float) bot_seg->x_l, (float) bot_seg->y_l, &top_seg->normal_info) ; add_near_flat_segment(&top_seg,zi) ;

}; add_near_flat_segment(&bot_seg,zi) ;

}; add_near_flat_segment(&sidel_seg,zi) ; add_near_flat_segment(&side2_seg,zi) ; zi++; };

SUBSTITUTE SHEET

-82 . 783 - temp_trijptr = near_flat_tri_list; near_flat_tri_list = near_flat_tri list->next_input_tri; mem_free(temp_tri_ptr,sizeof(INPUT_TRI_STRUC) ) ; };

if (top_seg != NULL_SEG) mem_free(top_seg,sizeof(OUT_SEG_STRUC) ) ; if (bot_seg 1= NULL_SEG) mem_free(bot_seg,sizeof(OUT_SEG_STRUC) ) ;

fprintf(stderr, " processing near flat triangles (%u)\n",near_tri_count) ; } ;

SUBSTITUTE SHEET

-82.784-

/*****************************************************/ /* */

/* PFPTRI.H */

/* */

/* PFP triangle definition header file */

/* */ /* MODIFICATION LOG */ * */

/* date who what */ * */

/* {P. Stinebaugh J original code */ /* J J

/*****************************************************/

struct in_ _tri

{ float xl; float yi; float zl; float x2; float y2; float z2; float x3; float y3; float z3;

UINT8 normal_info; struct in_tri *next_input_tri;

};

typedef struct in_tri INPUT_TRI_STRUC;

struct vector

{ float x; float y;

SUBSTITUTE SHEET

-82 . 785- float x_incr; float y_incr;

struct vect tri { struct 1 vector vector_l; struct vector vector_2; struct vector vector_3; float vertl_z; float vert2_z; float vert3_z; UINT8 normal_info; struct vect_tri *next_tri;

};

typedef struct vect_tri VECT_TRI_STRUC;

fdefine NULL_INPUT_TRI (INPUT_TRI_STRUC *) NULL fdefine NULL_VECT_TRI (VECT_TRI_STRUC *) NULL

SUBSTITUTE SHEET

-82.786-

/******************************************************/

/* */

/* PFPTUTL.C */

/* V

/* PFP Triangle Utilities module */

/* */

/* MODIFICATION LOG */ * *

/* date who what */ * *

/* J . Stinebaugh J original code */

/* J J */

/******************************************************/

finclude <stdio.h> finclude "pfp.h" finclude "pfptri.h" finclude "pfpseg.h" finclude "pfputl.h"

extern UINT16 z_control_table []

/******************************************************* exported procedure

p f p_get nin _z

******************************************************/

void pfp_get_min_z (tri , min_z)

SUBSTITUTE SHEET

-82.787-

INPUT_TRI_STRUC *tri; float *min_z;

{

*min_z = (float) (MAX_Z_VAL+1) ;

if (tri-> zl < *min_z) *min_z = tri-> zl;

if (tri-> z2 < *min_z) *min_z = tri-> z2;

if (tri-> z3 < *min_z) *min_z = tri-> z3;

) /* pfp_get_min_z */

/****************************************************** local procedure

get_max_z

******************************************************/

void get_max_z (tri, max_z)

INPUT_TRI_STRUC *tri; float *max z;

SUBSTITUTE SHEET

-82.788- *max_z = 0.0;

if (tri-> zl > *max_z) *max_z = tri-> zl;

if (tri-> z2 > *max_z) *max_z = tri-> z2;

if (tri-> z3 > *max_z) *max_z = tri-> z3;

} /* get_max_z */

/****************************************************** local procedure

orderjpoints

*******************************************************

void order_points (input_tri)

INPUT_TRI_STRUC *input_tri;

{

INPUT_TRI_STRUC *temp_tri; float min_z; float max_z;

SUBSTITUTE SHEET

-82 . 789- temp_tri = (INPUT_TRI_STRUC *) mem_alloc (sizeof (INPUT_TRI_STRUC) ) ;

pfp_get_min_z (input_tri, &min__z) ;

get_max_z (input_tri, &max_z) ;

if ((input_tri-> zl == max_z) && (input_tri-> z2 =• min_z) )

{ temp_tri-> xl = input_tri-> x2; temp_tri-> yl = input_tri-> y2; temp_tri-> zl = input_tri-> z2;

temp_tri-> x2 = input_tri-> x3; temp__tri-> y2 = input_tri-> y3; temp_tri-> z2 = input_tri-> z3;

temp_tri-> x3 = input_tri-> xl; temp_tri-> y3 = input_tri-> yl; temp_tri-> z3 = input_tri-> zl; }

else if ( (input__tri-> zl == max_z) && (input_tri-> z3 == min_z) )

{ temp_tri-> xl = input_tri-> x3; temp_tri-> yl = input_tri-> y3; temp_tri-> zl = input_tri-> z3;

temp_tri-> x2 = input_tri-> x2; temp_tri-> y2 = input_tri-> y2; temp_tri-> z2 = input_tri-> z2;

temp_tri-> x3 = input_tri-> xl; temp_tri-> y3 = input_tri-> yl; temp_tri-> z3 = input_tri-> zl;

SUBSTITUTE SHEET

-82.790- > else if ( (input_tri-> z2 == max_z) && (input_tri-> z3 == min__z) )

- { temp_tri-> xl = input_tri-> x3; temp_tri-> yl = input_tri-> y3; temp_tri-> zl = input_tri-> z3;

temp_tri-> x2 = input_tri-> xl; temp_tri-> y2 = input_tri-> yl; temp__tri-> z2 = input_tri-> zl;

temp_tri-> x3 = input_tri-> x2; temp_tri-> y3 = input_tri-> y2; temp_.tri-> z3 = input_tri-> z2; >

else if ((input_tri-> z2 == max_z) && (input_tri-> zl == min_z))

{ temp_tri-> xl = input_tri-> xl; temp_tri-> yl = input_tri-> yl; temp_tri-> zl = input_tri-> zl;

temp_tri-> x2 = input__tri-> x3; temp_tri-> y2 = input_tri-> y3; temp_tri-> z2 = input_tri-> z3;

temp_tri-> x3 = input_tri-> x2; temp_tri-> y3 = input_tri-> y2; temp_tri-> z3 = input_tri-> z2; }

else if ((input_.tri-> z3 == max_z) && (input_tri-> zl = min_z) )

{ temp_tri-> xl = input_tri-> xl;

SUBSTITUTE SHEET

-82 . 791- temp_tri-> yl = input_tri-> yl; temp_tri-> zl = input_tri-> zl; temp_tri-> x2 = input_tri-> x2; temp_tri-> y2 = input_tri-> y2; temp_tri-> z2 = input_tri-> z2;

temp_tri-> x3 = input_tri-> x3; temp_tri-> y3 = input_tri-> y3; temp_tri-> z3 = input_tri-> z3; >

else

{ temp_tri-> xl = input_tri-> x2; temp_tri-> yl = input_tri-> y2; temp_tri-> zl = input_tri-> z2;

temp_tri-> x2 = input_tri-> xl; temp_tri-> y2 = input_tri-> yl; temp_tri-> z2 = input_tri-> zl;

temp_tri-> x3 = input_tri-> x3; temp_tri-> y3 = input_tri-> y3; temp_tri-> z3 = input_tri-> z3; )

temp_tri-> normal_info = input_tri-> normal_info; temp_tri-> next_input_tri = input_tri-> next_input_tri; copy(temp_tri, input_tri, sizeof (INPUT_TRI_STRUC) ) ; mem_free(temp_tri,sizeof(INPUT_TRI_STRUC) ) ;

} /* order_points */

/****************************************************** local procedure

SUBSTITUTE SHEET

-82 .792-

get_vector

******************************************************/

void get_vector (vector_ptr, start_x, start y, start_z, end_x, end_y, end_z)

struct vector *vector_ptr; float start_x; float start_y; float start_z; float end_x; float end y; float end z;

double delta_x, delta_y, delta_z,

vector_ptr-> x = start_x; vector ptr-> y = startjy;

delta_z = end_z - start_z;

if (delta_z > 0.0)

{ delta_x = end_x - start_x; delta_y = end_y - start_y; vectorjptr-> x_incr = delta_x / delta_z; vector_ptr-> y_incr = delta_y / delta_z;

} else

{

SUBSTITUTE SHEET

-82 . 793- vector_ptr-> x_incr = 0; vector_ptr-> y_incr = 0;

}

} /* get_vector */

/****************************************************** exported procedure

pfp_get_intersection_segment

*******************************************************/ void pfp_get_intersection_segment (vect_ptr, z_value, segjptr)

VECT_TRI_STRUC *vect_ptr; UINT16 z_value; OUT_SEG_STRUC **seg_ptr;

{

OUT_SEG_STRUC *segment;

if (*seg_ptr == NULL_SEG)

*seg_ptr = (OUT_SEG_STRUC *) mem_alloc (sizeof(OUT_SEG_STRUC) ) ; segment = *seg_ptr;

segment-> normal_info = vect_ptr-> normal_info; segment-> x_l = round_flt(vect_ptr-> vector_l ,x + vect_ptr-> vector_l.x_incr * (z_value - vect_ptr->vertl_z) ) ;

SUBSTITUTE SHEET

-82 .794- segment-> y_l = round_fIt(vect_ptr-> vector_l .y + vectjptr-> vector_l. _incr * (z_value - vect_ptr->vertl_z) ) ;

if (vect_ptr-> vert2_z > z_value)

{ segment-> x_2 = round_fIt(vect_ptr-> vector_2 .x

+ vect_ptr-> vector_2.x_incr * (z_value - vect_ptr->vertl_z) ) ; segment-> y_2 = round_fIt(vect_ptr-> vector_2 .y + vect_ptr-> vector_2. _incr * (z_value - vectjptr->vertl_z) ) ;

} else

{ segment-> x_2 = round_fIt(vect_ptr-> vector_3 .x

+ vectjptr-> vector_3. _incr * (z_value - vect_ptr->vert2_z) ) ; segment-> y_2 = round_fIt(vect_ptr-> vector_3 .y + vectjptr-> vector_3.y_incr * (z_value - vect_ptr->vert2_z) ) ; }

} /* pfp_get_intersection_segment */

/****************************************************** exported procedure

SUBSTITUTE SHEET

-82 . 795- ******************************************************/

void pfp_convert_tri_to_vect(input_tri, vect_tri)

INPUT_TRI_STRUC *input_tri; VECT_TRI_STRUC *vect_tri;

{ struct vector *vectorjptr;

order_points (input_tri) ;

vector_ptr = (struct vector *) vect_tri;

get_vector (vector_ptr++, input_tri-> xl, input_tri-> yl, input_tri-> zl, input_tri-> x3, input_tri-> y3, input_tri-> z3) ;

get_vector (vector_ptr++, input_tri-> xl, input_tri-> yl, input_tri-> zl, input_tri-> x2, input_tri-> y2, input_tri-> z2) ;

get_vector (vectorjptr, input_tri-> x2, input_tri-> y2, input_tri-> z2, input_tri-> x3, input_tri-> y3, input_tri-> z3) ;

vect_tri-> vertl_z = input_tri->zl vect_tri-> vert2_z = input_tri->z2 vect_tri-> vert3_z = input_tri->z3 vect_tri-> normal_info = input_tri-> normal_info; vect_tri-> next_tri = NULL_VECT_TRI;

) /* pfp_convert_tri_to_vect */

SUBSTITUTE SHEET

-82 .796- ****************************************************** procedure

****************************************************** /

void pfp_convert_tri_to_segs (trijptr, seg_list)

INPUT_TRI_STRUC *tri_ptr; OUT_SEG_STRUC **seg_list;

{

OUT_SEG_STRUC *seg_ptr;

seg_ptr = (OUT_SEG_STRUC *) mem_alloc (sizeof (OUT_SEG STRUC) ) ; segjptr-> x_l = tri_ptr-> xl; seg_ptr-> y_l = tri_ptr-> yl; seg_ptr-> x_2 = trijptr-> x2; seg_ptr-> y_2 = tri_ptr-> y2; seg_ptr->normal_info = tri_ptr->normal_info; pfp_get_xy_normal_info (tri_ptr-> xl, tri_ptr-> yl, tri_ptr-> x2, tri_ptr-> y2, tri_ptr-> x3, trijptr-> y3,

&segjptr->normal_info) ; seg_ptr-> next_seg = *seg_list;

*seg_list = seg_ptr;

seg_ptr = (OUT_SEG_STRUC *) mem_alloc (sizeof (OUT_SEG

_STRUC) ) ; seg_ptr-> x_l = tri_ptr-> x2; seg_ptr-> y_l = tri_ptr-> y2; segjptr-> x_2 = tri_ptr-> x3; seg_ptr-> y_2 = tri_ptr-> y3; seg_ptr->normal_info = trijptr->normal_info;

SUBSTITUTE SHEET

-82 .797- pfp_get_xy_normal_info (tri_ptr-> x2, tri_ptr-> y2, tri_ptr-> x3, tri_ptr-> y3, tri_ptr-> xl, trijptr-> yl,

&seg_ptr->normal_info) ; seg_ptr-> next_seg = *seg_list;

*seg_list = segjptr;

seg_ptr = (OUT_SEG_STRUC *) mem_alloc (sizeof (0UT_SEG _STRUC) ) ; seg_ptr-> x_l = trijptr-> x3; seg_ptr-> y_l = tri_ptr-> y3; seg_ptr-> x_2 = tri_ptr-> xl; segjptr-> y__2 = tri_ptr-> yl; seg_ptr->normal_info = trijptr->normal_info; pfp_get_xy_normal_info (tri_ptr-> x3, tri_ptr-> y3, tri_ptr-> xl, tri_ptr-> yl, tri_ptr-> x2, tri_ptr-> y2,

&seg_ptr->normal_info) ; seg_ptr-> next_seg = *seg_list;

*seg_list = segjptr;

} /* pfp_convert_tri_to_segs */

SUBSTITUTE SHEET

-82.798- ******************************************************/ /* */

/* PFPUTL.C */

/* */

/* P P Utilities module */

/* */ /* MODIFICATION LOG */ * *

/* date who what */ * */

/* JP. Stinebaugh J original code */ /* J J */

/******************************************************/

finclude <stdio.h> finclude <time.h> finclude <malloc.h> finclude <math.h> finclude "pfp.h" finclude "pfptri.h" finclude "pfpseg.h" finclude "pfputl.h"

static long last_time;

extern long max_mem_alloc; extern long total nem_alloc; extern long curr nem_alloc;

float round_fIt(float_val) float float_val;

{ long int_val;

int ^al = float_val ;

SUBSTITUTE SHEET

-82 . 799- if (((float) int_val+0,5) <= float_val) int_val++; return (int_val) ;

} /* round_float */

double round_dbl(dbl_val) double dbljval;

{ if (dbl_val < 0.0) dbl_val = ceil(0.5+dbl val) ; else dbl_val = floor(0.5+dbl_val) ; return (dbl_val) ;

} /* round_dbl */

INT16 sign(d) double d;

{ if (d < 0.0) return(-1) ; else return(1) ;

);

STRING *mem_alloc (size)

UINT16 size;

{ STRING *ptr;

ptr = (STRING *) malloc (size) ;

curr_mem_alloc += size; total_mem_alloc += size;

if (curr_mem_alloc > max_mem_alloc) max mem alloc = curr mem alloc;

SUBSTITUTE SHEET

-82 . 800- if (ptr == (STRING *) NULL)

{ fprintf (stderr, "\n error - memory allocation failed\n") ; fprintf (stderr, "\n current allocation = %ld\n", currjnem_alloc) ; exit (SYS_FAILURE) ; }

return (ptr) ;

} /* mem_alloc */

void mem_free (ptr,numJoytes)

STRING *ptr; UINT16 num_bytes;

if (ptr 1= (STRING *) NULL)

( curr_mem_alloc -= num_bytes; free (ptr) ;

} else

{ fprintf (stderr, "\n error - null pointer freed \n") ; exit (SYS_FAILURE) ; }

} /* mem_free */

SUBSTITUTE SHEET

-82.801- void get_timestamp (timestamp)

STRING *timestamp;

{ long time_buf;

time (&time_buf) ; strcpy (timestamp, ctime (&time_buf) ) ;

} /* get_timestamp */

void openfile (filename, filejptr, open node)

STRING *filename; FILE **file_ptr; STRING *open_modei

if (*filename == '\0' )

*file_ptr = (FILE *) NULL; else

{ *file_ptr = fopen (filename, open_mode) ; if (*file_ptr == (FILE *) NULL)

( fprintf (stderr, "\n error - unable to open

%s\n", filename); exit (SYS_FAILURE) ;

} }

SUBSTITUTE SHEET

-82.802- } /* openfile */

void copy (sourcejptr, destjptr, byte_count)

STRING *sourcejptr; STRING *dest_ptr; INT16 bytε_count;

{

INT16 i;

for (i = 0; i < byte_count; i++)

{ *dest_ptr = *source_ptr; dest_ptr++; source_ptr++; }-

} /* copy */

void pfp_get_xy_normal_info

(xl,yl,x2, 2, 3,y3,normal_info) float xl; float yl; float x2; float y2; float x3; float y3;

UINT8 *normal_info;

{ double slope, offset;

*normal_info &= (255-N0RMAL_X_NEGATIVE-N0RMAL_X

SUBSTITUTE SHEET

-82 . 803-

_POSITIVE-NORMAL_Y_NEGATIVE-NORMAL_Y_POSITIVE) ;

if ( (x2 - xl) 1= 0.0) slope = (y2 - yl) / (x2 - xl) ; else slope = 0.0;

offset = yl - slope*xl;

if (slope == 0.0) { if (yi == y2) { if (y3 < y2) *normal_info j= NORMAL_Y_P0SITIVE; else *normal_info j= NORMAL_Y_NEGATIVE;

}; if (xl == x2) { if (x3 < x2) *normal_info j= NORMAL_X_POSITIVE; else *normal_info j= NORMAL_X_NEGATIVE;

} ; } else { if ( ( (y3 - offset)/slope) >= x3) *normal_info J= N0RMAL_X_P0SITIVE; else *normal_info j= N0RMAL_X_NEGATIVE; if ( (slope*x3 + offset) >= y3) *normal_info J= NORMAL_Y_POSITIVE; else *normal_info J= NORMAL_Y_NEGATIVE;

)

};

SUBSTITUTE SHEET

-82.δ04- *****************************************************/ /* */

/* PFPUTL.H */

/* */

/* PFP Utility Prototypes */

/* */ /*****************************************************/

double round_dbl() ; float round_flt() ; STRING *mem_alloc() ; INT16 sign() ;

SUBSTITUTE SHEET

-32.805- *****************************************************/ /* */

/* PFPZACT.C */

/* - */

/* PFP Z Active list module */ * * /* MODIFICATION LOG */

/* */

/* date who what */

/* */

/* JP. Stinebaugh j original code */ /* j j */

/*****************************************************

finclude <stdio.h> finclude "pfp.h" finclude "pfptri.h" finclude "pfpseg.h" finclude "pfputl.h"

/******************************************************* exported procedure

pfp_update_z_active_list

************************************************.*******/

SUBSTITUTE SHEET

-82 .806- void " pfp_update_z_active_list (z_bucket_ptr, seg_list, z_active_list)

INPUT_TRI_STRUC **z_bucket_ptr; OUT_SEG_STRUC **seg_list; VECT_TRI_STRUC **z_active_list;

{

VECT_TRI_STRUC *new_vect_tri;

INPUT_TRI_STRUC *z_bucket_back_ptr, **list_head;

list_head = z_bucketjptr; while (*z_bucket_ptr 1= NULL_INPUT_TRI) { new_vect_tri = (VECT_TRI_STRUC *) mem_alloc

(sizeof (VECT_TRI_STRUC) ) ; pfp_convert_.tri_to_vect (*z_bucketjptr, new_vect_tri) ; new_vect_tri-> next_tri = *z_active_list; *z_active_list = new_vect_tri; z_bucket_back_ptr = *z_bucket_ptr; *z_bucket_ptr = (*z_bucket_ptr)-> next_input_tri; mem_free (z_bucket_back_ptr,sizeof(INPUT_TRI_STRUC) ) ;

};

*list_head = NULL_INPUT_TRI;

} /* pfp_update_z_active_list */

/******************************************************* exported procedure

pfp_process_z_active_list

SUBSTITUTE SHEET

-82 . 807- *******************************************************

void pfp_process_z_active_list (z_active_list, z_value, seg_list)

VECT_TRI_STRUC **z_active_list; UINT16 z_value;

OUT_SEG_STRUC **seg_list;

{ VECT_TRI_STRUC *tri_back_ptr, *tri_list_ptr; OUT_SEG_STRUC *seg_ptr; VECT_TRI_STRUC list_head;

z_value++;

list_head .next_tri = *z_active_list; tri_list_ptr = *z_active_list; tri_back_ptr = &list_head

while (tri_list_ptr 1= NULL_VECT_TRI)

{ if (tri_list_ptr-> vert3_z <= z_value)

{ tri_back_ptr-> next_tri = tri_list_ptr-> next_tri; mem_free (tri_list_ptr,sizeof(VECT

_TRI_STRUC) ) ; tri_list_ptr = tri_back_ptr-> next_tri;

} else

( segjptr = (OUT_SEG_STRUC *) mem_alloc (sizeof(OUT_SEG_STRUC) ) ; pfp_get_intersection_segment (tri_list_ptr, z_value, &seg_ptr) ;

SUBSTITUTE SHEET

-82 . 80δ- seg_ptr->normal_info &= (255-FLAT_TRI-NΞAR

_FLAT_TRI) ; seg_ptr-> next_seg = *seg_list; *seg_list = segjptr; tri_list_ptr = tri_list_ptr-> next_tri; tri_backjptr = tri_back_ptr-> next_tri; }

*z_active_list = list_head .next_tri;

} /* pfpjprocess_z_active_list */

SUBSTITUTE SHEET

-32.809-

/*****************************************************/ /* */

/* PRTUTL.C - Debugging Print Routines */

/* *

/* MODIFICATION LOG */ * * /* date who what */ * *

/* j ! */

/* j j */

/*********** " ******************************************/

finclude <stdio.h> finclude "pfp.h" finclude "pfptri.h" finclude "pfpseg.h" finclude "pfpchl.h"

void print_hatch_point(out_file,point) FILE *out_file;

HATCH_POINT_STRUC *point;

{ if (point == NULL_HATCH_POINT) fprintf(out_file, "\nHatch Point NULL\n") ; else { fprintf(out_file,"\nHatch Point %u %u\n",point-

>x_val,point->y_val) ; fprintf(out_file," angle %d enter_flag %d triangle number %u\n",point->angle,point-> enter_flag,point->triangle_number) ; fprintf(out_file," next_point %lu\n",point-> nextjpoint) ;

}; };

SUBSTITUTE SHEET

-82 .810- void print_hatch_list(out_file,point_ptr) FILE *out_file;

HATCH_POINT_STRUC *point_ptr;

{ fprintf(out_file," BEGIN HATCH POINT

LIST \n") ; while (point_ptr != (HATCH_POINT_STRUC *) NULL) { print_hatch_point(out_file,point_ptr) ; pointjptr = point_ptr->next_point }; fprintf(out_file," END HATCH POINT

LIST \n") ;

};

void print_normal_info(out_file,norm) FILE *out_file;

UINT8 norm;

{ fprintf(out_file,"Segment Triangle Type: ") ; if (norm&FLAT_TRI) fprintf(out_file,"FLAT") ; else if (norm&NEAR_FLAT_TRI) fprintf(out_file,"NEAR FLAT") ; else fprintf(out_file,"SCAN") ; fprintf (out_file, "\n") ; fprintf (out_file, "NORMAL_X_POSITIVE = %s ", norm & NORMAL_X_POSITIVE ? "True " :

"False") ; fprintf (out_file, "NORMAL_X_NEGATIVE = %s\n", norm & NORMAL_X_NEGATIVE ? "True " : "False") ; fprintf (out_file, "NORMAL_Y_POSITIVE = %s ", norm & NORMAL_Y_POSITIVE ? "True " : "False"); fprintf (out_file, "NORMAL_Y_NEGATIVE = %s\n", norm & NORMAL_Y_NEGATIVE ? "True " : "False");

SUBSTITUTE SHEET

-82 . 811- fprintf (out_file, "NORMAL_Z_POSITIVE = %s ", norm & NORMAL_Z_POSITIVE ? "True " : "False") ; fprintf (out_file, "NORMAL_Z_NEGATIVE = %s\n", norm & NORMAL_Z_NEGATIVE ? "True " :

"False") ; fprintf (out_file, "\n") ;

> ;

void print_segment (out_file, seg)

FILE *out_file; OUT_SEG_STRUC *seg;

{ fprintf (out_file, "\n Segment\n") ; fprintf (out_file, " xl = %u yl = %u \n", seg-> x_l, seg-> y_l) ; fprintf (out_file, " x2 = %u y2 = %u \n", seg-> x_2, seg-> y_2) ; print_normal_info(out_file,seg->normal_info) ;

fprintf (out_file, " next ptr = %lu \n", seg-> next_seg) ;

} /* print_segment */

void print_seg_list (out_file, seg_list)

FILE *out_file;

OUT_SEG_STRUC *seg_list;

{

OUT_SEG_STRUC *seg_ptr; UINT16 list_length = 0;

SUBSTITUTE SHEET

-82.812- seg_ptr = seg_list; while (seg_ptr 1= NULL_SEG)

{ list_length++; segjptr = seg_ptr-> next_seg; }

fprintf (out_file, "\nprinting segment list \n") ; fprintf (out_file, "list length = %u ", list_length) ; fprintf (out_file, "list = \n") ;

segjptr = seg_list;

while (seg_ptr 1= NULL_SEG)

{ print_segment (out_file, seg_ptr) ; seg_ptr = seg_ptr-> next_seg;

}

} /* print_seg_list */

void print_seg_bucket_array (out_file, seg_bucket_array)

FILE *out_file; OUT_SEG_STRUC **seg_bucket_array;

{

OUT_SEG_STRUC *seg_ptr; UINT16 i;

fprintf (out_file, "\n Z Segment Bucket Structure:\n") ;

for (i = 0; i < MAX_Z_INDEX; i++) { seg_ptr = seg_bucket_array [i];

SUBSTITUTE SHEET

-82.813- if (seg_ptr 1= NULL_SEG) fprintf (out_file, "\n\n Z Bucket Index %d \n » , i) ; while (seg_ptr 1= NULL_SEG) { print_segment (out_file, seg_ptr) ; segjptr = seg_ptr-> next_seg;

} }

} /* print_seg_bucket_array */

void print_input_tri (out_file, tri)

FILE *out_file;

INPUT_TRI_STRUC *tri;

{ fprintf (out_file, " (x,y,z) = %f %f %f \n", tri-> xl, tri-> yl, tri-> zl) ; fprintf (out_file, " (x,y,z) = %f %f %f \n", tri-> x2, tri-> y2, tri-> z2) ; fprintf (out_file, " (x,y,z) = %f %f %f \n", tri-> x3, tri-> y3, tri-> z3) ; print_normal_info(out_file,tri->normal_info) ;

) /* print_input_tri */

in_box (tri_ptr)

INPUT_TRI_STRUC *tri_ptr;

SUBSTITUTE SHEET

-82 . 814-

lf ((tri_ptr-> zl <= 3000) JJ (tri_jιtr-> z2 <= 3000)

I I I I

(tri_ptr-> z3 <= 3000))

if ((tri_ptr-> zl >= 3000) Jj (tri_ptr-> z2 >= 3000) J J (tri_ptr-> z3 >= 3000))

{ if ( (tri_ptr-> xl < 20000) && (tri_ptr-> xl > 13000)) j J

( (tri_ptr-> x2 < 20000) && (tri_ptr-> x2 >

13000)) J J ( (tri_ptr-> x3 < 20000) && (tri_ptr-> x3 > 13000)) )

{ if (

((tri_ptr-> yl < 55000) && (tri_ptr-> yl > 48000) ) J { ((tri_ptr-> y2 < 55000) && (tri_ptr-> y2 >

48000) ) { j

((tri_ptr-> y3 < 55000) && (tri_ptr-> y3 > 48000) )

) return (1) ;

} } } return (0) ;

} /* in_box */

void print_tri_list (out_file,tri_list)

SUBSTITUTE SHEET

-82 . 815-

FILE *out_file;

INPUT_TRI_STRUC *tri_list;

{

INPUT_TRI_STRUC *tri_ptr; UINT16 list_length = 0;

trijptr = tri_list; while (tri_ptr 1= NULL_INPUT_TRI)

( list_length++; tri_ptr = tri_ptr-> next_input_tri;

}

fprintf (out_file, "\n list length = %u ", list_length) ; fprintf (out_file, "\n list = \n") ;

tri_ptr = tri_list; while (trijptr 1= NULL_INPUT_TRI) ( /*if (in_box (tri_ptr) ) */ print_input_tri (out_file, tri_ptr) ; tri_ptr = tri_ptr-> next_input_tri; }

) /* print_tri_list */

void print_tri_bucket_array (out_file, z_bucket_array)

FILE *out_file; INPUT_TRI_STRUC **z_bucket_array; {

SUBSTITUTE SHEET

-82. 816-

INPUT_TRI_sτRUC *tri_ptr; INT16 i;

fprintf (out_file, "\n Tri Bucket Structure:\n") ;

for (i = 0; i < MAX_Z_INDEX; i++) { trijptr = z_bucket_array [i] ; if (tri_ptr 1= NULL_INPUT_TRI) fprintf (out_file, "\n\n Z Bucket Index = %d \n » , i) ; while (tri_ptr 1= NULL_INPUT_TRI)

{ print_input_tri (out_file, tri_ptr) ; tri_ptr = tri_ptr-> ,next_input_tri;

} }

} /* print_tri_bucket_array */

void print_vect_tri (out_file, vect_tri)

FILE *out_file;

VECT_TRI_STRUC *vect_tri;

{ fprintf (out_file, " vector l:\n") ; fprintf (out_file, " x = %f y = %f x_incr = %f y_incr = %f\n", vect_tri-> vector_l .x, vect_tri-> vector_l .y, vect_tri-> vector_l .x_incr, vect_tri-> vector_l .y_incr) ;

SUBSTITUTE SHEET

-82 . 817- fprintf (out_file, " vector 2:\n") ; fprintf (out_file, " x = %f y = %f x_incr = %f y_incr = %f\n", vect_tri-> vector_2 .x, vect_tri-> vector_2 .y, vect_tri-> vector_2 .x_incr, vect_tri-> vector_2 .y_incr) ;

fprintf (out_file, " vector 3:\n"); fprintf (out_file, " x = %f y = %f x_incr = %f y_incr = %f\n", vect_tri-> vector_3 .x, vect_tri-> vector_3 ,y, vect_tri-> vector_3 .x_incr, vεct_tri-> vector_3 .y_incr) ;

fprintf (out_file, "Vertex 1 Z = %f\n",vect_tri-> vertl_z) ; fprintf (out_file, "Vertex 2 Z = %f\n",vect_tri-> vert2_z) ; fprintf (out_file, "Vertex 3 Z = %f\n",vect_tri-> vert3_z) ; print_normal_info(out_file,vect_tri->normal_info) ;

} /* print_vect_tri */

void print_z_active_list (out_file, z_active_list)

FILE *out_file; VECT_TRI_STRUC *z_active_list;

( while (z_active_list .1= NULL_VECT_TRI)

{

SUBSTITUTE SHEET

-82 . 818- print_vect_tri (out_file, z_active_list) ; z_active_list = z_active_list-> next_tri;

} f flush (out_f ile) ;

} /* print_z_active_list */

SUBSTITUTE SHEET

-82 . 819-

{$R-,S-,I-,D+,T-,F-,V-,B-,N-,L+} {$M 4096,1,65536}

STEREO, Sterolithography Device Driver

for 3D Systems' Sterolithography System

Version 2.60 by Tarnz Technologies

STEREO is a memory-resident laser controller device driver. It interfaces between the Background Task's Software Interrupt Handler and a program wanting to control the laser apparatus using easy text-based commands.

STEREO receives and processes simple (X,Y) laser position commands passed to it by some other program using a software interrupt vector. The CLIFF Turbo Pascal program is just such a program; it can read commands from either the computer's keyboard or from disk files and then pass them along to this program.

STEREO, like an MSDOS driver, can be called by programs written in any language, including assembly and BASIC. The interface will usually be a special subroutine that invokes the STERO software interrupt. Unlike an MSDOS driver, STEREO cannot be referenced directly by a filename.

STEREO'S device driver format is simpler, faster, and more clean than an MSDOS device driver. STEREO processed a complete text string (a line) at a time, as

SUBSTITUTE SHEET

-82 . 820- opposed to one character at a time for an MSDOS device driver. If desired, an official MSDOS device driver (STL: , LSR: or whatever) could be added in later.

STEREO understands the following commands:

BX 0-65535 Beginning X position (position) BY 0-65535 Beginning Y position (position) JX 0-65535 Jump to new X position (position) JY 0-65535 Jump to new Y position (position) NX 0-65535 Next X position (position) NY 0-65535 Next Y position (position) SS 1-65535 Step Size (rel incr) 1 SP 5-6553, . multi-pass Step Periods (10 us) SD 0-65535 Scanning Delay (step periods)

JS 1-65535 Jump Size (rel incr) JD 0-65535 Jump Delay (step periods)

LO 0-65535 Laser On delay (10 us)

LF 0-65535 Laser Off delay (10 us) + NS eNter Sequence mode + AB Enter Absolute mode

EX Execute

EC Execute and Clear

CL Clear table

MD AS +/- set Auto-Shutter mode (on/off)

MD BL +/- set BLock mode (on/off)

MD PA +/- set Pos Ack mode (on/off)

SR Soft Reset

HR Hard Reset

RC 1-10 Redraw pass Count (f passes) ! RD 0-65535 Redraw Delay (step periods)

! RS 0-65535 Redraw Size (distance)

1 VC 1-10 riVet pass Count (f passes)

! VP 5-6553, .. riVet step Periods (10 us)

SUBSTITUTE SHEET

-82.821-

1 VR 0-65535 riVet Reduction amount (distance) 1 VX 0-65535 riVet end X position (position) 1 VY 0-65535 riVet end Y position (position) ! WI 0-32767 Wait for Idle (delay)

where:

10 us is the f of 10s of microseconds resolution = 0.84 us (from 1.19 MHz clock) position is the absolute position in the field distance is the absolute distance in step size units rel incr is the relative f of position increments f passes is the number of redraw passes step periods is the time to cover that f of steps programmed by SP command (= tick counts) delay delay value in milliseconds (may be faster on faster computers)

In the above list, following each two-character command is the range of numbers allowed as arguments to the command. Each command must be on a separate line, ending with a CR or CR/LF sequence. All spaces are ignored. All numbers are in unsigned decimal.

The Control Instruction Set is intended to be compatible with General Scanning's DG Series Electronic Packages for Laser Control. Only the Vector Mode is supported. The Raster Mode is not supported. The step and delta functions of the Vector Mode are also unsupported. No Z-axis control is supported yet. Commands marked with an **' are not fully implemented as per the DG specification for

SUBSTITUTE SHEET

-82 .822- functional reasons. Commands marked with '+' are included only for the sake of complete command compatibility. ' 1 ' denotes new commands not available on the DG devices.

DG Version 2.6 Vector Mode Commands not supported:

ST enter STep mode

RE REset to top of stack in step mode

DL enter DeLta mode

QI Query IB 1 Q2 Query IB 2

The command line with invokes STEREO and causes it to be installed in memory takes the form:

STEREO [/options]

where /options are any number of user-selectable options:

/D - debug mode, display vector information

/NV - no constant vector velocity

/NG - no geometric correction

/NC - no version check at install time

STEREO can only be installed once after the computer has been powered up. If different options are required, the computer system will have to be completely rebooted.

The SP (and VP) command has multiple arguments. Each of up to ten passes of redraw can have its own step period. The SP command can have 1 to 10 arguments, each a step period for a pass:

SP sp0,spl,sp2,sp3...

SUBSTITUTE SHEET

-82 . 823-

where spO is the step period for redraw pass 0 (the original vector move) , spl is the step period for redraw pass 1, and so on. /V121 option is not longer supported.

Geometric correction is automatically invoked. If geometric correction is not desired, the option /NG or /GEO NO should be specified on the command line. Geometric correction occurs on the endpoints of any vector STEREO passes to the software interrupt handler.

STEREO code came from Version 1.40 of CLIFF, which originally performed the command translation. This memory-resident STEREO device driver was formed to speed up 3D Systems' supervisory programs, written in GWBASIC and Turbo BASIC. With the Geo Correct Table, STEREO takes up approximately 8OK of memory, increas¬ ing to about 150K the amount of main memory used by the complete laser controller system and its data structures.

Axes Control Options: DEFAULT

/X +/- select X-axis direction +

/Y +/- select Y-axis direction +

/SWAPXY swap X and Y coordinates no

/GEO XYJYXjNO select geo correct sequence YX (used for old style)

/AXESBEGIN to axes-control begin pos no

SUBSTITUTE SHEET

-82 .824-

Recent History: 8/18/87 Ver 2.02 STEREO released memory resident portion of Ver 1.x

CLIFF process WI Wait for Idle command added

8/22/87 Ver 2.03 Stuart's new Geometric Correction

Y is the first, X is the second mirror /NC no version check flag jump vectors of 0 steps skipped

Cvtlnt now works for 32768 ($8000)

Step Periods supported for stream

(non-block) mode

8/25/87 Ver 2.04 Geometric Correction delta bugs fixed

9/23/87 Ver 2.12 STEREO Axes Control added new options /X, /Y, /SWAPXY, /GEO

9/30/87 Ver 2.25 Table-Interpolation Geometric

Correction installed

10/26/87 Ver 2.26 Wait for Idle argument is 100 minimum

/NG prevents loading of STEREO.GEO

10/28/87 Ver 2.27 improved Geometric Correction formula

11/12/87 Ver 2.30 first Beta software release 11/18/87 Ver 2.31 allow axes control independent of geo correction

/AXESBEGIN option added to axes-control BX,BY

GeoCorrectTable size made programmable (70 elements/axis) added TableDivisor for

GeoCorrectTable

12/11/87 Ver 2.40 STEREO upgraded to Turbo Pascal

Version 4.0

SUBSTITUTE SHEET

-82.825-

STEREO always returns with Queue

Size

Change in CX

GeoCorrectTable storage allocated on heap dynamically max GeoCorrectTable size increased to 90 by 90

Some variables changed to Word or

Longint type

12/16/87 Ver 2.41 GeoCorrect overwrite / memory alloc debugged

QueueCount substituted for

QueueSize calculation

12/21/87 Ver 2.43 Check for Break turned off improved keyboard and Ctrl-Break

Abort service

1/06/88 Ver 2.50 zero-length vectors ignored

Ctrl-Break check looks at scan code now

1/27/88 Ver 2.60 better STEREO.GEO processing blanks allowed around commas separating numbers check for too few or too many entries in STEREO.GEO no mark and redraw around executes when redraw count is 1

OkayForRedrawCommand flag added to limit redundant mark and redraw commands }

uses Dos,Crt;

type strl6 = string[16] ; strδO = string[δO] ; BitArray = array[0..15] of Word;

SUBSTITUTE SHEET

-δ2 . δ26-

GeoCorrectTableType = array[0..10000] of Longint; GeoCorrectTablePtr = Λ GeoCorrectTableType;

var

FirstVar: Byte; { must be first variable defined } ch,key: Char; temp,cmd,TextCommand,OperationMnemonics,Operand: String;

StereoVersion: strl6; count,!,j,remline,Er,OpNum,code,code2: Integer; IOerr: Integer;

GeoFile,DefaultFile: text; tempX,tempY,XI,Yl,X2,Y2,oldX2,oldY2: Real; arg,beginXpos,beginYpos,Xpos,Ypos,oldX,oldY: Real;

FirstX,NegX,NegY,SwapXY,SwapBegin: Boolean; first,VelocityFlag,DebugMode,Redrawing,done: Boolean;

OkayForRedrawCommand: Boolean;

_Step_Size,_Step_Period,_Scan_Delay,_Jump_Delay: Word;

_Jump_Size,_Rivet_Reduction: Real;

_Laser_On_Delay,_Laser_Off_Delay: Word; _Redraw_Count,_Redraw_Delay,_Redraw_Size: Word;

KeyAbort,VersionCheckFlag,GeoCorrectFlag,DoingRivet: Boolean; changeX,changeY,ChangeV,BrokenX,BrokenY: Real; deltaX,deltaY,steps,GeoDeltaX,GeoDeltaY: Real; Distance,IntDeltaX,IntDeltaY: Integer;

IntSteps,TotalSteps,TempSteps: Word;

RivetMainPeriod,CurrentRedrawCount,_Rivet_Count: Word;

StoreCount,QueueCount: Word;

FieldX,FieldY,StartX,StartY,EndX,EndY,GeoEndX,GeoEndY, Xcoord,Ycoord: Real;

Discrete ,DiscreteY,DiscreteSteps: Word; regs: Registers;

XC,YC,XCount, Count,CoordCount,TableDivisor: Word;

StereoSize: Longint; StrOfs,StrSeg: Word; data,Rturn: Byte;

SUBSTITUTE SHEET

-32 . 827- xGeoCorrectTable,YGeoCorrectTable: GeoCorrectTablePtr;

LastVar: Byte; { must be last variable defined }

const ThisStereoVersion = '2.60'; MinSystemVersion = '2.30'; CtrlBreak = fO;

HexDigits: strl6 = O123456789ABCDEF' ; sp40 = ' ' ; Indentl = 4; Indent2 = 41; AllBits = $FFFF; BitValue: BitArray =

($0001, $0002, $0004, $0008, $0010, $0020, $0040, . $0080, $0100, $0200, $0400, $0800, $1000, $2000, $4000, $8000) ; Shutter = 0; { control word bit 0 - shutter open/closed } _BIOSVECTOR = $16; _STEREOVECTOR = $65;

MaxGeo = 100; { maximum GeoCorrectTable Index } GeoMult = 4096; { GeoCorrectTable Longint multiplier ) StepRound = 0.02; { rounding value for f of laser steps }

label ExitProgram;

function StartOfProgramCode: String; begin

StartOfProgramCode :=

•STEREO Device Driver Version 2.60 Copyright (C) 198δ by Tarnz Technologies • ; end;

{$i laser.inc) { include laser interface library }

SUBSTITUTE SHEET

-82.828- var

StepPerlodsArray,RivetPeriodsArray: _StepPeriodsType;

function StereoOk: Boolean; type CopyType = array[1..20] of char; var

CopyPtr: Λ CopyTy e; CopyStr: string[20] ; begin with regs do begin

AX := ($35 shl 8) or _STEREOVECTOR; MsDos(regs) ; CopyPtr := Ptr(ES,57) ; end; move(CopyPtr A [1] ,CopyStr[1] ,18) ; CopyStr[0] := #18; if CopyStr = 'Tarnz Technologies' then begin StereoOk := true; with regs do CopyPtr := Ptr(ES,30); move(CopyPtr Λ [1] ,StereoVersion[1] ,4) ; StereoVersion[0] := #4; end else begin StereoOk := false; StereoVersion := •?.??'; end; end;

function upper(text: String) : String; var i: Integer; temp: String; begin temp := text; for i := 1 to length(temp) do temp[i] := upcase(temp[i]) ;

SUBSTITUTE SHEET

-82 . 829- upper : = temp ; end ;

function many(Ch: Char;num: Integer) : String; var temp: String; i: Integer; begin temp := ' ' ; for i:=l to num do temp := temp+Ch; many := temp; end;

procedure ReadCommandLine(var line: string) ; var i: Integer; begin line := ParamStr(l) ; for i:=2 to ParamCount do line := line + ' • + ParamStr(i) ; end;

function CvtDelta(num: Real) : Word; begin num := num * 256; if num < 32768.0 then CvtDelta := trunc(num) else if num > 32768.0 then CvtDelta := trunc(num) else CvtDelta := $8000; end;

function sgn(num: Real) : Integer; begin if num<0 then sgn := -1 else if num>0 then sgn := 1 else sgn := 0; end;

SUBSTITUTE SHEET

-82 . 830- function CvtTicks(time: Real): Word; begin

CvtTicks := trunc(time * 119.0 / 10.0) ; end;

procedure SkipToNum(var str: String) ; var i: Integer; begin i := 1; while (i <= length(str)) and not(str[i] in [•0 « .. '9' , ' . ']) do inc(i) ; if i>l then str := copy(str,i,99) ; end;

procedure RealParse(var RealNum: Real) ; begin val(temp,RealNum,code) ; if codeoo then val(copy(temp,1,code-1) ,RealNum,code2) ; temp := copy(temp,code+l,99) ; end;

procedure IntParse(var IntNum: Word) ; var num: Real; begin if length(temp)=0 then IntNum := 0 else begin val(temp,num,code) ; if codeoo then val(copy(temp,1,code-1),num,code2) IntNum := trunc(num) ; if code=0 then temp := ' ' else temp := cop (temp,code+1,99) ; end; end;

SUBSTITUTE SHEET

-82 . 831- function IntStr(num: Integer) : strl6; var temp: strl6; begin if num>=0 then Str(num,temp) else Str(num+$8000,temp) ;

IntStr := temp; end;

function RealStr(num: Real) : ' strl6; var temp: strlδ; begin if num<0 then Str(65536.0+num:6:0,temp) else Str(num:6:0,temp) ; while temp[l]=' ' do temp := copy(temp,2,6) ; RealStr := temp; end;

function spc(len: Integer) : str80; begin spc := copy(sp40+sp40+sp40,1,len) ; end;

procedure msg(text: String) ; begin

(* return text to calling program *) end;

procedure msgln(text: String) ; begin

(* return text + Cr to calling program *) end;

function MemAbs(pt: Pointer): Longint; begin

MemAbs := Longint(seg(pt A ) ) shl 4 + ofs(pt A ); end;

SUBSTITUTE SHEET

-82 . 832- function PtrAdd(point: Pointer;offset: Longint) :

Pointer; var

NewAddr: Longint; begin

NewAddr := MemAbs(point)+offset;

PtrAdd := Ptr(NewAddr div 16,NewAddr mod 16) ; end;

function StatusKey: Char; begin with regs do begin AX := $0100; Intr(_BI0SVECT0R,regs) ;

StatusKey := chr(AH) ; { return scan code } end; end;

procedure SIHerror; begin

Return := Er; end;

function TryCommand: Boolean; begin if Er=3 {queue full} then TryCommand := true else TryCommand := false; if keypressed {abort} then begin if StatusKey = CtrlBreak then begin TryCommand := false; KeyAbort := true; end; end; end;

function TryBlockCommand: Boolean; begin

SUBSTITUTE SHEET

-82 . 833- if (Er=3) {command queue full) or (Er=6) {exec queue full} then TryBlockCommand := true else TryBlockCommand := false; if keypressed {abort} then begin if StatusKey = CtrlBreak then begin TryBlockCommand := false; KeyAbort := true; end; end; end;

procedure newX(num: Real) ; begin oldX := Xpos; Xpos := num; end;

procedure newY(num: Real) ; begin oldY := Ypos; Ypos := num; end;

{

AxesControl — adjust axes

} procedure AxesControl(oldX,oldY: Real;var retX,retY:

Real) ; begin if SwapXY then begin retY := oldX; retX := oldY; end else begin retX := oldX; retY := oldY; end;

SUBSTITUTE SHEET

-32.634- if NegX " then retX := 65535.0 - retX; if NegY then retY := 65535.0 - retY; end;

procedure SetRedrawCount(RedrawCount: Integer) ; begin if RedrawCountoCurrentRedrawCount then begin CurrentRedrawCount := RedrawCount; Er := 3; while TryCommand do Er := SetRedrawCount(CurrentRedrawCount) ; inc(QueueCount,3) ; SIHerror; end; end;

{

Laser Motion Routines:

* ResetRedraw - just mark for beginning of block

* PerformRedraw - redraw and mark last section

* MoveLaser - new move alg using redraw & vector slicing

* JumpLaser - controlled breakup of jump motion to limit overshoot }

procedure ResetRedraw; begin if OkayForRedrawCommand and BlockModeOn then begin if DebugMode then msgln('Mark 1 +IntStr(_Redraw_Size) ) ; Er := 3; while TryCommand do

Er := Mark; inc(QueueCount) ;

SUBSTITUTE SHEET

-82.835-

SIHerror; end;

Distance := 0; Redrawing := false; OkayForRedrawCommand := false; end;

procedure PerformRedraw; begin if OkayForRedrawCommand and BlockModeOn then begin if DebugMode then msgln('Redraw '+IntStr (_Redraw_Size) ) ; Er := 3; while TryCommand do

Er := Redraw; inc(QueueCount) ; SIHerror; end;

Distance := 0; Redrawing := false; OkayForRedrawCommand := false; end;

{

GeoCorrect — geometric correct coordinate pair

) procedure GeoCorrect(oldX,oldY: Real;var newX,newY:

Real) ; var

GXll,GX12,GX21,GX22,GYll,GY12,GY21,GY22: Real; Xf,Yf,XfYf: Real; XIndex,YIndex,Lookup: Word; begin if GeoCorrectFlag then begin

XIndex := trunc(oldX / TableDivisor) ; if XIndex >= XCount then XIndex := XCount-1; YIndex := trunc(oldY / TableDivisor) ;

SUBSTITUTE SHEET

-82.836- if YIndex >= YCount then YIndex := YCount-1; Lookup := XIndex * YCount + YIndex;

GXll = XGeoCorrectTable A [Lookup] ; GX12 = XGeoCorrectTable A [Lookup+l] ; GX21 = XGeoCorrectTable A [Lookup+YCount] ; GX22 = XGeoCorrectTable A [Lookup+YCount+l] ; GYll = YGeoCorrectTable A [Lookup] ; GY12 = YGeoCorrectTable [Lookup+l] ; GY21 = YGeoCorrectTable A [Lookup+ Count] ; GY22 = YGeoCorrectTable Λ [Lookup+YCount+l] ; Xf := (oldX - TableDivisor * 1.0 * XIndex) /

TableDivisor; Yf := (oldY - TableDivisor * 1.0 * YIndex) / TableDivisor; XfYf := Xf * Yf; newX := (GXll + Xf * (GX21 - GXll) + Yf * (GX12 - GXll)

+ XfYf * (GX22 + GXll - GX12 - GX21) ) / GeoMult; newY := (GYll + Xf * (GY21 - GYll) + Yf * (GY12 - GYll)

+ XfYf * (GY22 + GYll - GY12 - GY21) ) / GeoMult; -end else begin newX := oldX; newY := oldY; end; if DebugMode then begin writel ('GX11=• ,GXll/GeoMult:7:2, ' GX12=' ,GX12/ GeoMult:7:2,

' GX21=' ,GX21/GeoMult:7:2, ' GX22=' ,GX22/ GeoMult:7:2) ; writeln( •GY11=• ,GYll/GeoMult:7:2,' GY12=' ,GY12/ GeoMult:7:2,

' GY21=' ,GY21/GeoMult:7:2, ' GY22=' ,GY22/ GeoMult:7:2) ; writeln( « oldX=' ,oldX:7:2, • oldY=' ,oldY:7:2, • newX=' ,newX:7:2,' newY= r ,newY:7:2); writeln;

SUBSTITUTE SHEET

-82.837- end; end ;

procedure JumpLaser; begin AxesControl(Xpos,Ypos,EndX,EndY) ;

AxesControl(oldX ,oldY,StartX,StartY) ; changeX := EndX-StartX; changeY := EndY-StartY; if VelocityFlag then changeV := sqrt(sqr(changeX) +sqr(changeY) ) else if abs(changeX) < abs(changeY) then ChangeV := abs(changeY) else ChangeV := abs(changeX) ; steps := ChangeV / _Jump_Size; if steps>0 then begin deltaX := changeX / steps; deltaY := changeY / steps; IntSteps := trunc(steps+StepRound) + 1; TotalSteps := 1; repeat

BrokenX := StartX + deltaX*TotalSteps; BrokenY := StartY + deltaY*TotalSteps; TotalSteps := TotalSteps + 1; if TotalSteps >= IntSteps then begin BrokenX := EndX;

BrokenY := EndY; end;

GeoCorrect(BrokenX,BrokenY,FieldX,FieldY) ; Er := 3; { add discrete jump } while TryCommand do begin

Er := AddVector(trunc(FieldX) ,trunc(FieldY) ,

0,0,1); { incl a 1 tick pause

} OkayForRedrawCommand := true; end;

SUBSTITUTE SHEET

-82 . δ38- inc(QueueCount,13) ; SIHerror; until TotalSteps >= IntSteps; end; end;

procedure MoveLaser; begin

AxesControl(Xpos,Ypos,EndX,EndY) ; AxesControl(oldX,oldY,StartX,StartY) ; changeX := EndX - StartX; changeY := EndY - StartY; if VelocityFlag then changeV := sqrt(sqr(changeX) + sqr(changeY) ) else if abs(changeX) < abs(changeY) then ChangeV := abs(changeY) else ChangeV := abs(changeX) ; steps ι= ChangeV / _Step_Size; if steps>=l then begin deltaX := changeX / steps; deltaY := changeY / steps;

IntSteps := trunc(steps+StepRound) ; IntDeltaX := CvtDelta(deltaX) ; IntDeltaY := CvtDelta(deltaY) ; TotalSteps := 0; repeat

BrokenX := StartX + deltaX * TotalSteps; BrokenY := StartY + deltaY * TotalSteps; TempSteps := IntSteps - TotalSteps; if TempSteps>256 then TempSteps := 256; if (CurrentRedrawCount > 1) and (_Redraw_Size>0) then if Distance+TempSteps >= _Redraw_Size then begin TempSteps := _Redraw_Size - Distance; Redrawing := true; end;

TotalSteps := TotalSteps + TempSteps;

SUBSTITUTE SHEET

-82 . 839-

Distance := Distance + TempSteps; GeoCorrect(BrokenX,BrokenY,FieldX,FieldY) ;

{ Geometric Correction addition } if GeoCorrectFlag then begin GeoCorrect(BrokenX+TempSteps*DeltaX,BrokenY+TempSteps *DeltaY,

GeoEndX,GeoEndY) ; changeX := GeoEndX - FieldX; changeY := GeoEndY - FieldY; ChangeV := sqrt(sqr(changeX) + sqr(changeY) ) ; steps := ChangeV / _Step_Size; GeoDeltaX := ChangeX / steps; GeoDeltaY := ChangeY / steps; DiscreteX := CvtDelta(GeoDeltaX) ; DiscreteY := CvtDelta(GeoDeltaY) ;

DiscreteSteps := trunc(steps+StepRound) ; end else begin

DiscreteX := IntDeltaX; DiscreteY := IntDeltaY; DiscreteSteps := TempSteps; end;

Er := 3; { send out move command } while TryCommand do begin

Er := AddVector(trunc(FieldX) ,trunc(FieldY) , DiscreteX,DiscreteY,DiscreteSteps) ;

OkayForRedrawCommand := true; end; inc(QueueCount,13) ; SIHerror; if Redrawing then PerformRedraw; until TotalSteps = IntSteps; end; end;

SUBSTITUTE SHEET

-82.840-

procedure BeginX; begin begmXpos := PositionArgument; end;

procedure BeginY; var

X1,Y1,X2,Y2: Real; begin beginYpos := arg; if SwapBegin then AxesControl(beginXpos,beginYpos,XI,Yl) else begin XI := beginXpos; Yl := beginYpos; end; GeoCorrect(XI,Yl,X2,Y2) ;

Er := SetHomePosition(trunc(X2) ,trunc(Y2) ) ; SIHerror; end;

procedure JumpX; begin newX(arg) ; end;

procedure JumpY; begin newY(arg) ; if _Jump_Delay<>0 then begin JumpLaser; Er := 3; while TryCommand do

Er := AddPause( Jump Delay) ;

SUBSTITUTE SHEET

-82 . 841- inc(QueueCount,3) ; SIHerror; end; end;

procedure NextX; begin newX(arg) ; end;

procedure NεxtY; begin newY(arg) ;

MoveLaser; end;

procedure StepSize; begin

_Step_Size := trunc(arg) ; end;

procedure StepPeriods; var i: Integer; begin

PerformRedraw; count := 0; while (length(temp) > 0) and (count < 10) do begin val(temp,arg,code) ; if codeoo than val(copy(temp,l,code-

1) ,arg,code2) ; if code=0 them temp :=' ' else temp := copy(temp,code+1,99) ; count := count +1

StepPeriodsArray.num := count; if count>0 then begin (* if DebugMode then begin

SUBSTITUTE SHEET

-82.842- msg(' ew step periods array: ') ; for i:=0 to count-1 do msg(StepPeriods

Array. eriods[i] , ' ') ; msgln(' ') ; end; *) Er := 3; if BlockModeOn then begin while TryCommand do

Er := SetStepPeriods(StepPeriodsArray) ; inc(QueueCount,count*2+2) ; end else begin while TryCommand do

Er := AddChangeTimebase(StepPeriods Array.periods[0]) ; inc(QueueCount,3) ; end;

SIHerror; end;

PerformRedraw; end;

procedure ScanDelay; begin

_Scan_Delay := WordArgument; end;

procedure Jumpsize; begin

_Jump_Size := arg; if _Jump_Size < 50 then _Jump_Size := 50; { limit } end;

procedure JumpDelay; begin

_Jump_Delay := WordArgument; end;

SUBSTITUTE SHEET

-82 . 843- procedure LaserOn; begin

_Laser_On_Delay := CvtTicks(arg)

Er := SetTurnOnDelay(_Laser_On_Delay) ; SIHerror; end;

procedure LaserOff; begin

_Laser_Off_Delay := CvtTicks(arg) ; Er := SetTurnOffDelay(_Laser_Off_Delay) ;

SIHerror; end;

procedure SequenceMode; begin { no-operation } end;

procedure AbsoluteMode; begin

{ no-operation } end;

procedure Execute; begin

PerformRedraw; Er := 3; while TryBlockCommand do

Er := Execute;

SIHerror; ResetRedraw; end;

procedure ExecuteClear; begin

PerformRedraw;

SUBSTITUTE SHEET

-82.844-

Er := 3; while TryBlockCommand do

Er := ExecuteClear;

QueueCount := 0; SIHerror;

ResetRedraw; end;

procedure ClearTable; begin Er := Clear;

QueueCount := 0; if Er<>5 then SIHerror; { not in block mode okay }

ResetRedraw; end;

procedure SetMode; begin if length(cmd)=5 then case cmd[3] of

'A': Er := SetAutoShutterMode(cmd[5]) ;

•B': Er := SetBlockMode(cmd[5]) ; 'P': Er := SetPosAckMode(cmd[5]) ; end;

SIHerror; end;

procedure SoftReset; begin

Er := SetAutoShutterMode('-') ; { off }

SIHerror;

Er := SetBlockMode('-') ; { off }

SIHerror; Er := SetPosAckMode('-') ; { off }

SIHerror;

QueueCount := 0; end;

SUBSTITUTE SHEET

-82 . 845- procεdure HardResεt; bεgin

SoftRεset;

Er := ResεtCmdQueue; SIHεrror; end;

procedurε RεdrawCount; begin

_Redraw_Count := trunc(arg) ; if _Redraw_Count < 1 then _Redraw_Count := 1 else if _Redraw_Count > 10 thεn _Rεdraw_Count := 10; SetRedrawCount(_Rεdraw_Count) ; PεrformRedraw; Er := 3; while TryCommand do

Er := SetRεdrawCount(_Rεdraw_Count) ; inc(QueueCount,3) ; SIHerror; end;

procedurε RεdrawDεlay; begin

_Redraw_Delay := trunc(arg) ;

Er := 3; whilε TryCommand do Er := SεtRεdrawDεlay(_Rεdraw_Dεlay) ; inc(QuεueCount,3) ; SIHεrror; end;

procedurε RεdrawSizε; bεgin

_Rεdraw_Sizε := trunc(arg) ; εnd;

procεdurε RivεtCount;

SUBSTITUTE SHEET

-82.846- begin

_Rivet_Count := trunc(arg) ; if _Rivet_Count < 1 then _Rivet_Count := 1 εlsε if _Rivεt_Count > 10 thεn _Rivεt_Count := 10; _Rivεt_Count := _Rivεt_Count - 1; end;

procedurε RivεtPεriods; var i: Intεgεr; bεgin val(tεmp,arg,codε) ; if codεo then val(copy(temp,l,code-l) ,arg,code2) ; RivetMainPεriod := CvtTicks(arg) ; if codε = 0 thεn tεmp := ' ' εlse temp := copy (tεmp,codε+l,99) ; count := 0; whilε (lεngth(tεmp)>0 and (count<10) do bεgin val(tεmp,arg,codε) ; if codε,.0 thεn val(cop (tεmp,l,code-l) ,arg,codε2) if code=0 then temp := ' ' else temp := copy(tεmp,codε+l,99) ; RivεtPεriodsArray.periods[count] := CvtTicks(arg) ; count := count + 1; end RivetPεriodsArray.num := count; (* if DebugModε thεn bεgin msg('New rivet periods array: '); msg( ' Main=' ,RivetMainPεriod) ; for i:=0 to count-1 do msg(' ', RivetPeriodsArray.pεriods[i]) ; msgln(' •) ; end; *) end;

procedure RivetRεduction; bεgin

SUBSTITUTE SHEET

-82 . 847-

_Rivεt_Rεduction := arg; εnd;

procεdurε RεsεtFromRivεts; begin if RivetPεriodsArray.num>0 then begin { set standard step periods } Er := 3; whilε TryCommand do

Er := SetstepPeriods(StepPerlodsArray) ; inc(QueuεCount,StεpPeriodsArray.num*2+2) ; SIHerror; end; end;

procεdurε RivetX; begin newX(arg) ; εnd;

procedure RivetY; var StartX,StartY,EndX,EndY: Real;

ReducedStartX,ReducedStartY,ReducedEndX,ReducedEndY:

Rεal;

RεductionX,RεductionY: Rεal;

DirX,DirY,RedueedDirX,ReducεdDirY: Intεger; begin

StartX := oldX;

StartY := Ypos;

EndX := Xpos;

EndY := arg; { set rivet stεp pεriods }

Er := 3; whilε TryCommand do

Er := AddChangεTimεBasε(RivεtMainPεriod) ; inc(QuεueCount,3) ;

SUBSTITUTE SHEET

-82.848-

SIHεrror;

{ draw complεte vector }

NextY;

DirX := sgn(EndX - StartX) ;

DirY := sgn(EndY - StartY) ;

RεductionX r= _Rivet_Reduction * deltaX;

ReductionY := Rivet Reduction * deltaY;

ReducεdStartx = StartX + RεductionX; RεducεdStartY = StartY + RεductionY; RεducεdEndX = EndX - ReductionX; RεducεdEndY = EndY - ReductionY; ReducεdDirX := sgn(RεducεdEndX - RεducεdStartX) ; ReducedDirY := sgn(RεducεdEndY - RεducεdStartY) ; DoingRivεt := truε; { do rivεt if rεducεd vector size is greater than 0 units } if ((ReducεdDirX = DirX) and (RεducεdDirY = DirY) ) and (_Rivεt_Count > 0) thεn bεgin { εnd standard rεdraw if any } PerformRedraw; if RivetPεriodsArray.num>0 then begin { set rivet step periods } Er := 3; whilε TryCommand do Er := SεtStεpPεriods(RivetPeriodsArray) ; inc(QuεueCount,RivetPεriodsArray.num*2+2) ; SIHerror; end;

{ set rivet pass count } SetRεdrawCount(_Rivεt_Count) ;

{ draw rεducεd vεctor - thε rivεt } arg := ReducedStartX; JumpX; arg := ReducedStartY; JumpY; arg := ReducedEndX; NextX;

SUBSTITUTE SHEET

-82 . 849- arg := RεducedEndY;

NεxtY;

{ εnd rivεt rεdraw }

PerformRedraw; { restorε original rεdraw pass count }

SεtRεdrawCount(_Rεdraw_Count) ;

{ jump to εnd of full vεctor } arg := EndX;

JumpX; arg := EndY;

JumpY; εnd;

{ reset standard step periods } Er := 3; whilε TryCommand do

Er := SεtStεpPεriods(StεpPεriodsArray) ; inc(QuεuεCount,StεpPεriodsArray.num*2+2) ; SIHεrror;

DoingRivεt := falsε; εnd;

procεdurε Waitldlε; var time: Integer; begin time := trunc(arg) ; if time < 100 then time := 100; { set minimum delay timε } dεlay(timε) ; { dεlay long εnough for background task to see EX } repεat until GεtBkgndldlεStatus or kεyprεssed; if keypressεd then if StatusKey = CtrlBreak thεn KεyAbort := truε; εnd;

{

SUBSTITUTE SHEET

-82.850-

STEREO Command Parser

}

procedure ParseCommand; begin tεmp := copy(cmd,3,99) ; val(tεmp,arg,codε) ; if codeoo thεn val(copy(t mp,1,codε-1),arg,codε2) ; op := copy(cmd,l,2) ; i := pos(op,

'*BX*BY*JX*JY*NX*NY*SS*SP*SD*JS*JD*LO*LF*NS*AB' + '*EX*EC*CL*MD*SR*HR*RC*RD*RS*VC*VP*VR*VX*VY*WI') ; if (lεngth(op)>l) and (i>0 thεn casε i div 3 of casε OpNum of

0: BεgmX; BX

1: BεginY; BY

2: JumpX; JX

3: JumpY; JY

4: NεxtX; NX

5: NextY; NY

6: StepSizε; SS

7: StepPεriods; SP

8: ScanDεlay; SD

9: Jumpsizε; JS

10: JumpDεlay; JD

11: LaserOn; LO

12: LaserOff; LF

13: SequenceMode; NS

14: AbsoluteModε; AB

15: Exεcutε; EX

16: ExεcuteClear; EC

17: ClearTable; CL

18: SεtModε; MD

19: SoftRεsεt; SR 20: HardRεsεt; HR

SUBSTITUTE SHEET

-82 . 851-

21: RedrawCount; { RC }

22: RedrawDεlay; { RD }

23: RεdrawSizε; { RS }

24: RivetCount; { VC } 25: RivetPεriods; { VP }

26: RivεtRεduction; { VR }

27: RivεtX; { VX }

28: RivetY; { VY }

29: Waitldle; { WI } end elsε Return := 128; { unrecognized command } end;

Procεss STEREO Commands coming through the Software Interrupt

- Software Intεrrupt $65 (101) Handlεr -

ES:BX points to first charactεr of string. String should εnd with a charactεr valuε of 0, 10 (LF) , or 13 (CR) . An εrror codε will be returned in AL with 0 meaning no error occurred.

_ _ _ }

procedurε

RεceiveCommand(Flags,CS,IP,AX,BX,CX,DX,SI,DI,DS, ES,BP: Word) ; interrupt; begin

KeyAbort := false;

StrOfs := BX;

StrSeg := ES;

INLINE ($FB) ; { STI ;allow interrupts }

{ build a compatible command string }

SUBSTITUTE SHEET

-82.852- cmd := ' * donε := falsε; Rεturn := 0; QueueCount := 0; while (not KeyAbort) and (not done) and (Return=0) do bεgin

Ch := chr(Mεm[StrSεg:StrOfs]) ; donε := Ch < ' * ; if done or (Ch=';') then begin StrOfs := StrOfs + 1; ParseCom and; cmd := • * ; end else begin if Ch In ['!'..'-'] then cmd := cmd + upcase(Ch) ; StrOfs := StrOfs +1; end; end; { write('Stereo Debug ' ,keypressεd) ; } CX := QuεuεCount; AX := Rεturn; BX := StrOfs; εnd;

Mεmory Rεsidεnt Routinεs

Aftεr thε following routinεs install thε mεmory-resident routines above, they are thrown away and not used again.

procedurε RεsidεntTεrmination; bεgin with rεgs do bεgin

SUBSTITUTE SHEET

-82.853-

AH := $31; AL := 1;

DX := trunc(StereoSizε) shr 4; MsDos(rεgs) ; εnd; εnd;

procεdurε InitMεmoryResidency; begin

SetlntVec(_STEREOVECTOR,@RεceiveCommand) ; end;

{ - - - - - }

function WhiteSpace(var str: String;loc: Integer) : Integer; bεgin whilε (loc <= lεngth(str)) and (str[loc] in [#9,' ']) do loc := loc + 1; WhitεSpacε := loc; εnd;

procεdurε ChεckForOptions(var str: String); var i: Intεgεr; bεgin str := upper(str) ; whilε (lεngth(str) > 1) and (str[l] = ' ') do dεlεte (str,1,1); i := pos( '/D' ,str) ; { set debug mode } if i>0 thεn bεgin DεbugModε := true; delεtε(str,i,2) ; εnd; i := pos( '/NV' ,str) ; { not constant vεctor vεlocity } if i>0 thεn bεgin { largεr of X and Y axεs } VεlocityFlag := falsε;

SUBSTITUTE SHEET

-82.854- deletε(str,i,3) ; εnd; i := pos('/NG' ,str) ; { no gεomεtric corrεction } if i>0 thεn bεgin GeoCorrectFlag := false; dεletε(str,i,3) ; end; i := pos('/NC ,str) ; { no version check } if i>0 then begin VersionCheckFlag := false; delete(str,i,3) ; εnd; i := pos('/SWAPXY' ,str) ; { swap X & Y coordinatεs } if i>0 thεn bεgin SwapXY := truε; dεlete{str,i,7) ; end; i := pos('/AXESBEGIN' ,str) ; { axes-control begin (home) coordinates } if i>0 then begin

SwapBegin := truε; deletε(str,i,10) ; εnd; i := pos('/GEO' ,str) ; { gεo-corrεct axεs order } if i>0 then begin j := WhiteSpace(str,i+4) ; case str[j] of

*X « : FirstX := true; •Y': FirstX := false; 'N': GeoCorrectFlag := false; end; delete(str,i,j+2-i) ; end; i := pos('/X* ,str) ; { X-axis orientation } if i>0 then begin

NegX := (str[i+2]='-') ; delete(str,i,3) ;

SUBSTITUTE SHEET

-82.855- εnd; i := pos( '/Y' ,str) ; { Y-axis orientation } if i>0 then begin

NegY := (str[i+2]='-') ; dεlεtε(str,i,3) ; εnd; end;

procedure ShowAxis(Neg: Boolean;AxCh: Char); bεgin if Nεg thεn writε('-') εlsε writε('+'); write(AxCh, ' axis' ) ; εnd;

procεdurε ShowGεomεtry; begin write('Geomεtry is '); if SwapXY then write('XY Swapped, •); if SwapBεgin thεn writε('Bεgin Swappεd, '); if FirstX thεn bεgin ShowAxis(NεgX, 'X' ) ; writε(' first, thεn '); ShowAxis(NegY, 'Y' ) ; εnd εlsε bεgin

ShowAxis(NεgY, 'Y') ; writε(' first, thεn ); ShowAxis(NegX, 'X' ) ; εnd; writεln('.'); if GεoCorrectFlag then writeln ( ' Gεomεtric Correction active . ' ) ; end ;

{ M A I N P R O G R A M }

begin

CheckBrεak : = falsε ;

SUBSTITUTE SHEET

-82 . 856-

FillChar(FirstVar,ofs(LastVar)-ofs(FirstVar) ,#0) ; { clεar variablεs }

VelocityFlag := true; { default to constant vector velocity } GeoCorrectFlag := true; { default to geometric correction }

DriftCorrεctionFlag := truε; { pεrfor drift corrεction }

VεrsionCheckFlag := true; writeln; writel (#213,many( 205,53) ,#184) ; writεln(#179, ' STEREO, Stεrεolithography Dεvicε Driver ,#179); writεln(#179, ' 3D Systems Laser Stereolithography . System ',#179) ; writεln(#212,many(f205,53) ,fl90) ; writεln; cmd := StartOfProgramCodε;

RεadCommandLinε(cmd) ; if not LasεrPrεsεnt then goto ExitProgram; if StereoOk then begin writel ('STEREO Devicε Drivεr Vεrsion ' ,StεrεoVεrsion,

• alrεady installed. •) ; goto ExitProgram; end;

CheckForOptions(cmd) ; if VersionChεckFlag thεn if LaserVersion < MinSystemVersion then begin writeln(Obsolεtε LASER systεm in use. 1 ); goto ExitProgram; end; Xpos := 32767; Ypos := 32767; DoingRivet := false;

RivetMainPεriod := 1190; StepPeriodsArray.num := 0;

SUBSTITUTE SHEET

-82.857- RivεtPεriodsArray.num := 0;

{ read and/or set defaults } Assign(DεfaultFilε, 'STEREO.DEF') ;

rεsεt(DεfaultFilε) ;

($1+) if IOrεsultoO thεn bεgin writelnCCan"t find STEREO.DEF default file!');

_Stεp_Sιzε 32; _Stεp_Pεriod 119; _Scan_Delay 64; _Jump_Size 65535.0; _Jump_Delay 100; _Laser_On_Dεlay 0; _Lasεr_Off_Dεlay 0; _Rεdraw_Count l; _Rεdraw_Dεlay 0; _Rεdraw_Sizε 200; _Rivεt_Count l; _Rivεt_Reduction 100; end elsε bεgin { rεad dεfault filε } i := 1; while (i<=14) and not eof(DεfaultFilε) do begin readln(DεfaultFilε,temp) ; if not ((length(tεmp)=0) or (tεmp[l]=' 1 * ) ) thεn begin casε i of

1: IntParsε(_Stεp_Sizε) ; 2: bεgin count := 0; while (length(tεmp)>0) and (count<10) do begin

IntParse(StepPeriodsArray.periods[count]) ; count := count+1; εnd;

SUBSTITUTE SHEET

-82 . 858-

StεpPεriodsArray.num := count; _Stεp_Pεriod := StepPeriodsArray.periods[0] ; end; 3: IntParse(_Scan_Delay) ;

4: RealParse(_Jump_Size) ; 5: IntParse(_Jump_Dεlay) ; 6: IntParsε(_Laser_On_Delay) ; 7: IntParsε(_Laser_Off_Dεlay) ; 8: IntParsε(_Rεdraw_Count) ;

9: IntParse(_Redraw_Dεlay) ; 10: IntParse(_Rεdraw_Sizε) ; 11: IntParsε(_Rivet_Count) ; 12: bεgin count := 0; whilε (lεngth(temp)>0) and (count<10) do begin

IntParse(RivεtPεriodsArray.periods [count]) ; count := count+1; end;

RivεtPεriodsArray.num := count; end; 13: RealParse(_Rivet_Reduction) ; end; i := i+1; end; {if not} end; {while i<) close(DefaultFilε) ; end;

CurrentRεdrawCount := _Redraw_Count;

XGeoCorrectTablε := HεapPtr; if GeoCorrectFlag then begin { read Geometric Correction Table } Assign(GeoFilε, •STEREO.GEO') ; {$1-}

SUBSTITUTE SHEET

-82 . 859- rεset(GeoFilε) ;

{$!+} if IOrεsultoO thεn bεgin writεln('Can' 't find STEREO.GEO Gεomεtric Corrεction Filε! 1 );

GeoCorrectFlag := false; end else begin { read geomεtric corrεction table from file } repεat rεadln(GεoFilε,tεmp) ; until ( (length(tεmp)>0) and (tem [1]<>*!') ) or eof(GeoFile) ; SkipToNum(temp) ; IntParsε(XCount) ; SkipToNum(temp) ; IntParsε(YCount) ; YGeoCorrectTablε :=

PtrAdd(XGεoCorrεctTablε,Longint (XCount*YCount) shl 2) ; SkipToNum(tεmp) ;

IntPars (CoordCount) ; SkipToNum(tεmp) ; IntParse(TableDivisor) ;

If TablεDivisor < 1 thεn TablεDivisor := 1024; { for V2.30 compatibility } if (XCountoYCount) or (CoordCount<>2) or (XCount>MaxGεo) or (YCount>MaxGεo) thεn begin writeln('Illegal format for STEREO.GEO file.'); halt(l) ; end;

XC := 0; YC := 0;

StorεCount := 0; whilε (XC<XCount) and not εof(GεoFilε) do bεgin while (YC<YCount) and not eof(GεoFilε) do bεgin rεpeat readln(GεoFilε,tεmp) ;

SUBSTITUTE SHEET

-82 . 860- until ( (length(temp)>0) and (temp[1]<>'!*) ) or eof(GeoFile) ; SkipToNum(tεmp) ; RεalPars (Xcoord) ; SkipToNum(temp) ;

RεalParsε(Ycoord) ;

XGεoCorrεctTable A [StoreCount] := trunc(Xcoord* GeoMult) ;

YGeoCorrectTablε Λ [StorεCount] := trunc(Ycoord* GεoMult) ; inc(StorεCount) ; inc(YC) ; εnd; {whilε YC} inc(XC) ; YC := 0; εnd; {while XC} if XC < XCount then begin writel ( 'Not enough entriεs in STEREO.GEO file. » ); halt(2); εnd; while not eof(GεoFile) do begin readln(GeoFilε,temp) ; if (length(tεmp)>0) and (temp[l]o' 1 ') thεn bεgin

SkipToNum(temp) ; if temp[1] in ['0' .. •9' , ' . ' ] then begin writel ('Too many entries in STEREO.GEO file. ') ; halt(3); end; end; end; close(GeoFile) ; end; end;

SUBSTITUTE SHEET

-82 . 861-

SterεoSize := MemAbs(XGεoCorrectTablε) + (Longint(XCount* YCount) shl 3) - (Longint(PrefixSeg) shl 4) + 1024;

StεrεoSizε := ( (StεrεoSizε shr 4)+l) shl 4; (* writεln( 'MεmAbs XGεo=' ,MεmAbs(XGεoCorrεctTable) ) ; writeln( 'MemAbs YGeo=' ,MemAbs(YGeoCorrectTable) ) ; writεln('X*Y shl 2=' ,Longint(XCount*YCount) shl 2) ; writεln( *PrefixSeg=' ,Longint(PrefixSεg) ) ; writεln( 'StεrεoSizε=' ,StεrεoSizε) ;

*) writεln('STEREO Device Driver installed using ' ,

RealStr(StεrεoSizε/1024) , 'K bytes. ') ; ShowGeometry;

InitMemoryRεsidency; ResidentTer ination;

ExitProgram: εnd.

SUBSTITUTE SHEET

-82.862-

StereoLithography Lasεr Controllεr Software Interrupt Interface Routines for 3D Systems, Inc.

Version 2.60 by Tarnz Technologiεs

The purpose of thesε routines is to interface general- purpose Turbo Pascal programs with the mεmory rεsidεnt lasεr controller software. The machine language-based laser controller software the routinεs bεlow intεrface to can be used with other languages like Basic, C, and 8086 Assεmbly Language.

Turbo Pascal was chosen because of its devεlopmεnt environment and low source-to-εxεcutablε-objεct codε turnaround time. As development progresses and there is no longer a great neεd for a fast developmεnt εnviron- εnt, thεsε routinεs should bε adaptεd to C to maintain project software consistency. Turbo C and Microsoft C are the leading choices for C languages.

Below is a list of the routines in this include file. Most of the functions relatε directly to spεcific software interrupt calls. The Code is the rεlatεd intεrrupt's AX (AH,AL) valuε. Somε of thε intεrrupt functions require arguments to be passed in other registers, and some will return results. See the actual routines for more details on the interfacε protocol.

Pascal Function Codε Description

LaserOk seε if lasεr softwarε is installεd LasεrPrεsεnt tεll if lasεr softwarε not installεd

SUBSTITUTESHEET

-82.363-

OpenLasεr 00 — open laser DAC channel and initialize CloseLasεr 01 — close laser DAC channel and rεstore system

02 XX add command to background command queuε

AddVector 02 00 add vεctor command

AddOpenShuttεr 02 01 add opεn shuttεr command

AddClosεShutter 02 02 add closε shuttεr command

AddChangeTimebase 02 03 add changε timε base command

AddPause 02 04 add pause command

ResetCmdQuεuε 03 — reset background command queuε

GεtCmdQuεuεSize 04 — gεt background command quεue size

05 XX get option

_GetIntNum 05 00 get software interrupt vector number

_GetBkgnd ime 05 01 gεt background task intεrval timε

GetControlWord 05 02 gεt lasεr control word AutoShutterModeOn 05 02 get status of auto shutter modε

PosAckModεOn 05 02 gεt status of position acknowlεdgε modε

BlockModεOn 05 02 gεt status of block modε

GεtStatus 05 03 gεt lasεr status

GεtOpεnStatus 05 03 gεt lasεr channel open status

GεtBkgndldleStatus 05 03 get background idle status

GetTurnOffDεlay 05 04 get lasεr turn-off delay

GetTurnOnDelay 05 05 get lasεr turn-on dεlay

GetHomePosition 0 055 0066 gεt lasεr home position

06 xx . set option

SUBSTITUTE SHEET

-82.864-

_SεtIntNum 06 00 set softwarε intεrrupt vector number .SetBkgndTime 06 01 set background task interval time

SetControlWord 06 02 set laser control word

(genεral) _SetAutoShutModε 06 02 set laser control word, bit 0 _SεtPosAckModε 06 02 set laser control word, bit 1

SεtBlockModε 06 02 set laser control word, bit 2 06 03 -

.SetTurnOffDelay 06 04 set laser turn-off delay SetTurnOnDεlay 06 05 set laser turn-on delay SεtHomePosition 06 06 sεt lasεr homε position

07 xx background task εxεcution control

Exεcutε 07 00 εxεcutε command quεuε to currεnt point and stop

ExεcutεClεar 07 01 executε command queue to current point, stop, and clear

Clεar 07 02 clear command queue (resεt quεu 's start pointεr)

08 XX background task rεdraw control SεtStεpPεriods 08 00 sεt multi-pass stεp periods SεtRεdrawCount 08 01 set redraw pass count SεtRεdrawDεlay 08 02 set redraw delay Mark 08 03 mark redraw start position

Rεdraw 08 04 perform multi-pass redraw

SUBSTITUTE SHEET

-82.865-

const

_LASERVECTOR = $64; { Interrupt vector alternativε

}

{ valuεs: $60 through $67. }

_PACKET_SIZE = 13; { lεngth of vεctor packεt

_OK = 0; { Errors rεturnεd by Lεvεl

Zεro) _INTERNAL_ERROR = 255;

_MINIMUM_TICKS = 59; { don't go bεlow 50 us

>

_LASER_QUEUE_MAX= 60000.0; { Lasεr Quεuε size

_ALLBITS = $FFFF;

_BITVALUE: array[0..15] of Word = ($0001, $0002, $0004, $0008, $0010, $0020, $0040, $0080, $0100, $0200, $0400, $0800, $1000, $2000, $4000, $8000);

type

_Strl6 = string[16]; _Str255 = string[255]; _VεctorTypε = record fractX: Byte; { start coordinates startX: Word; fractY: Byte; { fractional portion - 1 bytε, should bε sεt to 0 } startY: Word; { intεgεr portion - 2 bytes

} deltaX: Integεr;{ +/- change values in 1/256 units} deltaY: Integεr;

SUBSTITUTE SHEET

-82 . 866- incr: Word; { f of increments within vector count} end; _StepPeriodsType = rεcord num : Byte; pεriods: arra [0..9] of Word; εnd;

var IntRεg: Rεgisters; LaserVersion: _Strl6;

{ LaserOk function check to seε if laser controller code has been installed.

returns: false if code not installed true if code is installed

LaserVersion contains laser controller version number

function LaserOk: Boolean; type

CopyType = array[1..20] of char; var CopyPtr: Λ CopyType; CopyStr: string[20]; begin with IntRεg do bεgin

AX ϊ= ($35 shl 8) or _LASERVECTOR; Intr($21, IntRεg) ;

CopyPtr := Ptr(Es,BX-19) ; end;

SUBSTITUTE SHEET

-82 . 867- movε(CopyPtr [1] ,CopyStr[1] ,18) ;

CopyStr[0] := #18; if CopyStr = 'Tarnz Technologies' then begin LaserOk := true; with IntReg do

CopyPtr := Ptr(Es,BX-46) ; movε(CopyPtr A [1] ,LasεrVersion[1] ,18) ; LaserVersion[0] := #4; end elsε bεgin LasεrOk := false;

LasεrVεrsion := '?.??'; end; end;

LaserPrεsεnt function samε as LasεrOk but also prints a mεssagε if lasεr systεm is not installεd.

returns: false if code not installed true if code is installεd

function LasεrPresent: Boolean; begin if LaserOk then LaserPresent := true elsε begin LaserPrεsεnt := falsε; writεln(•LASER systεm not installed.'); end; εnd;

{

OpenLaser(Ticks) function

SUBSTITUTE SHEET

-82 . 86δ- open up laser DAC channel with the background server interrupting every Ticks timer 0 ticks. Input for timer 0 is a 1.19 MHz clock signal, so if Ticks = 119, the background task would activate once per 100 us; with Ticks = 1190, once per ms; etc.

returns εrror code

function OpenLaser(ticks: Word) : Integer; begin { Min Time CHeck bypassed — BE CAREFUL! 111! } { if ticks<119 then ticks := 119; } with IntReg do begin

AX := $0000;

BX := ticks ; (* trunc(Period*l.19 {MHz}); *) Intr(_LASERVECTOR, IntReg) ; OpenLaser := AL; end; end;

CloseLasεr function closε off lasεr DAC channεl aftεr thε background command quεue empties. If laser neεds to bε stoppεd immεdiatεly, RεsetVectorPool should be called before this routine.

returns error code

function CloseLaser: Integer; begin with IntReg do begin

SUBSTITUTE SHEET

-82.869-

AX := $0100;

Intr(_LASERVECTOR, IntRεg) ; CloseLaser := AL; end; end;

AddVector(startX,startY,deltaX,deltaY,incr) function add the vector to the background command quεuε. Vector start coordinates are (startX,startY) and their change value is

(deltaX,dεltaY) . The number of incremental steps in the vector is incr. deltaX and deltaY are in a special format (high byte is +/- integer portion; low byte is 1/256 units) conducive to high-spεεd DAC updating. Sεε thε 3DPC protocol spεcification for morε information.

rεturns εrror code

function AddVector(startX,startY: Word;deltaX,dεltaY: Intεgεr; incr: Word) : Integεr; var

VectorPacket: _VectorType; bεgin if incr>0 thεn bεgin VectorPacket.fractX := 0; { set up vector packet } VectorPackεt.startX := startX; VεctorPackεt.fractY := 0; VectorPacket.startY := startY; VεctorPacket.deltaX := deltaX; VectorPacket.deltaY := deltaY; VectorPackεt.incr := incr; with IntRεg do bεgin

SUBSTITUTE SHEET

-82.δ70-

AX := $0200;

ES := Seg(VεctorPackεt) ; { point ES:BX to vεctor packεt } BX := Ofs(VεctorPacket) ;

Intr(_LASERVECTOR, IntReg) ; AddVector := AL; end; end else AddVector := 0; end;

{

AddOpenShuttεr function add thε open shutter command to the background command queue. The shutter will be opened by the background task when it gets to this command in the command queuε.

returns error code

function AddOpenShuttεr: Intεgεr; begin with IntReg do begin

AX := $0201;

Intr (_LASERVECTOR, IntReg) ; AddOpenShutter : = AL; end; end;

{

_AddCloseShutter function add thε closε shutter command to the background command queue. The shutter will be closed by the

SUBSTITUTE SHEET

-82 . 371- background task when it gets to this command in the command queue.

returns error code

function AddCloseShutter: Integer; begin with IntReg do begin

AX := $0202; Intr( LASERVECTOR, ' IntReg) ; AddCloseShutter := AL; end; end;

AddChangeTimεbasε(NεwTicks) function add the change time basε command to thε background command quεuε. Thε timer that awakens the back¬ ground task will be reloaded with the count of NewTicks by the background task when it gets to this command in the command queue.

returns error code

function AddChangeTimεbasε(NεwTicks: Word) : Intεgεr; begin with IntReg do begin

AX := $0203; BX := NewTicks;

Intr(_LASERVECTOR, IntReg) ; AddChangeTimebase := AL;

SUBSTITUTE SHEET

-82.872- end; end;

AddPause(DelayTicks) function add the pause command to the background command queuε. Whεn thε background task gεts to this command, it will pause for DelayTicks number of timer ticks. If the Background Interrupt Time is 119 (100 us) , then a pause of 1 ms will ensuε if DεlayTicks is 10. Aftεrwards, background activity rεsumεs.

returns error code

function AddPause(DelayTicks: Word) : Integεr; bεgin with IntRεg do begin

AX := $0204;

BX := DεlayTicks;

Intr(_LASERVECTOR, IntRεg) ; AddPausε := AL; εnd; εnd;

ResetCmdQuεue function clear out the background command queuε. Usually usεd as part of an abort procedure. Best .whεn used just before a CloseLaser call.

returns error code

SUBSTITUTE SHEET

-82 . 873-

function ResεtCmdQuεu : Intεgεr; bεgin with IntReg do begin

AX := $0300;

Intr (_LASERVECTOR, IntReg) ; ResεtCmdQueue : = AL; εnd; εnd ;

{

GεtCmdQuεuεSizε function get the background command queue's size in actual number of bytes. Number of vεctors is variable but can be estimatεd by thε numbεr returned by this routine / 13.

rεturns εrror code

function GεtCmdQueueSize(var size: Word) : Integer; begin with IntReg do begin

AX := $0400;

Intr(_LASERVECTOR, IntReg) ; size := BX; if size<0 thεn sizε := size + 65536; GetCmdQueueSize := AL; end; end;

SUBSTITUTE SHEET

-82.874-

GetIntNum(num) function place in num the software interrupt number. Not really important unless we have a software interrupt conflict.

returns error code

function GetlntNum(var num: Word) : Integer; begin with IntReg do begin

AX := $0500;

Intr(_LASERVECTOR, IntReg) ; num := BL; GetlntNum := AL;

end; end;

GetBkgndTime(ticks) function place in time the background task interrupt interval time in actual 1.19 MHz tick counts, (119 is 100 us, 1190 is 1 ms, etc.)

returns error code

function GetBkgndTime(var ticks: Word) : Integer; begin with IntReg do begin

AX := $0501;

SUBSTITUTE SHEET

-32.875-

Intr(_LASERVECTOR, IntRεg) ; ticks := BX; GetBkgndTime := AL; end; end;

GetControlWord(ctrl) function place in ctrl the Laser Control Word showing the status of various hardware and software mechanisms.

word bit description

0 Auto-Shutter Mode

1 Position-Acknowledgε Modε 2 Block Modε

3

0 shuttεr control, O=opεn/l=closεd

rεturns error code

function GetControlWord(var ctrl: Word): Integer; begin with IntReg do begin

AX := $0502;

Intr(_LASERVECTOR, IntReg) ; ctrl := BX; GetControlWord := AL; εnd; εnd;

SUBSTITUTE SHEET

-82.876-

AutoShuttεrModεOn function rεturns thε status of thε Auto Shuttεr Mode (truε for on) .

}

function AutoShuttεrModεOn: Boolεan; var

Er: Intεgεr; ctrl: Word; begin

Er := GεtControlWord(ctrl) ;

AutoShuttεrModεOn := (Ctrl and BITVALUE[0]) > 0; εnd;

{

_PosAckModεOn function rεturns thε status of the Position Acknowledge Mode (true for on) .

function PosAckModeOn: Boolean; var

Er: Integer; ctrl: Word; begin Er := GetControlWord(ctrl) ; PosAckModeOn := (ctrl and BITVALUE[1]) >.0; εnd;

SUBSTITUTE SHEET

-82.877-

BlockModεOn function rεturns thε status of thε Block Modε (true for on) .

function BlockModeOn: Boolean; var

Er: Intεgεr; ctrl: Word; bεgin

Er := GεtControlWord(ctrl) ; BlockModεOn := (ctrl and BITVALUE[2]) > 0; end;

GetStatus(statusl,status2) function placε in statusl and status2 thε Laser system's stati of various non-programmable hardware and software mechanisms.

word bit dεscription

statusl.C lasεr systεm channεl open status statusl.] laser systεm software interrupt established (sic) statusl.2 laser systεm background task in idle state statusl, 3-15 status2, 0 bit 0 of Port Cl, X and Y-axis position acknowledgε status2.1 bit 1 of Port Cl, Z-axis position acknowlεdgε status2.2 bit 2 of Port Cl

SUBSTITUTE SHEET

-82 . δ7δ- status2.3 bit 3 of Port Cl status2.4-15

rεturns error code

function GetStatus(var statusl,status2: Word):

Integεr; begin with IntReg do begin

AX := $0503; Intr(_LASERVECTOR, IntReg) ; statusl := BX; status2 := CX; GetStatus := AL; end; end;

GetOpεnStatus function tεlls whεthεr or not the laser system communications channel has been openεd and thε timεr tick trap installεd. The function returns a boolean value of TRUE if the channel is open.

returns boolean value

function GεtOpεnStatus: Boolεan; var

Er: Integer; stati,stat2: Word; bεgin

Er := GetStatus(stati,stat2) ;

SUBSTITUTE SHEET

-82 . 879- if Er=0 then GetOpεnStatus := (stati and BITVALUE[0]) > 0 εlsε GεtOpenStatus := false; end;

GetBkgndldleStatus function tells whethεr or not thε lasεr systεm background task is currently in the idle state where no more laser activity can be performεd without some more foreground-sourced commands. The function returns a boolean value of TRUE if the background task is idle.

returns boolean value

function GetBkgndldlεStatus: Boolean; var

Er: Intεgεr; stati,stat2: Word; bεgin Er := GεtStatus(stati,stat2) ; if Er=0 thεn GetBkgndldleStatus := (stati and BITVALUE[2]) > 0 elsε GεtBkgndldleStatus := false; end;

{•

GetTurnOffDεlay(ticks) function gεt thε idlε statε's lasεr turn-off dεlay in intεrrupt tick counts.

returns error code

SUBSTITUTE SHEET

-82.830-

function GetTurnOffDelay(var ticks: Word) : Integer; begin with IntReg do begin AX := $0504;

Intr(_LASERVECTOR, IntReg) ; ticks := BX; GetTurnOffDelay := AL; εnd; εnd;

GεtTurnOnDεlay(ticks) function gεt thε idlε state's lasεr turn-on dεlay in intεrrupt tick counts.

rεturns εrror codε

function GεtTurnOnDεlay(var ticks: Word) : Intεgεr; begin with IntReg do begin AX := $0505;

Intr(_LASERVECTOR, IntReg) ; ticks := BX; GetTurnOnDelay := AL; end; end;

GetHomεPosition(X,Y) function get the idle state's laser home position.

SUBSTITUTE SHEET

-82.881- returns error code

function GetHomεPosition(var X,Y: Word) : Intεgεr; bεgin with IntReg do begin

AX := $0506;

Intr(_LASERVECTOR, IntRεg) ;

X := BX; Y := CX; GεtHomεPosition := AL; εnd; εnd;

{

SεtΙntNum(num) function sεt thε softwarε intεrrupt numbεr to num. All softwarε interrupt call after this point must use this new intεrrupt numbεr. Thε intεrrupt vεctor for thε old numbεr is rεstored.

returns error code

function SetIntNum(num: Word) : Intεgεr; bεgin with IntReg do begin

AX := $0600; BL := num;

Intr(_LASERVECTOR, IntReg) ; SetlntNum := AL; εnd; end;

SUBSTITUTE SHEET

-82 . 882-

_SetBkgndTime(ticks) function set the background task intεrrupt intεrval to ticks which has the actual number of 1.19 MHz tick counts. (119 is 100 us, etc.)

returns error code

function SεtBkgndTimε(ticks: Word) : Integer; begin if ticks<_MINIMUM_TICKS then ticks := _MINIMUM_TICKS; with IntRεg do bεgin

AX := $0601; BX := ticks; Intr(_LASERVECTOR, IntRεg) ; SεtBkgndTimε := AL; end; end;

SetControlWord(ctrl) function set the Laser Control Word to ctrl. It is recommεnded that most software programs use the AlterControlWordBit and the specific mode set routines which follow.

word bit description

0 Auto-Shutter Mode

1 Position-Acknowledgε Mode

2 Block Mode

SUBSTITUTE SHEET

-82.883-

3

4 shuttεr control, 0=opεn/l=closεd

rεturns error code

function SetControlWord(ctrl: Word): Intεgεr; begin with IntRεg do begin

AX := $0602; BX := ctrl; Intr(_LASERVECTOR, IntReg); SetControlWord := AL; εnd; εnd;

AltεrControlWordBit(op,bit) function alter the state of the indicated Control Word bit. If op is 'S' or •+', the bit is set; if op is 'C or '-*, the bit is clearεd.

rεturns εrror codε

function AltεrControlWordBit(op: Char;bit: Word)

Integer; var

Er: Integεr; ctrl: Word; bεgin

Er := GεtControlWord(ctrl) ; if Er=0 thεn bεgin

SUBSTITUTE SHEET

-82 .884- if upcase(op) in ['S^'+'J then ctrl := ctrl or BITVALUE[bit] else if upcase(op) in ['C','-'] then ctrl := ctrl and ( ALLBITS- BITVALUE[bit]) ;

Er := SetControlWord(ctrl) ; end; AlterControlWordBit := Er; end;

SetAutoShuttεrMode(state) function set the state ('S'or '+' to set, 'C or '-* to clear) of the Auto-Shutter Mode.

returns error code

}

function SetAutoShutterModε(op: Char) : Intεger; begin SetAutoShuttεrModε := AltεrControlWordBit(op,0) ; εnd;

{

SetPosAckMode(statε) function sεt the state ('S' or '+' to set, 'C « or •- to clear) of the Position-Acknowledgε Modε.

rεturns error code

function SetPosAckMode(op: Char) : Integεr; begin SetPosAckModε := AltεrControlWordBit(op,1) ;

SUBSTITUTE SHEET

-82 . 885- end ;

SetBlockModε(state) function set the state ('S' or '+' to set, *C* or •-' to clear) of the Block Mode whεrε the 07 commands (below) are active.

returns error code

function SetBlockModε(op: Char) : Intεgεr; begin SetBlockModε := AltεrControlWordBit(op,2) ; εnd;

SεtTurnOffDεlay(ticks) function sεts thε idle state's laser turn-off delay to ticks interrupt counts.

returns error codε

function SεtTurnOffDεlay(ticks: Word) : Intεger; begin with IntReg do begin

AX := $0604; BX := ticks;

Intr(_LASERVECTOR, IntReg) ; SetTurnOffDεlay := AL; εnd; εnd;

SUBSTITUTE SHEET

-82 .886-

SetTurnOnDelay(ticks) function sets the idle state's laser turn-on delay to ticks interrupt counts.

rεturns εrror code

function SetTurnOnDelay(ticks: Word) : Integer; begin with IntReg do begin AX := $0605; BX := ticks;

Intr(_LASERVECTOR, IntReg) ; SetTurnOnDelay := AL; end; end;

{

SetHomePosition(X,Y) function sets the idle state's laser home position.

returns error codε

function SetHomePositio (X,Y: Word) : Integεr; begin with IntReg do begin

AX := $0606; BX := X; CX := Y;

Intr(_LASERVECTOR, IntReg) ; SetHomePosition := AL;

SUBSTITUTE SHEET

-82.887- εnd; εnd;

Exεcutε function set the background task running. The background task will process those commands added to the command queue from the last Clear Operation up to this Executε call. For the first Execute, then background task will start at the beginning of the queuε. New commands can be added to the command queuε while the background task is running.

When the background task is finished processing the current command block, it will automatically shut down, placing the laser beam at the presεt home position.

To make programs written for earlier versions (where the background task freε-ran) compatiblε, Execute, ExecuteClear, and Clear calls (seε bεlow) should bε usεd wherever appropriate.

rεturns εrror code

function Executε: Integer; begin with IntReg do begin AX := $0700;

Intr(_LASERVECTOR, IntReg) ; Execute := AL; εnd; εnd;

SUBSTITUTE SHEET

-82. 8δδ-

ExecutεClear function perform the equivalent of the Execute function

(seε abovε) and a Clεar function (see below) function. The ExecuteClεar function providεs a convεniεnt shorthand for:

Er := Exεcute;

Er := Clear;

returns error code

function ExecutεClεar: Intεgεr; bεgin with IntReg do begin

AX := $0701; Intr(_LASERVECTOR, IntReg) ; ExecutεClεar := AL; end; end;

Clear function clear thε command quεuε. Futurε Exεcutε and ExεcutεClεar calls will start thε background task procεssing command queue entries added after the call to this routine. An Executε Operation askεd for immεdiately after a Clear Operation has no effεct.

If Clear is not called between consecutivε

Exεcutε Operations, then background task will reprocess the command queue entries for the first

SUBSTITUTE SHEET

-82.889-

Exεcutε Opεration. Sometimεs this is desired, and sometimes it isn't.

returns error code

function Clear: Integer; begin with IntRεg do begin

AX := $0702;

Intr(_LASERVECTOR, IntReg) ; Clear := AL; end; end;

{'

SetStepPeriods function set the stεp pεriods for thε multiplε passεs. array contains numbεr of stεp pεriods to dεfine (1 to 10) and the step period values in 0.82 us (1.19 Mhz) units.

returns error codε

function SεtStεpPεriods(var sp_array:

_StεpPeriodsType) : Integer; begin with IntReg do begin AX := $0800;

ES := Seg(sp_array) ; { point ES:BX to stεp periods array } BX := Ofs(sp_array) ; Intr(_LASERVECTOR, IntReg) ;

SUBSTITUTE SHEET

-82 . 890- SεtStepPeriods := AL; end; end;

SetRεdrawCount function set the number of passes for the background task's redraw (1-8) .

returns error code

function SεtRεdrawCount(count: Word) : Intεgεr; bεgin with IntRεg do bεgin

AX := $0801; if count<1 thεn count := 1 εlsε if count>10 thεn count := 10;

BX := count;

Intr(_LASERVECTOR, IntRεg) ; SetRedrawCount := AL; end; end;

{

SetRεdrawDelay function set the number of timer ticks the background task should delay beforε starting a rεdraw pass.

rεturns error code

SUBSTITUTE SHEET

-82 . 891-

function SetRedrawDelay(delay: Word) : Integer; begin with IntReg do begin AX := $0802; BX := delay;

Intr(_LASERVECTOR, IntRεg) ; SεtRεdrawDεlay := AL; εnd; end;

{'

Mark function marks thε current position as the start of the next redraw. Usually only necεssary at thε beginning of a block.

returns error codε

function Mark: Intεgεr; bεgin " with IntRεg do bεgin

AX := $0803;

Intr(_LASERVECTOR, IntRεg) ; Mark := AL; εnd; εnd;

Redraw function causes the background task to perform a multi-pass redraw operation when it is encountered in the

SUBSTITUTE SHEET

-82 .392-

Background Command Quεuε. Rεdraw also marks so as to minimizε usε of commands.

rεturns error code

function Redraw: Integer; begin with IntReg do begin

AX := $0804;

Intr(_LASERVECTOR, IntReg) ; Redraw := AL; end; end;

{ end of LASER.INC }

SUBSTITUTE SHEET

-82 . 893-

{$R-,S+,I+,D+,T-,F-,V-B~,N-,L+} {$M 16384,0,655360}

{=

3D Systεms Stεrεolithography Systεm Softwarε

SUPER.PAS

SLA-1 Part-Making Graphics Supεrvisor

SUPER-spεcific Commands:

ZW sεcs sεt Z-axis Wait timε in seconds ZD distance set Z-axis dip Depth in millimeters ZV velocity set Z-axis Velocity paramεter ZA accεl set Z-axis Accelεration parametεr

Rεcent History:

9/ 1/87 Ver 2.04 Vεrsion 2 released

9/ 2/87 Ver 2.06 Variable dip logic corrected

9/ 3/87 Ver 2.07 compiled by TBM (Modifiεd Turbo

Basic) doublε parsε of options EX &

CL bεforε doublε EC to supprεss glitch

9/ 4/87 Vεr 08 addεd SV, SI critical arεas 9/17/87 Vεr 10 PRM numbεrs lεss than 0.1 supportεd sεlεctable range of Z layers with /START, /STOP options keyboard pause / continuε / skip to layεr control

9/22/87 Vεr 2.11 fixεd incorrεct day of wεεk rεad

9/23/87 Vεr 2.12 new SUPER commands ZW, ZD, ZV, and

ZA structural changes to SUPER.PRM

9/25/87 Vεr 2.20 new SLICE 19 block format supportεd

9/28/87 Vεr 2.21 /NEGZ Z-stagε is nεgative flag default option linε in SUPER.PRM addεd NFUB support added lower-

SUBSTITUTE SHEET

-82.894- case SUPER command support

9/30/87 Vεr 2.25 no execute for empty blocks (primarily for L block)

10/20/87 Vεr 2.26 /DEMO out-of-vat-delay option for AutoFact '87

10/26/87 Vεr 2.27 *.P files now *.L file error file support

11/03/87 Vεr 2.28 special demo screen read from file SUPER.DM0

11/04/87 Vεr 2.29 demo action descriptions with good timing

11/12/87 Ver 2.30 first Bεta softwarε releasε 11/15/87 Ver 2.31 addεd dirεctory of *.L filεs 11/20/87 Vεr 2.32 multiplε part-making capability addεd

12/04/87 Ver 2.33 slicε20 FUB FDB blocks Menu System forced pause at εnd of part-making run BLOCK.ID filε supportεd

12/16/87 Ver 2.40 SUPER convεrtεd from Turbo Basic to Turbo Pascal faster file transveral, laser buff r filling no spεcial dεmo scrεεn support

12/18/87 Vεr 2.41 fixεd Z-Tablε dip routinε (inf board output) 12/21/87 Ver 2.50 graphics support added start-up andpart-making information displays laser vectors shown on screεn

12/23/87 Ver 2.51 Block Filε read speed up skipping to new layers sped up 150 times 12/28/67 Ver 2.52 skip to new layer fixed Layer Control File command processing fixed added ability to flip betwεεn thε two graphic scrεεns l/06/8δ Ver 2.53 break abort allowed during skip action negativε offsεts shown as such wait action F1/F2 support addεd graphics display of error messagεs

SUBSTITUTE SHEET

-82 . 895- axεs orientation arrows for view window better file directory display 1/22/88 Ver 2.54 control of min/max vat viεwport coords via SUPER.PRM ShowFiles based on *.V instead of *.L case no longer important on SUPER.PRM option line better non¬ existent input files recovεry 1/25/88 Vεr 2.60 Graphics Supεrvisor no longer classified as Experimental support of *.R Range Control Files (as well as *.L) correct layer count derived from Range Control File 2/06/88 - /DEMO option made functional rivet processing madε functional

usεs Dos, Crt,

Graph, { library of graphics routinεs } Drivers, { all the BGI drivers } Fonts; { all the BGI fonts }

typε str4 = string[4] ; str6 = string[6] ; strlO = string[10]; strl6 = string[16]; str40 = string[40] ; strδO = string[80]; OpModεTypε = (TεxtOp,GraphicsOp) ;

var

FirstVar: Bytε; { must bε first variablε dεfinεd }

Ch,kεy: Char; index,dummy,code,i,j ,k: Integer;

WeekDay,Hour,Minu,Sec,Mon,Day,Year: Integεr;

SUBSTITUTE SHEET

-82 .896- tεmp,cmd,SingleBar: str80;

ShowStuff,ZTablεOf ,LasεrOff,DipFlag,NεgZStage,Demo: Boolεan;

FirstLayεr,SameBlock,MoveOnFlag,SkipFlag,PausεFlag: Boolεan;

QSizε,Layεr,VPosition,StartZ,EndZ,NumLayers, LayersToBuild: Longint;

XYScalε,ZPitch,PartHεight: Rεal;

CurrεntDatε,CurrentTime: str16; ParamOptions,ControlLine,BlockLinε,PartNamε: strδO;

StartTimεStamp,EndTimεStamp: str40;

BlockMnemonicsCount,OutOfVatDεlay,BoxCount, xl,yl,x2,y2: Word;

BlockFilεLoc,MaxBlockSizε,BlockSizε: Longint; rεgs: Registεrs;

ControlFilε,ErrorFile: Text;

BlockFile: file; {untyped}

XOffset,YOffsεt,ZAddrεss: Longint;

ParBlockTypε: arra [0..100] of strlO; ParStereoDef: array[0..100] of strδO;

BoxTypε: array[1..10] of str4;

MinX,MaxX,MinY,MaxY: array[1..10] of Word;

BoxXl,BoxYl,BOXX2,BoxY2,BoxX3,BoxY3,BoxX4,BoxY4: array[1..10] of Word; Mεmbεr: array[1..4] of Word;

BlockMnemonics: array[1..20] of strlO;

Offsets: array[0..50,1..22] of Longint;

LayerCount,NumXOffsets,NmYOffsets,NumOffsets: Word;

ParCount,RεlεxationTimε: Word; LasεrVεrsion,StereoVersion: str4; checkl,check2: Boolεan;

BlockNumRεad,Buflndε ,Controllndεx,Blocklndex: Integer;

SaveSεc,NεwSεc,DεltaSecs,01dDeltaSεcs,ControlLayεr, BlockLayεr: Longint;

GrDεltaX,GrDεltaY: Longint;

ControlTyp ,BlockTypε; strlo;

SUBSTITUTE SHEET

-82 . 897-

DipDepth,ZTableVeloc,ZTableAccel: Rεal; SliceRes,ZSpacing,Thickness:Real; OnScrεεn,GraphDrivεr,GraphMode,Error: Integer; Viewport: ViewPortType; OpMode: OpModεType;

LayεrCtr1,SwapXY,NegX,NegY: Boolean; GrMinX,GrMinY,GrMaxX,GrMaxY: Longint; RangεCount,BlockCount: Intεgεr; RangeZStart,RangeZEnd: Longint; Boxindex,RangεZSpacε,RangεCureDepth: Integεr; ZStart,ZEnd: array[l..100] of Longint;

{ all thε ranges } ZSpace,CurεDεpth: array [1..100] of Ineger;

{ } BlockTypes: array[l..100] of str6;

{ just for one range } BlockCmds: array[l..100] of str80; LastVar: Byte; { must be last variable-to-be-zεroεd dεfinεd }

BlockBuf: array[1..4100] of Char;

const

Vεrsionld = '2.60';

MSDOS = $21;

LASERVECTOR = $64; STEREOVECTOR = $65;

Blockldεntifiεrs = 'ZXYISHVABJCDEFGK' ;

ErrorFileName = 'C:\SYSTEM.ERR';

SystemFileName = 'C:\SLA1.SYS' ;

HomeDirectory = 'C:\3DSYS' ; BlockldFilεNamε = 'BLOCK.ID' ;

ParamFileName = •SUPER.PRM';

SupεrCommandsCount = 4;

SupεrCommands: array[1..4] of str4 = ('ZW', 'ZD', *ZV , 'ZA' ) ; CtrlC = A C;

SUBSTITUTE SHEET

-82 . δ98-

Bs = Λ H; Tab = A I; Lf = J; Cr = A M; CtrlS = A S; Fl = 59; F2 = 60; spδO =

DayOfWεεk: String[21] = 'SunMonTuεWεdThuFriSat' ; Zel : array f l . .12 ] of Integer (1,4,3,6,1,4,6,2,5,0,3,5); BlockRecordSize = 4096;

procεdurε 0vεrTεxt(Tεxt: String;len: Intεgεr) ; forward;

{

Dεscribε Error to Opεrator

> procedure PrintError(Text: String) ; bεgin if OpModε = TεxtOp then begin if whereX>l then writeln; writeln( •*** ' ,Text) ; εnd εlsε bεgin

MoveTo(3*S,24*14-2) ; OverTεxt('*** * +Tεxt,50) end; end;

{ include various files }

SUBSTITUTE SHEET

-82.399-

($i utility,inc} { iscellanεous routinεs

{$i kεybrd.inc} { kεyboard routines

{$i graph.inc} { screεn graphics routinεs

{$i time.inc} { datε and .timε routines

{$i zstagε.inc} { Z-stage elεvator routinεs

($i lctrl.inc} { laser control routines

function EofBlockFile: Boolean; begin EofBlockFilε:= eof(BlockFile) and (BufIndex>=BlockNumRεad) ; εnd;

procεdurε OpεnFilεs; label EasyLayεr; bεgin

{ look for εithεr a .R or .L control filε } If LayεrCtrl thεn goto EasyLayεr; assign(ControlFilε,PartNamε+' .R' ) ;

{$1-} reset(ControlFile) ; if IOresult=0 then begin if εof(ControlFilε) then begin

SystemError(•Error: Control File ' +PartName+' .R εmpty. * ) ; halt(6) ; εnd; εnd else begin EasyLayεr; assign(ControlFilε,PartNamε÷' .L' ) ; reset(ControlFile) ; if IOresultoO thεn begin

SystemError('No Control File for part '+PartName) ; halt(5) ;

SUBSTITUTE SHEET

-82 .900- εnd εlsε bεgin if eof(ControlFile) then begin SystemError('Error: Control File '+PartName+' .L empty. ') ; halt(7); εnd else LayerCtrl := true; end end;

{ look for the vector file } assign(BlockFilε,PartNamε+' .V) ; rεsεt(BlockFile,l) ; if IOresultoo then begin CantOpen(PartName+' .V) ; halt(8) ; end; if EofBlockFile then begin

SystemError( 'Error: '+PartName+* .V εmpty. ') ; halt(9) εnd; {$1+} εnd;

procεdure ParseControlLinεCommεnts; begin if (length(ControlLinε)>0) and copy(ControlLine, 1,6)='!MERGE « ) then ' bεgin i := pos('-STARTLAYER ' ,ControlLinε) ; if (i>0) and (StartZ=0) thεn StartZ := LongVal(copy(ControlLinε, i+12,5) ,dummy) ; i := pos( « -ENDLAYER ' ,ControlLinε) ; if (i>0) and (EndZ=65535) thεn EndZ := LongVal(copy(ControlLinε, i+10,5) ,dummy) ; i := pos(•-NUMLAYERS ' ,ControlLinε) ; if (i>0) and (NumLayers=65535) then NumLayers :=LongVal(copy

SUBSTITUTE SHEET

-82.901- (ControlLinε,i+ll,S) ,dummy) ; end end;

procedure GetLayεrControlLinε; bεgin rεpεat if eof(ControlFile) then bεgin ControlLinε : = ' ' ; SamεBlock := falsε; exit; end; readin(ControlFilε,ControlLinε) ; ParsεControlLinεCommεnts; until (length)ControlLine)>0) and (ControlLine[1]<>' 1 •) ; Controllndex := 1; UnitValInt(ControlLayεr,

ControlLinε,Controllndεx) ; UnitStr(ControlType,ControlLine, Controllndex) ;

SamεBlock := (BlockLayεr = ControlLayεr) and (BlockTypε = ControlTypε) ; { writεln(SamεBlock, • CLayer=' ,ControlLayer, ' CType=' ,ControlTypε, ' (Line=', Contro and;

procedure GetRangeControlLine; bεgin rεpeat if eof(ControlFilε) thεn bεgin ControlLine :=•'; εxit; εnd; readln(ControlFile,ControlLine) ; ParseControlLineCommεnts; until (lεngth(ControlLinε)>0) and

SUBSTITUTE SHEET

-82.902- (ControlLinε[l]<>' 1 « ) ; εnd;

procεdurε RεadRangε; var Inde ,p: Integεr; AtEnd: Boolean; begin

Index := 1;

UnitValInt (RangeZStart, ControlLinε,Indεx) ; UnitValInt (RangεZEnd, ControlLine,Index) ;

UnitValShortInt (RangεZSpace, ControlLine,Indεx) ; UnitValShortInt(RangeCureDεpth,ControlLin ,Indεx) ; AtEnd := falsε; BlockCount := 0; repeat

GetRangεControlLine; if (ControlLine=' ') or (ControlLine[1] in [ •0 » .. '9•]) then AtEnd := true else begin inc(BlockCount) ; p := pos(' , • ,ControlLine) ; if p=0 then p := length(ControlLinε)+l; BlockTypεs[BlockCount] := copy(ControlLinε,l,p-l) ; BlockCmds [BlockCount] :=

NoQuotεs(copy(ControlLinε,p+1,255) ) ; end; until AtEnd; end;

procedurε RεSεekBlockFile; bεgin if BlockFilεLoc > FilεSizε(BlockFile) then BlockFileLoc := FileSize(BlockFilε) ; { forcε eof condition } See (BlockFile,BlockFilεLoc) ;

SUBSTITUTE SHEET

-82 . 903-

BlockRεad(BlockFile,BlockBuf,BlockRεcordSiz ,

BlockNumRεad) ; BufIndεx := 1; end;

function GetBlockCh: Char; bεgin if not EofBlockFilε thεn bεgin

GεtBlockCh := BlockBuf[BufIndex] ; inc(BufIndεx) ; inc(BlockFileLoc) ; if BufIndex>BlockNumRεad then begin

BufIndex := 1; BlockRead(BlockFile,BlockBuf,BlockRecordSize, BlockNumRεad) ; εnd; εnd; εnd;

procεdurε GεtBlockLin ; var Ch: Char; storε: Intεgεr; bεgin rεpεat

BlockLinε := ' • ; if EofBlockFilε thεn bεgin SamεBlock := false; exit; εnd;

Ch := GεtBlockCh; BlockLinε[1] := Ch; storε := 2; while (not EofBlockFile) and (ChoCr) do begin Ch := GetBlockCh; BlockLine[store] := Ch; inc(store) ;

SUBSTITUTE SHEET

-82.904- εnd;

BlockLinε[0] := chr(storε) ; { throw away linε-feed } if not EofBlockFile then Ch :=GetBlockCh; if BlockLine[l] in [Α'..'Z'] then begin Blocklndex := 1;

UnitStr(BlockType,BlockLinε,Blocklndεx) ; UnitValInt(BlockLayεr,BlockLinε,Blocklndεx) ; εnd; until (lεngth(BloekLine)>0) and (BlockLine[l]<>' 1 ' ) ; SamεBlock := (BlockLayεr = ControlLayεr) and (BlockType = ControlType) { writeln(SameBlock, ' BLayεr=' ,BlockLayεr, ' B Typε —= I BlockTypε, ; BLinε=' ,BlockLinε) end;

procedure BlockSkip; var

Ch: Char; i,NumRead: Integεr; Match: strlO; SkipBuf: String; bεgin

Match := Lf+ « L' ; whilε (BlockLayεr < StartZ) and not EofBlockFile do begin Seek(BlockFile,BlockFileLoc) ; BlockRead(BlockFile,SkipBuf[1] ,255,NumRead) ; i := pos(Match,SkipBuf) ; SkipBuf[0] := chr(255) ; while (i=0) and not(eof(BlockFilε) or kεyprεssεd) do begin inc(BlockFileLoc,NumRead) ; move(SkipBuf[236] ,SkipBuf[1] ,20) ; BlockRead(BlockFile,SkipBuf[20] ,235,NumRead) ; if keyprεssεd thεn HandlεKεyboardRεquεst;

SUBSTITUTE SHEET

-32 . 905- i = pos(Match,SkipBuf) ; if >0 thεn dec(i,19); εnd; if i>0 thεn inc(BlockFilεLoc,i) else BlockFileLoc := FileSizε(BlockFilε) ; ReSeεkBlockFile; GetBlockLine; if keypressεd thεn HandlεKεyboard Rεquεst; end; end;

(

Send Supervisor execute command to the Stereo driver

) procecure LasεrExecute; bεgin

ShowError(STEREO( 'EX;CL;EC;EC') ) BlockSizε := 0; end;

{'

Send Supervisor lasεr control command to thε Stεreo driver

} procecure SendLaserCommand(cmd: String) ; bεgin ShowError(STEREO(cmd) ) ;

BloekSize := BloekSize + QSize; if BlockSizε > MaxBlockSizε then LasεrExεcutε; εnd;

(

Pick Out and Exεcutε SUPER-specific Command }

SUBSTITUTE SHEET

-32 . 906- procedure PickOutSuperCo mand(var cmd: String) ; var op: str4; k,index: Integεr; arg: Rεal; begin repeat op := upper(copy(cmd,1,2) ) ; index := 1; whilε (indεx<SupεrCommandsCount) and (pos(SupεrCommands[indεx] ,op)=0) do inc(indεx) ; if index<=SuperCommandsCount thεn bεgin k: = 3; whilε (k<lεngth(cmd) ) and (cmd[k]o';' do inc(k) ; inc(k); arg := RεalVal(copy(cmd,3,k-3) ,code) ; casε index of

1: {ZWait} Relaxation Time = trunc(arg) ; 2: {ZDepth} DipDεpth = arg;

3: {ZVεloc} ZTablεVεloc = arg; 4: {ZAccεl} ZTablεAccel = arg; end; cmd := copy(cmd,k,199) ; end; until index > SupεrCommandsCount; end;

Process both SUPER and STEREO commands

SUPER and STEREO commands are broken apart and exεcutεd in thε propεr sεquence, but by the two different programs. }

SUBSTITUTE SHEET

-32 . 907- procεdurε ProcεssCommands(cmd: String) ; var

OrgCmd: String; i,j,Superlndex: Integer; begin cmd := upper(cmd) ; repεat

OrgCmd := cmd; i := length(OrgCmd) + 1; for j:=l to SuperCommandsCount do begin

SuperIndεx := pos(SupεrCommands[ ] ,OrgCmd) ; if (Supεrlndex > 0) and (Superlndex < i) then i := Superlndex; end; cmd := copy(OrgCmd,1,i-1) ; if length(cmd)>0 then SεndLasεrCommand(cmd) ; cmd := copy(OrgCmd,i,255) ; if lεngth(cmd)>0 thεn PickOutSupεrCommaήd(cmd) until length(cmd)=0; end;

Sort four numbers in Membεr array for RεadLayεrBox, PointlnBox routinεs

} procεdurε QuadSort; var tεmp: Word;

QuadSortFlag: Boolεan; QuadSortI: Integer; begin

QuadSortFlag := true; whilε QuadSortFlag do bεgin QuadSortFlag := false; for QuadSortI := 1 to 3 do begin { quit if no swaps

SUBSTITUTE SHEET

-82 .908- if Mεmbεr[QuadSortI] > Mεmbεr[QuadSortI+1] thεn bεgin temp := Mεmbεr[QuadSortI] ; { swap two valuεs } Member[QuadSortI] := Membεr[Quad Sort 1+1] ; Member[Quadsortl+l] := temp;

QuadSortFlag : = true; εnd; end; end; end;

{

Seε if a point is in critical arεa box

} function PointInBox(index: Integer;XA,YA: Word) ; Boolean; begin if (XA >= MinX[index]) and (XA <= MaxX[index]) and (YA > = Miny[index]) AND (YA <= MaxY[index] then PointlnBox := true else PointlnBox := false; end;

{

See if both points are in a critical area box

} function QualifyRivet: Boolεan; bεgin

QualifyRivεt := falsε; for Boxindex:=1 to BoxCount do if PointlnBox(Boxindex,x l,yl) and PointlnBox (Boxinde ,x2,y2) then begin QualifyRivet := true; exit; end; end;

SUBSTITUTE SHEET

-82 . 909-

Rεad critical arεa box for layεr

} procεdurε RεadLayerBox; var i: Integεr;

Box_Xl,Box_Yl,Box_X2,Box_Y2,Box_X3,Box_Y3,Box_ X4,Box_Y4: Real; begin inc(BoxCount) ; i := 4; if ControlTypε[i]=' ' then inc(i) ;

UnitStr(BoxType[BoxCount] ,ControlLine,Controllndex)

UnitVal(Box_Xl)ControlLine,Controllndex)

UnitVal(Box_Yl)ControlLine,Controllndex)

UnitVal(Box_X2)ControlLine,Controllndex)

UnitVal(Box_Y2)ControlLinε,ControlIndεx)

UnitVal(Box_X3)ControlLinε,Controllndεx)

UnitVal(Box_Y3)ControlLine,Controllndex)

UnitVal(Box_X4)ControlLine,Controllndεx)

UnitVal(Box_Y4)ControlLine,Controllndex) i := BoxCount: if XYScaleol;000 then begin

BoxXl[i = trunc(Box _X1 * XYScalε) BoxYlfi = trunc(Box _Y1 * XYScalε) BoxX2[i = trunc(Box _X2 * XYScalε) BoxY2[i = trunc(Box _Y2 * XYScale) BoxX3[i = trunc(Box _X3 * XYScale) BoxY3[i = trunc(Box _Y3 * XYScale) BoxX4[i = trunc(Box _X4 * XYScale) BoxY4[i = trunc(Box _Y4 * XYScale) end elsε bεgin

BoxXl[i = trunc(Box _X1) BoxYl[i = trunc(Box _Y1) BoxX2[i = trunc(Box _X2) BoxY2[i = trunc(Box _Y2) BoxX3[i = trunc(Box _X3)

SUBSTITUTE SHEET

-32.910-

BoxY3[i] = trunc(Box _Y3) ; BoxX4[i] = trunc(Box _X4) ; BoxY4[i] = trunc(Box _Y4) ; end;

Membεr[l] := BoxXl[i] ; { need box X-axis min and max

Membεr[2] = BoxX2[i]; Mεmber[3] = BoxX3[i]; Membεr[4] = BoxX4[i]; Quadsort; MinX[2] := Mεmber[l] MaxX[2] := Mεmber[4] ;

Membεr[1] := BoxYl[i] ; { nεεd box Y-axis min and max

Mεmbεr[2] = BoxY2[i]; Member[3] = BoxY3[i]; Membεr[4] = BoxY4[i]; Quadsort; MinY[i] := Mεmber[1] MaxY[i] := Member[4] ; εnd;

}

Find Block Typε in ParBlockTypε array. If thεrε, sεnd thε corrεsponding ParStεrεoDεf dεfault string to Stεreo.

} procedure SetBlockDef aults ; bεgin i := 1; whilε (ParBlockTypε [i] <>ControlTypε) and (i<=ParCount) do inc (i) ; if i<=Par Count thεn

ProcessCommands (ParSterεoDεf [i] ; end;

SUBSTITUTE SHEET

-82 . 911-

procεdurε GraphVεctor; var grxl,grx2,gryl,gry2,tεmp: Word; begin if NegX thεn bεgin grxl:= round( (65535-xl-XOffset-GrMinX)/GrDeltaX*

(77-45)*8) ; grx2:= round((65535-x2-XOffset-GrMinX)/GrDeltaX* (77-45) *δ) ; end else begin grxl := round( (xl+XOffset-GrMinX)/GrDeltaX*

(77-45)*8) ; grx2 := round( (x2+XOffset-GrMinX)/GrDeltaX* (77-45)*δ) ; end: if NegY then begin gryl := round( (65535-y2-YOffsεt-GrMinY)/GrDεltaY* (22-9)*14) ; gry2 := round( (65535-yl-YOffsεt-GrMinY)/GrDεltaY* (22-9)*14) ; end else begin gryl := round( (yl+YOffset-GrMinY)/GrDεltaY* (22-9)*14) ; gry2 := round( (y2+YOffsεt-GrMinY)/GrDεltaY* (22-9)*14) ; end; if SwapXY then begin temp := grxl; grxl := grxl; gryl := temp; tεmp := grx2; grx2 := gryl; gry2 := temp; end;

SεtViεwPort(45*8+4 ,9*14+4 ,77*8+4,22*14+4,truε) ;

SUBSTITUTE SHEET

-62 . 912-

Lin (grxl,gryl,grx2,gry2) ; SεtViεwPort(0,0,GεtMaxX,GetMaxY,true) ; εnd;

procεdurε DrawVεctor; begin

SεndLasεrCommand('JX'+WordStr(xl+XOffsεt)+' ;

JY•+WordStr(yl+YOffsεt)+• ;NX'+WordStr(x2+XOffsεt) +' ;NY'+WordStr(y2+YOffsεt) ) ; if OpMode=GraphicsOp then GraphVector; end;

{-

procedurε DrawSεctionRivεt; bεgin if QuallifyRivet then begin - { Box type I skips } if BoxType[Boxindex]='XI' then exit; { Skip hatch } if BoxType[BoxIndεx]='XV' then begin SendLaserCommand(•JX'+WordStr(xl+XOffset)+' ;

JY « +WordStr(yl+YOffsεt)+' ;VX'+WordStr(x2+XOffsεt) T +' ;VY'+WordStr(y2+YOffset) ) ; if OpMode=GraphicsOp then GraphVector; end; end elsε DrawVεctor; end;

{

procεdurε DrawSkinRivεt; begin if QualifyRivet then begin { Box Type I skips } 0 if BoxType[i]= « SI' then exit; { Skip hatch } if BoxTypε[i]='SV thεn bεgin

SendLaserCommand(•JX'+WordStr(xl+XOffset)+'

SUBSTITUTE SHEET

-82 . 913-

JY'+WordStr(yl+YOffset) +' ;VX•+WordStr (x2+XOffset)+' ;VY'+WordStr(y2+YOffsεt) ) ; if OpModε=GraphicsOp then GraphVector; end; end elsε DrawVector; εnd;

{=

BLOCK PROCESSING ROUTINES: SLICE

ZBlock: Section Border - VI XBlock: Section X Hatching VI

YBlock: Section Y Hatching VI

IBlock: Section Angle Hatching V18 8/26/87

SBlock: Up Facing Skin Border V17 8/25/87

HBlock: Up Facing Skin X Fill V17 VBlock: Up Facing Skin Y Fill V17

ABlock: Up Facing Skin X Hatch V17

BBlock: Up Facing Skin Y Hatch V17

JBlock: Up Facing Skin Anglε Hatch V18

CBlock: Down Facing Skin Bordεr V17 DBlock: Down Facing Skin X Fill V17

EBlock: Down Facing Skin Y Fill V17

FBlock: Down Facing Skin X Hatch V17

GBlock: Down Facing Skin Y Hatch V17

KBlock: Down Facing Skin Anglε Hatch V18

- Nεw Mnεmonic Sεt -

BlockL Layer id (no vectors) V19 9/25/87 BlockLB Layer Border V19 BlockLH Layer Hatch VI9. BlockFUF Flat Up skin Fill V19 BlockNFUB Near-Flat Up skin Border V19a 9/28/87 BlockNFUF Near-Flat Up skin Fill V19 BlockFDF Flat Down skin Fill V19

SUBSTITUTE SHEET

-82.914-

BlockNFBD Nεar-Flat Down skin Bordεr V19 BlockNFDH Near-Flat Down skin Hatch V19 BlockNFDF Near-Flat Down skin Fill V19 BlockFUB Near-Flat Down skin Fill V20 12/4/87 BlockFDB Near-Flat Down skin Fill V20

{

procedurε HandlεBlockVεctor(Blockypε: Intεgεr) ; bεgin casε Block Typε of

1: DrawVεctor; {ZBlock}

2: DrawSectionRivet; {XBlock}

3: DrawsεctionRivεt; {YBlock}

4: Draws ctionRivεt; {IBlock}

5: DrawVεctor; {SBlock}

6: DrawVεctor; {HBlock}

7: DrawVector; {VBlock}

8: DrawskinRivεt; {ABlock}

9: DrawskinRivεt; {BBlock}

10: DrawSkinRivεt; {JBlock}

11: DrawVector {CBlock}

12 DrawVector {DBlock}

13 : DrawVector {EBlock}

14 : DrawSkinRivet; {FBlock}

15 : DrawSkinRivεt; {GBlock}

16 DrawSkinRivet; {KBlock}

20 {BlockL}

21 : DrawVεctor {BlockLB}

22 : DrawSεctionRivet; {JBlockLH}

23 : DrawSkinRivet; {JBlockFUF}

24 : Draw Vector {JBlockNFUB}

25 : DrawSkinRivet; {JBlockNFUF}

26 : DrawS inRivet; {JBlockFDF}

27 : DrawVector {JBlockNFDB}

28 : DrawSkinRivet; {JBlockNFDH}

29 : DrawSkinRivet; {JBlockNFDF}

SUBSTITUTE SHEET

-32 . 915-

30: DrawVector {JBlockFUB} 31: DrawVector {JBlockFDB} end; end;

Break apart input line into two coordinates (xl,yl) and (x2,y2)

> procedure GetCoords; var x_l,y_l,x_2,y_2: Rεal; bεgin

Blocklndεx := 1;

UnitVal(x_l,BlockLine,Blocklndex) ;

UnitVal(y_l,BlockLine,Blocklndex) ;

UnitVal(x_2 ,BlockLine,Blocklndεx) ;

UnitVal(y_2,BlockLine,Blocklndex) ; if XYScaleoi.000 then begin l = trunc(x_l * XYScale); yi = trunc(y_l * XYScale) ; x2 = trunc(x-2 * XYScale) ; y2 = tranc(y_2 * XYScale) ; εnd εlsε bεgin xl trunc(x_l) y trunc(y_l)

X2 trunc(x_2) y2 tranc(y_2) end; end;

{

Process block entries until a new layer block header appears }procedure ProcessBlockByLayer; var

SUBSTITUTE SHEET

-82.916- n,ProcI,Ofs: Integer; Ctrl: strlO;

OrgSameBlock,BlockHadVeetorsFlag: Boolean; OrgBlockLayer: Word; OrgBlockType: strlO; bεgin

{ will return at end of block } n := 2; while (n<length(ControlType)) and no (ControlType[n] in [ » 0'..'9']) do inc(n) ; ProcI : = 0; ifn=2 thenProcI:=pos(ControlType[1] ,BlockIdentifiεrs) if Proc 1=0 then begin Ctrl := copy(ControlType,1,n-1) ; for j:=1 to BlockMnemonicsCount do if Ctrl = BlockMnemonics[j] then ProcI := 19+j; { start at 20 } end if Procl>0 then begin if OpMode=TεxtOp thεn write(ControlType, ' ') else begin

MoveTo(28*8,13*14) ; OverText(ControlType , 5 ) ; end;

SetBlockDefaults;

ProcessCommands(NoQuotes(copy(ControlLine, Controllndex,199) ;))) VPosition := BlockFileLoc; OrgSameBlock := SameBlock;

OrgBlockLayer := BlockLayer; OrgBlockType := BlockType; for Ofs:=l to NumOfsets do begin if Ofs>l then begin BlockFileLoc := VPosition; ReSeekBlockFil ; end;

SUBSTITUTE SHEET

-82 . 917-

XOffset := Offsets[Ofs-1,1] YOffset := Offsets[Ofs-1,2] SameBlock := OrgSameBlock; BlockLayer := OrgBlockLayer; BlockType := OrgBlockType;

BlockHadVeetorsFlag : = false; whilε SameBlock do begin GetBlockLine; if SameBlock then begin BlockHadVeetorsFlag : = true;

GetCoords;

HandleBlockVector(ProcI) ; end; end; if BlockHadVeetorsFlag then LasεrExεcutε; end; end else

Message( 'Unrecognized block type '+BlockType+' in lay r » +WordStr(Layer) ) ; end;

procedurε ScanAndSεndCommands(block: str6) ; var i,len: Integer; begin len := 0; i := 1; whilε (ParBlockTypε[i]oblock) and (i<=ParCount) do inc(i) ; if i<=ParCount thεn bεgin

ProcessCommands(ParstereoDef[i]) ; inc(len,length(ParStereoDef[i]) ) ; εnd; i := 1; whilε (BlockTypes[i]oblock) and (i<=BlockCount) do inc(i) ;

SUBSTITUTE SHEET

-82.918- if i<=BlockCount then begin ProcessCommands(BlockCmds[i]) ; inc(len,length(BlockCmds[i]) ) ; εnd; if len > 0 then LaserExecute; end;

{

Process block entries until a new block entry appears procedurε ProcεssBlockByRange; var n,ProcI,Ofs: Integer; Ctrl: strlO;

OrgSameBlock,BlockHadVeetorsFlag: Boolea ; OrgBlockLayer: Word; OrgBlockType: strlO; begin

{ will return at end of vector block } n := 2; while (n<length(BlockType) ) and not(BlockType[n] in [O'..'9'3) do inc(n) ; ProcI := 0; if n=2 then ProcI:=pos(BlockType[1] ,Blockldentifiεrs) ; if Procl=0 then begin

Ctrl := cop (BlockType,l,n-l) ; for j:=l to BlockMnemonicsCount do if Ctrl = BlockMnemonicsfj] then ProcI := 19+j ; { start at 20 } end; if Procl>0 then begin if OpMode=TextOp then write(BlockTypε, ' •) else begin

MoveTo(28*8,13*14) ; OverText(BlockType,5) ; end; ScanAndSendCommands(Blocktypε) ; VPosition := BlockFileLoc;

SUBSTITUTE SHEET

-82 . 919-

ControlTypε := Block Type;

OrgSamεBlock := (BlockLayεr = ControlLayεr) and

(BlockTypε = ControlTypε) ; OrgBlockLayεr := Blocklayer; OrgBlockType := Block Type; for Ofs :=1 to NumOffsets do begin if Ofs>l then begin

BlockFileLoc := VPosition; ReseekBlockFile; end;

XOffset := Offsets[Ofs-l,l] ; YOffsεt := Offsεts[Ofs-l,2] ; SamεBlock := OrgSameBlock; BlockLayer := OrgBlockLayer; BlockType := OrgBlockType;

BlockHadVeetorsFlag := false; while SameBlock and not EofBlockFile do begin GetBlockLine; if SameBlock then begin BlockHadVeetorsFlag := true;

GetCoords;

HandlεBlockVεctor(ProcI) ; εnd; end; if BlockHadVeetorsFlag then LaserExecutε; εnd; end else

Message( 'Unexpected block type '+BlockType+' in layer '+WordStr(Layer) ) ; end;

Supεrvisor dip Z-tablε routinεs

) procedure DelayControl(DelayTime: Integer);

SUBSTITUTE SHEET

-82.920- var key: Char; ScreenH: Intεger; line: String; NewZ: Word; begin

Screεn H := whereX; DeltaSees := 0; GetTime; SaveSec - Sεc + 60*Minu +3600*Hour; MoveOnFlag := false; SkipFlag := false; PauseFlag := false; while (DeltaSees < Dealy Time) and not MoveOnFlag do begin WaitTest; if keypressed then begin key := upcase(ReadKey) case key of #0: begin key := ReadKεy; if OpMode = GraphicsOp then begin if ord(key) = Fl then SetVisualPagε(O) εlse if ord(key) = F2 thεn SetVisualPage(l) end; end; CtrlS: key := ReadKey; CtrlC: Abort;

« P « : . PauseFlags= not PauseFlag;

'C : begin

MoveOnFlag := true; { force exit

PauseFlag := fals ; end;

'S*: begin

MoveOnFlag := truε;

SkipFlag := true;

SUBSTITUTE SHEET

-82 . 921-

PausεFlag := false; end; end; end; if DeltaSεcs o OldDεltaSεcs thεn bεgin OldDεltaSecs := DeltaSees; temp := IntStr(DelayTimε-DεltaSεcs) ; if PauseFlag then temp := temp + '-P' elsε temp := temp + ' ' ; if OpMode=TextOp then begin gotoxy(ScreεnH,whεreY) ; write(temp) ; end elsε begin

MoveTo(73*8,7*14) ; OverText(temp,5) ; εnd; εnd; end; {while} gotoxy(ScrrenH,whereY) ; if PauseFlag then temp := '0-P ' elsε tεmp := *0 if OpModε=TεxtOp thεn bεgin gotoxy(ScreenH,wherεY) ; write(temp) ; end else begin MoveTo(73*8,7*14) ; OverText(temp,5) ; end; if PauseFlag then begin { handle pause } Action('PAUSED') if OpMode=GraphicsOp thεn bεgin MoveTo(3*8,24*14-2) ;

OutText('Supervisor paused. Press any key to continue...'); end; key := ReadKεy;

PauseFlag := false; if OpMode=GraphicsOp then begin

SUBSTITUTE SHEET

-82 .922-

MovεTo(3*8,24*14-2) ; OverText(' ' ,50) ; end; end; if (OpMode=TextOp) and (whereX>l) then writeln; if SkipFlag then begin { handle layer skip } if OpMode=TextOp thεn bεgin write('Skip to what Z layer? ') ; readln(line) ; end else begin

MoveTo(3*8,24*14-2) OutText('Skip to what Z layer? '); line := Getlnput(δ) ; MoveTo(3*7,24*14-2) ; OverText(" ,30) ;

Action( •SKIPPING') end; if length(line)>0 then begin NewZ := LongVal(linε,codε) ; if NεwZ>0 then StartZ := NewZ; end; end; end;

procedurε DipAndWait; var clean: Boolean; begin if whereX>l then writεin; Action('WAITING') ; clean := false;

{ Textmode(cSO) ; } repeat

SendLaserCommand('WI 1000'); { wait for background laser control to idle } { write(• kp=' ,kεyprεssεd) ; } if keypressed then HandleKeyboardRequest

SUBSTITUTE SHEET

-82 . 923- else clean := true; { write( • c=• ,clean) ;} until clean; { write(exited...') ; key := readkεy; } ZMove('MN H+ V + RealStr(int(ZTableVeloc*10000)/ 10000,3) + ' A' + RealStr(int(ZTableAccel*10000.0)/1000,3) ) ; if Demo then begin Action('SURFACING•) ; FormatZCommand(-PartHeight) ; DεlayControl(OutofCatDεlay) ; if SkipFlag thεn εxit; FormatZCommand(PartHeight) ; dεlay(100) ; WaitForldleZStage; { wait for Z-stage to stop moving}

end; Action( » DIPPING') ; FormatZCommand(DipDεpth) ; if Dεmo thεn FormatZCommand(-DipDεpth) εlsε bεgin if FirstLayεr thεn bεgin

FormatZCommand(Thicknεss-DipDεpth) ; FirstLayεr := falsε; εnd else if ZSpacing o 0 then FormatZCommand( (ControlLayer-Layer)/ ZSpacing * Thickness - DipDεpth; end;

Action( • ELAXING') ; if OpMode=GraphicsUp then begin MoveTo(67*8,7*14) ;

OutText( 'TIME: *+WordStr(RelaxationTime) ) ; DelayControl(RelaxationTime) ; MoveTo(66*8,7*14) ; OverText(' • ,10) ; end else DelayControl(RelaxationTime) ;

SUBSTITUTE SHEET

■62 .924- and

procedure HandleHeader(Line: String) ; var Index: Integer; begin

Index :=2; while (Index<length(Lin ) ) and (Line[Index]=' ) do inc(Index) ; UnitVal(SIiceRes,Line,Inde ) ; UnitVal(ZSpacing,Linε,Indεx) ; UnitVal(Thicknεss,Linε,Indεx) ; end;

procedure DetεrminεNumLayers; var i: Integer; range: Longint; begin i := 1; range = ZStart[1] ; LayersToBuild :=0; while (i <= RangeCount) and (range <=EndZ) do begin if range >= StartZ then inc(LayersToBuild) ; if ZSpace[i]>0 ten inc(range,ZSpace[i]) else inc(range) ; if range > ZEnd[i] then begin inc(i) ; r nge := ZStar [i] ; end; end; end;

procedure DriveByLayers; begin

SUBSTITUTE SHEET

-82.925-

{ dεtermines the next block to execute can skip blocks on specific layεrs handlεs dipping, sεtting of critical arεas, scrεεn updates

} while (ControlLine o ' •) and (ControlLayεr <= EndZ) do begin if ControlLayer < StartZ then begin BlockSkip;

GεtLayerControlLine; εnd else if ControlType=• #T0P' then begin if DipFlag then begin DipAndWait; DipFlag := false; end; if not SkipFlag then begin Layer := ControlLayer; if OpMode=TextOp thεn writε(Layεr, ' : ') εlsε bεgin

MoveTo(14*8,13*14) ; OvεrTεxt( ordstr(Layεr) ,5) ;

SetViewPort(45*8+4,9*14+4,22*8+4+14,true) ; ClεarViεwPort; SetViewPort(0.0,GetMaxX,GεtMaxY,true) ;

MoveTo(7*8,7*14) ; inc(LayerCount) ; if LayersToBuild < 65535 then

OverText(WordStr(LayerCount)+' OF "+ OF '+WordStr(LayersToBuild) ,13) else OverText(WordStr(LayerCount) ,13) ; end;

Action( •DRAWING' ) ; SetBlockDefaults; cmd := NoQuotes(copy(ControlLine, Controllndex,199) ) ; if length(cmd) >0 then begin

SUBSTITUTE SHEET

-82 . 926-

ProcessCommands(cmd) ; LaserExecute; end;

BoxCount : = 0; { no layer boxes } end;

SkipFlag := false; GetLayerControlLine; end else if ControlType=•fBTM' then begin SetBlockDefaults; cmd :=NoQuotes(copy(ControlLine,Controllndex,199)); if length(cmd)>0 then begin ProcessCommands(cmd) ; LaserExecute; end; DipFlag : = true;

GetLayerControlLine; end else if copy (ControlType,!,3)=*fCA' then begin ReadLayerBo : GetLayerControlLine; { will skip blocks for those *.L block entries edited out} end else begin if SameBlock then begin ProcessBlockByLayεr; GetLayerControlLine; end else GεtBlockLin ; end; end; end;

procedure DriveByRanges; begin

{ utilizes range information can't skip blocks on specific layers doesn't support critical areas handles dipping, screen updates }

SUBSTITUTE SHEET

-82 . 927- whilε (not EofBlockFilε) and (BlockLayεr <= EndZ) do bεgin if BlockLayεr > RangεZEnd thεn RεadRangε; if BlockLayer; < StartZ then begin BlockSkip;

DeterminεNumLayεrs; { adjust layεr m of n valuεs} inc(LayersToBuild,LayerCount) ; end else begin

ControlLayer := BlockLayer; { dip based on ControlLayer - Layer } if DipFlag then -begin DipAndWait; DipFlag := false; end; if BlockLayer >= StartZ then begin Layer := ControlLayer; if OpMode=TextOp then write(Layer, * : ' ) else begin

MoveTo(14*8,13*14) ; OverText(WordStr(Layer) ,5) ;

SetViewPort(45*8+4 ,9*14+4 ,77*8+4,22*14+4 ,true) ; ClεarViεwPort;

SetViewPort(0,0, &&&&&MaxX,GetMaxY,truε) ; MoveTo(7*8,7*14) ; inc(LayerCount) ; if LayersToBuild < 65535 then

OverText(WordStr(LayerCount)+' OF ' +WordStr(LayersToBuild) ,13) else OverText(WordStr(Layεr Count) ,13) ; end;

Action( •DRAWING» ) ; ScanAndSendCommands( ' TOP' ) ; whilε (ControlLayer = BlockLayer) and not EofBlockFile do ProcessBlockByRange;

ScanAndSendCommands( ' fBTM' ) ; DipFlag := true;

SUBSTITUTE SHEET

-32.92δ- εnd; εnd; end; end;

procedure PartMake; var cmd: String; begin if NumOffsets > 1 then writeln(IntStr(NumOffsets) , multiples being made at once. ') ; writein;

SendLaserCommand('HR;MD BL +*); FirstLayεr :=true; repeat

LayerCount :=0; SendLaserCommand( •CL;EC•) ; BlockSizε :=0;

{ rεad table headεrs

} if LayεrCtrl then begin repeat

GetLayerControlLine; if ControlLine[l]='*' then

HandleHeader(ControlLine) ; until ControlLine[1]o•*' ; LayersToBuild := NumLayers; end else begin RangeCount :=0

ControlLine ; while ControlLineo' ' do begin { read all ranges in} GetRangeControlLine; i f Co nt r o l L i n e [ l ] = ' * ' th ε n HandleHeader(ControlLine) ; if ControlLine[1] in [0*..9'] then bεgin

SUBSTITUTE SHEET

-82 . 929- inc(RangeCount) ; Index := 1;

UnitValInt (ZStart [RangeCount] , ControlLine,Index) ; UnitValInt (ZEnd) [RangeCount],

ControlLine,Index) ; UnitValShortInt (ZSpace [RangeCount] ,

ControlLine,Index) ; UnitValShortInt(CureDepth [RangeCount] , ControlLine, Index) ; end; end; Close(ControlFile) ;

DεtεrminεNumLayεrs; { dεtεrminε f of layεrs from range data } resεt(ControlFilε) ; rεpεat

GεtRangεControlLin ; until (ControlLine=' *) or (ControlLine[l]o'*') ; ReadRangε; { load in block data for first rangε } Layεr := ZStart[1] ; εnd;

BufIndεx := 1; BlockFileLoc := 0; BlockRead(BlockFile,BlockBuf,BlockRecordSizε, BlockNumRead) ; repeat

GetBlockLine; if BlockLine[l]='*' then HandleHeader(BlockLine) ; until BlockLine[!]<> *'; Layer := -1;

{ update Action Screen

)

SUBSTITUTE SHEET

-82 . 930- if OpMode=GraphicsOp then begin MoveTo(1*8,7*14) ; if LayersToBuild<65535 then OutText(•LAYER 1 OF '+WordStr(LayersToBuild) ) else OutText('LAYER 1' ) ; MoveTo(14*8,12*14) ;

OutTεxt(WordStr(StartZ) ) ; MoveTo(14*8,14*14) ; OutText(WordStr(EndZ) ) ; end;

if LayerCtrl then DrivεByLayεrs { dεcidε on control routine } else DriveByRangεs;

close(ControlFile) ; close(BlockFile) ; if Demo then OpenFiles; until not Demo; end;

{ ___ __ ___——__- —— _ }

procedure CheckForOptions(var cmd: string); var i,oi,j: Integer; begin cmd := upper(cmd) ; i := pos('/TEXT',cmd) ; { check for /TEXT text operation} if i>0 then begin

OpMode := TextOp; delete(cmd,i,5) ; end; i t- pos( « /STAR ',cmd) ;{ check for /START Z-layer start } if i>0 then begin oi := i; inc(i,6) ;

SUBSTITUTE SHEET

-82.931- whilε (i<lεngth(cmd) ) and (cmd[i]=' ') do inc(i) ; j := FindStr(i,cmd, ' /'); val(copy(cmd,i,j-i) ,StartZ,code) ; delete(cmd,oi,j-oi) ; end; i := POS( '/STOP' ,cmd) ; {check for /END Z-layer end } if i>0 then begin oi := i; inc(i,5) ; while (i<lεngth(cmd) ) and (cmd[i]=' ') do inc(i) ; j := FindStr(i,cmd, ' /'); val(copy(cmd,i,j-i) ,EndZ,codε) ; delete(cmd,oi,j-oi) ; end; i := pos( '/SWAPXY' ,cmd) ; { swap X & Y coordinates } if i>0 then begin

SwapXY := true; delete(cmd,1,7) ; end; i := pos( '/X' ,cmd) ; {X-axis orientation } if i>0 then begin

NegX := (cmd[i+2]='_') ; dεlεtε(cmd,i,3) ; end; i := pos( '/Y' ,cmd) ; { Y-axis orientation } if i>0 thεn begin

NegY := (cmd[i+2]='-') ; dεlεtε(cmd) ,i,3) ; end; i := pos('/S' ,cmd) ; if i>0 then begin { check for /S Show Stuff flag }

ShowStuff := true; delεtε(cmd,i,2) ; εnd; i : = pos('/ZOFF',cmd) ; { chεck for /ZOFF

No Z-Control flag } if i>0 thεn begin

SUBSTITUTE SHEET

-82 . 932-

ZTableOff := true; delete(cmd,i,5) ; end; i := pos('/LOFF' ,cmd) ; { check for /LOFF No Laser flag } if i>0 then begin LaserOff := true; delete(cmd,i,5) ; end; i := pos('/NEGZ' .cmd) ; { check for /NEGZ Neg-Z Stage flag } if i>0 then begin NegZStage := true; delete(cmd,i,5) ; end; i := pos('/HEIGHT',cmd) ; { check for /HEIGHT flag } if i>0 then begin oi := i; inc(i,7) ; while (i<length(cmd)) and (cmd[i]=' ') do inc(i) ; j := FindStr(i,cmd, ' /*); val(copy(cmd,i,j-i) ,PartHεight,codε) ; delete(cmd,oi,j-oi) ; εnd; i = pos('/DEMO',cmd) ; { chεck for /DEMO flag } if i>0 then begin Demo := true; oi := i; inc(i,5) ; while (i<length(cmd) ) and (cmd[i]=' » ) do inc(i) ; j s= FindSt (i,cmd, ' /'); val(cop (cmd,i,j-i) ,OutOfVatDelay,code) ; delete(cmd,oi,j-oi) ; end; i := pos('/LC ,cmd) ; { check for Layer Control option } if i>0 then begin LayerCtrl := true;

SUBSTITUTE SHEET

-82 . 933- dεlεtε (cmd, i , 10) ; end; end;

procedurε ReadBlockldFile; var

BlockldFile: text; BlockldLine: string; Group: Integer; Block: String; begin

BlockMnemonicsCount := 0;

{$1-} assign(BlockldFile,BlockldFileName) ; resεt(BlockldFile) ; if IOrεsultoO thεn bεgin assign(BlockldFil ,HomeDirectory+•'+BlockIdFilεNamε) ; rεsεt(BlockΙdFilε) ; if IOresulto then begin writεln(•Can"t find Block Id file.'); half(2); εnd; end;

{$!+} while not eof(BlockldFile) do begin readln(BlockldFile,BlockldLinε) ; if (length(BlockldLinε)>0) and (BlockldLine[1]<>' 1 ) then begin index := 1;

UnitValShortInt(Group,BlockldLinε,indεx) ; UnitStr(Block,BlockldLine,index) ; if Group=0 then begin inc(BlockMnemonicsCount) ; BlockMnemonics[BlockMnεmonicsCount] := upper(Block) ; end; end;

SUBSTITUTE SHEET

-82.934- end; close(BlockldFilε) ; end;

procedure GetXOffsεts(linε: string) ; bεgin

NumXOffsets := 0; repeat

Offsets[NumXOffsets,1] : = LongVal(line,code) ; inc(NumXOffsets) ; j := FindStr(l,linε, ', « ); if (j=length(line)+l) or (linε[j]=' ') thεn exit; line := cop (linε,j+1,199) ; until NumXOffsets>50 end;

procedure GetYOffsεts(line: string) ; begin

NumYOffsets := 0; repeat

Offsets[NumOffsets,2] := LongVal(line,code) ; inc(NumYOffsets) ; j := FindStr(1,line, ' , '); if (j=length(line)+l) or (line[j]= » ') thεn exit; line := copy(line,j+1,199) ; until NumYOffsets>50 end;

procedure GetXY(line: String;var Xvar,Yvar:ongInt) ; bεgin

Xvar := LongVal(linε,codε) ;

Yvar := LongVal(copy(linε,code+1,255) ,code) ; end;

procedure ReadSuperParamsFile; var

ParamFile: text;

SUBSTITUTE SHEET

-82 . 935- count: Intεgεr; cmd,ParamLinε: String; begin

assign(ParamFile,ParamFileName) ; reset(ParamFilε) ; if IOresultoo thεn bεgin assign(ParamFilε, 'C:\3DSYS'+ParamFilεNamε) ; reset(ParamFile) ; if IOresultoo then begin writeln('Can•'t find Supervisor Parametεr file.'); halt(3) ; end; end; {$!+} count := 0; while (not eof(ParamFile) ) and (count<=8) do begin readln(ParamFile,ParamLine) ; if (length(ParamLine)>0) and (ParamLine[1]<>' 1 ') then begin case count of 0: begin

ParamOptions := upper(NoQuotεs(ParamLinε) ) ; if lεngth(ParamOptions)=0 then ParamOptions := 'NONE';

ChεckForOptions(ParamLinε) ; end; 1: Z ddress := IntVal(ParamLine,code) ; 2: ZPitch := RealVal(ParamLine,code) ; 3: XYScale := RealVal(ParamLine,code) ; 4: GetXOffsets(ParamLine) ; 5: GetYOffsets(ParamLine) ; 6: MaxBlockSize := IntVal(ParamLine,code) ; 7: GetXY(ParamLine,GrMinX,GrMinY) ; 8: GetXY(ParamLine,GrMaxX,GrMaxY) ; end; inc(count) ;

SUBSTITUTE SHEET

-82.936- end; end;

NumOffsets := NumXOffsets; if NumOffsets > NumYOffsets then NumOffsets := NumYOffsets; ParCount := 0; while not eof(ParamFile) do begin cmd := ' • ; repeat repeat if eof(ParamFile) then begin

SystemError('Error - Unexpectεd εnd of

SUPER.PRM file!'); halt(4) ; end; readln(ParamFile,ParamLine) ; i := 1;- " { clean up input, zap some white space } while (i<length(ParamLine) ) and (ParamLine[i] in [Tab,' ']) do inc(i) ; delete(ParamLine,1,i-1) ; until (length(ParamLinε)>0) and (ParamLine[i]<>* 1 ') ; j := pos(' 1 • ,ParamLine) ; if j>0 then begin dεc(j) ; while (j>0) and (ParamLine[j] in [Tab, 1 •] do dec(j) ; delete(ParamLine,j+1,199) ; end; cmd := cmd + ParamLine; until cmd[length(cmd) ]<>';'• inc(ParCount) ι i := FindStr(1,cmd, • , « ) ;

ParBlockType[ParCount] := cop (cmd,1,i-1) ; ParStereoDef[ParCount] :=NoQuotes(copy(cmd,i+1,199) ) ; end; close(ParamFile) ; end;

SUBSTITUTE SHEET

-82.937-

procεdurε ShowFiles(FileSpεc: string) ; var

FilεCount: Integer; Dirlnfo: SearchRεc; bεgin

FileCount := 0;

FindFirst(FileSpec,AnyFile,Dirlnfo) ; ifDosErroroo then writein('- none -') else begin while DosError=0 do begin if FileCount>0 then write(spc(11-( (whεrεX-1) mod 10+1) ) ) inc(FileCount) ; write(copy(Dirlnfo.Name,l,pos( ' . • ,Dirlnfo.Namε)-1) ) ; FindNext(Dirlnfo) ; εnd; writεln; εnd; εnd;

procedure GetPartFileNamεTεxt; bεgin if lεngth(PartNamε)=0 then begin writeln( 'Dirεctor Listing of Part Files:'); writel ; ShowFiles('*.V) ; writεln; writε('Part Prefix: '); readln(PartName) ; end; PartName := upper(PartName) ; CheckForOptions(PartName) ; εnd;

procεdurε GetPartFileNameGr; var

SUBSTITUTE SHEET

-82 . 933-

FileCount: Integer; Dirlnfo: SearchRec; namε: strlδ; begin if length(PartNamε)=0 then begin FileCount := 0; MoveTo(1*8,11*14) ;

OutTextCParts Directory Listing:'); FindFirst( « *.V ,AnyFile,DirIn o) ; MoveTo(l*8,12*14) ; if DosErroroO then OutText('- NONE - ) else begin while (DosError = 0) and (GetY < 23*14) do begin inc(FileCount) ; name:=copy(Dirlnfo.Namε,1,posC . ' ,Dirlnfo.Name)

1) ; " name := name + spc(12-length(name) ) ; OutText(name) ; if GetX>8*60 then MoveTo(1*8,GetY+14) ;

FindNext(Dirlnfo) ; end; writeln; end; MoveTo(1*8,22*14) ; SetColor(2) ;

OutText('Part Filename: '); SetColor(3) ;

PartName := upper(Getlnput(50) ) ; CheckForOptions(PartName) ; end; end;

procedure MakeTitle; begin ClearViεwPort; SetColo (3) ;

SUBSTITUTE SHEET

-82 . 939-

DrawBorder;

MovεTo(10,5) ;

SetColor(3) ;

DrawBorder; MoveTo(10,5) ;

SetTextStyle(TriplexFont,HorizDir,4) ;

OutTεxt( •3D Systεms*) ;

MovεTo(13,40) ;

SεtTextStyle(SmallFont,HorizDir,6) ; OutText( 'Sylmar, California');

MoveTo(250,15) ;

SεtTεxtStylε(SansSerifFont,HorizDir,4) ;

OutTεxt( 'SUPERVISOR') ;

SεtTextStyle(DεfaultFont,HorizDir,1) ; MoveTo(64f8,1*14+7) ;

OutText( 'SLA-1•) ;

MoveTo(64*8,2*14+7) ;

OutText( 'Version '+VersionId) ;

SetLinεStylε(SolidLn,0,ThickWidth) ; Linε(0,65,639,65) ;

SεtLinεStylε(SolidLn,0,NormWidth) ; εnd; procεdurε MakεParamScrεεn; var i: Integer; bεgin

MakεTitle;

Linε (0,6*14+4,639,6*14+4);

SetTextStyle(DεfaultFont,HorizDir.1) ; MoveTo(l*8,7*14) ;

OutText( 'Options: '+ParamOptions) ;

Line(0,8*14+4,639,8*14+4) ;

MoveTo(1*8,9*14) ;

OutText( 'XY-Scale: « +RεalStr(XYScalε ,4) ) ; MoveTo(55*8,9*14) ;

OutText( 'f Parts: X Y' ) ;

Line(0,10*14+4,639,10*14+4) ;

SUBSTITUTE SHEET

-82.940- Line(68*6-4,8*14+4,6δ*δ-4,23*14+4) ; Lin (74*8-4,8*14+4,74*8-4,23*14+4) ; Line(54*8-4,8*14+4,54*8-4,10*14+4) ; Line(0,21,*14+4,68*8-4,21*14+4) ; Line(0,23,*14+4,639,23*14+4) ; MoveTo(64*δ,9*14) ; OutText(WordStr(NumOffsets) ) ; i := 0; while (i<12) nd (i<NumOffsεts) do bεgin MθvεTo(6δ*8, (11+i)*14) ;

OutTεxt(LongStr(Offsεts[i,1]) ) ; MoveTo(74*8, (ll+i)*14) ; OutTεxt(LongStr(Offsets[i,2]) ) ; inc(i) r end; end;

procedure MakeAction Scrεεn; var

H,V: Char; NegHorz,NegVεrt: Boolεan; bεgin

MakeTitle;

Line(0,6*14+4,639,6*14+4) ;

SetTextStyle(DefaultFont,HorizDir,1) ; MoveTo(1*8,7*14) ;

OutText('Options: '+ParamOptions) ;

Line(0,8*14+4,39,8*14+4) ;

MoveTo(1*8,9*14) ;

OutText( » XY-Scale: « +RealStr(XYScale,4) ) ; MoveTo(55*8,9*14) ;

OutTex ( « f Part : X Y ! ) ;

Line(0,10*14+4,639,10*14+4) ;

Line(68*8-4,8*14+4,68*δ-4,23*14+4) ;

Line(74*8-4 ,8*14+4,74*8-4,23*14+4) ; Line(54*8-4,8*14+4,54*8-4,10*14+4) ;

Line(0,21*14+4,68*8=4,21*14+4) ,

SUBSTITUTE SHEET

-82 . 941-

Linε(0,23*14+4,639,23*14+4) ; MoveTo(64*8,9*14) ; OutTεxt(WordStr(NumOffsεts) ) ; i := 0; whilε (i<12) and (i<NumOffsεts) do bεgin MoveTo (68*8 , (ll+i)*14) ; OutText(LongStr(Offsets[i,1]) ) ; MoveTo(74*8, (ll+i)*14) ; OutText(LongStr(Offsets[i,2]) ) ; inc(i) ; εnd; end;

procedure MakeActionScreεn; var H,V: Char;

NεgHorz,NegVert: Boolean; bεgin

MakeTitle;

Line(0,6*14+4,639,6*14+4) ; SetTextStyle(DefaultFont,HorizDir,1) ;

MoveTo(l*δ,7*14) ;

OutText( •ACTION: •) ;

SεtColor(2) ;

OutText( 'INITIALIZING') ; SetColor(3) ;

Line(0,6*14+4,639,8*14+4) ;

MoveTo(1*8,5*14+3) ;

OutText('PART ' +PartName) ;

MoveTo(64*8,5*14+3) ; OutText( •CONTROL: ' ) ; if LayerCtrl then OutText(•LAYER') ; else OutText( 'RANGE') ;

MoveTo(1*8, *14) ;

OutTex ('START TIME: '+StartTimeStamp) ; MoveTo(3*8,10*14) ;

OutText('END TIME: '+EndTimeStamp) ;

SUBSTITUTE SHEET

-82.942- Line(0,11*14+4,35*8+4 ,11*14+4) ; MovεTo(l*δ,12*14) ; OutText( 'START LAYER: « ) ; MovεTθ(4*8,13*14) ; OutText( ON LAYER: '); MoveTo(3*8,14*14) ; OutTεxt( 'END LAYER: ' ) ; Line(0,15*14+4,35*8+4,15*14+4) ; MoveTo(28*8,12*14) ; OutText( •BLOC ' ) ;

Linε(35*8+4,8*14+4,35*8+4,15*14+4) ; Line(24*8+4,11*14+4,24*8+4,15*14+4) ; Rectangle(45*8+4-1,9*14+4-1,77*8+4+1,22*14+4+1) ; Line(0,23*14+4,639,23*14+4) ; { draw axes orientation arrows } NegVert := NegY; NegHorz := NegX; V := » Y « ; H := 'X» ; if SwapXY then begin NegVert := NegX; NegHorz := NegY; V := « X « ; H := 'Y « ; end; case NegVert of false: case NegHorz of false: begin

Line(38*8+4,10*14+4,33*8+4,12*14+4) ; Line(38*8+4,10*14+4,42*8+4,10*14+4) ;

MoveTo(43*8,10*14) ; OutTex (H) ; MoveTo(38*δ,13*14-4) ; OutText(V) ; end; true: begin

Line(42*8+4,10*14+4,42*8+4,12*14+4) ;

SUBSTITUTE SHEET

-82.943- Line(38*8+4,12*14+4,42*8+4,10*14+4) ; MovεTo(42*8,13*14-4) ; OutTεxt(V) ; MoveTo(37*8,10*14) ; OutText(H); end; end; true: case NegHorz of false: begin . Line(38*8+4,10*14+4,38*8+4,12*14+4) ;

Line(38*8+4,12*14+4,42*8+4,12*14+4) ; MovεTo(38*8,9*14+4) ; OutText(V) ; MovεTo(43*8,12*14) ; OutText(H); end; true: begin

Line(42*8+4,10*14+4,42*8+4,12*14+4) ; Line(38*8+4,12*14+4,42*8+4,12*14+4) ; MoveTo(37*8,12*14) ;

OutText(H) ; MovεTo(42*8,9*14+4) ; OutTεxt(V) ; εnd; εnd; end; end;

{ - - - M A I N - - -}

begin CheckBreak :— false;

FillChar(FirstVar,ofs(LastVar)-Ofs(FirstVar) ,f0;

{ clear variables } SingleBar := many(chr(196) ,45) ; writeln; writeln(SingleBar) ;

SUBSTITUTE SHEET

-82 . 944- writeln(' SUPER, Part-Making Supervisor'); writelnC 3D Systems Laser Sterolithography System'); writelnC Version ' ,VεrsionId, ' 3D Systems, Inc.'); writeln(SingleBar) ; writeln;

OpMode := TextOp;

checkl:= LaserPresent; check2:= StereoPresent; if not (checkl and check2) then halt(l) ; OpMode := GraphicsOp;

StartZ := 0;

EndZ := 65535;

NumLayers := 65535;

ReadBlockldFile; ReadSuperParamsFile;

ReadCommandLine(cmd) ; { process overriding command line } i := pos('/' ,cmd) ; if i=0 then i : length(cmd) +1; PartName := upper (copy(cmd,1,i-1) ) ; cmd := upper(copy(cmd,i,255) ) ;

CheckForOptions(cmd) ;

GrDeltaX := GrMaxX-GrMinX; if GrDeltaX < 10 then GrDeltaX := 10; GrDeltaY := GrMaxY-GrMin ; if GrDeltaY < 10 then GrDeltaY := 10;

if OpMode=TextOp then begin

GetPartFileNameTex ; if (NumOffsets<l) or (length(PartName)=0) then halt(0) ; writeln;

OpenFiles; writeln('Starting part-making process...');

GetTimeStamp; StartTimeSta p := CurrentDate+' '+CurrεntTimε;

SUBSTITUTE SHEET

-82 . 945-

InitZTable;

PartMake; writεln;

SystεmError( 'Part complεtεd. ') ; writeln; writeln(•Start Time: ' ,StartTimeStamp) ;

GεtTi εStam ; writelnC End Time: ' ,CurrentDate+' *+CurrεntTime) ; end else begin

InstallGraphics;

Buildlmage;

MakεParamScrεεn;

Showlmage; GetPartFileNameGr; if (NumOffsets<l) or length(PartNamε)=0) then begin TextModε(C80) ; halt(0) ; end; OpenFiles;

Buildlmagε;

GεtTimeStamp;

StartTimeStamp := CurrεntDatε+' '+CurrεntTime;

MakeActionScreεn; Showlmage;

InitZTable;

PartMake; writeln;

GetTimeStamp; EndTimeStamp := CurrentDate+' '+CurrentTime;

MoveTo(13*8,10*14) ;

OutText(EndTimeStamp) ;

Action( •PART COMPLETED') ; repeat Ch := ReadKey; if (Ch = fO) and keyprεssεd thεn begin key := ReadKεy; { don't ovεrwritε Ch }

SUBSTITUTE SHEET

-82.946- if OpMode = GraphiesOp then begin if ord(key) = Fl then SetVisualPage(O) else if ord(key) = F2 then SetVisualPage(l) ; end; until ChofO; ClosεGraph; end; Quit; end.

SUBSTITUTE SHEET

-82.947-

3D Systems Stereolithography System Software

XFER.PAS

SLA-1 File Transfer Utility Software

History: 11/12/87 Ver 2.30 first Beta software release 12/02/87 Ver 2.31 reactivates tcp for Turbo Pascal

'J^.O Υιeτϊu

12/17/87 Ver 2.40 telnet/ ftp host is 'SliceComputer '

(not 'procesε ' )

1/11/88 "Ver 2.50 support o£ ή ϊierent "Ethe net types based on SLA1. SYS file

1/20/88 Ver 2.51 upper case X for exit 1/25/88 Ver 2.60 version update only

I

{$R-,S+,I+,D+,T-,F-,V-,B-,N-,L+ } ($M 16384,0,16384 \

uses Crt ,Dos;

type

EthernetSupport = (_NoEthemet,_Excelan,_Micom, JCJnknown) ;

var Ch: Char;

Line,SingleBar: String; Ethernet: EthernetSuppor ; SystemFile,ErrorFile; Text;

const Versionld = ' 2. 60 ' ;

ComSpec = ' C: \C0fflLAND. C0M ' ;

SUBSTITUTE SHEET

-82.948-

SystεmFilεNamε = 'C:\SLA1.SYS' ; ErrorFileName = 'C:\SYSTEM.ERR' ;

{

Show error and store it on disk } procedure SystemErro (Text: strinq \ ; bεgin writeln(Text) ; assign (ErrorFile, ErrαrFiLeKam.e\ ? rewrite (ErrorFile) ; . writeln (ErrorFile , » XFER: ' , ext) ; close (Er or FiLe.\ -, end;

"£ τvc.ioτv λspper ("tea*.*. «xx*5y. ^fcs xsy, var i: Integer; begin temp := text; ior (temp[ij); upper := temp; end;

function many(Ch: Char;num: Integer) : String; var temp: String; i: Integer; begin temp := ' • ? for i:=l to num do temp := temp+Cfa; many := temp; end;

procedure Deter ineEthernetSupport;

SUBSTITUTE SHEET

-82.949- begin

Ethernet := _NoEthernet; assign.(Sγstem.Flie,Sγst &EiL &ame.\ ;

resεt(SystemFile) ;

if IOresult=0 then begin while not eo (SystemFile) do begin xea \τ^S>^a . ^^"i fe, Δ."\^>*, Line := upper Line ; if copy(Line,l,9)='ETHERNET=' then begin

'N': Ethernet := _NoEthernet; 'E': Ethernet := _Excelan; M : Ethernet := _Mϊcom;

'U' : Ethernet := JJnknow ; εnd; εnd; end; end; end;

begin

DetermineEthernetSupport; SiitgleB x *. = 'saεcΛNf 5Λ^,V^i * » if Ethernet = _Excelan then Exec ( ComSpec , '/C REX') ; repeat ClrScr; writeln(SingleBar) ; writel ('XFER, Ethernet File Transfer'); writeln [ 3D Systems " Laser StereolVCnography System') ; writeln('Version '+VersionId+' 3D Systems, Inc. '); writeln(SingleBar) ; writeln,- writeln; writeln;

SUBSTITUTE SHEET

-82.950- if Ethernet = _NoEthernet then begin

SystemError ( 'No Ethernet Communications Support ') ; end else begin case Ethernet of Ethernet suppor ') ;

_Micom : writeln('using Micom Interlan support 1 ) ; else writelnC usinq unknown su rqort ' { ι end; writeln; writ Ltv; writelnC 1. TELNET, Terminal Utility > ) ; writelnC 2. FTP, File Trans fer Program ') ;

writeln; writeln; writeC Υfriϊch actϊoxf* ) ; Ch := upcase(ReadKey) ; if Ch in f'l', '2', 'X'J then begin writeln; writeln? case upcase (Ch) of '1': begin

SliceComputer') ; halt(O); enδ.*, '2': begin

Exec (ComSpec, '/C FTP SliceComputer ' ) ; "halt [ 0") ; end ; 'X ' : halt(O) ; end; end? end;

SUBSTITUTE SHEET

82.951- until 0=1 ; end.

SUBSTITUTE SHEET

-82.952-

Utility Routines

function sgn(num: Rεal) : Rεal; begin if num<0 then sgn := -1 else if num>0 then sgn := 1 else sgn := 0; end;

function upper(tεxt: string) : string; var i: Intεger; tεmp: string; begin temp := text; for i := 1 to length(tεmp) do tεmp[i] := . upcase(temp[i]) ; upper := temp; end;

function many(Ch: Char:num: Integεr) : string; var temp: string; i: Integer; begin temp := * ' ; for i:=l to num do temp :=* temp+Ch; many := temp; end;

function mi (intl,int2: Intεger): Integer; begin if intl<int2 then min := intl else min := int2; end;

SUBSTITUTE SHEET

-82 . 953- function max(intl,int2: Integer): Integer; begin if intl>int2 then max := intl elsε max := int2; εnd;

function IntStr(num: Intεgεr): strl6; var tεmp: str16; bεgin if num>=0 thεn Str(num,tεmp) εlsε Str(num+$8000,tεmp) ;

IntStr := temp; end;

function WordStr(num: Word): strl6; var temp: str16; bεgin

Str(num,tεmp) ; WortStr := temp; end; var temp; str16; begin

Str(num,temp) ; LongStr := temp; end;

function RealStr(num: Rεal;AftεrDεcimal: Intεgεr): str80; var i: Integer; temp: strδQ; begin

Str(num:10:AfterDecimal,tεmp) i := 1; whilε (i<length(temp) ) and (temp[i]= ' ' ) do inc(i) ;

SUBSTITUTE SHEET

-82.954-

RεalStr := copy(tεmp,i,99) ; εnd;

function spc(len: Integer) : string; begin spc := copy(sp80+sp80,1,len) ; end;

procedure ReadCommandLine(var line: string) ; var i: Intεger; begin line := ParamStr(l) ; for i:=2 to ParamCount do linε := line + * ' + ParamStr(i) ; end; {

Remove excess quote marks around string

> function NoQuotes(Text: strSO) : str80; const Quote = "" ; var s,e: Integer; begin s := 1; if (lengt (Text)>1) and (Text[l]=Quotε) thεn inc(s) ; e := length(Text) ; if Text[e]=Quote thεn dec(e) ;

NoQuotes := copy(Text,s,e-s+l) ; end;

{

Removes all double spaces in text string

> procedure RemovεDoublεSpaces(var text: string) ; begin

SUBSTITUTE SHEET

-82.955- whilε pos(' ',tεxt)>0 do dεlεtε(tεxt,pos(' 'text),l); end;

{ Find any char of Chars in Main starting at index Start Rεturns lεngth(Main)+l if no charactεr of Chars in Main

> function FindStr(Start: Integer;Main: string;Chars: strlO) : Integer; var i,j ,min: Integer; tεmp: String; bεgin min := lεngth(Main)+l; temp := copy(Main,Str*****99) ; for i:=l to length(Chars) do begin j := Start + pos(Chars[i] ,temp) - 1; if (j >= Start) and (j < min) then min := j; end;

FindStr := min end;

{ bettεr val routinεs } function IntVal(linε: String;var codε: Intεgεr):

Integer; var code2: Integer; num; Integer; begin val(line,num,code) ; if codeoo then val(copy(1ine,1,code-1),num,code2) ; IntVal := num; end;

SUBSTITUTE SHEET

-82 .956- function LongVal(linε: String;var code: Integεr):

Longint; var code2: Integer; num: Longint; begin val(line,num,code) ; if codeoo then val(copy(line,1,code-1) ,num,code2) ; LongVal := num; end;

function RealVal(linε: String:var codε: Intεger): Real; var code2: Integεr; num: Rεal; bεgin if line[l]='.' then line := '0' + line; val(line,num,code) ; if codeoo then val(copy(line,1,code-1) ,num,code2) ;

RealVal := num; end;

{

Pick out a number from a string starting at Index and going to the next space or comma or end-of-string } procedure UnitValShortInt(var Storage: Integer;Text:

String;var Index: Integer) ; var i: Integer; begin

Storage := IntVal(copy(Text,Index,99) ,i) ; if i=0 then Index := length(Text)+1 else Index := Index . + i; end;

SUBSTITUTE SHEET

-82 . 957- procεdurε UnitValInt(var Storagε: Longint;Tεxt: String;var Indεx: Intεgεr) ;

var i: Integer; begin

Storage := LongVal(copy(Text,Indεx,99) ,i) ; if i=0 then Index := length(Text)+1 elsε Indεx := Index + i; end; var i: Integεr; bεgin

Storagε := RealVal(copy(Text,Index,99) ,i) ; if i=0 then Index := length(Tεxt)+1 εlsε Index := Index + i; end;

{

Pick out text from a string starting at Index and going to the next comma or end- -of-string

} procedure UnitStr(var Storage,Tεxt: String;var Indεx:

Integer) ; var i: Integer; begin i := FindStr(Index,Text, ' , ' ) ; Storagε := copy(Text,Index,i-Index) ; Index := i + i; end;

{

Show error and store it on disk

} procedurε SystεmError(Tεxt: string) ; begin

SUBSTITUTE SHEET

-82 .958- if OpMode = TextOp thεn writeln(Text) elsε bεgin

MoveTo(3*8,24*14-2) ; OverText(Text,50) ; Ch := ReadKey; TextMode(C80) ; end; assign(ErrorFile,ErrorFileName) ; rewrite(ErrorFile) ; writεln(ErrorFilε , 'SUPER: > ,Tεxt); close(ErrorFile) ; end;

{

Can't open file. Report this to operator. } procedurε CantOpεn(FileName: string) ; begin

SystemError('Can''t open file '+FilεNamε) ;\ εnd;

SUBSTITUTE SHEET

-82.959-

Kεyboard Routines

procedurε Abort; var kεy: Char; bεgin if OpModε=GraphicsOp thεn TεxtMode(CBO) ; whilε kεyprεssεd do kεy := ReadKεy; halt(127) ; εnd;

function STEREO(LasεrCommand: String) : Intεgεr; forward; procedure ShowError(Error: Integer) ; forward;

procedurε Quit; var key: Char; begin

ShowError(STEREO('SP 100;EC;EC) ) ; if OpMode=GraphicsOp then TextMode(C80) ; halt(0) ; εnd;

procεdurε HandlεKεyboardRεquest; var key: Char; begin while keypressed do begin key := ReadKey; if key = CtrlS then key := ReadKey; if key = CtrlC then Abort; if (key = fO) and keypressed then begin key := ReadKey; if OpMode = GraphiesOp then begin if ord(key) = Fl then SetVisualPage(O)

SUBSTITUTE SHEET

-82.960- εlsε if ord(key) = F2 then SetVisualPage(l) ; end; end; end; end;

SUBSTITUTE SHEET

-82 .961-

GRAPH Includε Filε

{$F+) procεdurε MainExit; {$F-} bεgin {$1-} Close(SliceFile) ; Close(TriangleFilε) ; {$1+} RestorεCrtMod ; TεxtBackground(Black) ; TextColor(White) ; ClrScr; ExitProc:=ExitSave; εnd;

procεdurε CursorOff; bεgin with rεgs do bεgin AH := 3; BH := 0; Intr($10,rεgs) ; AH := 1;

CH := CH or $20; Intr($10,rεgs) ; εnd; end;

procedurε CursorOn; begin with regs do begin AH := 3; BH := 0; . Intr($10,regs) ; AH := 1; CH := CH and $DF; Intr($10,rεgs) ; end; end;

SUBSTITUTE SHEET

-82.962- { ************************************************* procedurε ConvεrtRtoS(r,s : PointerType) ;

{ Convεrts a Real type (6 byte) number to a Single (4 byte) var e : Byte; bεgin e:=r A [0] ; if eoo then Dec(e,2) ; s Λ [3]:=(r Λ [5] and $80) or ((e shr 1) and $7F) ; s Λ [2]:=((e shl 7) or (r Λ [5] and $7F) ) and $FF; s Λ [l]:=r Λ [4] ; s Λ [0]:=r Λ [3] ; εnd;

*******************************************************}

procedure ProgramErro (ErrorLine : String) ; { Print Program Error and exits program } begin

RestoreCrtMode; TextBackground(Black) ; TextColor(White) ; ClrScr; writeln( '*** SLAGRAPH ERROR: ' ,ErrorLine, ' ***') ; ch:=ReadKey; Halt(l) ; end;

procedure ReAllocate(ch : Char;Alloc : Longint) ; { Allocates thε array space to sugessted numbεr } var MemoryAvail : Longint; begin

{ Free Heap } Release(HeapTop) ; SliceFilename := ' ';

SUBSTITUTE SHEET

-82 . 963-

TrianglεFilεnamε:= ' ' ; MεmoryAvail := MemAvail - 32768;

if ch='S' then begin

{ Don't allow more than machine can handle } if Alloc>MAX_LAYERS then Total_Layers:=MAX_LAYERS εlsε Total_Layεrs:=Alloc;

{ Make sure you can allocate that many alone. If not, set maximum ) if Total_Layers*LAYER_SIZE>MemoryAvail thεn Total_Layers:=Round(MemoryAvail/LAYER_SIZE) ;

{ Givεn numbεr of Layers, fill rest of mεmory with Trianglεs )

Total_Trianglεs:=Round( (MεmoryAvail-Total_Layεrs*LAYER_S IZE)/TRIANGLE_SIZE) ; if Total_Triangles>MAX_TRIANGLES then Total_Triangles:=MAX_TRIANGLES; εnd εlsε bεgin

{ Don't allow more than machine can handle } if Alloc>MAX_TRIANGLES then Total_Triangles:=MAX_TRIANGLES else Total_Triangles:=Alloc;

{ Make sure you can allocate that many alone. If not, set maximum } if Total_Triangles*TRIANGLE_SIZE>MemoryAvail then Total_Triangles:=Round(MεmoryAvail/TRIANGLE_SIZE) ;

{ Givεn numbεr of Triangles, fill rest of memory with Layers )

Total_Layers:=Round( (MεmoryAvail-Total_Triangles*TRIANGL E_SIZE)/LAYER_SIZE) ; if Total_Layers>MAX_LAYERS then Total_Layεrs:=MAX_LAYERS; end;

GetMem(SIiceLayerValue ,Total_Layers*2) ;

GetMem(SIiceLayεrPtr,Total_Layεrs*4) ;

SUBSTITUTE SHEET

-82 .964-

GetMe (SliceLayerBlocks,Total_Layers*2) ; GetMem(SlicεLayerXMin,Total_Layers*2) ; GetMem(SiiceLayerXMax,Total_Layers*2) ; GetMem(SIiceLayerYMin,Total_Layers*2) ; GetMem(SliceLayerYMax,Total_Layers*2) ; GetMεm(TrianglePtr,Total_Triangles*4) ; GetMe (TriangleAxisValue,Total_Triangles*6) ; Dεc(Total_Trianglεs) ; Dec(Total_Layers) ; end;

procedure OutTextLn(aline:String) ; { "writeln" for graphics } begin

OutTεxt(alinε) ; MovεTo(1 ,GεtY+TεxtHeight(' » )+2) ; εnd;

procedure GrTextXY(aline:String;x,y : Byte) ; { writes text at XY char on graphic screεn } begin OutTextXY( (x-1)*(Tεxt idth( '

')+ ) , (y-1)*(TεxtHeight(' ')+2) ,aline) ; end;

procedure ConvertStoR(s,r : PointerType) ;

{ Converts a Single type (4 byte) number to a Real (6 byte) } begin r A [0]:=(((s Λ [3] shl 8) + s A [2]) shr 7) and $FF; r [l] :=0; r Λ [2]:=0; r A [4] =s A [l] ; r Λ [5]:=(s Λ [3] and $80) or (s Λ [2] and $7F) ; if r A [0]<>0 then Inc(r A [0] ,2) ; { e offset } end;

SUBSTITUTE SHEET

-82 . 965- procεdurε ToUpper(var aline : String) ; { Converts a string to upper case ) var i : Integer; begin for i:=l to Length(alinε) do aline[i] := UpCase(aline[i]) ; εnd;

procεdurε Cεntεr(str : String;linεnum : Byte) ; { Centεrs tεxt on screen line ) begin

GotoXY(1,linenum) ; ClrEol; if Length(str)>79 then GotoXY(1,linenum) elsε GotoXY(40-(Lεngth(str) div 2),linεnum); writε(str) ; end;

procedure WaitKey;

{ Waits for a key press while prompting } var ch : Char; bεgin

Cεntεr( '<Prεss any key to continue>' ,25) ; ch:=ReadKey; end;

procedure PrintHeader;

{ Prints general 3D header at top of screen } begin

TextColor(Whitε) ; if Not MonoDisplay then TextBackground(Bluε) else TextBackground(Black) ; ClrScr;

Center('3D Systems Graphics Display Program (Version '+VERSI0N+') ' ,1) ;

SUBSTITUTE SHEET

-82 . 966-

Center('Copyright (C) 1988 3D Systεms Inc 1 ,2); SelεctTxtColor(LightGreen) ; end;

procedure PrintsliceHεadεr; { Print Slice Screεns hεadεr } bεgin

PrintHεader;

SelectTxtColor(LightRed) ; Center('Slice File Control Functions',3) ; TextColor(White) ; end;

procedure PrintTriHeader;

{ Print Triangle Screεns hεadεr } begin PrintHeader;

SelectTxtColor(LightRεd) ;

Center('Triangle File Control Functions' ,3) ; TextColor(White) ; end;

function GetFilename(var FileName : String; sel : Integer) : Boolean;

{ Displays file with SLI or STL extεntions and allows user to select a file to use. ) var

DirRec : SSeeaarrcchhRRec;

CurrFileName : SSttrriinngg;;

Extn : SSttrriinngg;; row,col : Intege ; count : Integer; begin

DisplayMode := 'W'; .

FileSorted := false;

FileError:=FALSE;

SUBSTITUTE SHEET

-82 . 967- if sel = 1 then begin Extn := '.STL'; PrintTriHeader; GotoXY(3,6) ; write( 'Triangle') ; εnd else begin Extn := ' .SLI' ; Prints1iceHeader; GotoXY(3,6) ; writε( 'SIicε') ; εnd;

{ Display thε εntriεs } writε(' Files in current directory:'); row := 0; col := 0; count := 0;

FindFirst( '*'+Extn,AnyFile,DirRec) ; whilε (DosError = 0) and (count < 75) do bεgin GotoXY(3+col*15,8+row) ; write(Cop (DirRec.name,1,Pos( ' . * ,DirRec.namε)-1) ) col := col + 1; if col = 5 thεn bεgin col := 0; row := row + 1; end;

FindNext(DirRεc) ; end;

{ Read the filename } repeat GotoXY(1,24) ; ClrEol; write( ' Enter File Name: ) ; Readln(CurrFilename) ; ToUpper(CurrFilename) ; DosError:=0; if CurrFilename o ' • then begin { Find in directory )

SUBSTITUTE SHEET

-82 . 968- if Pos(' . ' ,CurrFilεnamε) = 0 then CurrFilenamε

:= CurrFilεname + Extn; if Pos(•*' ,CurrFilename)=0 then begin FindFirst(CurrFilename,AnyFile,DirRec) ; if DosError o 0 then CenterC****

"'+CurrFilenamε+'" Filε Not Found ****',25); end else begin DosError:=1;

CentεrC*** No Wild cards allowεd ***',25); end; if DosErroroO then CurrFilename:=' ' ; end; until (DosError = 0) ; if CurrFilename = ' ' then GetFilenamε:'=FALSE else begin

FileName := CurrFilename; GetFilenamε:=TRUE; end; end;

procedure ASCError(FilεNamε : String) ; { Prints ASC filε εrror } bεgin

Str(StartLinεPos,TempStr) ;

Center('Error found in Text file '"+FileName+*" at byte offset '+TempStr,23) ;

Cente ( » Line: •+Copy(ErrLine,1,73) ,24) ; WaitKey; end;

procedure ASCErrorLn(FileName : String) ; { Prints ASC file error } begin

Str(CurrLinePos, empStr) ;

Center('Error found in Text filε "•+FileName+ « " at line » +TempStr,23) ; Center( » Line: '+Copy(ErrLine,1,73) ,24) ;

SUBSTITUTE SHEET

-82 . 969-

WaitKεy; εnd;

procεdure CheckBuffer(var InFile : File) ;

{ Makes surε thε input buffer has enogh data in it. If not, it reads more in. } var

NumRead : Word; begin if InBufPtr > InBufEnd-160 thεn bεgin { Rεload Buffεr ) if InBufPtr > InBufEnd then InBufEnd := 0 {

Buffer Empty ) elsε begin

{ Buffer almost empty } InBufEnd := InBufEnd - InBufPtr + 1;

Movε(InBuffεr[InBufPtr] ,InBuffεr[0] ,InBufEnd) ; εnd;

{ Fill rεst of buffεr } if Not Eof(InFile) thenBlockRεad(InFilε,InBuffer [InBufEnd] ,BUF_SIZE-InBufEnd,NumRead) else NumRead:=0; { Set buffer pointers ) if InBufEnd+NumRead=0 then EndOfFile:=TRUE else Inc(InBufEnd,NumRead - 1) ; InBufPtr := 0; end; end;

procedure ResetFile(var InFilε : Filε) ; { Rεsεts input filε to top of file } begin

Reset(InFile,1) ; Seek(InFile,0) ; CurrFilePos:=0; CurrLinePos:=0; InBufPtr := BUF_SIZE+1;

SUBSTITUTE SHEET

-82.970-

InBufEnd := BUF_SIZE; EndOfFilε:=FALSE; FilεError:=FALSE; εnd;

procedure PositionFile(var InFile : File;charnum : Longint) ;

{ Positions input buffer to specific character of file. If not in buffer reads from file } begin if (charnum>=CurrFilεPos-InBufPtr) AND (charnum<=CurrFilePos-InBufPtr+InBufEnd) thεn InBufPtr:=InBufPtr+charnum-CurrFilePos else begin Sεe (InFile,charnum) ;

InBufPtr := BUF_SIZE+1; InBufEnd := BUF_SIZE; EndOfFile:=FALSE; εnd; CurrFilεPos:=charnu ; CheckBuffer(InFilε) ; end;

procedure ReadLine(var InFile : File);

{ Reads a line from input file into a string } var

EOFPos,CRPos,i : Integer; begin

InputLine:=' ' ; if Not (FileError or EndOfFile) then repεat CheekBuffer(InFile) ; { Search for CR } if Not EndOfFile then begin if InBufEnd=0 then i:=0 else i := InBufEnd-InBufPtr+1; if i > 255 then i := 255;

SUBSTITUTE SHEET

-82 . 971-

InputLine[0] := Char (i) ; Movε(InBuff r[InBufPtr] ,InputLinε[1] ,i) ; CRPos := Pos(CR,InputLinε)-1; if CRPos < 0 then CRPos := i; InputLine[0] := Char (CRPos) ;

EOFPos := Pos(EOF_CHAR,InputLine)-1; if EOFPos>0 then InputLine[0] := Char (EOFPos) ; StartLinεPos:=CurrFilεPos; PositionFilε(InFilε,CurrFilePos+CRPos+l) ; if InBuffεr[InBufPtr] = LF thεn

PositionFilε(InFilε,CurrFilεPos+l) ; Inc(CurrLinεPos) ; ToUppεr(InputLinε) ; ErrLine:=InputLine; εnd εlse InputLine := ' • ; until EndOfFile OR (InputLine <> '*); EndOfFile := EndOfFile and (InputLine= ') ; εnd;

function ParsεLin (var alinε : String) : String; { Parsεs first word from string and truncs off from original string ) var parsed : String; i,j : Integer; begin i:=l; while (i<=Lεngth(alinε) ) AND (aline[i]= > • ) do Inc(i) ; if i>Length(alinε) thεn bεgin aline:=' ' ; parsed:=' ' ; end else begin j:=i; while (j<=Length(aline) ) AND (aline[j]<>' ') do Inc(j);

Move(aline[i] ,Parsed[1] ,j-i) ;

SUBSTITUTE SHEET

-82.972- parsed[0] :=Chr (j-i) ; if j>=Length(aline) then aline:=' * εlse begin

Mov (alin [j+1] ,aline[1] ,Length(aline)-j) ; aline[0] :=Char (Length(aline)-j) ; end; end;

ParseLine:=parsed; end;

SUBSTITUTE SHEET

-82 . 973-

Time/Date Routine

{

Pad time elεmεnt with lεft spacε if nεcεssary ) function PadSp(num: Intεger) : strlO; var temp: strtlO; bεgin tεmp := IntStr(num) ; if num<10 thεn PadSp := ' ' + tεmp εlse PadSp := temp; end;

{ Pad time elεmεnt with lεft zεro if nεcessary

} function LZero(num: Integer): strlO; var temp: str10; begin temp := IntStr(nu ) ; if num<10 then LZero := *0* + temp else LZero := temp; end;

{

Compute day-of-week using Harry's modified Zeller

Algorithm

> function Zellεr(month,day,year: Integer) : Integεr; begin if month<3 then dec(year) ;

Zellεr := (Zεl[month] + day + yεar + (yεar shr 2)) mod 7;

SUBSTITUTE SHEET

-82.974- εnd;

{

Read time directly from clock chip works only on ATs, 286s, 386s; does not work on standard PCs, XTs

} procedure GetTime; var good; Boolean; begin good := false; while not good do begin port[$70] := $0A; { wait for update to finish (then there's 244 us) } if (port[$71] and $80)=0 then begin port[$70] := $00; { get seconds } Sec := port[$71] ; por [$70] := $0A; if (por [$71] and $80)=0 then begin port[$70] := $02; { gεt minutεs } Minu := port[$71]; por [$70] := $0A if (port[$71] and $80)=0 thεn bεgin por [$70] := $04; { get hours } Hour := port[$71]; port[$70] := $0A if (port[$71] and $80)=0 then bεgin port[$70] := $04; { gεt day } Day := port[$71] ; port[$70] :» $0A if (port[$71] and $80)=0 then begin port[$70] := $08; { get month } Mon := port[$71] ; port[$70] := $0A if (port[$71] and $80)=0 then begin port[$70] := $09; { get year } Year := port[$71];

SUBSTITUTE SHEET

-82.975- port[$70] := $0A if (port[$71] and $80)=0 thεn good := truε; end; end; end; end; end; end; end;

Sec := (Sec shr 4) * 10 + (Sec and $0F) ; { convert from BCD }

Minu = (Minu shr 4) * 10 + (Minu and $0F) Hour = (Hour shr 4) * 10 + (Hour and $0F) Day = (Day shr 4) * 10 + (Day and $0F) Mon = (Mon shr 4) * 10 + (Mon and $0F) Year = (Year shr 4) * 10 + (Year and $0F) WeekDay = Zeller(Mon,Day,Year) ; end;

{

Get a time stamp consisting of the relative day and the current time

} procedurε GεtTimεStamp; var tdow,tda ,tmon,tyear,tsec,tminu,thour: str10; AmPm: Char; begin

GetTime; tmon := PadSp(Mon) ; tday := LZero(Day) ; tyear := LZero(Year) ; tdow := copy(DayOfWeek,Zeller(Mon,Day,Year)*3+l,3) ; CurrentDate := tdow+' '+tmon+'/'+day+'/'+tyεar; tsεc := LZεro(Sεc) ; tminu := LZero(Minu) ;

SUBSTITUTE SHEET

-82.976- if Hour=0 then begin thour := « 12';

AmPm := 'A' ; end else if Hour<12 then begin thour := PadSp(Hour) ;

AmPm := 'A'; end else if Hour=12 then begin thour := '12' ;

AmPm := 'P' ; end else begin thour := PadSp(Hour-12) ;

AmPm := 'P• end;

CurrentTime := thour+' : '+tminu+' '+AmPm+'M'; end;

{

Compute difference in seconds for a calling wait routine

} procedure WaitTest; begin

GetTi e:

NewSecs := Sec + 60*Min*****3600*Hour; DeltaSees := NewSεc - sureSec; if DeltaSees < 0 then DeltaSees := DeltaSεcs + 86400; end;

SUBSTITUTE SHEET

-82 . 977-

Z-Stagε El vator Routines

procedur InitZTable; bεgin port[ZAddrεss+l] := $64; port[ZAddrεss+l] := $60; dεlay(100) ; port[ZAddrεss+l] := $40; port[ZAddrεss+l] := $60; delay(100) ; εnd;

procedure ZTable(Ch: Char) ; var b: Integεr; bεgin rεpeat b := port[ZAdress+l] ; until (b and $10)>0 port[ZAddrεss] := ord(Ch) ; port[ZAddrεss+l] := $70; rεpεat

B:=port[ZAddrεss+l] ; until (b and $10)=0; port[ZAddress+l] := $60; and;

{

Send command to Z-axis stepper controller

} procedurε ZMove(Cmd: string) ; begin if ShowStuff then begin if whereX>l thεn writεln; writeln( ' ZTable>' ,Cmd) ; end;

SUBSTITUTE SHEET

-82 .978- if not ZTablεOff thεn bεgin

Cmd := Cmd + Cr; for i:=l to lεngth(Cmd) do ZTablε(Cmd[i]) ; end; end;

procedure FormatZCommand(Distance: Real) ; begin

Distance := sgn(Distance) * int(abs(Distancε) * ZPitch * 1000 / 25.4) ; if NegZStage then Distance := -Distance; ZMove(; '+RealStr(Distance,0)+' G•) ; εnd;

procedure WaitForldleZStagε; var b: Word; bεgin rεpeat b := port[ZAddress+l] ; until keypressed or (b and 2>0) ; end;

SUBSTITUTE SHEET

-82 . 979-

Lasεr Controllεr Routines

{ •

Check for Memory-Rεsident Laser Controllεr Systεm } function LaserOk: Boolean; type

CopyType = array[1..20] of char; var CopyPtr: A CopyType; CopyStr: string[20] ; begin with regs do begin

AX := ($35 shl 8) or LASERVECTOR; Intr($21,regs) ;

CopyPtr := Ptr(ES,BX-19) ; εnd; movε(CopyPtr [1] ,CopyStr[1] ,18) ; CopyStr[0] := #18; if CopyStr = 'Tarnz Tεchnologiεs' thεn bεgin LaserOk := true; with regs do

CopyPtr := Ptr(ES,BX-46) ; move(CopyPtr A [l] ,LaserVεrsion[l] ,4) ; LaserVersion[0] := #4; εnd εlsε bεgin

LaserOk := false; LaserVersion := '?.?? •' / end; end;

function LaserPresεnt: Boolean; begin if LaserOk then LaserPrεsεnt := true else begin

SUBSTITUTE SHEET

-82.980-

LaserPresent := false;

SystemError('LASER systεm not installed.'); end; end;

{

Check for Memory-Resident STEREO Sterεolithography Dεvice Driver

} function StereoOk: Boolean; type

CopyType = array[1..20] of char; var

CopyPtr: A CopyType; CopyStr: string[20] ; begin with regs do begin

AX := ($35 shl 8) or STEREOVECTOR; Intr($21,rεgs) ; CopyPtr := Ptr(ES,57) ; end; move(CopyPtr [1] ,CopyStr[1 ,18); CopyStr[03 := #18; if CopyStr = 'Tarnz Technologies' then begin StereoOk := true; with regs do

CopyPtr := Ptr(ES,30) ; move(CopyPtr A [1] ,StereoVεrsion[13,4) ; StereoVersion[0] := #4; end else begin StereoOk := false;

StereoVersion := *?.??'; end; end;

function SterεoPresent: Boolean; begin

SUBSTITUTE SHEET

-82 . 981- if StereoOk then StereoPresent := true else begin

StereoPresent := false;

SystemError('STEREO driver not installed.'); end; end;

procedure ShowError(Error: Integεr) ; bεgin casε Error of 0: ;

1: PrintError('1. Lasεr interface card not found 1 ); 2: PrintError( *2. Laser channel not open' ) ; 3: PrintError('3. Background Command Queuε full timεout') ; 4: PrintError('4. Invalid intεrrupt time'); 5: PrintError( '5. Not in block mode ) ; 6: PrintError('6. Exec Queuε limit timeout'); 7: PrintError( '127. Bad SIH command para εtεr'); 8: PrintError( '128. Unrεcognizεd STEREO command'); 255: PrintError( '255. Intεrnal εrror (please report) ') ; εlsε PrintError(IntStr(Error)+ » . Unrεcognizεd SIH εrror') ; end; end;

{ , _ _ _ _ _

Pass Command on to Memory Resident STEREO Devicε Drivεr _ _ _ _ _ _ , _ _ _ }

function STEREO(LasεrCommand: String): Intεgεr; begin

STEREO := 0; if lεngth(LasεrCommand)>0 thεn begin if ShowStuff then begin if whereX>l then writeln;

SUBSTITUTE SHEET

-82. 982- writeln(' Laser>' ,LaserCommand) ; end; if not LaserOff thεn bεgin if LasεrCommand[13<>' ! ' thεn with rεgs do bεgin laserCommand := LaserCom and + chr(O) ; AX := $00;

BX := Ofs(LasεrCommand)+1; { pass pointεr to string }

ES := Seg(LaserCommand) ; Intr(STEREOVECTOR,regs) ;

STEREO := AX and $FF; QSizε := CX; end; end; end; if keypressed then HandlεKεyboardRεquεst; end;

SUBSTITUTE SHEET

-82.983-

3D Systεms Stεreolithography System Software

TESTPART.BAS

SLA-1 Test Part Utility Software

Compile with TBM - Modified Turbo Basic - not TB!

Recent History:

1/11/88 Ver 2.50 first releasε 1/25/88 Vεr 2.60 vεrsion updatε only

VεrsionId$ = "2.60"

SingleBar$ = STRING$(45,196)

CLS

PRINT SingleBar$

PRINT " TESTPART, Test Part Utility" PRINT " 3D Systems Laser Sterεolithography Systεm 11

PRINT " Version "+VersionId$+ 3D Systems, Inc."

PRINT SingleBar$

PRINT

PRINT PRINT " 1. BanjoTop, Determine Working Curves"

PRINT " X. Exit Program"

PRINT

PRINT Ke Loop: K$ = UCASE$(INKEY$)

IF K$ = "1" THEN StartBanjo

IF K$ - "X" THEN END

GOTO KeyLoop

SUBSTITUTE SHEET

-82 .984- ********************************************************

BANJOTOP turbobasic version 11/19/87 wav

********************************************************

StartBanj o : CLS

PRINT

LOCATE 1,36 PRINT "BANJOTOP" PRINT INPUT "INPUT BIGGEST SP VALUE OF 5 TO BE DRAWN

(160 minimum) :",sp$ t$ = ucase$(left$(sp$,l) ) if t$="Q" or t$="X" then end sp = VAL(sp$) IF sp/16 < 10 THEN

PRINT PRINT

PRINT " ERROR ERROR ERROR ERROR" PRINT " THE SMALLEST SP MUST NOT BE LESS THAN 10"

PRINT PRINT "THUS, USE SP 160 FOR FASTEST LASER

DRAWING !" LOCATE 20,30 PRINT "ANY KEY TO TRY AGAIN ...";

GOSUB strobe GOTO StartBanjo END IF PRINT "THE FOLLOWING STRING SP'S WILL BE GENERATED."

PRINT

FOR I = 1 TO 5

PRINT "SP ";sp sp = sp/2 NEXT I

PRINT

SUBSTITUTE SHEET

-82.985-

PRINT "OK ? (Y/N)" gosub strobe

IF ans$ <>"Y" AND ans$o "y" THEN StartBanjo

CLS

SP = 32*SP

STRINGSP = SP

PRINT "PLEASE WAIT..." SHELL "CLIFF 'HR/W/T"

mamprogram:

GOSUB setup

GOSUB mainmenu

GOSUB opεnfilε

GOSUB writeparametεrs

GOSUB writεbase GOSUB writestrings

LOCATE 18,27

PRINT "making base and strings...";

GOSUB movemirrors

LOCATE 22,35 PRINT " done ! !":

END

END

writebase:

M$ = "J" X = xside/2

Y = yside/2 + yinc

SUBSTITUTE SHEET

-82.986-

GOSUB writεxytofilε

M$ = "N"

X = xside/2

Y = - side/2 GOSUB writexytofilε

X = -xside/2

Y = -yside/2 GOSUB writεxytofilε X = -xside/2 Y = yside/2

GOSUB writexytofilε X = xside/2 + yinc

Y = yside/2 GOSUB writexytofilε RETURN

writεstrings:

sp = stringsp * 2

FOR x = -3*xsidε/8 TO xsidε/8 STEP 6*xsidε/(12*4) sp = sp/2

PRINTf2,"SP";sp M$="J"

Y- -yside/2 - yinc GOSUB writexytofile M$="N"

Y= yside/2 + yinc GOSUB writexytofile NEXT X RETURN

SUBSTITUTE SHEET

-82 . 987- writexytofile:

PRINTf2, M$;"X";cx+x PRINTf2, M$;"Y";cy+y RETURN

writeparameters:

PRINTf2,"MD BL +" PRINTf2,"CL" PRINTf2,"SS2" PRINTf2,"SP";sp PRINTf2,"JD0" PRINTf2, "BX32000" PRINT#2, "BY62000" RETURN

ovemirrors:

PRINT#2,"EX"

CLOSE

SHELL "CLIFF LASER.DAT/W/T"

ON ERROR GOTO chkerror

OPEN "CLIFF.ERR" FOR INPUT AS #3

CLOSE #3

PRINT "CLIFF process aborted."

END

END chkerror:

CLOSE f3 RESUME chkdonε

chkdone:

ON ERROR GOTO 0 RETURN

SUBSTITUTE SHEET

-82.988- openfile:

OPEN "LASER.DAT" FOR OUTPUT AS #2 RETURN

mammenu:

CLS

FOR 1=1 TO 79 LOCATE 1,1,0 PRINT "*"; NEXT LOCATE 2,35,0 PRINT "* SLA1 *" LOCATE 3,33,0 PRINT "PROGRAM: BANJOTOP" FOR 1=1 TO 79 LOCATE 4,1,0 PRINT "*"; NEXT FOR I = 1 TO 5

LOCATE 10 + i,30 PRINT "SP ";STRINGSP STRINGSP = STRINGSP / 2 NEXT I STRINGSP = 32 * STRINGSP LOCATE 23,25

PRINT "ANY KEY TO CONTINUE..."; GOSUB strobe

FOR 1=25 TO 55 LOCATE 23,1,0 PRINT " "; NEXT RETURN

SUBSTITUTE SHEET

-82.989- sεtup:

CX = 32000 approx center of pot cy = 32000 scale = 140 bits/mm xside = 25 1 x 1/2 inch xside = xside * scale yside = xside / 2 sp = 500 base step period yinc = yside / 4 overlap

RETURN

strobe: ans$ = INKEY$

IF LEN(ans$) = 0 then strobe return

SUBSTITUTE SHEET

-82.990-

/****************************************************** *

* 3D Systεm's Unix Slice User Interfacε Program * *===========================:===:===================

*

* Vεrsion 2.40 Second Beta Release * *******************************************************/

finclude <stdio.h> finclude<string.h> finclude <math.h>

finclude <sys/types.h> #include<sys/timεs.h> struct tms timestampl,timestamp2; unsignεd long timε_vall,timε_val2; unsigned long system ime;

#include "ui.h"

#dεfinε UI_FILE__EXT ".UII" #define Z_SPACE_EXT ".UIZ" fdefine SLICE_INPUT_EXT ".stl" fdefine SLICE_OUTPUT_EXT ".sli" fdefine LAST FILE "LAST.UIN"

fdefine PARA_NO 11 fdefine FUNC_NO 24 fdefine FLUSH_IN fflush(stdin) fdefine CLRSCR system("tput clear")

fdefine SLICE_PGM "slice" fdefine SLICE_VER "260" fdefine VERSION 2.60

SUBSTITUTE SHEET

-82 . 991- fdεfinε log_file_name "LOG.UI" FILE *log_file_ptr;

/******************************************************/

typedef struct { int z_layer; int z_VALUE; ) l_RECORD:

/******************************************************/

unsigned scaled(user_info,num) USER_INFO_STRUC *user_info; float num;

{ rεturn(unsignεd) (user_info->resolution*num+0.5) ) ; };

/******************************************************/

char exact(user_info,num)

USER INFO_STRUC *usεr_info; float num; { if (fabs(user_info->resolution * num - scale (user_info, num) ) < 1E-3) return (' ') ;

}

*******************************************************/

wait_key()

char line[2] ;

SUBSTITUTE SHEET

-82 . 992- printf("\n Prεss <Entεr> to continuε ") ; getline(line r l) ;

/******************************************************/

unsigned read_int()

char line[73 ; int i; float temp;

do { getline(line,6) ; i=0; parse_number(1ine,&i.&temp) ; if (temp < 0.0) temp = -temp; if (temp > 65535.0) printf("Number Ragne Error (0- 65535) .Retype: ") ;

*******************************************************/

float read_float(check) BOOLEAN check;

char line[13 ; int i; float temp;

do { getline(line,12) ; i=0 parse_number(line,&i,&temp) ; if (temp < 0.0) temp = -temp; temp = (unsigned long) (temp*1000_0.0005) / (float) (1000) ; if (check && (temp > 65535.0)) printf("Number Range Error (0-65535) . Retypε: ")

SUBSTITUTE SHEET

-82 .993-

) while (check && (temp > 65535.0)); rεturn(tεmp) ; }

/******************************************************/

openfile (filenamε,file_ptr,open_mode) char filename[3 ; FILE **file_ptr; char *opεn_modε;

{ if ((*filε_ptr = fopεn (filεnamε, opεn_mode) ) == NULL)

( fprintf (stderr, "\n ERROR - unable to opεn %s\n", filename) ; εxit (1) ; }

} /*opεnfile */

/******************************************************/

pet_object_name (argc,argy,objεct_nam ) int argc; char *argy[] ; char object_name[] ;

{

FILE *file_ptr;

if (argc > 1) { strcpy (object_name,argy[1]) ; if (strchr(object_name, ' . ') != NULL)

{ fprintf (stderr, "\n*** Object namε cannot contain periods. ") ;

SUBSTITUTE SHEET

-82 .994- fprintf (stderr, "Object name is not thε filε namε ***\n") ; exit (1) ;

} } else

{ if (!file_exist(LAST_FILE) )

{ fprintf (stderr, » \n*** Cannot find %s. Please use ",LAST_FILE) ; fprintf (stderr, "%s command with" object name ***\n", argy[03) ; εxit (1) ; } openfile (LAST_FILE.&file_ptr, "r") ; fscantf (file_ptr, "%s", object_name) ; fclose (file_ptr) ;

} } /* get_object_name */

/******************************************************/

file_exist (file_name) char (filε__name[3 ;

{ FILE *file_ptr;

if ((file_ptr + fopen (file_name, "r" )) i= NULL)

{ felose(file_ptr) ; return(TRUE) ; } else return (FALSE) ; } /* file exist */

/******************************************************/

SUBSTITUTE SHEET

-82 . 995-

update_last_UI (object_name) char object_name[] ;

(

FILE *file_ptr;

opεnfilε (LAST_FILE, &file_ptr, » w") ; fprintf (file_ptr, "%s\n", object_name) ; fclose(file_ptr) ; }; /* update_last_UI */

/******************************************************/ nid read_Ul_file(filεname, user_info) char filεnamε[]; USER_INFO_STRUC *user_info;

FILE *file_ptr; char option[STR_LEN3 ,temp_str[STR_LEN] ; unsigned int i;

openfile(filenamε, &filε_ptr, "r") ;

whilε (fscanf(filε_ptr,"%s",option) == 1) { if (strcmp(option,VERSIONJTXT) == 0) fscanf(filε_ptr,"%f",&user_info->version) ; if (strcmp(option,IN_FILE_TXT) == 0) fscanf(file_jptr,"%s",user_info->input_filename) ; if (strcmp(option,EXTRA_PARAMS_TXT) == 0) { fgets(user_info- >extra_parameters,STR_LEN,filεjptr) ; user_info->extra_parameters[strlen(user_info- >εxtra_ parameters)-! = '\0';

} if (strcmp(option,OUT_FILE_TXT) == 0) fscanf(file_ptr,"%s",user_info->segfilε_namε) ;

SUBSTITUTE SHEET

-82 . 996- if (strcmp(option,SCALE_TXT) == 0) fscanf(filε_ptr,"%f",&user_info->resolution) ; if (strcmp(option,RES_TXT) = 0) fscanf(filεjptr,"%f",&usεr_info-.rεsolution) ; if (strcmp(option,Z_SPACE_TXT) == 0) fscanf(fiie_ptr,"%f",&user_info->z_spacing) ; if (strcmp(option,X_FLAT_TXT) == 0) fscanf(file_ptr,"%f",&user_info->x_flat_fill_ spacing) ; if (strcmp(option,Y_FLAT_FILL_TXT) == 0) fscanf(file_ptr,"%f",&user_info->y_flat_fill_ spacing) ; if (strcmp(option,X_HATCH_TXT) == 0) fscanf(file_ptr,"%f",&user_info->x_hatch_spacing) ; if (strcmp(option,Y_HATCH_TXT) = 0) fscanf(filεjptr,"%f",&user_info->y-hatch_spacing) ; if (strcmpt(optin,ANGLE_HATC&_TXT) == 0) fscanf(file_ptr,"%f",&user_info->angle_hatch_ spacing) ; if (strcmp(option,MSAJTXT) == 0) fscanf(filε_ptr,"%u",&usεr_info- >min_surface_angle) ; if (strcmp(option, IAJTXT) == 0) fscanf(file_ptr,"%u",&user_info->min_intεrsεct_ angle) ; if (strcmp(option,FILETYPEJTXT) == 0) fscanf(file_ptr,"%u",&user_info->file_tγpe) ; if (strcmp(option,CENTERING_TXT) = 0) fscan (file_ptr,"%u",&user_info->centering) ; if (strcmp(option,VAR_Z_SPACE_TXT) == 0) { i = 0; fscanf(file_ptr,"%s",temp_str) ; while (temp_str[03 1= '* « ) { fscanf(file_ptr,"%f %f %s",&user_info- >z_level[i],

&user_info->z_level_ spacing[i3 /

SUBSTITUTE SHEET

-82.997- tεmp_str) ; i++; } } } fclose(file_ptr) ; if (user_info->version < 2.339) { user_info->z_spacing /= user_info->resolution user_info->x_flat_fill_spacing /= user_info- >resolution user_info->y_flat_fill_spacing /= user_info- >resolution user_info->x_hatch_spacing /= user_info->resolution usεr_info->y_hatch_spacing /= usεr_info->rεsolution; usεr_info->anglε_hatch_spacing /= usεr_info- >rεsolution;

/******************************************************/

pεt_usεr_info_from_filε (usεr_info,objεct_nam ) USER_INFO_STRUC *user_info; char object_name[] ;

char filename[STR_LEN] ;

strcpy(filεnamε,objεct_namε) ; strcat(filename,UI_FILE_EXT) ; init_user_info(usεr_info,objεct_namε) ; if (file_exist(filename) )rεad_UI_file(filename,user_ info) ;

/* get_usεr__info_from_file */

/******************************************************/

void save_UI_data_file(user_info,object_name) USER INFO STRUC *user info;

SUBSTITUTE SHEET

-82 .998- char objεct_name[3 ;

(

FILE *file_ptr; char filεname[STR_LEN] ; unsigned int i;

strcpy(filename,object_name) ; strcat(filename,UI_FILE_EXT) ; opεnfilε (filename, &file_ptr, "w") ;

fprintf(file_ptr,"%s ; fprintf(file_ptr,"%s %s\n",IN_FILE_TXT,usεr_info- >input_ filename) ; fprintf(file_ptr,"%s %s\n",EXTRA_PARAMS_TXT,user_info- > extra_parameters) ; fprintf(file__ptr,"%s %s\n",OUT_FILE_TXT,user_info-> segfile_name) ; fprintf(file_ptr,"%s %f\n",RES_TXT,usεr_info-> resolution) ; fprintf(file_ptr,"%s %f\n",Z_SPACE_TXT,user_info->z_ spacing) ; fprintf(file_ptr,"%s %f\n",X_FLAT_FILL_TXT,user_info- >x_ flat_fill_spacing) ; f rintf(filejptr,"%s %f\n",Y-FLAT_FILL_TXT,user_info-

>y„_ flat_fill_spacing) ; fprintf(file_ptr,"%s %f\n",X_HATCH_TXT,usεr_info- >x = hatch _spacing) ; f rintf(file_ptr,"%s %f\n", _HATCH_TXT ,usεr_info- >y_hatch -spacing) ; fprintf(file_ptr,"%s %f\n",ANGLE__HATCH_TXT,user_info-> angle_hatch_spacing;

SUBSTITUTE SHEET

-82 .999- fprintf(file_ptr,"%s %u\n",MSA_TXT,user_info- >min_surfacε _anglε) ; fprintf(file_ptr,"%s %u\n",MIA_TXT,user_info->min_ intersεct_angle) ; fprintf(file_ptr,"%s %u\n",FILETYPE_TXT,user_info- >filε_ type) ; fprintf(file_ptr,"%s %u\n",CENTERING_TXT,user_info-> cεntεring) ; fprintf(file_ptr,"%s\n",VAR_Z_SPACE_TXT) ; i = 0; whilε (usεr_info->z_lεvεl[i3 >= 0) { fprintf(file_ptr," > %f %f\n",user_info->z_level[i] , user_info->z_level_spacing[ i++;

} fprintf(file_ptr," *\n » ) ; fclose(file_ptr) ; printf("User Interfacε Options for %s Savεd\n",objεct_ namε) ; wait_kεy() ; } /* savε_UI_data_filε */

/******************************************************/

show_main_mεnu(usεr_info,objεct_name) USER_INFO_STRUC *user_info; char object_name[] ;

} char filenamε [STR_LEN3 ; unsigned int i; CLRSCR; printf (" - SLICE USER INTERFACE -

\n » ); printf (" Version %-1.2f\n\n\n",

SUBSTITUTE SHEET

-82 . 1000-

VERSION) : printf (" Current Object: %s\n",object_namε) ; printf ("Databasε File Name: %s",user_info->input_ filename) ; switch (user_info->file_type) { case 0: print (", ASCII format"); break; case 1: printf (", Binary format"); break;

} printf("\n") ; printf(" Extra Parametεrsr %s\n",usεr_info->εxtra_ parameters) ; printf("\n") ; printf (" Alter - Alter standard options\n") ; printf (" Extra - Set extra parameters\n") ; printf ("\n") ; printf (" Load - Load a different object's options\n") ; printf (" Save - Save current object's options\n") ; printf (" Write - Save current option's under different object name\n") ; printf ("Copy - Copy another object's options into current object\n") ; printf ("\n"): printf (" DoSlice - Do slicing with current options\n") ; printf (" Quit - Exit UI (Use SAVE to save options first)\n") i printf ("\n") ; }; /* show_main_menu */

/******************************************************

process__UI_main (user_info,str_comm.object_name)

SUBSTITUTESHEET

-82 . 1001-

USER_INFO_STRUC *usεr_info; char str_comm[] ; char objεct_namε[] ;

unsignεd int option_val,temp; char option_str[3] ,option_chr; float temp_float;

do { show_main_mεnu(usεr_info,objεct_namε) ; printf ("Which Command? ") ; gεtlinε(option_str,2) ; option_chr = touppεr(option_str[0] ) ; procεss_command (option_chr,usεr_info, str_comm, objεct_namε) ;

) while (option_chr != 'Q'); ) /* process_UI_main */

/******************************************************/

process_command

(option_chr,user_info,str_comm,objεct_name) char option_chr; USER_INFO_STRUC *usεr_info; char str_comm[] ; char objεct_namε[] ;

{ char tεmp_name[STR_LEN] ;

switch (option_chr)

{ case 'A' : process_UI_option(usεr_info,str_comm,objεct _namε) ; break; casε 'E': set_extra_paramεters(user_info) ; break:

SUBSTITUTESHEET

-82.1002- casε 'L' : load_UI_data_filε(usεr_info,object_name) ; break; case 'S' : save_UI_data)filε(usεr)info,objεct_namε) ; break; case 'W' : printf("New object name to save under?

") ; getlinε(tεmp_namε,STR_LEN) ; savε_UI_data_file(user_info,tεmp_namε) ; break; case *C: copy_UI_data_file(usεr_info) ; break; casε 'D' : slicε_UI_data_filε(usεr_info,str_comm, object_name) ; brεak;

}

/* procεss_command */

/******************************************************/

parse_number(line,ptrjpassed,num) char line[] ; int *ptr_passed; float *num;

{ int sign,ptr; float basε,fraction_basε; BOOLEAN good_num;

ptr = *ptr_passed;

whilε (line[ptr] == ' ') ptr++; if (line[ptr] == '-') sign = -1; else sign = 1; if (strchr("+-",line[ptr] 1= NULL) ptr++;

SUBSTITUTE SHEET,

-82.1003- base = 0; fraction_basε + 0; good_num = FALSE; while ((LINE[ptr] == '.' !1 ((line[ptr] >= '0') && (linε

[ptr] <= '9')))

( if (linε[ptr] != '.') { good_num = TRUE; if (fraction_basε == 0.0) { base == base * 10 + (line[ptr++] - '0'); ) εlsε { basε = basε + ((float) (linε[ptr++] - '0') * fraction_basε) ; fraction_basε = fraction_basε / 10.0;

} ) εls { fraction_basε + 0.1; ptr++; ) }

*ptr_passed = ptr; *num = sign * base; if (((line[ptr] 1= ' ') && (line [ptr] 1= ',') && (line

[ptr] != '\0•) ) i 1 !good_nu

{

*num = 0; rεturn(FALSE) ; } εlsε {

*ptr_passed++; return(TRUE) ;

} )

*ptr_passed = ptr;

SUBSTITUTESHEET

-82.1004-

*num = sign * basε; if (((linε[ptr] 1= » » ) && (linε[ptr] != ',') && (linε[ptr] 1= '\0')) !1 !good_nu

{ *num = 0: rεturn(FALSE) ; } else {

*ptr_passed++; return(TRUE) ; } }

/******************************************************/ getline(s,lim) char s[] ; unsigned int lim;

{ int c,i;

FLUSH_IN; i = 0; c = getchar() ; while ((i<lim) && (c != EOF) && (c!='\n') && (ci=LF) )

{ s[i] = c; i++; c = getchar() ;

} s[i] = « \0'; FLUSH_IN; return(i) ; }

/******************************************************/

find = z_level(usεr_info,lεvεl,indεx) USER INFO STRUC *usεr info;

-82 . 1005- float level; unsignεd *index;

{ unsignεd i;

i=0; whilε (usεr_info-> z_level[i] < level) && (user_info-> z_level[i] >=0) && (i < MAX_Z_TABLE) ) i++; *indεx = i; )

/******************************************************/

insεrt_z_table(user)_info,levεl,spacing,mεssage) USER_INFO_STRUC *user_info; float level,spacing; char messagε[];

{ unsigned i,j;

if ( (user_info-> z_level[MAX_Z_TABLE-l] >=0.0) && (user_info-> z_levεl[MAX_Z_TABLE-l] 1= level)) { strcpy(messagε,"**** Tablε Fullε. Cannot Add New Levεl ****") ; ) εlsε { find_z_level(user_info,level,&i) ; if ( (user_info-> z_lεvεl[i] != lεvεl) && (user_info- > z_levεl[i] >= 0))

{ for (j=MAX_Z_TABLE-l; (j > i) ; j—)

{ usεr_info-> z_level[j] = user_info-> z_level[j- ] user_info-> z_level_spacing[j] = usεr_info-> z_ level_spacing[j-1] ;

-82 . 1006-

} > user_info-> z_lεvεl[i3 = lεvεl; usεr_info-> z_lεvεl_spacing[i3 = spacing; } }

/******************************************************* /delete_z_level(user_info,levεl,mεssagε) USER_INFO__STRUC *user_info; float level; char message[3;

unsignεd i,j ;

find_z_lεvεl(usεr_info,lεvel,&i) ; if ((usεr_info-> z_lεvεl[i] != level) 11 (i == MAX_Z_ TABLE) )

{ strcpy(mεssagε,"**** Lεvεl does not exist ****"); } else { for (j=i; j<MAX_Z_TABLE-l) ; j++) { user_info-> z_level[j] = user_info-> z_lεvεl[j+l] ; user_info-> z_level_spacing[j3 = user_info-> z_level__ spacing[j+13 ; } user_info-> z_level[MAX_Z_TABLE-13 = -1; } }

/******************************************************/

show_z_tabl (usεr_info,linenum) USER_INFO_STRUC *usεr_info; float lεvεl; USSTiTUTS 8HEST

-82.1007- char message[] ;

unsigned i,j;

find_z_level(user_info,level,&i) ; if ( (user_info-> z_lεvel[i] != level) 11 (i == MAX_Z_ TABLE) )

( strcpy(mεssagε,"**** Lεvεl doεs not exist ****");

) else { for (j=i; j<MAX_Z_TABLE-l) ; j++) { user_info-> z_lεvεl[j3 = user_info-> z_level[j+1] ; usεr_info-> z_lεvεl_spacing[j] = usεr_info-> z_lεvεl_ spacing{j+1] ; ) usεr_info-> z_lεvεl[MAX_Z_TABLE-l] = -1;

} }

******************************************************

show_z_tablε(usεr_info,linεnum) USER_INFO_STRUC *usεr_info; uinsignεd int *linεnum;

( unsignεd int i,nεxt_linε;

CLRSCR; printf(" Z Levεl") ; printf(" ") ; printf("Spacing\n") ; printf(" _________»); printf(" ") ; printf( ; next linε = 3;

-82 . 1008- for (i=0; (user_info->z_levεl[i] >= 0) && (i < MAX_Z_ TABLE) ; i++)

{ printf(" %9.3f ",usεr_info->z_lεvεl[i] ; printf(" "); printf(" %9.3f\n",usεr_info->_lεvεl_spacing[i]) ; next_line++;

} *linεnum = next_line;

}

/******************************************************

void input_z_spacing (usεr_info_perm) USER _INFO_STRUC *usεr_info_pεrm; {

USER_INFO_STRUC usεr_info; char cmd,linε[STR_LEN] ,mεssage[STR_LEN] ; unsigned int i,leninum; float float_valuε,float_valuε_2;

CLRSCR; printf("\n\nZ-Spacing Input\n") ; printf("===========\n\n") ; do { printf("Fixed or Variable Z-Spacing (F, V or Q)? ") ; getline(line,1) ; cmd = toupper(line[0]) ; } while (strchr("FVQ",cmd) == NULL) ; switch (cmd) { case 'F' : do { printf("\nFixed Z-Spacing Value? ") ; getline(1ine ,STR_LEN-1) ; i = 0; parsε_numbεr(linε,&i,&float_valuε) ;

-82 . 1009-

) while ( (float_value <= 0) | | (float_value

>=65535.0)) ; user_info_perm-> z_spacing = float_valuε; brεak; casε 'V* : strcpy(mεssagε," ") ; mεmcpy(&usεr_info,user_info_perm,sizeof(USER_INF0_

STRUC) ) ; user_info.z_spacing = 0.0; do { do { show_z_table(&usεr_info,&linεnum) ; whilε (linεnum < 23)

{ printf("\nj) ; linenum++;

} printf("%s\n",mεssagε) ; printf("Command (A,D,S,Q,Hεlp)? ") ; gεt1inε(1inε,STR LEN-1) : cmd = touppεr(1ine[0]) ; if (cmd == '0' Jj strchr("ADSQH".cmd) == NULL) strcpy(mεssagε,"**** Entεr Valid Command ****"); ) whilε (cmd == '\0' jj strchr(ADSQH".cmd) == NULL) ; strcpy(message," ") ; switch (cmd) { case 'H' : printf("\nZ-Spacing Help Commands:\n\n") ; printf(" A-level spacing Add nεw lεvel and spacing value to table\n print (" D-lεvel

Delete level from table\n") ; printf(" S

Save table, return to options menu\n") ; printf(" Q

Quit, rεturn to options mεnu, don't save t printf(" H

SUBSTITUTE SHEET,

-82 . 1010- print this Help messagε\n") ; printf("\n Notε: All Valuεs arε in CAD Units\n") ; wait_key() ; break; case 'A' : i = 1; if (Iparse_number(line.&i,&float_value) ) strcpy(message,"**** Invalid Numeric input for

level ****'•) else { if (float_value < 0.0) strcpy(mεssagε,"**** Level must be a positive number ****") ; else { if (!parse_numbεr(linε,&i,&float_value_2) ) strcpy(mεssagε,"**** Invalid Numεric input for spacing ****") ; else { if (float_value_2 <= 0.0 strcpy(mεssagε,"**** Spacing must bε greater than zero ****") ; elsε { insεrt_z_tablε(&usεr_info, float_valuε, float_value_2,messagε) } }

} } break; case *D' : i = 1; if ('parse_number(line,&i,&float_yaluε) ) strcpy(message,"**** Invalid Numεric input for level ****") ;

SUBSTITUTE

-82.1011- else { if (float_value < 0.0) strcpy(mεssagε,"**** Lεvεl must bε a positive number ****") ; elsε { delete_z_level(&user_info, float_value,mεssage) ; } } break; case 'S' :

memcpy(usεr_info_perm,&user_info,sizeof(USER_INF0_ STRUC) ) ; printf("=== Variable Z-Spacing Information Saved ===\n"); wait_key() ; break; ) /* ADSQH */ ) while (strchr("SQ",cmd) == NULL); break; /* V */ } /* VFQ */ /* input_z_spacing */

/******************************************************

copy_UI_data_file (usεr_info) USER_INFO_STRUC *usεr info;

FILE *file_ptr; char object_name[STR_LEN] ,filenamε[STR_LEN] ,tεm l

[STR_LEN,tεmp2[STR_LEN] ; unsignεd int file_type;

printf ("Objεct namε to copy? ") ; getline(objεct_namε,STR_LEN) ; strcpy(filename,object_name) ;

HEET

-82 . 1012- strcat (filenamε,UI_FILE_EXT) ; if (!file_exist(filename) )

{ printf("**** Cannot find User Interfacε data filε for

%s *****\n",object_name) ; } εlse { strcpy*templ.user_info-> input_filename) ; file_type = user_info->file_typε; strcpy(temp2,user_info-> segfilε_name) ; get_user_info_from_file(user_info,object_name) ; strcpy(usεr_info-> input_filεnamε,tεmpl) ; user_info-> file_type = file_type; strcpy(user_info-> segfile_namε.tεmp2) ; printf("User Intεrfacε Options for %s Copiεd\n", object_name) ;

} wait kεy() ; } /* copy_UI_data_filε */

/******************************************************/

set_extra_parameters (user_info) USER_INFO_STRUC *user_info;

char temp[STR_LEN] ;

CLRSCR; printf("\n") ; printf("Extra Parameters allows you to specify non- standard slice options\n") ; printf("for inclusion in the slice command line. What parameters are valid\n") ; printf("is based on the version of Slice you will use.\n\n") ; printf("The following parameters have beεn known to εxist:\n\n";

-82.1013- printf(" -x part's height is in the x-axis\n") ; printf(" -y part's height is in the y-axis\n") ; printf(" -aries usε the non-standard Aries CAD System input file format\n") ; printf("\n\n") ; printf("Current Extra Parametεrs are:\n") ; printf("%s\n\n".user info->extra parameters): printf("Enter new Extra Parametεrs or just press Enter to keep old:\n") ; getline(temp,STR_LEN-1) ; if (strlen(temp)>0 { if (strcmp(temp," ")==0) strcpy(user_info->εxtra_ parameters,"") ; εlsε strcpy(user_info->extra_paramεters,temp) ;

} )

******************************************************

load_UI_data_file (usεr_info,objεct_namε) USER_INFO_STRUC_ *user_info; char object_name[] ; [

FILE *filejptr; char filename[STR_LEN] ;

printf ("Object name to load? ") ; getline(object_name,STR_LEN) ; strcpy(filenamε,obj ct_namε) ; strcat (filename,UI_FILE_EXT) ; if (!file_exist(filenamε) ) {

-82 . 1014- printf("=== Cannot find User Interfacε data filε for

%s\n",objεct_namε) ; printf("=== Sεtting options to Usεr Intεrfacε dafaults

\n"); init_usεr_info(usεr_info,object_name) ; } else { get_user_info_from_file(user_info,objεct_namε) ; printf("Usεr Intεrfacε Options for %s Loadεd \n". obj ct_namε) ;

} wait_kεy() ; } /* load_UI_data_filε */

/******************************************************

slice_YU_data_file (user_info.str_com,object_name) USER INFO STRUC *usεr info; char str_comm[]; char objεct_nam [] ; { char z_space_file[STR_LEN] .slice_vεrsion[53;

strcpy(z__space_filε,objεct_namε) ; strcat(z_spacε_filε,Z_SPACE_EXT) ; printf("Slicε Vεrsion to use (Default %s)? ",SLICE_VER) ; getlinε(slice_version,4) ; if (slice_version[03 == '\0') strcpy(siice_vεrsion,

SLICE_VER) ; set_command_linε (user_info,object_name ,str_comm,z_space_ file,slice_yersion) ; run_slice (user_info, str_comm,z_spacε_filε) ; } /* slice_UI_data_file */

-82 . 1015- /******************************************************/

show_option_menu(usεr_info,objεct_name) USER_INFO_STRUC *user_info; char object_name[] ; { char filεnamε [STR_LEN3 ; unsignεd ini i;

CLRSCR; printf (" - SLICE USER INTERFACE -\n" printf (" Vεrsion %-

1.2f\n\n\n",VERSION) ; printf (" Currεnt Objεct: %s\n\n",objεct_namε; printf ("Option Dεscription Valuε

Inte printf (" —— >- printf (" (1) DATABASE File Name %s ",user_info- >inpu switch (usεr_info->filε_typε) { case 0: printf ("(ASCII)"); brεak; casε 1: printf ("(Binary) ") ; break; } printf ("\n") ;

printf (" (2) Rεsolution %-8.3f\n",usεr_info-

printf (" (3) Z-Spacing ") ; if (user_info->z_spacing != 0.0) { printf ("%-8.3f Fixεd %c%u\n", user_info- >z_spacing, exact(user_info,usεr_info scalεd(usεr_info,user_

SUBSTITUTE SHEET

-82 . 1016- info->z_spacing) ) ; } elsε } printf ("Variablε\n") ; }

printf (" (4) x hatch spacing %-8.3f %c%u\n usεr_info->x_hatch_spacing,εxact(user_info,user_ info-> x_hatch_spacing) ,scalεd(usεr_info,usεr_info->x_ hatch_spacing) ) ; printf (" (5) y hatch spacing %-8.3f %c%u\n usεr_info->y_hatch_spacing,exact(user_info,usεr_ info-> y_hatch_spacing) ,scalεd(usεr_info,usεr_info->y_ hatch_spacing) ) ; printf (" (6) 60/120 dεgrεε hatch spacing %-8.3f %c%u\n usεr_info->angle_hatch_spacing,exact(user_info, user = _info->anglε_hatch_spacing) ,scaled(user_info, user_info->angle_hatch_spacing) ) ; printf (" (7) x skin fill spacing %-8.3f %c%u\n usεr_info->x_flat_fill_spacing,exact(usεr_info, user__info->x_flat_fill_spacing) ,scaled(user_info, user_info->x_flat_fill_spacing) ) ; printf (" (8) y skin fill spacing %-8.3f %c%u\n user_info->y_flat_fill_spacing,exact(usεr_info, user_info->y__flat_fill__spacing) ,scaled(user_info, user_info->y__flat_fill__spacing) ) ; printf (" (9) Minimum Surface Angle for scannεd facets

%u\n",usεr_info->min_ printf (" (10) Minimum Hatch Intεrsεct Angle %u\n",user_info->min_ printf (" (11) Sεgmεnt Output Filε Namε

SUBSTITUTE SHEE '

-82 . 1017-

%s\n",user_info->sεgf printf (" (Q) Quit, rεturn to Main Mεnu\n:); printf ("\n"); r /* show_option_menu */

%u\n",user_info->min_

/******************************************************/

process_UI_option (user_info,str_comm,object_name)

USER_INFO_STRUC *usεr_info; char str_comm[] ; char objεct_namε[] ;

[ unsignεd int option_val,tεmp; char option_str[3] ,option_chr; float tεmp_float;

do { show_option_mεnu(usεr_info,objεct_nanε) ; printf ("Aftεr which Option? ") ; getline(option_str,2) ; option_chr = toupper(option_str[0] ; option_val = 0; tεmp = 0; parse_numbεr(option_str,&tεmp,&tεmp_float) ; option_val = tεmp_float; process_option (option_val,usεr_info) ; ) whilε (option_chr != 'Q'); } /* procεss_UI_option */

/*****************************************************/

process_option (option_val,user_info) int option_val; USER_INFO_STRUC "user_info;

SUBSTITUTE SHEET

-82.1018-

int temp;

switch (option_val)

{ case 1 : input_filenamε (usεr_info) ; brεak; case 2 : printf ("Entεr rεsolution value " ") ; usεr_info->rεsolution = rεad_float(FALSE) ; if (user_info->resolution == 0) user_info-> resolution = 1.0; break; case 3 : input_z_spacing (user_info) break; case 4 : input_hx_ (user_info) ; break; case 5 : input_hy_ (user_info) ; break; case 6 : input_ahs_ (user_info) ; break; case 7 : input_hfx_ (user_info) ; break; case 8 : input_hfy_ (user_info) ; break; case 9 : input_msa_ (user_info) ; break; case 10: input_mia_ (user_info) ; break; case 11: printf ("Enter segment file name : ") ; getline(user_info->segfile__name.STR_LEN-1) ; if (strchr(user__info->segfilε__name, ' o ') ==

NULL strca (user_info->sεgfilε_namε,SLICE_ OUTPUT_EXT) ; brεak; }

} /* procεss__option */

-82 . 1019-

/******************************************************/

input_filεnamε (usεr info)

USER_INFO_STRUC *user_info;

{ char line[2] ;

printf ("Object Data File Name? ") ; gεtlinε(usεr_info->input_filεnamε,STR_LEN-1; if (strchr(usεr_info->input_filεnamε, '.') == NULL) strcat(usεr_info->input_fil ,SLICE_INPUT_EXT) ; do { printf ("File Type Binary or ASCII (B,A)? ") ; getline(linε,1) ; linε[0] = touppεr(linε[0]) ; } while ((line[0] != » A') && (line[0] 1= 'B')); if (linε[0] == 'A') user_info->file_typε = 0; εlse user_info->file_typε = 0; } /* input_filename */

******************************************************/

input hfy (user_info) USER_INFO_STRUC *usεr_info;

printf ("Entεr Y skin fill spacing valuε (hfy) : ") ; usεr_info->y_flat_fill_spacing = read_float(TRUE) ; /* input_hfy */

/******************************************************/

input hfx (user_info)

USER_INFO_STRUC *user_info;

printf ( "Enter X skin fill spacing value (hfx) : " ) ; usεr_info->x t _flat_fill_spacing = read_fl oat (TRUE) ;

-82.1020- /* input_hfx */

/******************************************************/

input hy (usεr_infσ)

USER_INFO_STRUC *usεr_info;

printf ("Enter Y hatch spacing value (hy) : ") ; user_info->y_hatch_spacing = read_float(TRUE) ; /* input_hy */

/******************************************************/

input hx (user_info) USER_INFO_STRUC *usεr_info;

printf ("Entεr X hatch spacing valuε (hx) : ") ; user_info->x_hatch_spacing = read_float(TRUE) ; /* input_hx */

/******************************************************/

input_ahs (user_info)

USER_INFO_STRUC *usεr_info;

printf ("Enter a value for 60-120 angle hatch spacing

user_info->angle_hatch_spacing = read_float(TRUE) ; /* input_ahs */

/******************************************************/

input_mia (user_info)

USER_INFO_STRUC *usεr_info; [

-82.1021- printf ("Entεr Minimum Intεrsεct Anglε valuε (mia) :

") ; usεr_info->min_intεrsεct_anglε = rεad_int() ; } /* input_mia */ /******************************************************

input_msa (usεr_info)

USER_INFO_STRUC *usεr_info

[ printf ("Entεr a Minimum Surface Angle value (msa) : "); usεr_info->min_surfacε_anglε = read_int() ; } /* input msa */

/******************************************************/

selεct centering (user_info) USER_INFO_STRUC *user_info

[ char ans printf ("Enter Y for centεring, N for not cεntεring :

"); ans = getchar() ; if (toupper(ans) == Υ » ) user_info->centering = TRUE; else user_info->cεntering = FALSE; /* select_centering */

/******************************************************

init_user_info (user_info,objεct_namε) USER_INFO_STRUC *usεr_info; char objεct_namε[] ;

[ unsignεd i;

user_info-> version = VERSION; strcpy(usεr_info->input_filename,object_name) ;

SUBSTITUTESHEET

-82 . 1022- strcat(usεr_info->input_filεnamε, SLICE_INPUT_EXT) ; usεr_info->filε_type = 2; user_info->resolution = 1.0; user_info->z__spacing — 10.0; user_info->z_flat_fill_spacing = 0.0; user_info->x_flat_fill_spacing = 0.0; user_info->y_hatch_spacing = 0.0; usεr_info->x_hatch_spacing = 0.0; usεr_info->angle_hatch_spacing = 0.0; user_info->min_surface_angle = 0; usεr_info->min_intersect_anglε = 0;

strcpy(usεr_info=>extra_paramεtεrs,"-ARIES -Y") ; strcpy (user_info->segfilε_namε,objεct_namε) ; streat (user_info->segfilε_namε, SLICE_OUTPUT_EXT) ; user_info->centering = FALSE;

for (i=0; i < MAX_Z_TABLE; i++) usεr_info-> z_level[i] = -1; } /* init_usεr_info */

/******************************************************/

sεt__command_line

(usεr_info,object_name,str_comm,z_spacε_ file,slice_version) USER_INFO_STRUC *user_info; char oobbjject_name[] ; char ssttrr_comm[ ; char zz___sεpace_file[] ,slice_vεrsion[] ;

{ char ch[STR_LEN] ; int i;

FILE *filε ptr;

-82 . 1023- strcpy (str_comm, SLICE_PGM) ; streat (str_comm, slice_version) ; streat (str_comm, " <") ; streat (str_comm, usεr_info->input_filεnamε) ; streat (str_comm, " ") ;

switch (usεr_info->file_type) { case 1: streat (str_comm, BINARY_TXT) ; streat (str_comm, " ") ; break; }

if (strcmp(slice_version,"240) ") < 0) streat(str_com , SCALE_TXT) ;

else streat (str_comm, RES_TXT) ; sprintf (ch, " %1.3f ", user_info->rεsolution) ; streat (str_comm,ch) ;

if (usεr_info->z_spacing !- 0.0)

{ streat (str_comm, Z_SPACE_TXT) ; sprintf (ch, " %u ", scalεd(usεr_info,usεr_info-> z_ spacing) ) ; streat (str_comm, ch) ; ) εlse { streat (str_comm, VAR_Z_SPACE_TXT) ; streat (str_comm, " ") ; streat (str_comm, z_space_filε) ; streat (str_comm, " ") ;

opεnfilε (z_spacε_filε, &file_ptr, "w") ; for (i=0; ((i < MAX_Z_TABLE) && user_info- >z_lεvεl[i]

>= 0) ) ; i++) fpritnf(file_ptr,"%u %u\n",

UTESHEET

-82 . 1024- scalεd(usεr_info,usεr_info->z_lεvεl[i3 , scalεd(usεr_info,usεr_info- >z_levεl_spacing[i3) ) ; fclosεf(filεjptr) ; } if (usεr_info->x_flat_fill_spacing != 0)

{ streat (str_comm, X_FLAT_FILL_TXT) ; sprint(ch, "%u ", scaled(user_info, sεr_info- >x_flat_ ill_spacing) ) ; streat (str_comm, ch) ;

} if (user_info->y_flat_fill_spacing != 0) { streat (str_comm, Y_FLAT_FILL_TXT) ; sprintf(ch, " %u ", scaled(user_info,user_ info->y_flat_fill_spacing) ) ; streat (str_comm, ch) ; )

if (user_info->x_hatch_spacing != 0)

{ streat (str_comm, X_HATCH_TXT) ; sprintf(ch, " %u ",scalεd(usεr_info,user_ info->x_hatch_spacing) ) ; streat (str_comm, ch) ;

} if (usεr_info->yJaatch_spacing 1= 0)

{ streat (str_comm, Y__HATCH_TXT) ; sprint (ch, " %u ",scaled(user_info,usεr_ info->y_hatch_spacing) ) ; streat (str_comm, ch) ;

> if (user_info->anglε_hatch_spacing 1= 0)

(

-82 . 1025- strcat (str_comm, ANGLE_HATCH_TXT) ; sprintf(ch, " %u ",scaled(user_info,user_info- >anglε_ hatch_spacing) ) ; streat (str_comm, ch) ; >

if (usεr_info->min_surfacε_anglε 1= 0)

{ streat (str_comm, MSA_TXT) ; sprintf(ch, " %u ", user_info->min_surface_anglε; streat (str_comm, ch) ;

} if (usεr_info->min_intersect_angle != 0)

{ streat (str_comm, MIAJTXT) ; sprintf(ch, " %u ", usεr_info->min_intersect_anglε) ; streat (str_comm, ch) ;

} if (user_info->centering) { streat (str_comm, CENTERING_TXT) ; streat (str_comm, " ")

} streat (str_comm, OUT_FILE_TXT) ; streat (str_comm, " ") ; streat (str_comm, user_info->segfile_namε) ;

if (strlεn(usεr_info->εxtra_paramεtεrs)>0) { streat(str_comm, " ") ; streat(str_comm, usεr_info->extra_paramεtεrs) ; }

/* set_command_line */

-82 . 1026- ****************************************************** /

run_slice (user_info,str_comm,z_spacε_filε) USER_INFO_STRUC *user_info; char str_comm[]; char z_spacε_filε[3 ;

{ int rc.i = 0,j = 0; char tεmp[STR_LEN] ;

printf ("Slicε Command Linε:\n") ; whilε (str_comm[i3 != '\0') { if ((j > 65) && (str_comm[i] == ' •)) { j = 7 printf("\n ") ;

} printf ("%c", str_cmm[i++3) ; j++

} printf("\n\n") ; f-flush(stdout) ;

* timεstamp and exεcutε slicε command

*/ timε(&systεm_time) ; time_vall = times(Stimεstampl) ; re = system (str_comm) ; time_val2 = times(×tamp2) ;

/* record slice activity in log file */ openfile (log_file_name, &log_filε_ptr, "a") ; fprintf(log_file_ptr,"%s CODE=%d REAL=%lu CPU=%lu\n", ctime(&system_time) ,re,timε_val2-time_vall,

-82 . 1027- timεstamp2.tms_cutimε + timεstamp2.tms_cstimε - timεstampl.tms_cutime - timestampl.tms_cstime) ; fclose(log_file_ptr) ;

if (file_exist(z_spacε_filε) ) { strcpy(tεmp,"rm ") ; streat(tεmp,z_spacε_filε) ; system(temp) ;

} if (re 1=0)

{ printf ("\n*\n") ; printf ("* WARNING: SLICE ERROR DETECTED RC = %d\n", rc) ; printf ("*\n") ;

) else printf (" SLICE COMPLETED\n") ;

wait_kεy() ;

/* run_slicε */

/******************************************************/

main(argc,argv) int argc; char *argv[] ;

USER_INFO_STRUC user_info; char obj ct_namε[STR_LEN] ; char str__comm[200] , ans[STR_LEN] ,ans2[STR_LEN] ;

strcpy (ans, " ") ; get_objεct_namε (argc,argv,object_name) ; gεt_usεr_info_from_file (&user_info, object_name) ;

procεss_UI_main (&user_info,str_comm,object_name) ;

-82. 1028- updatε_last_UI (objεct_namε) ; printf("\n") ; exit(0) ;

-82.1029- fdefinε LF 10

#define MAX_Z_TABLE 20 fdefinε STR_LEN 81 fdεfinε BOOLEAN short int fdεfine TRUE 1 fdefinε FALSE 0

fdefine VERSION_TXT "version" fdefinε IN_FILE_TXT "datafile" fdεfine FILETYPE_TXT "filetype" fdefine EXTRA_PARAMS_TXT "extra"

fdefine OUT_FILE_TXT "-sf" fdefinε Z_SPACE_TXT "-ZS" fdεfinε SCALE_TXT "-scale" fdεfinε RES_TXT "-res" #dεfinε X_FLAT_FILL_TXT "-hfx"

#dεfinε Y_FLAT_FILL_TXT "-hfy"

#dεfinε X_HATCH_TXT "-hx"

#dεfinε Y_HATCH_TXT "-hy"

#dεfine ANGLE_HATCH_TXT "-ha" #definε MSA_TXT "-msa" fdefine MIA_TXT "-mia" fdefine BINARY_TXT "-b" fdefinε CENTERING_TXT "-C" fdεfinε VAR Z SPACE TXT "-zsf"

typedεf struct /* NOTE: Not thε same as in SLICE */

{ float version; char input_filεnamε[STR_LEN] ; unsignεd filε_type; char segfile_namε[STR_LEN] ; float resolution; float z_spacing; float x_flat__fill_spacing; float y_flat_fill_spacing;

-82.1030- float x_hatch_spacing; float y_hatch_spacing; float anglε_hatch_spacing; unsignεd min_surfacε_anglε; unsignεd min_intεrsεct_anglε; unsignεd cεntεring; ehar εxtra_parameters[STR_LEN] ; float z__lεvεl[MAX_Z_TABLE3,z_lεvεl_spacing [MAX_Z_TABLE3 ; USER_INFO_STRUC;

-82.1031-

VIEW, Pop-Up Laser Controller Status View Program

for 3D Systems' Sterolithography Systεm

Vεrsion 2.60 by Tarnz Tεchnologiεs

VIEW is a memory-resident pop-up utility that shows the status of the Tarnz Technologies' laser controller. It can bε callεd up from within any forεground program with just with a prεss of ALT-S. Thε forεground program will bε tεmporarily suspended until VIEW is cancellεd.

VIEW installs itsεlf in thε path of thε kεyboard kεy service routines and watches for an ALT-S. When it see it, it "pops-up" with a status display of what the laser controller is doing, showing the size of both the Background Command and the Exεc Command Quεues and some other miscεllanεous information. When ALT-S is pressed again, VIEW "un-pops" and lets the previous foreground program continue.

As long as VIEW is active, it shows the real-time status. Any changes the lasεr controllεr background task makεs will bε immεdiatεly reflected in VIEW'S display.

}

{

-82.1032-

Rεcent History: 8/22/87 Ver 2.03 VIEW in devεlopmεnt, not rεlεasεd memory-rεsident laser controller status view program nothing being reportεd

8/25/87 Ver 2.04 vεrsion numbεr updatεd only

9/23/87 Ver 2.12 addεd MinSystεmVersion check

9/30/87 Ver 2.25 only updated version number

11/12/87 Ver 2.30 first Beta software releasε

1/25/88 Ver 2.60 version update only

{$C-,U-,K-}

type strl6 = string[163 ; str80 = string[803 ; str255 = string[255]; BitArray = array[0..153 of Word; J egpack = record case integεr of 1: (_AX,__BX,_CX,_DX,_BP,_SI,_DI,_DS,_ES,_Flags:

Integer) ;

2: (_A ,_AH,_BL ._BH ,_CL,_CH,_DL,_DH: Byte) ; end; ScreenTypε = array[l..25,1..80,1,.23 of char; XYTypε = rεcord

Xpos,Ypos: Bytε; εnd; DisplayTypε = (Mono,CGA) ;

var ch,key,key2: Char; temp,cmd,op: str255; count,i,remline,E ,OpNum,code: Integer; ordkεy,data,ViewSize,IOerr: Integer;

-82 . 1033-

LasεrVεrsion,ViεwVεrsion: str16; BiosRεgs,regs: JRegPack; SavεScrεεn,PopUpScrεεn: ScrεenType; done,reshow,VersionCheckFlag,LargeScreenChange: Boolean;

SaveCursorPosition: XYTypε;

CursorMode ,ImagεRow,ImagεCol: Intεger;

Xstart,Ystart: Integer;

LastVar: Byte; { must be last variable definεd }

MonoVideoScreεn: ScreenType absolute $B000:$0000; CGAVidεoScrεεn: ScrεεnType absolute $B800:$0000;

const

ThisViewVersion = '2.60'; MinSystεmVεrsion = '2.30'; _LASERVECTOR = $64; _VIEWVECTOR = $09; Display: DisplayTypε = Mono;

Esc = 27;

AltS = 27031

Fl = 27059

F2 = 27060

F3 = 27061

F4 = 27062

F5 = 27063

F6 = 27064

F7 = 27065

F8 = 27066

F9 = 27067

F10 = 27068

ShftFl = 27084

ShftF2 - 27085

ShftF3 = 27086

ShftF4 = 27087

ShftF5 = 27088

ShftFδ zs 27089

-82.1034-

ShftF7 = 27090

ShftFδ = 27091

ShftF9 = 27092

ShftFlO = 27093

CtrlFl = 27094

CtrlF2 = 27095

CtrlF3 = 27096

CtrlF4 = 27097

CtrlF5 = 27093

CtrlF6 = 27099

CtrlF7 = 27100

CtrlFδ = 27101

CtrlF9 = 27102

CtrlFlO = 27103

LeftArrow = 27075 RightArrow = 27077

UpArrow = 27072

DownArrow = 27080

Home = 27071

EndKey = 27079

Ins = 27082

Del = 27083

CtrlC = #3;

HεxDigits: strl6 = '0123456789ABCDEF' ; sp40 = ' ' ;

AllBits = $FFFF;

BitValuε: BitArray =

($0001, $0002, $0004, $0008, $0010, $0020, $0040, $0080, $0100, $0200, $0400, $0800, $1000, $2000, $4000, $8000);

Shutter = 0; { control word bit 0 - shutter open/closed }

SaveDSεg : Integer = 0;

Active : Integεr = 0;

OrgKεylntr : Integer = 0; { really a 2-word pointer }

OrgKεyIntr2: Integer = 0;

BIOS = $10;

-82.1035- labεl ExitProgram;

procedure ScreenRoutines; external 'SCREEN.EXE'; procedure FullScrεεnUpdatε(var imagε: ScrεεnTypε) ; εxtεrnal; ScreenRoutines[$2003 ; procedurε ScrεεnUpdatε(ch,Position: Intεgεr); εxtεrnal; ScrεεnRoutinεs[$203] ;

function LaserOk: Boolean; type

CopyType = array[1..203 of char; var

CopyPtr: A CopyType; CopyStr: string[20] ; begin with regs do begin _AX := ($35 shl 8) or _LASERVECTOR; Intr($21,rεgs) ; CopyPtr := Ptr(_Es,_BX-19) ; εnd; movε(CopyPtr A [1] ,CopyStr[1] ,18) ; CopyStr[0] := #18; if CopyStr = 'Tarnz Technologies' then bεgin LasεrOk := true; with rεgs do

CopyPtr := Ptr(_Es,_BX-46) ; move(CopyPtr Λ [l] ,LaserVersion[1] ,18) ; LaserVersion[0] := #4; εnd εlsε bεgin

LasεrOk := falsε; LaserVersion := '?.??'; end; εnd;

function LaserPresent: Boolean; begin if LaserOk then LaserPresent := true

-82.1036- εlsε bεgin LaserPresεnt := falsε; writεln('LASER not installed.'); end; end;

function ViewOk: Boolεan; type

CopyType = arra [1..20] of char; var CopyPtr: A CopyType; CopyStr: string[203 ; begin with regs do begin

_AX := ($35 shl 8) or _VIEWVECTOR; Intr($21,regs) ;

CopyPtr := Ptr(_Es,_BX-38) ; end; move(CopyPtr A [13 ,CopyStr[1] ,18) ; CopyStr[03 := #18; if CopyStr = 'Tarnz Techno1ogiεs• thεn begin ViεwOk := truε; with regs do

CopyPtr := Ptr(_Es,_BX-65) ; mov (CopyPtr A [13,ViεwVεrsion[1] ,4) ; ViεwVεrsion[0] := #4; εnd εlse begin ViewOk := false;

ViewVersion := '?.??'; end; end;

function upper(text: str255) : str255; var i: Integer; temp: str255; begin

-82.1037- tεmp := text; for i := 1 to lεngth(tεmp) do tempfi := upcasε(tεmp[i3) ; uppεr := temp; end;

function many(Ch: Char;num: Integεr) : str255; var temp: str255; i: Integεr; begin temp := ' ' ; for i:=l to num do temp := temp+Ch; many := temp; end;

procedurε RεadCommandLin (var line: str255) ; var CL: str80 absolute Cseg:$80; begin line := CL; end;

function Cvtlnt(num: Real) : Integer; begin if num < 0 then Cvtlnt := 0 εlse if num > 65535.0 then Cvtlnt := $FFFF else if num < 32768.0 then Cvtlnt := trunc(num) else if num > 32768.0 then Cvtlnt := trunc(num-65536.0) else num := $8000; εnd;

function sgn(num: Real) : Integer; begin if num<0 then sgn := -1 else if num>0 then sgn := 1 else sgn := 0;

-82 . 1033- εnd;

function CvtTicks(timε: Rεal) : Intεgεr; bεgin

CvtTicks := Cvtlnt(timε * 119.0 / 10.0); εnd;

procεdure RεalParsε(var RealNum: Real) ; begin val(temp,RealNum,code) ; temp := copy(temp,code+1,99) ; εnd;

procedure IntParse(var IntNum: Integεr) ; var num: Real; bεgin val(tεmp,num,code) ;

IntNum := Cvtlnt(num) ; temp := copy(temp,code+1,99) ; end;

function IntStr(num: Integεr) : strl6; var temp: strlδ; begin if num>=0 then Str(num,temp) elsε Str(num+$8000,tεmp) ; IntStr := temp; end;

function RealStr(num: Real) : strl6; var temp: str16; begin if num<0 then Str(65536.0+num:6:0, emp) elsε Str(num:6:0,temp) ;

-82 . 1039- while temp[l]=' ' do temp := copy(temp,2,6) ; RealStr := temp; end;

function rpt(ch: Char;len: Integer) : str80; var i: Integεr; tεmp: str80; bεgin temp := ' ' ; for i := 1 to len do temp := temp+ch; rpt := temp; end;

function spc(len: Intεgεr) : str80; begin spc := copy(sp40+sp40+sp40,l,len) ; end;

procedure beep; begin sound(lOOO) ; delay(250); NoSound; end;

procedurε SetTextColor(atr: Byte) ; bεgin TεxtColor(atr and $0F) ;

TεxtBackground(atr shr 4) ; εnd;

procεdurε ClearEol(atr: Byte) ; var oldX: Integer; begin

SetTεxtColor(atr) ;

-82 . 1040-

ClrEol; { write(' ') ; whilε whεrεX>l do writε(' ') ; } εnd;

procedure ClearScrεεn(atr: Byte) ; var oldY: Integεr; bεgin

SεtTεxtColor(atr) ; ClrScr;

{ gotoxy(1,1); oldY := 0; whilε oldYowhεrεY do begin oldY := wherεY; ClεarEol(atr) ; εnd; gotoxy(1,1); ) εnd;

procedure GetScrεεn(var imagε: ScrεεnTypε) ; bεgin port[$3D8] := 33; { Vidεo off } case Display of

Mono: image := MonoVideoScrεεn; CGA : imagε := CGAVidεoScrεεn; εnd; port[$3D8] := 41; { Vidεo back on } end;

procedurε SetScrεεn(var imagε: ScreenTypε) ; begin if (Display=Mono) or LargeScrεεnChangε thεn bεgin port[$3D8] := 33; casε Display of

Mono: MonoVidεoScrεen := image; CGA : CGAVideoScreεn := imagε;

-82.1041- end; port[$3D8] := 41; LargεScreenChangε := false; end else FullScreenUpdatε(imagε) ; εnd;

procεdure Clearlmage(var imagε: ScreenTypε) ; begin

FillChar(Image,4000,0) ; ImagεRow := 1; ImagεCol := 1; end;

procedure ImageNewLinε; begin

ImageCol := 1; if ImagεRow <25 thεn ImagεRow := ImagεRow + 1; εnd;

procεdure GotoImage(col,row: Intεgεr) ; begin

ImageRow := row; ImagεCol := col; εnd;

procεdurε ImageWriteCh(var image: ScreenType;ch: Char; atr: Byte) ; bεgin image[ImageRow,ImagεCol,13 := ch; image[ImageRow,ImageCol,2] := chr(atr) ; ImageCol := ImageCol + 1; end;

procedure ImageWrite(var image: ScreenType;text: str80;atr: Byte) ; var i: Integer;

-82.1042- bεgin for i := 1 to lεngth(tεxt) do I agεWritεCh

(image,text[i] ,atr) ; end;

procedure ImageWriteln(var image: ScreenType;tεxt: str80;atr: Byte) ; begin

ImageWrite(image,text,atr) ; ImageNewLin ; εnd;

procedure ImageLineWrite(var imagε: ScrεεnTypε;tεxt: strS0;atr: Byte;max: Integεr) ; bεgin

ImageWrite(image,text,atr) ; while ImageCol<=max do

ImagεWritε(imagε, ' ' ,atr) ; ImageNewLine; εnd;

procεdurε DrawBox(var imagε: ScreenType;xl,yl,x2,y2: Integer;BoxType: Integεr;atr: Bytε) ; type

BoxMode = array[1..43 of Char;

{

Box Types: 1: Single Line all around 2: Double Line all around

3: Single Line horizontal, Double Line vertical 4: Double Line horizontal, Single Line vertical

} const

{ Type 1 2 3 4 UpperLeftCorner : BoxMode = (#218,#201,f214,f213) ; UpperRightCo nεr: BoxModε = (f191,f187.,f183,f184) ; LowerLeftCorner : BoxMode = (f192,#200,#211,f212) ;

-82 . 1043-

LowεrRightCornεr: BoxMode = (#217,f188,f169,f190) HorzBar : BoxMode = (f196,f205,f196,f205)

VertBar : BoxModε = (f179,f186,f186,f179) var i: Intεger;

FullHorzBar: str80; bεgin

GotoImage(xl,yl) ;

FullHorzBar := many(HorzBar[BoxType] ,x2-xl-l) ; ImageWritεCh(imagε,UppεrLεftCornεr[BoxTypε],atr) ; ImageWrite(image,FullHorzBar,atr) ; ImageWriteCh(imagε,UppεrRightCornεr[BoxTypε] ,atr) ; for i:=yl+l to y2-l do bεgin GotoImagε(xl,i) ; ImagεWritεCh(imagε,VεrtBar[BoxTypε],atr) ; GotoImagε(x2,i) ;

ImagεWritεCh(imagε,VertBar[BoxType] ,atr) ; εnd;

GotoImage(xl,y2) ; ImagεWritεCh(imagε,LowεrLεftCornεr[BoxTypε],atr) ; ImagεWritε(imagε,FullHorzBar,atr) ; ImagεWritεCh(imagε,LowεrRightCornεr[BoxTypε] ,atr) ; εnd;

procεdurε BlankLine(var image: ScreεnTypε;maxcol: Intεgεr;atr: Byte) ; bεgin whilε ImagεCol<=maxcol do ImagεWriteCh(image, ' ',atr);

ImageNεwLine; εnd;

procedure CursorOff; bεgin with BiosRegs do bεgin _AH := $03; Intr(BIOS,BiosRεgs) ;

-82. 1044- if (_CX and $6000)<>$2000 then begin CursorMode := _CX; _AH := $01; _CH := $20; Intr(BIOS,BiosRegs) ; end; end; end;

procεdurε CursorOn; bεgin with BiosRεgs do bεgin _AH := $01; _CX := CursorModε; Intr(BIOS,BiosRεgs) ; end; end;

procedure RemXY(var XYvar: XYTypε) ; bεgin

XYvar.Xpos := whereX; XYvar.Ypos := wherεY; εnd;

procεdurε SεtXY(XYvar: XYTypε) ; bεgin gotoxy(XYvar.Xpos,XYvar.Ypos) ; end;

procedure BuildPopUpScreen; var i; Integer; begin PopUpScreen := SavεScrεεn;

DrawBox(PopUpScrεεn,Xstart,Ystart,Xstart+38,

Ystart÷13,2,$07) ; for i:=Ystart+l to Ystart+12 do begin

-82 . 1045-

GotoImagε(Xstart+l,i) ;

BlankLin (PopUpScrεen,Xstart+37,$20) ; εnd;

GotoImage(Xstart+10,Ystart) ; ImageWrite(PopUpScrεεn, • 3D SYSTEMS VIEW ',$17);

Gotolmage(Xstart+3,Ystart+2) ;

ImagεWritε(PopUpScrεεn, ' MODES',$27);

Gotolmage(Xstart+3,Ystart+3) ;

ImageWritε(PopUpScreen, ' Exεc Quεuε Sizε: 0 BL+',$27);

Gotolmagε(Xstart+3,Ystart+4) ;

ImageWrite(PopUpScrεεn, 'Command Queue Size: 0

PA-',$27);

Gotolmage(Xstart+3,Ystart+5) ; ImageWrite(PopUpScreen, ' AS-' ,$27);

Gotolmage(Xstart+3,Ystart+6) ;

ImagεWrite(PopUpScreεn, 'Background Statε: IDLE' ,$27) ;

Gotolmag (Xstart+3,Ystart+7) ; ImageWrite(PopUpScrεen, ' Timer Interval: 1190 us',$27) ;

Gotolmag (Xstart+3,Ystart+9) ;

ImageWrite (PopUpScreen, 'Trace: 4 2 2 3 2 6 2 2 2 1 2

2 2' ,$27) ; Gotolmage(Xstart+3, start+10) ;

ImageWrite(PopUpScreεn, 'Error: 5

. .',$27);

Gotolmage(Xstart+1,Ystart+12) ;

ImageWrite(PopUpScreen, ' - Press ESC to exit - ',$47); end;

procedure _readkey(var ch: Char) ; bεgin rεad(kbd,ch) ; ch := upper(ch) ; εnd;

-82 . 1046- procεdurε RεadKεy; var gotkεy: Boolean; begin gotkey := false; while not gotkey do begin _readkey(kεy) ; ordkey := ord(key) ; if (kεy=#27) and kεyprεssεd thεn bεgin _readkey(kεy2) ; ordkεy := ord(key2)+27000; end; gotkey := true; reshow := false; case ordkey of

LeftArrow : if Xstart > 1 thεn begin Xstart := Xstart - 1; reshow := true; end; RightArrow: if Xstart < 42 then begin

Xstart := Xstart + 1; reshow := true; end; UpArrow : if Ystart > 1 then begin Ystart := Ystart - 1; reshow t - true; end; DownArrow : if Ystart < 12 then begin Ystart := Ystart + 1; reshow := true; end; end; if reshow thεn bεgin BuildPopUpScrεen; Se Screen(PopUpScrεεn) ; gotkεy := falsε; end;

-82 . 1047- if ( ordkεy=AltS ) or (ordkεy=Esc) then done : = true; end; end;

function ViewExternalldentifiεr: str255; bεgin

ViewExternalldεntifier :=

•VIEW Utility Vεrsion 2.80 Copyright (C) 1988 by Tarnz Tεchnologiεs • ; εnd;

Procεss VIEW Kεyboard Intεrrupt

Intεrrupt 9 Handler -

procedurε KεyboardHandlεr; bεgin

INLINE (

$5D/ ( POP BP undo 2nd BP push }

$FB/ [ STI

$50/ [ PUSH AX

$E5/$60/ [ IN AX,60h

$3C/$1F/ [ CMP AL,31 'S' scan codε? }

$75/$25/ [ JNE KEY1

$B4/$02/ [ MOV AH,2

$CD/$16/ \ [ INT 16H

$A8/$08/ { L TEST AL,3 Alt kεy?

$74/$lD/ \ JZ KEY1

$E4/$61/ { IN AL,61h ;y- ΪS, rεsεt kεyboard}

$8A/$E0/ { MOV AH,AL ;

$0C/$80/ { OR AL,80h ;

$E6/$61/ < OUT 61h,AL ;

-82 . 1048-

$8A/$C4/ MOV AL,AH }

$E6/$61/ OUT 61h,AL }

$FA/ CLI εnablε intεrrupt s}

$B0/$20/ MOV AL, 20h }

$E6/$20/ OUT 20h,AL }

$FB/ STI enable interrupts}

$58/ POP AX

$2E/$80/$3E/Active/$00/ { CMP CS: [Activε] ,0 ;bring up VIEW }

$74/$09/ { JE KINTR ;if not alrεady activε}

$5D/ { POP BP undo TURBO

$CF/ { IRET {KEY1:

$58/ { POP AX handlε ordinary kεy}

$5D/ { POP BP

$2E/$FF/$2E/OrgKεyIntr/ { JMP CS: [OrgKεylntr] {KINTR:

$50/ { PUSH AX save registers

$53/ { PUSH BX

$51/ { PUSH CX

$52/ { PUSH DX

$56/ ( PUSH SI

$57/ { PUSH DI

$1E/ { PUSH DS

$06/ { PUSH ES

$2E/$8E/$lE/SaveDSeg) { MOV DS,CS: [SavεDSεg] ;sεt Data Sεg }

LargeScreenChange := true; GetScreen(SaveScreen) ; RemXY(SaveCursorPosition) ; BuildPopUpScreen; SetSeree (PopUpScreεn) ; Active := 1; CursorOff;

-82.1049- donε := falsε; repeat

ReadKey; write(key) ; until done;

LargeScrεεnChangε := truε; SεtScreen(SaveScreεn) ; CursorOn;

SεtXY(SavεCursorPosition) ; Activε := 0;

INLINE(

$07/ [ POP ES rεstorε registers}

$1F/ \ [ POP DS

$5F/ \ L POP DI

$5E/ \ t POP SI

$5A/ \ [ POP DX

$59/ { L POP CX •

$5B/ \ POP BX

$58/ { POP AX

$8B/$E5/ { L MOV SP,BP •undo TURBO }

$5D/ < POP BP

$CF) ; { IRET εnd;

Memory Residεnt Routines

After the following routines install the memory- resident routines above, they are thrown away and not used again.

}

procedurε InstallVector; bεgin

-82 . 1050- with regs do bεgin

AH := $35; { savε old kεyboard vεctor

}

_AL := _VIEWVECTOR; MsDos(rεgs) ;

OrgKεylntr := _BX; OrgKeyIntr2 := _ES;

_AH := $25; { install VIEW keyboard vector }

_AL := _VIEWVECTOR; _DS := CSeg;

_DX := Ofs(KεyboardHandlεr) ; MsDos(regs) ; end; end;

procedure ResidentTεrmination; bεgin with rεgs do begin _AH := $31; _AL := 1; _DX := Viewsizε; MsDos(regs) ; end; end;

procedure InitMemoryResidency; begin

SaveDSeg := Dseg; InstallVector; end;

{ - - - - - }

procedurε CheckForOptions(var str: str255) ; var i: Integεr;

-82.1051- begin while (length(str)>1) and (str[l]= « ') do delete (str,1,1); i := pos( '/NC ,str) ; { no version check } if i>0 then begin

VersionCheckFlag := false; deletε(str,i,3) ; end; εnd;

{ • - M A I N P R O G R A M }

bεgin writεln; writεln(f213,many(f205,54) ,#184) ; writεln(f179, • VIEW, Pop-Up Lasεr Controller Status Viεw Utility ',#179); writεln(f179, ' 3D Systεms Lasεr Stεrεolithography Systεm ',#179); writεln(f179 , ' Version '+ThisViewVεrsion+' by Tarnz Technologies November 1987 writεln(f212,many(f205,54) ,#190) ; writεln; ReadCommandLine(cmd) ; if not LaserPresent then goto ExitProgram; if ViewOk then begin writeln('VIEW Utility Vεrsion » ,ViεwVersion, ' already installed. ') ; goto ExitProgram; end;

CheckForOptions(cmd) ; if VersionCheckFlag then if LaserVersion < MinSystemVεrsion then bεgin writεln( 'Wrong LASER vεrsion numbεr. 1 ); goto ExitProgram; εnd;

-82 . 1052-

ViεwSizε := (ofs(InstallVector) + ofs(LastVar) ) div 16 + $200; Xstart := 40; Ystart := 2;

writeln('VIEW memory-rεsidεnt utility installεd using

I r

RεalStr(ViεwSizε*16.0) , ' bytεs. « ) ;

InitMεmoryRεsidεncy; RεsidentTermination;

ExitProgram: εnd.

-82 . 1053-

3D Systems Stεrεolithography Systεm Softwarε

ZSTAGE.BAS

SLA-1 Z-Stagε Control Program

Rεcεnt History:

11/12/87 Vεr 2.30 first Bεta softwarε rεlease 11/15/87 Ver 2.31 fixed motor controller timing eliminated need for NUM LOCK l/22/8δ Ver 2.50 added motion status can move specified distances (inches) supports ZSTAGE.PRM filε

1/25/88 Vεr 2.60 version update only 2/24/8δ Ver 2.61 Home Directory search for

ZSTAGE.PRM fix displays source of ZSTAGE.PRM File

SCREEN 0,1 CLS

KEY OFF

MOTION = 0

VersionId$ ="2.61"

ParamFileNamε$ = "ZSTAGE.PRM" HomεDir$ = "C:\3DSYS\"

TIMEOUT = 0

TRUE = -1

FALSE = 0

ON ERROR GOTO TryHomε OpεnedParamFileNamε$ = ""

OPEN ParamFileName$ FOR INPUT AS #1

OpenεdParamFi1εNamε$ =ParamFi1εNamε$

GOTO RεadParams TryHome: RESUME TryHome2

-32.1054-

TryHomε2:

ON ERROR GOTO CantRεadParams

OPEN HomεDir$ = ParamFilεName$ FOR INPUT AS #1 OpenεdParamFileNamε$ = HomεDir$ = ParamFilεNamε$ GOTO RεadParmas

CantRεadParams:

Address = 800 assume thesε valuεs

Accεl$ = ".5"

Veloc$ = "1" BigDist$ = "2000000"

Microsteps = 100000

TimεoutValuε = 2000 RESUME PrepareMenu

CheckForOptions: 1% ' = INSTR(CmdLine$,"/S")

IF I%>0 THEN chεck for /S Show Stuff flag

ShowStuff = TRUE

CmdLinε$ = LEFT$(CMDLinε$,I%-l)+MID$(CMDLinε$,I%+2) END IF 1% = INSTR(CmdLinε$."/NEGZ") check for /NEGZ Neg-Z

Stagε flag IF I%>0 THEN

NεoZStagε = TRUE

CmdLinε$ = LEFTS(CmdLinε$.I%-l)+MID$(CmdLinε$,I%+5) END IF RETURN

RεadParams:

ON ERROR GOTO 0 LINE INPUT fl,A$ IF LEN(A$)=0 OR LEFT$(A$,1)="!" THEN RεadParams 1% = INSTR(2,A$,CHR$(34)) IF 1% > 0 THEN A$=LEET$(A$,I%) CmdLinε$ - FN NoQuotεs$(A$)

-82 . 1055-

GOSUB CheckForOptions FOR I%=1 TO 6 ReadNextLine:

LINE INPUT fl,A$

IF LEN(A$)=0 OR LEFT$(A$,1)="!" THEN ReadNεxtLine

V=VAL(A$)

V$ = LEFT$(A$.INSTR(A$," ")-l)

IF I%=1 THEN Address = V_ ELSE IF I%=2 THEN Accel$ = V$_ ELSE IF I%=3 THEN Vεloc$ = V$_

ELSE IF I%=4 THEN BigDist$ = V$_

ELSE IF I%=5 THEN MicroStεps = V_

ELSE IF I%=6 THEN TimεoutValuε = V

NEXT 1% CLOSE #1

PrepareMεnu:

CmdLine$ = COMMAND$ GOSUB CheckForOptions

ShowMenu: ON ERROR GOTO 0

CLS

Index$ = STRING$(22," ")

PRINT Indent$;"ZSTAGE, Z-Stage Elevator Controller"

PRINT Indent$;"3D Systεms Stεreolithography System" PRINT Indent$;"Version "+VersionId$+" 3D Systεms,Inc."

LOCATE 6.33

IF TIMEOUT THEN PRINT "NO ELEVATOR"_

ELSE PRINT "ELEVATOR STOP" Indεnt$ - STRING$(19," ")

PRINT

PRINT

PRINT Indent$;" UP ARROWS for moving elevator up"

PRINT PRINT Indent$;"DOWN ARROWS for moving εlεvator down"

-82 . 1056-

PRINT

PRINT Indεnt$;" SPACE BAR to stop εlεvator motion"

PRINT

PRINT Indεnt$;" D move a specifiεd distance"

PRINT

PRINT Indent$;" Q or X to εxit program"

PRINT

Row = CSRLIN LOCATE 21,1

IF OpεnεdParamFileName$ = "" THEN

L$ = "Not using any Paramεtεr Filε:"

ELSE

L$ = "Using "+OpεnεdParamFilεNamε$+" Paramεtεr Filε:"

END IF

GOSUB CεntεrLine

PRINT

L$ = "Address ="+STR$(Address)+" Accεl = "+Accel$+" Veloc = "+Veloc$

IF NegZStagε THEN L$ = L$ + " /NEGZ"

GOSUB CenterLine

PRINT

!$ = "Big Dist + "+BigDist$+" Microsteps ="+STR$(MicroStεps)+_

" Timεout Valuε ="+STR$(TimeoutValue)

GOSUB CentεrLinε

LOCATE Row,l

GOSUB Control KεyLoop:

A$=UCASE$(INKEYS) :IF A$="" THEN KeyLoop

IF A$="8 • OR MID$(A$,2,1)="H" THEN EvelUp IF A$="2 ' OR MID$(A$,2,1)="P" THEN EvelDown IF A$="D ' THEN MoveDistance IF A$="Q « OR A$="X" THEN Quit IF A$=" THEN GOSUB Control

GOTO KεyLoop

-82.1057-

EvεlUp:

IF NεgZStage THEN Dir$="+" ELSE Dir$ = "-" LOCATE 6,33 PRINT "ELEVATOR UP " GOTO MoveEvel EvεlDown:

IF NεgZStagε THEN Dir$="-" ELSE Dir$ = "+"

LOCATE 6,33

PRINT "ELEVATOR DOWN"

MoveEvel:

CMD$=" E MN A"+Accel$+" V"+Vεloc$+" D"+Dir$+BigDist$+" G"

GOSUB SendZStageCmd

GOSUB RεquestStatus GOTO ShowMenu

SendZStagεCmd:

IF ShowStuff THEN LOCATE 25,1 PRINT SPC(79) ; LOCATE 25,1

PRINT "ZSTAGE OUTPUT" ";CMD$; END IF

IF RIGHT$(CMD$,l)OCHR$(13) THEN CMD$=CMD$+CHR$(13) FOR 1=1 TO LEN(CMD$) X$=MID$(CMD$,I.l) TIMEOUT = 0 GOSUB SεndChar IF TIMEOUT THEN RETURN NEXT I X$=CHR$(13) TIMEOUT = 0 GOSUB SεndChar IF TIMEOUT THEN RETURN

GεtResponse:

-82 .1058-

C$="" GεtRεsponsεl:

B=INP(Addrεss+1) IF (B AND &H8)=0 THEN RETURN D=INP(Addrεss)

OUT Addrεss+l,&HEO TC = 0 GetResponse2: TC = TC + 1 IF TC > TimεoutValuε THEN TIMEOUT = -1 RETURN ELSE

B=INP(Address+1) IF B AND &H8 THEN GetResponse2 END IF

OUT Addrεss+1,&H60 C$=C$+CHR$(D)

IF Do &HD THEN GεtRεsponsεl RETURN

SεndChar: TC = 0 CharLoopl: TC = TC + 1 IF TC > TimεoutValuε THEN TIMEOUT = -1 RETURN ELSE

B=INP(Addrεss+1) IF (B AND &H10)=0 THEN CharLoopl END IF

OUT Address,ASC(X$) OUT Address+1,&H70 TC = 0 CharLoop2:

TC = TC + 1

-82. 1059-

IF TC > TimeoutValue THEN

TIMEOUT = -1

RETURN ELSE B=INP(Address+l)

IF B AND &H10 THEN CharLoop2 END IF

OUT Addrεss+1,&H60 RETURN

Control:

OUT Address+1,&H64

FOR Y + 1 TO 20 : NEXT delays

OUT Address+1,&H60

FOR Y = 1 TO 1000 : NEXT OUT Address+1,&H40

FOR Y = 1 TO 10 : NEXT

OUT Addrεss+1,&H60

FOR 1=1 TO 500 : NEXT

RETURN

RεquεstStatus:

CMD$="R"

GOSUB SεndZStageCMD IF TIMEOUT OR ((INSTR(C$,"*S")<>0)+(INSTR(C$,"*§")<>0) ) THEN RETURN ZZ$=INKEY$

IF ZZ$="" THEN RequestStatus CMD$="S" GOSUB SendZStageCmd RETURN

MoveDistance: LOCATE Row,l

INPUT "Move how far (in inches)? ",F$ IF F$="" THEN ShowMenu

-82 . 1060-

F = INT(VAL(F$) * MicroSteps) convεrt to stεp units IF F < 0 THEN

IF NegZStage THEN Dir$ = "+" ELSE Dir$= "-"

F = -F ELSE

IF NεgZStagε THEN Dir$ = "-" ELSE Dir$ = "+" END IF

Dist$ = STR$(F)

IF LEFT$(Dist$,l) = " " THEN Dist$ = MID$(Dist$,2) CMD$=" E MN A"+Accεl$+" V"+Vεloc$+" D"+Dir$+Dist$+" G

II

GOSUB SεndZStagεCmd GOSUB RεquεstStatus GOTO ShowMεnu

Quit:

GOSUB Control

CLS

END

CεntεrLine: LOCATE , (79-LEN(L$))/2 PRINT L$; RETURN

Removε εxcess quote marks around string

DEF FN NoQuotes$(Tεxt$) LOCAL S,E S = 1

IF LEFT$(Tεxt$,l)=CHR$(34) THEN S=S+1 E = LEN(Text$)+l IF RIGHT$(Text$,l)=CHR$(34) THEN E=E-1 FN NoQuotes$ = MID$(Tεxt$,S,E-S) END DEF

-82. 1061-

CALOUT.BAS ver 2.60 2/12/88 to convert sεnsor rεadings to calibration tablε specifies directory for STEREO.GEO, accepts .CAL input

readings are evεry 889 bits = 0.2500" nεarεst above 65536 = 74 x 889 = 65786 = 65535 + 251 therεforε our tablε goes from 0 to 74 tlo%=0 thi%=74

DIM x3f(tlo%:thi%,tlo%:thi%) ,y3#(tlo%:thi%,tlo%:thi%) « X & Y calibration tables

DIM xl#(tlo%:thi%+l) ,yl#(tlo%:thi%+l) ,x2#(tlo%:thi%+l) , y2#(tlo%:thi%+l) 'sensors # 1,2

CLS ? reread:

INPUT "Exact name of calibration file to be adjustεd ";nm$

InputFile$= nm$ '#1 - rename when saving i%= INSTR(l,nm$,".") IF i%>0 THEN nm$=LEFT$(nm$,i%-l)

OutputFile$=nm$+".GEO" '#2

DriftFile$= nm$+".DRF" '#2

'nεarest to centεr is 37 x 889 = 32893 =

32767 + 126 (.0354") 'and our rεadings (-5" to + 5") arε from array locations 17 to 57 • (NOTE X Axis is reversed: this was corrected by reading X from 5 to -5)

clo%=17 chi%=57 incf=889

-82.1062-

CLS

KEY OFF LOCATE 5,1,1

?"Program to convert data from Beam Profilεr Calibration Run"

INPUT "Customεr Namε and/or SLA-1 Sεrial f ",nm$ ?

INPUT "DX Sεrial f ",dx$ ?

INPUT "Date of Calibration ",dt$

CLS

LOCATE 5,1,0

?"Filling Uncorrectεd Tablε" ' FOR i% = tlo% TO thi% x3f=inc#*i% IF x3f<5 THEN x3f=5 IF X3f>65530 THEN x3f=65530 FOR j% = tlo% TO thi% x3f(i%,j%)=x3f NEXT j% NEXT i%

FOR j% = tlθ% TO thi% y3f=inc#*j% IF y3#<5 THEN y3f=5

IF y3f>65530 THEN y3f=65530 FOR i% = tlo% TO thi% y3 (i%,j%)=y3# NEXT i% NEXT j%

Reading:

CLS

LOCATE 5,1,0

-82.1063- ?"Reading Measured Values"

' may later have tεxt in .CAL filε which should be saved

SUB ReadLine(x3f,y3f) 'later usε tεmperature to check for drift

LOCAL a$, i% ReadLine: LINE INPUT fl,a$

IF LEFT$(a$,l)="i" THEN ReadLinε x3f=VAL(a$) y3f=VAL(MID$(a$,10,10) ) 'could parsε to thε commas? END SUB

OPEN INPUTFILE$ FOR INPUT AS fl

'Should savε the 32767,32767 readings at beginning & end 'to check for relativε movεmεnt, or uncompεnsatεd drift.

FOR i% = clo% TO chi%

CALL ReadLine(xlf(i%)) ,ylf(i%)) CALL ReadLine(x2f(i%)) ,y2f(i)) FOR j% = clo% TO chi%

CALL ReadLine(x3 (i%,j%) ,y3f(i%,j%) ) IF X3f(i%,j%)<10000 OR X3f(i%,j%)>55000 OR y3#(i%,j%)<10000 OR y3f(i%,j%)>55000 THEN ?""WARNING: check files for possible wrong entriεs"

END IF NEXT j% NEXT 1% i%=chi%+l 'just in case BASIC changes

CALL ReadLine(xlf(i%) ,ylf(i%) ) 'extra reading bracketing calibration points

-82.1064- CALL ReadLinε(x2#(i%) ,y2#(i%) ) may add 32767,32767 at bεginning &εnd

CLOSE #1

CLS

LOCATE 5,1,0

?"Finding Mirror Drift"

FOR I%=clo% TO chi%+l xltot#=xltotf+xl (i%)/(chi%+l-clo%+l) 'could usε arrays, but much εasiεr to makε εrrors! x2totf=x2totf+x2f(i%)/(chi%+l-clo%+l) yltot =yltotf+yI (i%)/(chi%+l-clo%+l) y2totf=y2totf+y2f(i%)/(chi%+l-clo%+l) NEXT 1%

FOR I%=clo% TO chi%+l xdf=xltotf-xlf(i ) if xdmax#<xd# thεn xdmax#=xd# if xdminf>xdf then xdminf=xdf xldevf=xldεvf+xd#*xdf/(chi%+l-clo%+l) xdf=x2totf-x2 (i%) if xdmaxf<xdf then xdmaxf=xdf if xdminf>xdf then xdminf=xdf x2dεvf=x2dεvf+xd *xdf/(chi%+l-clo%+l) ydf=yltotf-ylf(i%) if ydmaxf<ydf thεn ydmaxf=ydf if ydminf>ydf thεn ydmin#=yd# yldevf=yldevf+ydf*ydf/(chi%+l-clo%+l) ydf=y totf-y2#(i%) if ydmaxf<ydf then ydmaxf=ydf if ydmin#>ydf then ydminf=ydf y2dev#=y2devf+ydf*ydf/(chi%+l-clo%+l) NEXT 1%

OPEN DriftFile$ FOR OUTPUT AS #2

-82 . 1065-

PRINT #2," xltotf x2totf yltotf y2totf (bits) " PRINT #2, USING "#####f. f";xltθtf,x2tθtf,yltθtf) , y2totf) PRINT f2," xldεvf x2dεv# yldεv# y2dεv# (bits RMS)"

PRINT #2, USING "ffff f. f";SQR(xldev ) ,SQR(x2devf) ,

SQR(yldεv ) ,SQR(y2dεvf) PRINT f2,""

PRINT #2," xl#(i%) x2f(i%) yl#(i%) y2#(i%) (bits) "

FOR i%=clo% TO chi%+l

PRINT #2, USING "######.##";xl#(i%)-Xltθt#; x2#(i%)-x2tot#;_yl (i%)-yltot ;y2#(i%)-y2tot# NEXT i% CLOSE #2

FOR I%=clo% TO chi%+l 'rε-work the drift information

xof#=((xl#(i%)+x2f(i%))-(xltot +x2totf))/2 'bits yoff=((ylf(i%)+y2f(i%))-(yltotf+y2totf))/2 'bits xgn#=(xl#(i%)-x2#(i%) )/(xltot#-x2tot#)

'approximately = 1 ygn#=(yl#(i%)-y2#(i%) )/(yltot#-y2tot#) 'approximately = 1 're-usε the xl#() etc. arrays xl#(i%)=xof# x2#(i%)=xgnf ylf(i%)=yoff y2f(i%)=ygn# NEXT i%

OPEN DriftFile$ FOR APPEND AS #2 PRINT #2,""

PRINT #2," X offset X gain Y offsεt Y gain (bits, bits/10";CHR$(34) ;")" PRINT #2,""

FOR i%=clo% TO chi%+l

-82.1066-

PRINT #2, USING "#######.#'*;xl#(i%) ; (X2#(i%)-1)*35560_ yl#(i%) ; (y2f(i%)-l)*35560 NEXT i% CLOSE #2

'needs to show temp, drift & ask whethεr to corrεct or usε un-corrεcted * * * if ydmaxf<ydf then ydmaxf=ydf if ydmin#>ydf then ydminf=ydf xdf=xdmaxf-xdminf 'both started from zero, must be + & - ydf=ydmaxf-ydmin

IF xdf<ydf THEN xd#=yd# 'selεct larger PRINT PRINT "From measuring the apparent position of the beam profile sensors" PRINT "during calibration, we find total effective mirror drift" PRINT USING "ffff";xdf/3.556; " PRINT " mils " PRINT

FOR i = 1 to 10000 NEXT i

PRINT "Program found wrong profiler pinholes, " PRINT ""

PRINT "File will be written without attempting to correct for drift" GOTO writeout END IF IF Xdf>35 THEN

PRINT "Excessive drift, you may want to run again

II PRINT " ?tempεrature drift

-82 . 1067-

PRINT " ?air conditioning direct air currents

PRINT " ?insufficient warmup" PRINT IF xdf>100 THEN

PRINT "File will be written without attempting to correct for drift" GOTO writeout END IF PRINT "DO YOU WANT TO USE THE TEMPERATURE CORRECTION

OF CALIBRATION POINTS (Y/N) ?" PRINT "you may want to run this program again aftεr studying the ";

PRINT LEFT$(outputfile$,LEN(outputfile$)-4) ;

".DRF filε" DO

K$=UCASE$(INKEY$) LOOP UNTIL K$="Y" OR K$="N" IF k$="N" THEN writeout END IF

'GOTO writeout ***** use when tεmpεraturε drift file did not work CLS

LOCATE 5,1,0

?"Adjusting Measurεd Valuεs"

•NOTE: wε will assume 32767 is at center of range, to 1st ordεr

' so wε can usε offsεt & gain (of & gn) indεpendently

I

* First calculate offset & gain for each set of readings,

-82. 106δ-

* thεn takε proportionatε part of thε onεs for beginning & end ' of the Y Axis (j%) table movemεnt; ' —assume drift evenly distributed over time intervals betwεen

1 readings, remembεr that profilε mεasurεmεnts takε timε too. ' Xnew = ( Xold - 32767 ) / Xgn + 32767 - Xof ' (how nice if numbers werε cεntεrεd on Zεro!)

FOR i% = clo% TO chi%

' nεεd thε range of corrections from beginning & end of Column xoff=xl (i%) 'start xofdf=(xl#(i%+l)-xlf(i%))/(chi%-clo%+2) 'delta yof#=ylf(i%) ' 'start yofdf=(ylf(i%+l)-ylf(i%) )/(chi%-clo%+2) 'delta xgn =x2f(i%) 'start xgndf=(x2f(i%+l)-x2f(i%) )/(chi%-clo%+2) 'delta ygn =y2f(i%) 'start ygndf=(y2 (i%+l)-y2f(i%) )/(chi%-clo%+2) 'delta

FOR j% = clo% TO chi% x3f(i%,j%)=(x3f(i%,j%)-32767)/(xgn +xgnd#*

(j%-clo%+l))_+32767 - xoff-xofdf*(j%-clo%+l) y3f(i%,j%)=(y3#(i%,j%)-32767)/(ygn#+ygnd#*

(j%-clo%+l))_+32767 - yof#-yofd#*(j%-clo%+l) NEXT j% NEXT 1%

•CLS 'LOCATE 5,1,0

'?"Adjusting Extrapolated Valuεs"

'do we really need to ? - yes for 12" pot at

-82 . 1069- same level . . . 'but should be calibrating 12" by then: SO - DON'T

I

CLS LOCATE 5,1,0

?"Writing Corrected File"

writeout:

OPEN outputFile$ FOR OUTPUT AS #2

PRINT f2,"!SLA-l ";nm$;", DX serial f ";dx$;" on ";dt$

PRINT f2,"!Position values used for calibration, &

RMS deviations (bits)" PRINT f2,"!Sensorl "; PRINT #2, USING "f f ff.ff";xltot#,yltotf,SQR(xldεvf) ,

SQR(yldεvf) PRINT f2,"!Sensor2 "; PRINT #2, USING "ff ###.##";x2tot#,y2tot#,SQR(x2dεv#) ,

SQR(y2dεv#)

WRITE #2,thi%+l,thi%+l,2,inc#

FOR i% = tlo% TO thi% FOR j% = tlo% TO thi%

A$ = STR$(INT(x3#(i%,j%)*10+0.5)/10) PRINT #2,MID$(A$,2) ; PRINT #2,",";

A$ = STR$(INT(y3f(i%,j%)*10+0.5)/10) PRINT f2,MID$(A$,2) NEXT j% NEXT i% CLOSE #2

-32.1070-

CLS 7

?"Calibration corrεction complεtε 7 ?"Wε havε created two filεs, ";driftfile$;" and

";outputfile$ 7

?driftfile$;" has thε profilεr positions mεasurεd aftεr εach column of the grid" ?

?outputfilε$;" has thε calibration data which will bεcomε STEREO.GEO" 7

?"Rεnamε it C:\3DSYS\STEREO.GEO whεn loading in calibratεd machine" END

OutNoSp:

A$ = STR$ (INT (A*10+0.5) /10) PRINT f 2 , MID$ ( A$ , 2 ) ; RETURN

-82.1071- A P P E N D I X E

©1989 3D SYSTEMS, INC. ALL RIGHTS RESERVED

-82 . 1072-

Non-3D Systεms Softwarε Status as of 4/13/88 Slicε Computεr (NEC386)

TM 386/lx Opεration Systεm UNIXi Systεm V Rεlεasε 1.0.4 80386 TCP Ethεrnet Support, MICOM Version

INTERACTIVE Systems Corporation

2401 Colorado Avεnue, 3rd Floor

Santa Monica, California 90404 Process Computer (WYSE 286) MS-DOS 3.21

Wyse Technology

3571 N. First Street

San Jose, CA 95134 Q-DOS II Version' 2.00

Gazellε Systεms

42 North University Avenue, Suite 10

Provo, Utah 84601 FTP Software PC/TCP File Transfer Program Version 1.16 FTP Software PC/TCP Telnεt Vεrsion 1.16

MICOM-IntεrIan, Inc.

155 Swanson Rd. ,

Boxborough, MA 01719 April 13, 1988 Major parts list for SLA1 Laser:

1) Liconix

1390 Borregas Avenuε Sunnyvalε, CA 94089 A) Model 4 4OH HeCd Multi ode Lasεr

B) Model 424OPS Power Supply

2) Omnichrome

13620 Fifth Street Chino, CA 91710 A) Model 356XM HeCd Laser

B) Model 100 Power Supply

-82 . 1073-

Scanning mirrors:

1) Genεral Scanning, Inc. 500 Arsonal Strεεt Watεrtown, MA 02172 A) P/N E00-Z2173 XY0507 Scanning Mirrors

B) P/N E00-DX2005 Controllεr for XY0507

Scanning Mirrors Z-axis (Vεrtical) Elεvator: 1) Daεdal P.O. Box G

Harrison City, PA 15838 (Purchasεd Via Rεp.) Pacific Tεchnical Products 15901 Foothill Blvd. Sylmar, CA 91342

A) P/N 008-0324-3 14" Linεar Table with 5 Pitch

B) P/N MC5000-20 Motor Control with Motor Drive SLA1 Process Computεr:

1) Wysε Tεchnology 3571 N. First Strεet San Jose, CA 95134 (Purchased Via Rep.) Periphεral Systems, Inc.

8107 Orion Avenue

Van Nuys, CA 91406

A) Wyse 286, Model 2200, includes 1. 40 MByte Hard Disc 2. "AT" Keyboard

3. Monitor

4. Graphic Card

5. Math Coprocessor

2) Tarnz Technologiεs 8025 Sεpulvεda Blvd

Van Nuys, CA 91411 A) I/O board

-82. 1074-

SLA1 Slice Computer:

1) NEC Information Systems, Inc. 1414 Massachusetts Avenuε Boxborough, MA 01719 (purchasεd Via Rep.)

Periphεral Systεms, Inc. 8107 Orion Avεnuε Van Nuys, CA 91406 A) NEC Powermate 386 Computer Beam Expander:

1) Optomeo Dεsign Co.

901 18th St., Suitε 203

LOS Alamos, N.M. 67544

A) Modεl f D10493 (4X) Bεan Expandεr

-82.1075- A P P E N D I X I

©1989 3D SYSTEMS, INC. ALL RIGHTS RESERVED

-82.1076- TECHNICAL PAPERS

3D SYSTEMS. INC. STEREOLITHOGRAPHY INTERFACE

DECEMBER 1. 1987

3D SYSTEMS

3D SYSTEMS

12847 Arroyo Strεεt

Sylmar, CA 91342

(81δ) 89δ-1533 FAX 818-361-5484

-82.1077- 3D SYSTEMS, INC.

STEREOLITHOGRAPHY INTERFACE

1. STEREOLITHOGRAPHY APPARATUS (SLA) OVERVIEW

2. LASER CONTROLLER OVERVIEW

3. TEST PART SPECIFICATION

-82.1078- TECHNICAL PAPERS

3D SYSTEMS, INC. SLA OVERVIEW

3D SYSTEMS

3D SYSTEMS

12847 Arroyo Strεεt

Sylmar, CA 91342

(818) 898-1533 FAX 818-361-5484

-82 . 1079-

3D SYSTEMS. INC. SLA OVERVIEW

3D Systems' StereoLithography Apparatus (SLA) is a new CAP [Computer-aided Prototyping) product allowing a design engineεr to quickly construct a thrεe dimensional model designed and stored on a CAD/CAM/CAE system. The SLA, in conjunction with the designer's workstation, allows a convenient, easily installed, and truly integrated CAD/CAM/CAE environment.

An overview of the procedurε necessary to produce a part with thε SLA is prεsented in Figurε 67.

1. Modεl Entry

To manufacturε a part with the SLA, a designεr first usεs thε system to input a model of the part.

2. Supporting Structures

Typically this part requirεs a wall thicknεss of approximatεly 0.1" and a support structure to ensure an accurate transfer of the CAD model to the plastic building material. This support structure may be added by the CAD designεr or, in the near future, by the SLA user.

3. Attribute Definition

Additionally, the model as input into the CAD system, may have surface and structural featurεs which need special attention during construction. At first, the design engineer is required to manually flag these areas or to modify the part design. As our software matures, more and more of these special cases are expεcted to be incorporatεd into the SLA controller.

-82 . 1080- potεntial structural problεm. Arεas on thε surfacε of thε modεl may also bε highlightεd. Thεse areas are now assigned attributes which are passed along to the SLA software for further processing.

Facet Rεprεsεntation of thε Modεl

Thε model must now be translated from the internal format used by the CAD system to a planar facetεd rεprεsεntation, or, in the near future, an IGES wire frame representation. Howevεr, thε facεtεd represεntation is thε only format currεntly supportεd by 3D Systεms.

This data structurε loosely follows a graphics standard called PHIGS (Programmers Hierarchical Interactivε Graphics Standard) . Figures 68a-68b illustrate the format of this relatively verbosε standard. The following paragraphs briefly outline the details of our facet reprεsεntation. Furthεr dεtails arε forthcoming.

Facεt Normal Includεd with each facet is a unit normal which is required to point away from the surface of the solid. For example, given a spherε with a wall thicknεss of 0.1", (typical for fabrication) the facets that describe the inner surface or wall would have their normals pointing inward, correspondingly, those on the outer surface, outward.

-82 . 1081-

Order of Facet Data

Additionally, the vertices of the triangles should be orderεd such that thεy givε the

*• direction of the triangle's normal according 5 to the right hand rule. Note that the normal is specifiεd first, followed by the thrεε trianglε vεrtices, followed by the facet attributes.

Precision

10 Internally, the normal's i, j, and k components and the nine vertεx coordinatεs are representεd as 32 bit single precision floating point numbers, each with an eight bit exponεnt and a 24 bit mantissa. This

15 translates into a floating point value with a

. mantissa of just under eight significant digits, thus giving an upper limit to the usable precision of the PHIGS standard.

Condensed Binary Format

20 Becausε thε numbεr of facεts is εxpεcted to exceed 100,000 for more exacting surface finish requiremεnts, a compact form of thε facet data will be implemεntεd. This condεnsed data file requirεs thε normal

25 componεnts and thε vertex coordinates to be in a binary floating point format compatible with the Intel 80287 math coprocessor (See figure 69) .

This format uses threε 32 bit values to 30 specify the normal, a total of nine 32 bit values to specify the triangle verticεs, and a 16 bit unsignεd intεger for the attributes, for a total of 50 bytes per triangular facet.

-82.1082-

Facεt Attributεs

Rεfεrring back to stεp 3 rεgarding attributεs, note that the model attributes identifiεd by thε designer are passed along to the SLA system at the facet level. For a large model, several hundred attributes are expεctεd to completely definε thε modεl to thε SLA softwarε.

Communication to the SLA Thε physical transfer of the faceted data and associated attributes from the CAD system to thε SLA is madε ovεr a high spεεd data link. In-housε thε transfer is made over an Excεllan Ethernet data link. This data could be trans- ferrεd over a 19.2 Kbaud RS232 data link or even on floppy disks, but becausε of thε largε amounts of data to bε transferred, a high speεd data link is prεfεrrεd.

5. Slicing" thε Modεl This faceted data file, which now resides on the SLA, is used as Input to a slicing program. The slices or layers of the model typically include crosshatching to strengthen the model walls, skins to surface the model, and special groups of building vectors to accommodate problem areas identified by the facet attributes.

-82 . 1083-

6. Building thε Model

The sliced model is now transferrεd to the SLA supervisor. This program is responsiblε for actually building thε modεl. By sending the slicεd data to thε mirrors which dirεct thε SLA's lasεr, and by controlling thε SLA εlevator, the supervisor is able to build up the CAD model one layer at a time. Other functions of the supervisor include characterizing the SLA laser, matching the lasεr speed to the photosensitive propertiεs of thε plastic, and coordinating the construction of the more difficult attribute flaggεd arεas.

-82.1084- TECHNICAL PAPERS

3D SYSTEMS, INC.

LASER CONTROLLER OVERVIEW

3D SYSTEMS

3D SYSTEMS

12847 Arroyo Street

Sylmar, CA 91342

(818) 89δ-1533 FAX 816-361-5484

-82 . 1085- 3D SYSTEMS . INC .

LASER CONTROLLER OVERVIEW

A CAD program must bε ablε to produce a file with the specific format describεd below. Usually this file is quite large in size (several hundred thousand bytεs) and is transfεrrεd ovεr a high-spεεd data link such as Ethernet to the 386-based Stereolithography Computer. Transfers of smaller-size files using RS-232 and floppy diskettεs arε also possible but not recommεnded.

The SLICE Input Format loosely follows a graphics standard called PHIGS (Programmers Hierarchical Interactive Graphics Standard) , and improves on it in several ways. First, all the numeric data can be compressεd into binary form, grεatly reducing the size of storage files and reducing the data transfer time to thε Stεreolithography computer. Second, support of special part-building attributes allow certain features to be "attached" to facεts and passεd all thε way down thε pikε to the Part-Making Supervisor. SLICE does not support negative or 0 values of verticies information.

Files being sub ittεd to SLICE should have the extεnsion ".STL" that is, thε namε of thε filεs should end in ".STL".

The files can be stored in eithεr ASCII or Binary. Wε rεcommεnd using the ASCII format while developing STL-file-making softwarε and thεn switching to the binary format for release.

-82 . 1086-

An examplε of an ASCII STL filε follows. It dεfinεs a simplε tetrahedron.

solid SolidJPetra.2 facεt normal -1 0 0 outεr loop vertex 0 0 0 vertex 0 0 1 vertεx 0 1 0 εndloop εndfacet facet normal 0 -1 0 outer loop vertex 0 0 0 vertex 1 0 0 vertex 0 1 0 endloop endfacet facet normal 0 0 -1 outer loop vertex 0 0 0 vertex 0 1 0 vertex 1 1 0 attribute 16 attribute 9 attribute 22 endloop endfacet

• • endsolid Solid__Tetra.2

Thε important structure for an ASCII STL file which is different from the binary structure is its use of words to identify the type of numeric data. The facet normal and vertex information can be in floating point - numbers like 43.332382912 and 1.3045E+3 are acceptablε. Nεgativε and 0 numbεrs arε not accεptεd for vεrticiεs

-82 . 1087- information. If the numbers are in scientific rotation, only E or e for exponent is supported (pleasε do not usε D for εxponent) . Facεt normal must bε a unit vεctor. There must be at least one space betwεεn two data fiεlds.

Wε assume a word is 16 bits and is εqual to two bytεs. The precise format for a binary STL file is:

(top of file)

80 bytes - genεral information contains part na εs, commεnts, εtc.

4 bytεs 2 words - numbεr of facet records each facet record defines one triangle First facet record: 6 words - Normal Vector

2 words - i coordinate 2 words - j 2 words - k 18 words- Triangle Vertices 2 words - xl )

2 words - yl ) - First vertex 2 words - zl ) 2 words - x2 )

2 words - y2 ) - Second vert x 2 words - z2 )

2 words - x3 )

2 words - y3 )

2 words - z3 )

1 word - Numbεr of Attributεs < spεcial attributε >

This word should be set to zero

The STL Binary Format is similar. In structure to the ASCII format. One facet record follows another, and each

-82 . 1088- facεt rεcord consists of a unit normal, three triangle vertices, and optionally some attributes. Since we don't as yεt support attributεs, thε attributε count word should bε sεt to zero.

The binary format for the number of facεt rεcords and for each number of attributes is just an unsigned integer. The normal and triangle vertices are in four-byte 8087 real format, with a 3 byte mantissa and a 1 byte exponent.

Seε following listing for TEST 0017.STL and FIGURE 70.

-82.1089- TEST0017.STL

solid Solid_Box.6 facet normal 0 1 2.63415e-09 outεr loop vεrtεx 3 1.4 4 vεrtεx 4 1.4 4 vertex 4 1.4 3 endloop endfacεt facεt normal 0 1 2.63415e-09 outer loop vertεx 4 1.4 3 vεrtεx 3 1.4 3 vεrtεx 3 1.4 4 endloop endfacet facet normal -6.58537e-09 0 1 outεr loop vεrtεx 4 1.4 4 vertex 3 1.4 4 vertεx 3 1 4 endloop endfacet facet normal -6.58537e-09 0 l outer loop vεrtεx 3 1 4 vεrtεx 4 1 4 vεrtεx 4 1.4 4 endloop endfacet facet normal 1 4.03548ε-08 0 outεr loop vεrtεx 4 1 4 vεrtεx 4 1 3 vεrtεx 4 1.4 3 εndloop

-82.1090- εndfacεt facεt normal 1 4.03548e-08 0 outer loop vertex 4 1.4 3 vertεx 4 1.4 4 vεrtεx 4 14 εndloop εndfacεt facεt normal -6.58537ε-09 0 -1 outεr loop vεrtεx 3 1 3 vertex 3 1.4 3 vertεx 4 1.4 3 εndloop εndfacεt facεt normal -6.58537ε-09 0 -1 outεr loop vεrtεx 4 1.4 3 vεrtεx 4 1 3 vεrtεx 3 1 3 εndloop endfacet facet normal -1 4.03548e-08 0 outεr loop vεrtex 3 1 3 vertex 3 1.4 3 vertεx 4 1.4 3 εndloop εndfacεt facεt normal -6.58537ε-09 0 -1 outer loop vertex 4 1.4 3 vertex 4 1 3 vertεx 3 1 3 endloop endfacet facet normal -1 4.03548e-08 0

-82.1091- outεr loop vertex 3 1.4 3 vertex 3 1 3 vertex 3 1 4 endloop endfacet facet normal -1 4.03548e-08 0 outer loop vertex 3 1 4 vertex 3 1.4 4 vertex 3 1.4 3 endloop endfacεt facεt normal 0 -1 2.63415ε-09 outer loop vεrtex 4 1 3 vertex 4 1 4 vertex 3 1 4 endloop endfacεt facεt normal 0 -1 2.63415ε-09 outer loop vertex 3 1 4 vertex 3 1 3 vertex 4 1 3 endloop endfact εndsolid Solid Box.6

-82.1092- TECHNICAL PAPERS

3D SYSTEMS, INC.

TEST PART SPECIFICATION

3D SYSTEMS

3D SYSTEMS

12847 Arroyo Strεεt

Sylmar, CA 91342

(818 ) 898-1533 FAX 818-361-5484

10

-82.1093-

Sεε Figurεs 71a-71h, 72a-72b for test part specification and oriεntation.

-82.1094- A P P E N D I X J

© 1989 3D SYSTEMS, INC. ALL RIGHTS RESERVED

-82. 1095-

******************************************************* REM "CF7.BAS" TURBOBASIC PROGRAM, USED TO CREATE

QUARTER CYLINDER ******************************************************** *

CLS:PRINT"X, Y, & Z on?":PRINT"prεss any kεy whεn rεady" WHILE INKEY$ = "":WEND

PRINT"ok"

COMMON CLR SHELL "CLIFF ΗR/T"

LOCATE 8,15,0:IF CLR THEN COLOR 30,1,0 IF CLR THEN COLOR 14,1

PRINT "LOADING..."

» MAIN PROGRAM

SHELL "CLIFF HR/T

GOSUB INITIALIZE:GOSUB 7000

'CLOSE:GOSUB 1000

****** MAKE BASE ******

PRINT:PRINT "drawing basε" SP$ = "2000" : PASS = 1 GOSUB supportRails GOSUB Xhatch PRINT #2, "EX":GOSUB CLIFF

********* MAKE POSTS *******

JD$ = "100": POSTNUM=8 GOSUB POSTS JD$ = "0"

-82.1096- ι ****** DRAW SUPPORT RAIL *******

PRINT:PRINT "drawing support rail"

ARC = 5 * PI/12

GOSUB 7000 PRINT #2, "SP 350"

RAD = RADIUS

PASS = 1

GOSUB SidεRails

GOSUB Posts PRINTf2,"EX":GOSUB CLIFF

GOSUB DIP

GOSUB IDLE

1000: 'NOW MAKE MULTIPASS, SHORT VECTOR, UNSUPPORTED RAIL PASS = l:SS$ = "2":SP$ = "10":ARC = 5 * PI/12

GOSUB 7000

GOSUB FilεWritε

RAD = RADIUS

GOSUB SidεRails 'SHORT VECTOR ROUTINE FOR SIDE RAILS

GOSUB XHatch 'MAKE CROSS HATCHES

RAIL$ = SP$

GOSUB Rivεts 'MAKE RIVETS

PRINT#2,"EX" FOR LAYER = 1 TO 25

PRINT:PRINT "drawing layεr f ";LAYER

GOSUB CLIFF

GOSUB DIP 'LOWER Z-STAGE

GOSUB IDLE NEXT LAYER

-82 . 1097-

PRINT:PRINT "SS = "SS$;" SP = "RAIL$;" f OF PASSES = "PASS UD = 25.4:DD = -TD:GOSUB 1100 END

-82 . 1098-

«************** POST SUBROUTINE *****************

POSTS:

GOSUB 7000:GOSUB FileWrite FOR ANG = 0 TO ARC STEP PI/12 M$ = "J" L = COS (ANG) * RADIUS: GOSUB XMovε: 'PRINT

"X=";L L = SIN (ANG) * RADIUS: GOSUB YMovε: 'PRINT "Y=";L

L = COS (ANG) * 9*RADIUS/10: GOSUB XMove: 'PRINT

"X=";L L = SIN (ANG) * 9*RADIUS/10: GOSUB YMove: 'PRINT

"Y=";L NEXT ANG PRINT#2,"EX" CLOSE FOR LAYER = 0 TO POSTNUM :PRINT "post layer ";LAYER

GOSUB CLIFF GOSUB DIP GOSUB IDLE

NEXT LAYER JD$ = "0"

RETURN

>********* INNER & OUTER WALLS SUBROUTINE ************ SupportRails:

GOSUB FileWrite

FOR CIR = 1 TO PASS

FOR RAD = RADIUS TO 9*RADIUS/10 STEP -RADIUS/10

-82.1099-

M$ = "J"

FOR ANG = 0 TO ARC STEP PI/48

L = COS (ANG) * RAD: GOSUB XMove: 'PRINT "X=";L L = SIN (ANG) * RAD: GOSUB YMovε: 'PRINT

"Y=";L M$ = "N" NEXT ANG NEXT RAD NEXT CIR RETURN

I

********** RADIAL CROSSHATCH SUBROUTINE **********

XHatch:

FOR ANG = ARC TO 0 STEP -PI/48 FOR HATCH = 1 TO PASS M$ = "J"

L = COS (ANG) * RADIUS: GOSUB XMovε: 'PRINT "X=";L L = SIN (ANG) * RADIUS: GOSUB YMove: 'PRINT

"Y=";L M$ = » N"

L = COS (ANG) * 9*RADIUS/10: GOSUB XMove: 'PRINT "X=",-L

L = COS (ANG) * 9*RADIUS/10: GOSUB YMove: 'PRINT "Y=";L NEXT HATCH NEXT ANG RETURN

-82 .1100-

>******** RADIAL RIVET SUBROUTINE **********

RIVETS:

SP$ = STR$(2000*VAL(SS$)/2) PRINT#2,"SP";SP$

FOR ANG = 0 TO ARC STEP PI/24

M$ = "J"

L = COS (ANG) * 39/40*RADIUS: GOSUB

XMove: 'PRINT "X=";L L = SIN (ANG) * 39/40*RADIUS: GOSUB

YMove: « PRINT "Y=";L

M$ = "N"

L = COS (ANG) * 37/40*RADIUS: GOSUB

XMove: •PRINT "X=";L L = SIN (ANG) * 37/40*RADIUS: GOSUB

YMove: » PRINT "Y=";L

NEXT ANG

RETURN I _____________________________________________________ ******* SHORT VECTORS SUBROUTINE ******** SideRails:

INC = PI/48

FOR ANG = 0 TO ARC - PI/48 STEP INC M$ = "J" IF PASS/2 = INT(PASS/2) THEN XPASS = PASS/2

ELSE XPASS = 1 + PASS/2 5810 FOR CYCLE = 1 TO XPASS AGL = ANG

L = COS(AGL) * RAD:GOSUB XMove L = SI (AGL) * RAD:GOSUB YMove

AGL = AGL + INC M$ = "N"

L = COS(AGL) * RAD:GOSUB XMove L = SIN(AGL) * RAD:GOSUB YMove

-82.1101-

NEXT CYCLE

IF PASS/2 <> INT(PASS/2) GOTO 5855 L = COS(ANG) * RAD:GOSUB XMove L = SIN(ANG) * RAD:GOSUB YMovε 5855 NEXT ANG

RAD = .9 * RAD

IF RAD = .9 * RADIUS THEN 5810

RETURN i ______________________________________________________ INITIALIZE: •sεt up values

IF ZADDRESS%=0 THEN ZADRESS%=800

GOSUB InitZTable

TD = 0 'total depth moved

SCALE = 90 'LSB's / mm RADIUS = 30: RADIUS=RADIUS*SCALE 'standard radius in mm

GOSUB GetCεntεr:CX = CX - 1500:CY = CY - 1650

OX= 5500:OY=1650 Offsets

PI=4*ATN(1) ARC = PI/4

WT = 40

LYR=.254

TDMAX=40 'total distance down we can movε, in mm SS$ = "2" 'SS$ = full width

JD$ = "0" 'dεlay aftεr jump, in units of SP

RETURN

I , ._________„________ _.

FilεWrite:

PRINTf2,"MD BL +" PRINTf2,"CL" M$="B":L=OX:GOSUB XMovε:L=OY:GOSUB YMove 'rest position PRINT#2,"SP » ;SP$

-82.1102-

PRINTf2,"JD";JD$ '1-65535 x SP (stεp pεriods) at εnd of jump PRINT#2,"SS";SS$

RETURN i ,__

******* x — Y axes movemεnts ********

XMove:

V=CX+L

V$=STR$(INT(V)) V$=RIGHT$ (V$ , LEN (V$ ) -1)

PRINTf 2, M$;"X";V$

RETURN i _______________________________________________________

YMove :

V=CY+L

V$=STR$(INT(V)) V$=RIGHT$ (V$ , LEN (V$) -1) PRINT 2, M$;"Y";V$

RETURN ' — — — - — — — -

CLIFF:

CLOSE 'use Harry's system

SHELL "CLIFF LASER. DAT/T/W"

'ON ERROR GOTO 4706 4706 'OPEN "CLIFF. ERR" FOR INPUT AS f3:CLOSE #3 4707 'PRINT "CLIFF procεss abortεd. " :END

•CLOSE f3:RESUME 4707 ON ERROR GOTO 0 RETURN

-82 . 1103- ι _______________________________________________

7000 OPEN "LASER.DAT" FOR OUTPUT AS f2:RETURN i ____.

GetCenter: 'routine for reading cx and xy from text file

OPEN "CENTERXY.DAT" FOR INPUT AS #2 INPUT #2, CX INPUT #2, CY CLOSE RETURN

• INITIALIZE the Z-axis controller

I

InitZTable

OUT ZAddrεss%+l,&H64

OUT ZAddrεss%+l,&H60

FOR Itemp% = 1 TO 5000 'delay

NEXT Itemp% OUT ZAddrεss%+l,&H40

OUT ZAddrεss%+l,&H60

FOR Itemp% = 1 TO 5000 'dεlay

NEXT Itemp%

RETURN 'END InitZTable

DIP: Format Z-axis controller command string and send it DD=5:UD=5-LYR:TD=TD+LYR

'check total dist (in mm) '

IF TD>TDMAX THEN PRINT"MAXIMUM DIP-DEPTH EXCEDED

PROGRAM ABORTED":END

-82.1104- 'calculatε and transmit distancε

1100 CD=DD:S$="-":GOSUB FormatZCommand CD=UD:S$="":GOSUB FormatZCommand

RETURN i . . . . ,_ .

FormatZCommand: 'AND SEND TO Z TABLE ZPitch = 100

CD = CD * ZPitch * 1000 / 25.4 CD$ = FN StrNoSp$(INT(CD)) CMD$ = "D"+S$+CD$+" G" GOSUB ZMovε RETURN 'END FormatZCommand

Send command to Z-axis stepper controller

ZMove:

ShowStuff= 0 IF ShowStuff THEN

IF P0S(X)>1 THEN PRINT PRINT " ZTABLE>";CMD$ END IF

ZTableOff = 0 IF NOT ZTableOff THEN

IF RIGHTS(CMD$,1) <> CHR$(13) THEN CMD$=CMD$+CHR$(13}

FOR 1=1 TO LEN(CMD$)

X$=MID$(CMD$,I,1) GOSUB ZTablε

NEXT I END IF RETURN 'END ZMove

-82 . 1105-

•Send one character to thε Z-tablε controllεr

I

ZTablε: DO

B=INP(ZAddress%+l) LOOP UNTIL (B AND &H10) OUT ZAddress%,ASC(X$) OUT ZAddrεss%+l,&H70 DO

B=INP(ZAddrεss%+l) LOOP UNTIL NOT(B AND &H10) OUT ZAddress%+l,SH60 RETURN 'END ZTable RETURN

I

'Makε a string from a numbεr without a lεading space

I DEF FN StrNoSp%(Num) LOCAL A$ A$=STR$(Num)

IF LEFT$(A$,1)=" " THEN A$=RIGHT$(A$,LEN(A$)-1) FN StrNθSp$ = A$ END DEF i ._—-

IDLE:

PRINT"WAIT";WT;: FOR J = 1 TO WT : FOR I = 1 TO 3555 NEXT I : PRINT"."; : NEXT J :PRINT RETURN

END IDLE

E

-82 . 1106-

'this program makεs a doublε-wallεd, crosshatchεd,

'single pass quarter cylinder which is supported for

'only half its length

'DERIVED FROM "CF4.BAS"

' 'CF7.BAS 10/13/87 KS