as
as sets the spacing of the nodes along an edge by the size of its first or last interval.
Syntax
as imin jmin kmin imax jmax kmax direction flag size
The first six numbers are a region, as for lin. direction is i, j or k. flag is 0 or 1. With 0, size is the length of the first interval, at the end with the lowest index. With 1, size is the length of the last interval, at the end with the highest index. size is a positive real number.
What it does
James fixes the interval you name at size and finds the one ratio that makes the other intervals continue as a geometric series to the full length of the edge. The sizes change smoothly along the edge. For an edge of length 7 cut into three intervals, flag 0 and size 1 give a ratio of 2 and the nodes 0, 1, 3 and 7. With flag 1 and the same size, the last interval is 1, and the intervals from the low end are 4, 2 and 1.
The region and the direction select edges. For each combination of the two indices other than the direction, within the region, there is one edge running in the direction. If the region spans more than one reduced index along the direction, James ignores the partitions inside the span and treats it as one composite edge.
When James applies it
With the edge interpolation, in steps 4 and 5. James lays out the edges that a spacing command reaches at step 4, in the order of the commands, so the later command holds on nodes that two commands share. Step 5 spaces every other edge equally. After step 6 projects the nodes of an edge onto a surface, James spaces them again along the projected edge by the same rule, and repeats until they settle. An edge attached to a curve is spaced along the curve. The command is legal only in the Part phase. James refuses it in the Control and Merge phases (E0412).
Rules James adds
- A flag other than 0 or 1 is an error (E0104).
- A size that is zero or negative is an error (E0902).
- A region with no length in the direction is an error (E0900).
- A size that no positive ratio can fit is an error that names the command. It happens when the intervals at that size are already longer than the edge, as with a size of 10 on an edge of length 7. The engine reports it and the run exits with 2.
- On a
cylinderpart James measures the length of an edge in the part’s own coordinates. Along an edge in the angle direction, a size or a gap counts degrees, not a distance.
Diagnostics
- E0102: a reduced index lies outside the part.
- E0106: a range of the region is written high to low.
- E0900: the region has no length in the direction.
- E0902: the size is zero or negative.
- E0104: the flag is not 0 or 1.
Example
The script tests/corpus/077-as-derive-ratio/input.tg, which make test runs:
block 1 4; 1; 1;
0 7;
0;
0;
as 1 1 1 2 1 1 i 0 1
endpart
The edge runs along i from 0 to 7 in three intervals. Flag 0 and size 1 fix the first interval at 1, so James solves for a ratio of 2. The intervals are 1, 2 and 4, and the nodes sit at 0, 1, 3 and 7, to twelve digits. With merge, neutral and write added to the script and --write-unref-nodes on the command line, James writes the nodes. The flag is needed because the part has no element.
See also
- res: gives the ratio directly.
- das: fixes both end intervals.
- Shaping a part: the order of steps.