sf

sf projects the vertices, edges and faces of a region onto a surface, so that the mesh follows real geometry.

Syntax

sf imin jmin kmin imax jmax kmax sd surface
sf imin jmin kmin imax jmax kmax kind parameters

The first six numbers are a region, as for lin. The region must be a vertex, an edge or a face.

The surface is either a reference or an inline definition:

  • sd surface names a surface that sd defines, by its number or its name.
  • kind parameters defines the surface on the spot, with every kind that sd builds and the same parameters. The kinds that take a trans ; tail in sd take it here too, and the ; is required even when the list is empty:
plan x0 y0 z0 xn yn zn
cy x0 y0 z0 xn yn zn radius
sp x0 y0 z0 radius
cone x0 y0 z0 xn yn zn radius angle
ts x0 y0 z0 xn yn zn r1 t r2
cp curve trans ;
rule3d curve1 curve2 trans ;
sds surface_1 surface_2 ... ;

These are some of the kinds; the other planes, cylinders, conics and the surfaces built from curves are written as the sd page gives them, with the spellings cyli, sphe, plane, xzplan, iplane, toru and torus as well. The sd page explains each parameter. A surface built from curves names its curves by number, and the kinds differ in when the number is checked. The revolutions crx, cry, crz and cr, and cp, need their 2D curve defined before the command is read, so an ld later in the part is too late (E1001). The kinds built from curves (rule2d, swept, rule3d, crule3d, pipe, blend3, blend4 and r3dc) are checked when the part ends, so an ld or curd later in the part may still define their curves (E1001, E1014).

What it does

James moves each node of the region to the nearest point of the surface. The projection stays in force: when a later step moves the node, James projects it again. A node that several commands constrain is projected onto all of its surfaces at once.

  • One surface: the node goes to the nearest point of that surface.
  • Two surfaces: the node goes to a point on both, which lies on the curve where they cross.
  • Three surfaces: the node goes to the point where all three meet.

A surface with sides is bounded, and a node beyond its edge goes to the edge. The geometry chapter says which kinds those are and how James finds the nearest point on them.

The shaping chapter explains projection, including where a face projected onto a sphere bulges.

When James applies it

A vertex is projected at step 3, the nodes of an edge at step 6 and the nodes of a face at step 9. A region that is an edge is therefore stored for steps 3 and 6, and a region that is a face for steps 3, 6 and 9. sf is legal only in the Part phase. James refuses it in the Control and Merge phases (E0412).

Rules James adds

  • A region that is a block is an error (E0807). Projecting a solid has no meaning, so James asks you to name its faces.
  • A node may carry at most three surfaces (E0803). James counts the distinct surfaces that reach one vertex, in the order of the commands. A composite from sds counts as one. James reports the first vertex that reaches four, once per part.
  • An inline surface that you repeat is a second surface. James does not recognise a repeat. To reuse a surface, define it once with sd and name it.
  • sd name selects the surface with that name. If several surfaces share the same first eight characters, ignoring case, James uses the composite of all of them, and the composite counts as one surface.
  • A surface kind that James knows of but does not support is an error (E0801): nurbs, igess, igesp, function, csps, bsps, nrbs, hermite, mesh, face, faceset, poly, stl and bstl. Every other kind is read as sd reads it, and raises the same errors as sd for its parameters. A word that is no surface kind at all is E0104. A surface number or name that nothing defines is an error (E0800), which James reports when the part ends, because an sd may follow the sf. A bare sd with nothing after it is E0104.
  • A projection that cannot be solved stops the run with an error that names the node and the part. A node at the centre of a sphere is the usual case: every point of the sphere is equally near. A node on the axis of a cylinder, a cone or a revolved curve, or on the centre curve of a pipe, is another. James never turns such a failure into a warning.

Diagnostics

  • E0800: the surface number or name is not defined.
  • E0801: the inline surface kind is not supported.
  • E1001 and E1014: a curve of an inline surface is not defined.
  • The other errors of the surface kinds, such as E1005 for a radius, are the ones sd raises.
  • E0803: a node would carry more than three surfaces.
  • E0807: the region is a block.
  • E0102: a reduced index lies outside the part.
  • E0106: a range of the region is written high to low.

Example

The script tests/corpus/066-sf-two-surface-intersection/input.tg, which make test runs:

sd 1 plan 0 0 0 0 0 1
sd 2 plan 0 0 0 1 0 0
block 1 2 3;1 2 3;1 2 3; 0 1 2; 0 1 2; 0 1 2;
sf 1 1 1 1 3 1 sd 1
sf 1 1 1 1 3 1 sd 2
endpart

The two sd commands define the plane z = 0 and the plane x = 0. Both sf commands name the edge 1 1 1 1 3 1, which runs along j on the line where the planes cross, so every node of the edge carries two surfaces. The edge already lies on both planes, so nothing moves. The IR holds two sf rows, each with steps [3 6].

See also

  • sfi: the same command with an index progression.
  • sd: defines the surfaces that sf refers to.
  • ms: projects one face per index onto a sequence of surfaces.
  • Shaping a part: how projection and interpolation combine.

James 0.8.0.

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