Geometry

Surfaces and curves are the shapes a part is fitted to. This chapter describes the 36 surface kinds James defines with sd, the two-dimensional curves of ld and lcc that some of them are built from, and the three-dimensional curves of curd that other surfaces are built from and that edges are attached to. It also says which surfaces have sides, the boundary curves that edge and patch attach a mesh to. Geometry is defined in any phase and referred to by number.

How geometry is defined and used

You define a surface, a 2D curve or a 3D curve with a number. The definition is legal in the Control, Part and Merge phases, so a script may put all its geometry first or define a shape just before the part that needs it. Defining geometry changes no mesh. It adds a row to a table, and a later command uses the row.

  • A surface is referred to by its number or its name. sf, sfi and ms project onto surfaces, and edge and patch attach edges and faces to their sides. sd reads a surface number for sds and intp.
  • A 2D curve is referred to by its number. sd reads it for the surfaces built from 2D curves.
  • A 3D curve is referred to by its number. cur, curf, cure and curs read it, and so does sd for the surfaces built from 3D curves.

A surface, a 2D curve and a 3D curve each have their own table, so surface 1, 2D curve 1 and 3D curve 1 are three different things.

A surface is always Cartesian, even when the part that uses it is a cylinder part. James converts around each projection.

Geometry is built from these commands: sd, ld, lcc and curd.

Surfaces

sd defines a surface by number. James builds 36 kinds, in six families. A kind’s name is the word that follows the number. The tables give the parameters in the order sd takes them. A point is three numbers, x y z, written plainly unless the table says point, which is a point in a coordinate system. trans ; stands for a transformation list, which may be empty and always ends in ;.

Planes

Kind Parameters, in order What it is
plan x0 y0 z0 xn yn zn The plane through the point (x0, y0, z0), normal to the vector (xn, yn, zn).
xyplan, yzplan, zxplan trans ; The plane z = 0, x = 0 or y = 0, moved by the list.
pl2 point point The plane through the first point, normal to the line from the first point to the second.
pl3 point point point The plane through three points that do not lie on a line.
pl3o point point point offset The plane of pl3, moved along its normal by offset.
iplan a b c d The plane a x + b y + c z = d.

Cylinders

Kind Parameters, in order What it is
cy x0 y0 z0 xn yn zn radius The infinite cylinder about the axis through the point along the vector, with the given radius.
xcy, ycy, zcy radius trans ; The cylinder of that radius about the x, y or z axis, moved by the list.
cy3 x1 y1 z1 x2 y2 z2 x3 y3 z3 The cylinder whose axis passes through the centre of the circle through three points of a cross section, normal to that circle’s plane, with that circle’s radius.
cyr2 x1 y1 z1 x2 y2 z2 radius The cylinder about the axis through two points, with the given radius.
cyr3 x1 y1 z1 x2 y2 z2 x3 y3 z3 radius The cylinder whose axis passes through the centre of the circle through three points of a cross section, normal to that circle’s plane, with the given radius.

Spheres, cones and the other quadrics

Kind Parameters, in order What it is
sp x0 y0 z0 radius The sphere about the point.
cone x0 y0 z0 xn yn zn radius angle The infinite cone about the axis through the point along the vector. radius is the cone’s radius at the point and angle is its half-angle in degrees.
cn2p x0 y0 z0 xn yn zn r1 t1 r2 t2 The infinite cone about the axis through the point along the vector whose radius is r1 at distance t1 along the axis from the point and r2 at distance t2.
er x0 y0 z0 xn yn zn r1 r2 The ellipsoid of revolution about the axis through the point (its centre) along the vector, with the semi-axis r1 across the axis and r2 along it.
pr x0 y0 z0 xn yn zn r1 t1 r2 t2 r3 t3 The infinite paraboloid of revolution about the axis through the point along the vector, whose radius is the quadratic in the distance t along the axis that passes through the three points (r1, t1), (r2, t2) and (r3, t3).
ts x0 y0 z0 xn yn zn r1 t r2 The torus about the axis through the point along the vector. The circle of radius r1 about the axis, in the plane at distance t along the axis from the point, is the centre line of a tube of radius r2.

Surfaces built from 2D curves

Kind Parameters, in order What it is
crx, cry, crz curve The 2D curve with that number, revolved about the x, y or z axis.
cr x0 y0 z0 xn yn zn curve The 2D curve revolved about the axis through the point along the vector.
cp curve trans ; The 2D curve placed in the x-z plane and extended without end along y, moved by the list.
rule2d y1 curve1 y2 curve2 trans ; The ruled surface between the first 2D curve in the plane y = y1 and the second in the plane y = y2.
swept base direction curve1 a1 [curve2 a2 ...] ; trans ; The surface that a cross section sweeps as it travels along the 2D base curve. direction is r or l.

Surfaces built from 3D curves

Kind Parameters, in order What it is
rule3d curve1 curve2 trans ; The ruled surface between two 3D curves.
crule3d curve1 curve2 trans ; The surface between two 3D curves ruled in cylindrical coordinates about the z axis.
pipe curve r1 s1 [r2 s2 ...] ; trans ; The tube of varying radius about a 3D curve.
blend3 curve1 curve2 curve3 trans ; The patch bounded by three 3D curves.
blend4 curve1 curve2 curve3 curve4 trans ; The patch bounded by four 3D curves.
r3dc x0 y0 z0 xn yn zn curve begin end trans ; The 3D curve revolved about the axis through the point along the vector, from the angle begin to the angle end, both in degrees.

Composites

Kind Parameters, in order What it is
sds surface_1 surface_2 ... ; The union of earlier surfaces.
intp surface_1 surface_2 fraction The surface a fraction of the way from the first surface to the second. The sd page describes it, and ssf and ssfi need it.

What the parameters mean

  • A plane’s vector is its normal. It may have any length, because James normalizes it. A vector of zero length is an error that the engine reports when it builds the surface, and so are the coefficients a b c of iplan when all three are zero. The normal of pl3 and pl3o follows the right-hand rule through the three points in the order written, and a positive offset moves the plane along it. The second point of pl2 fixes only the direction of the normal. The three points of pl3, pl3o, cy3 and cyr3 may not lie on one line, and the two points of pl2 and cyr2 may not coincide (E1010).
  • A cylinder’s vector is the direction of its axis. The vector 0 0 5 is as good as 0 0 1. A cylinder’s radius must be positive (E1005), and so must the radius of xcy, ycy, zcy, cyr2 and cyr3.
  • A sphere’s radius must be positive (E1005). So must both radii of er and ts. The torus of ts may have a tube radius larger than r1, so that the tube crosses the axis.
  • A cone’s vector is the direction of its axis. A radius of 0 puts the apex at the point. The radius may not be negative (E1007). The angle lies strictly between -90 and 90 and is not 0 (E1006). The cone is the whole algebraic cone, both nappes. cn2p is the same cone given by two of its radii. It needs r1 different from r2 and t1 different from t2 (E1011); for equal radii, write the cylinder with cy.
  • A paraboloid of pr needs three different t values (E1011). Three points that lie on a line give a cone or a cylinder, which James accepts.
  • A revolved curve uses the global origin as the curve’s origin and the named axis as the curve’s local z direction. For cr the curve’s x is the distance from the axis and its z the distance along it from the point. A curve is bounded by the circles that its two ends sweep, so a node beyond an end projects onto that rim.
  • A cp surface is the 2D curve extended along y: the curve’s x is x and its z is z, and the surface repeats the curve at every y. A node moves to the nearest point of the curve in the x-z plane and keeps its y. The list then moves the whole surface, so cp 1 rx 90 ; runs the extension along z instead.
  • A composite from sds is projected onto every member, and a node keeps the nearest result. Its members may have gaps or overlaps. Every member must be an earlier surface (E1000). The list is a plain list of numbers. The colon shorthand 1:3 is E0104.
  • The curves of the surfaces built from curves must exist when sd is read: a 2D curve (E1001) or a 3D curve (E1014). In rule2d, rule3d and crule3d a negative curve number reverses that curve. The two curves of a ruled surface are paired point to point by the fraction of their length.
  • swept takes a base curve and at least one cross section, each a 2D curve with a fraction a of the base’s length from 0 to 1 (E1013); the fractions must increase. A section lies in the plane normal to the base at its fraction, with its x along the base’s right normal in the x-z plane (r) or its left normal (l), and its z along y. For a base running along +x the right normal is +z, as James reads the page’s right side, seen from +y. Between two sections the surface is interpolated linearly, and before the first and after the last the nearest section holds.
  • pipe takes pairs of a radius and a fraction of the curve’s length from 0 to 1 (E1013); the radii must be positive (E1005) and the fractions may not decrease. The radius is linear between two pairs and the first and last hold beyond them.
  • blend3 and blend4 take their curves in any order. James sorts them into a loop. The first curve given stays first, and James tries every order and direction of the others and keeps the loop whose corner gaps add up to least, the closing gap included; a tie goes to the earlier candidate. It takes each corner at the midpoint of the two ends that meet there, so a small gap is bridged. The patch is the transfinite patch of that loop; for blend3 the fourth side is the corner where the third curve meets the first.
  • r3dc turns the curve counter-clockwise about the axis, by the right-hand rule, from begin to end. An end below begin goes on round, so the turn is end - begin + 360, and a turn of 360 degrees or more in either direction is the whole revolution. The end angle must differ from the begin angle (E1011).
  • crule3d joins each pair of points on the two curves by a line that is straight in cylindrical coordinates about the global z axis: the radius, the angle and the height change linearly along it, and the angle changes by the shorter way round.

A node projected onto a surface moves to the nearest point of the surface. The shaping chapter explains projection. The planes, cylinders, cones, sp, er, pr and ts give the nearest point in closed form or by a bounded one-dimensional search, and the revolutions and cp find it with the 2D curve’s own search. A surface built from curves (rule2d, swept, rule3d, crule3d, pipe, blend3, blend4 and r3dc) is projected by a local search: James takes the best of a grid of 17 by 17 samples and the curves’ joints as the start (for pipe and r3dc a search along the curve) and refines it, so where such a surface folds back on itself or has several sheets, a node can settle on a local nearest point. A node beyond the edge of such a surface moves to the edge. A node that has no one nearest point, such as one on the axis of a cylinder or on the centre curve of a pipe, stops the run with an error that names the node and the surface (the engine’s messages list them).

The script examples/lens.tg, which make test runs, uses a cylinder and two spheres:

c A lens: one block part, its top and bottom faces projected onto two
c spheres and its four sides onto a cylinder, so the square block becomes a
c round biconvex lens 0.6 thick at the rim and 1.67 at the centre.
c 245 nodes, 144 elements.
c
c   james lens.tg --format exodus -o lens.exo
sd 1 cyli 0 0 0 0 0 1 2
sd 2 sphe 0 0 3.164 4
sd 3 sphe 0 0 -3.164 4
block 1 7;1 7;1 5;-1.4 1.4;-1.4 1.4;-0.6 0.6;
sfi -1 -2;;;sd 1
sfi ;-1 -2;;sd 1
sfi ;;-1;sd 2
sfi ;;-2;sd 3
endpart
merge
write

The two spheres have radius 4 and their centres lie on the z axis, 3.164 above and below the origin. The spheres cut the cylinder of radius 2 at z = 0.3 and z = -0.3. The sphere centred above shapes the bottom face and the one centred below shapes the top face, so the lens is 0.6 thick at the rim and 1.67 at the centre. The four sfi commands project the sides of the block onto the cylinder and its top and bottom onto the spheres. James writes 245 nodes and 144 elements.

Spellings James accepts

Several kinds have a second spelling that reads as the same kind. James stores the short word, so a script that uses either one gives the same mesh.

Spelling Same as Where it comes from
cyli cy TrueGrid’s tutorial and examples.
sphe sp TrueGrid’s tutorial and examples.
plane plan TrueGrid’s examples.
xzplan zxplan TrueGrid’s dictionary of surface types, in its own example of zxplan.
iplane iplan TrueGrid’s list of the inline types of ms.
toru ts TrueGrid’s text on the torus.
torus ts James’s own word.

torus is James’s addition. The short word ts is an abbreviation that a new reader has to look up, so James accepts the whole word beside it and beside TrueGrid’s toru. TrueGrid does not know torus, so a script that uses it runs in James only. The script tests/corpus/300-sd-ts-toru-torus/input.tg:

c ts, Vol. 2, p. 171, and the same torus spelled toru and torus
sd 4 ts 0 0 0 1 0 1 4 6 1
sd 5 toru 0 0 0 1 0 1 4 6 1
sd 6 torus 0 0 0 1 0 1 4 6 1

The three sd commands define the same torus three times: its axis is the x axis, the centre circle has radius 4 and lies 6 along the axis from the origin, and the tube has radius 1. The IR holds three rows of kind ts.

The same words are accepted wherever a surface type is read, in sd and inline in sf, sfi and ms.

Points in a coordinate system

The kinds pl2, pl3 and pl3o, and the curve type arc3, take their points with a word that names the coordinate system, and James turns each point into Cartesian coordinates when it reads the command.

Word Arguments The point
rt x y z The Cartesian point.
cy rho theta z The point at distance rho from the z axis, at the angle theta from the x axis in the x-y plane, at height z.
sp rho theta phi The point at distance rho from the origin, at the angle theta from the x axis in the x-y plane and the angle phi above that plane.

The angles are in degrees. Written out, a cy point is (rho cos(theta), rho sin(theta), z) and an sp point is (rho cos(phi) cos(theta), rho cos(phi) sin(theta), rho sin(phi)). Any other word is E1012. That includes pt, the label of a point that TrueGrid’s display draws, which James has no way to give a meaning.

Transformation lists

The fifteen kinds with trans ; in the tables take a list of the operators of tr, applied in order, and then the ; that ends it. The ; is required even when the list is empty: sd 1 xyplan ; is the plane z = 0 and sd 1 xyplan mz 1; is the plane z = 1. A missing ; is E0104. James ignores any further ; that follow, so a script that ends a line with ;; still reads. A kind that takes no list ignores a ; after its arguments as well.

The thirteen operators of tr are accepted. tf, ftf, rxy, ryz and rzx are refused here as they are in tr (E0503). The script tests/corpus/286-sd-xyplan-trans/input.tg:

c xyplan, Vol. 2, p. 173: the plane z = 0 rotated about the x-axis
sd 1 xyplan rx -15;

The plane z = 0 is turned by -15 degrees about the x axis. The IR holds the surface and one transformation row, rx -15.

The combined transformation of a list must be a similarity: it may rotate, reflect, translate and scale by one factor (csca, or xsca, ysca and zsca with the same factor), and nothing else. A cylinder under a scale of one axis alone would be an elliptic cylinder, which James has no kind for, and a pipe’s circles would not stay circles. James checks this when it builds the surface, before any part is meshed, and stops with exit code 2. The script tests/corpus/339-sd-trans-not-similarity/input.tg:

sd 1 zcy 1 xsca 2;
block 1 3;1 3;1 2;-2 2 -2 2 0 1
sfi -1;;;sd 1
endpart

James prints this, as tests/corpus/339-sd-trans-not-similarity/expected.diag.txt holds:

input.tg:1:1: error: surface #0 has a transformation that is not a similarity; xsca scales one axis
james: 1 error, 0 warnings

The message names the first xsca, ysca or zsca in the list. When the list holds none, as in a csca 0 that collapses the surface, the message ends after similarity.

Sides

A side is a boundary curve of a surface. edge attaches the nodes of a mesh edge to a side, patch attaches the four edges of a face to the four sides of a surface, and curd makes a 3D curve of a side with the type sdedge. Only a surface with a boundary has sides.

Sides Kinds
Four rule2d, rule3d, crule3d, swept, blend4, and r3dc when its turn is under 360 degrees.
Three blend3.
Two crx, cry, crz and cr when the curve is open; pipe, unless it is a closed tube; and r3dc when its turn is 360 degrees or more, unless it is a closed tube.
None The infinite kinds: every plane, cylinder and cone, pr and cp. The closed kinds: sp, er, ts, and a revolution of a closed curve. The closed tubes: a pipe on a closed curve whose radius is the same at both ends, and an r3dc of a closed generatrix turned a full circle. The composites sds and intp.

A closed kind has no sides in James. TrueGrid describes the edges of a sphere, a cylinder or a torus as edges that meet, and James does not build them. A closed tube has none either, because its two rims would be one seam circle: a pipe on a closed curve whose radius is the same at both ends, and an r3dc of a closed generatrix turned a full circle (a pipe whose end radii differ, or a full turn of an open generatrix, keeps its two). Closed means that the curve’s two ends meet in position, so a closed curve whose ends meet at a corner counts, and the surface has a tear at the join, like the curve’s other corners. A script that wants the two circles of such a tube writes an open curve.

James numbers the sides of every kind but blend3 by one rule, and numbers the three sides of blend3 round its loop. A kind has two parameters: sides 1 and 2 lie at the start and the end of the first, and sides 3 and 4 at the start and the end of the second. The table says which curve each side is, kind by kind.

Kind Side 1 Side 2 Side 3 Side 4
rule2d, rule3d, crule3d The line between the first points of the two curves The line between their last points The first curve The second curve
swept The cross section at the start of the base The cross section at its end The path of the sections’ first points along the base The path of their last points
blend4 The fourth curve of the loop The second curve of the loop The first curve given The third curve of the loop
blend3 The first curve given The second curve of the loop The third curve of the loop None
r3dc, under 360 degrees The circle that the curve’s first point sweeps The circle that its last point sweeps The curve at the begin angle The curve at the end angle
r3dc, 360 degrees or more, open generatrix The circle that the curve’s first point sweeps The circle that its last point sweeps None None
crx, cry, crz, cr The circle that the curve’s first point sweeps The circle that its last point sweeps None None
pipe, not a closed tube The rim at the start of the curve The rim at its end None None

The loop of a blend3 or blend4 is the one the surface is built on, the one with the least summed corner gaps that the parameters describe, starting with the first curve given. A reversed curve of a ruled surface (a negative number) swaps the ends that “first” and “last” name. A side runs in the direction in which the parameter that varies along it increases, and all three sides of a blend3 run round the loop in one direction. A rim of a revolution goes counter-clockwise about the axis by the right-hand rule, starting in the direction of the coordinate axis that is least aligned with the revolution axis (the first of x, y, z on a tie), made perpendicular to it: the y axis for a revolution about x, and the x axis for one about y or z.

A side may be a point. A revolution whose curve starts or ends on the axis has a rim of no length there, and a ruled surface whose two curves meet at their starts has a line of no length for its side 1. edge, patch and sdedge refuse such a side with an error that says so.

TrueGrid’s manual numbers the edges of a spline surface the same way, and James applies that rule to every kind it builds. The manual does not say how it numbers the sides of the other kinds, and its display labels them in an order of its own, so a script that was written against the labels TrueGrid draws may name another side in James. The compatibility chapter lists the difference. The script tests/golden/065-cr-rims/input.tg, which make test runs, uses two rims:

c A 2D curve revolved about an arbitrary axis (cr): the line from (1, 0) to
c (1, 2) in the curve's own plane revolved about the axis through (5, 5, 5)
c along z, a cylinder of radius 1 between z = 5 and z = 7. A block's face
c beside it is projected onto the surface, and the face's two end edges are
c attached to the surface's two rims, side 1 at the curve's first point and
c side 2 at its last.
ld 1 lp2 1 0 1 2;
sd 1 cr 5 5 5 0 0 1 1
block 1 5;1 2;1 5;4.5 5.5 5.5 6.2 5 7
edge 1 2 1 2 2 1 1.1
edge 1 2 2 2 2 2 1.2
sfi ;-2;;sd 1
endpart
merge
neutral
write

The ld is the line from (1, 0) to (1, 2) in the curve’s own plane, and cr revolves it about the axis through (5, 5, 5) along z: a cylinder of radius 1 between z = 5 and z = 7. Its side 1 is the circle at the curve’s first point, z = 5, and its side 2 the circle at z = 7. The two edge commands put the far face’s edges at the bottom and the top of the block on those circles, and the sfi projects the rest of the face onto the cylinder, so all 25 nodes of the face end up on it.

Redefining and naming

A surface number that you define again replaces the surface, and James does not warn. A number below 1 is E0104. James keeps the parameter %nextsrf: the highest surface number defined so far plus one. It changes as soon as sd has read the surface number, so an sd that is then refused, for an unknown kind or a bad radius, moves it as well.

A surface may have a name, written before the number. A name holds a letter and no spaces (E1008). Only its first eight characters count, and case is ignored. A name that you give to several surfaces makes a composite of them for any command that refers to that name. The script tests/corpus/139-sfi-name-composite/input.tg:

sd bowl 3 sp 0 0 0 1
sd BOWL 1 sp 3 0 0 1
sd 2 sp 6 0 0 1
block 1 3;1 3;1 3;0.5 1.5;0 1;0 1;
sfi -1;;; sd bowl
sfi -2;;; sd Bowl
endpart

The first two spheres share the name bowl, in lower and upper case. A sfi that refers to bowl or to Bowl gets a composite of the first two spheres. The IR holds that composite as a fourth surface, with the two spheres as members. The third sphere has no name and is not in it.

2D curves

A 2D curve lives in a local plane with the coordinates x and z. It is not in the mesh’s coordinate system until a surface places it. A revolving surface reads x as the distance from the axis and z as the position along it. cp and rule2d place the curve in the x-z plane, or in a plane of constant y, with x as x and z as z. swept places its base in the x-z plane and each cross section in the plane normal to the base.

ld

ld builds one curve from a chain of segments. Each segment starts where the one before it ended.

ld number lp2 x z [x z ...] ; lar x_end z_end radius ;
  • lp2 draws straight lines through its points. A first point that is not where the chain ended gets a line to it first. A single point sets the start of the chain when nothing precedes it, and a chain that never gets past that point is E1002.
  • lar draws a circular arc from where the chain ended to (x_end, z_end). The arc is the short one. A positive radius turns counter-clockwise and a negative radius turns clockwise.

The chord rule governs lar: the radius must be at least half the length of the chord from the start to the end (E1003). A radius of exactly half the chord is a semicircle, and its sign chooses the direction.

A curve holds at most 256 segments. Any other segment type is refused: a type James knows of is E1009 and a word that is no segment type is E0104 in place of the first segment. After a complete segment such a word ends the ld, and James reports it as not recognized (E0105).

lcc

lcc makes concentric arcs. It takes a centre, a begin angle and an end angle in degrees, and a list of radii. Each radius is one curve.

The curves are numbered from one above the highest 2D curve number defined so far. The script tests/corpus/181-lcc-three-arcs/input.tg:

c lcc makes three concentric arcs, numbered 1 to 3
lcc 0 0 0 90 1 2 3;

The angles run from 0 to 90 degrees about the origin, so each curve is a quarter circle. The IR holds three 2D curves, numbered 1, 2 and 3, each with one arc. A curve that ld defined before the lcc moves the numbering up: after ld 1 an lcc with two radii makes curves 2 and 3.

An arc turns clockwise when the begin angle is larger than the end angle, and nothing wraps through 360 degrees. A negative radius reflects the arc through the centre. A span of zero is an arc of no length, and the engine refuses it with exit code 2.

Surfaces from a 2D curve

crx, cry and crz revolve a defined curve about the x, y or z axis, and cr about an axis of its own. cp, rule2d and swept use 2D curves as well, as the table of surfaces says. The curve must exist when sd is read (E1001), and the message names the kind, rule2d argument 2 is not a defined 2D curve. The script tests/corpus/122-sd-crx-accept/input.tg:

ld 1 lp2 0 0 1 1;
sd 1 crx 1

The ld defines curve 1 as one line from (0, 0) to (1, 1). The sd revolves it about the x axis as surface 1, which is a cone. The IR holds the curve with one lp2 segment and the surface with kind crx, which refers to the curve.

A revolved curve whose first and last points coincide is closed, and its surface has no sides. An open curve gives a surface with two sides, the circles that its ends sweep.

3D curves

curd defines a 3D curve by number. A 3D curve moves nothing by itself. The commands cur, curf, cure and curs attach an edge to it, and the surfaces rule3d, crule3d, pipe, blend3, blend4 and r3dc are built from them. A curve that cur names may be defined by a curd later in the same part, before the part ends. A curve number that is never defined is E0601.

James builds four types.

  • lp3 is a polyline through its points, in order.
  • csp3 is a cubic spline through its points. Its parameter runs by unit steps between points.
  • arc3 is a circular arc, or a whole circle, through three points.
  • sdedge is a side of a surface.
curd number lp3 x y z [ x y z ... ] ;
curd number csp3 option [ end_value ... ] x y z [ x y z ... ] ;
curd number arc3 option point point point [ operator ... ; ]
curd number sdedge surface.side [ operator ... ; ]

A curve has at least two points (E0602). A loop needs at least three points; two are refused when the curve is built (exit 2). The count of coordinates is a multiple of three (E0605). A transformation operator may follow the point list, as in tr.

csp3 takes an option first. The word loop closes the spline into a smooth loop and takes no end value. Otherwise the option is two digits, one for each end of the curve.

Digit Condition at that end Values that follow the option
0 natural: second derivative zero none
1 a derivative vector three reals
2 matches the first end of another curve a curve number and a magnitude
3 matches the last end of another curve a curve number and a magnitude

The values of the first digit come before those of the second. A match takes the unit tangent of the other curve at its named end and scales it by the magnitude. The other curve must be defined before this one (E0601). A wrong option or a wrong number of end values is E0606.

A curd holds one group, lp3, csp3, arc3 or sdedge. A second group on the same command is E0608. The script tests/corpus/138-curd-second-group-rejected/input.tg:

curd 1 lp3 0 0 0 1 1 1; lp3 2 2 2 3 3 3;
curd 2 lp3 0 0 0 1 1 1;;

James prints the message in tests/corpus/138-curd-second-group-rejected/expected.diag.txt:

input.tg:1:25: error [E0608]: curd carries more than one type group; this version of James accepts one
james: 1 error, 0 warnings

Extra semicolons after a point list are ignored, and a transformation word on the same line as the last ; belongs to the curd. The script tests/corpus/153-curd-stray-semicolon-trans/input.tg:

curd 1 lp3 0 0 0 1 1 1 2 2 2;;
curd 2 lp3 0 0 0 1 1 1 2 2 2; ; mx 1;
curd 3 lp3 0 0 0 1 1 1;
; mx 1;
block 1 2;1 2;1 2;0 1;0 1;0 1;
endpart

The three curves are polylines. Curve 1 ends in two semicolons. Curve 2 has a stray ;, then mx 1 on the same line, which the IR holds as a transformation row. Curve 3 has two points, and its mx 1 is on the next line after a ;. The IR holds three curves and two transformation rows, and the part is unaffected.

arc3

arc3 takes an option and three points, each in the coordinate system rt, cy or sp. The three points fix a circle, and the option says which part of it the curve is. Three points on a line, or two that coincide, fix no circle (E0609), and so does an option that is none of the three words.

Option The curve
seqnc The arc from the first point through the second to the third.
cmplt The rest of the circle: the arc from the first point to the third that does not pass through the second.
whole The whole circle, from the first point through the second and the third and back to the first. It is a loop.

A transformation list after the third point moves the three points. The list must be a similarity, as a surface’s must: the circle through the moved points is the moved circle only when the list rotates, reflects, translates and scales by one factor. A scale of one axis alone would make an ellipse, which James has no curve type for, so James stops with exit code 2 when it builds the geometry, before any part is meshed, and prints 3D curve #0 has a transformation that is not a similarity; xsca scales one axis (ysca or zsca in place of xsca; a list with no scale of one axis in it that still collapses the curve ends the line after similarity). The number counts the 3D curves from 0 in the order of definition. The list of an sdedge maps the side as it stands and is not held to this rule: a list that scales the circle’s plane unequally turns a circle side into a cubic spline through 257 points of its ellipse. The script tests/corpus/312-curd-arc3-three-options/input.tg:

c arc3, Vol. 2, pp. 89-91: the arc, its complement and the whole circle through P1, P2, P3
curd 1 arc3 seqnc rt 0 1 0 rt
.5 .8 0 rt 1 0 0 ;
curd 2 arc3
cmplt rt 0 1 0
rt .5 .8 0 rt 1 0 0 ;
curd 3 arc3
whole rt 0 1 0
rt .5 .8 0 rt 1 0 0 ;

The three points (0, 1, 0), (0.5, 0.8, 0) and (1, 0, 0) lie on one circle in the x-y plane. Curve 1 is the arc through all three, curve 2 is the rest of that circle, and curve 3 is the whole circle. The IR holds the option of each as seqnc, cmplt or whole.

sdedge

sdedge makes a 3D curve of one side of a surface. Its argument is the surface number, a dot and the side number, written as one word: 1.3 is side 3 of surface 1. The sides section says which kinds have sides and how they are numbered. se is another spelling of sdedge.

The surface must be defined before the curd, and the side must lie between 1 and 4, or the command is E0604. A side that the surface’s kind lacks, such as any side of a plane, is an error that the engine reports when it builds the curve, with exit code 2: 3D curve #0: surface #0, a plane, has no sides, or 3D curve #1: surface #0, a pipe, has 2 sides; side 3 does not exist. A transformation list after the side moves the curve; a list that scales the circle’s plane unequally turns a circle side into a cubic spline through 257 points of its ellipse, and a list that collapses the curve to a point is refused as a curve of no length.

The curve is the side as the surface has it. A straight side is an lp3, a circle or an arc is an arc3, and a side that is a copy of one of the surface’s own curves is that curve; any other side becomes a cubic spline through 257 points of the side, with the side’s own tangents at its ends. A side across a tear of a swept surface, where the sections leave a polyline base that turns at a vertex, jumps at that vertex, and the spline through its points overshoots beside the vertex by about 0.13 times the jump: an sdedge of such a side, or a cur on it with no sf to hold the nodes to the surface, leaves nodes that far off the surface. The script tests/corpus/313-curd-sdedge/input.tg:

c sdedge, Vol. 2, pp. 72-73: curves made of sides of a ruled surface
curd 1 lp3 0 0 0 1 0 0;;
curd 2 lp3 0 1 0 1 1 0;;
sd 1 rule3d 1 2;
curd 3 sdedge 1.3
curd 4 sdedge 1.1 mz 2;
curd 5 se 1.2

The surface is the flat strip between the two lines. Curve 3 is side 3, its first curve. Curve 4 is side 1, the line between the curves’ starts, moved up by 2. Curve 5 is side 2, the line between their ends, written with the spelling se. The curves are ordinary 3D curves, so cur and curs can attach edges to them.

A curd holds one side. To follow several sides in a row, define a curve for each and join them with curs.

What James refuses

  • A surface kind that TrueGrid defines and James does not build is E1004 in sd and E0801 inline. They are the IGES kinds nurbs, igess and igesp; the spline surfaces csps, bsps, nrbs and hermite; function, a surface from a formula; and the polygon kinds mesh, poly, stl, bstl, face and faceset. A word that is no surface kind at all is E0104.
  • A 2D segment that James knows of and does not build is E1009. A word that is no segment is E0104 in place of the first segment, and E0105 after a complete one, because it ends the ld.
  • A 3D curve type that James knows of and does not build is E0603. A word that is no curve type is E0104. A curve of several segments, such as a chain of sides in one curd, is E0608, and rmseg, which removes the last segment of such a chain, is refused as a command (E0100).
  • A transformation operator tf, ftf, rxy, ryz or rzx in a surface’s list or a curve’s is E0503.

The compatibility chapter says which milestone adds more kinds: the spline surfaces, function, the polygon kinds mesh, poly, stl and bstl, and the remaining curve types are the work of milestone M15; face and faceset wait for the sets, and the IGES kinds stay long-term.


James 0.8.0.

This site uses Just the Docs, a documentation theme for Jekyll.