xform { <elist> ... }
Transform graphic entities. This is basically the commands rotate, stretch, and shift, rolled into one.
<elist>
A group/entity list defining which entities are to be transformed. If omitted, the current contents
of the these group are xformed.
-ef=<filter>
A filter to be applied to all entities within <elist>,
further qualifying which entities are to be transformed. If omitted, the
filter current_filter is used.
-mem=<string>, -mps=<ident>
2 switches which, when both are present, indicate a special "variable
mapsheet" transform operation.
Such an operation enables entities to be transformed by different 2-D coefficients
each determined by an entity's "mapsheet" value.
In this "variable mapsheet" mode, the command ignores all other tranformation switches (-p, -sc, -sh, -st, -x, -y, -z).
For this to work, all entities to be transformed should be of a graphic
class with a string (or numeric) member named <string>.
Entities of different classes may be present, but each class must have this
same named member.
The value of this member for each entity is known as its "mapsheet" value.
In addition, a set of mapsheet transformations must be supplied for all possible "mapsheet" values.
This set (<ident>) should be in the form of an array of objects, whose class contains
at least 2 members:
string or numeric mapsheet
numeric transform[6]
The names of these 2 members are arbitrary and do not have to be
mapsheet and transform.
However, the types: string (or numeric)
and numeric[6] must adhere.
In this way, the transformations for all mapsheet values are supplied.
The 6 numeric transformation parameters are as follows:
1,2 The pivot point (x,y only) for rotating and scaling, equivalent to the -p switch.
3 The rotation angle, equivalent to the -z switch.
4 The scaling factor, equivalent to the -sc switch.
5,6 The shift (x,y only), equivalent to the -sh switch.
When comparing mapsheet name values, numeric values are converted to string values.
-p=<point>
A point to be used as a pivot for rotating and stretching. If omitted, the
modelling origin is used.
-sc=<num>
Scale (stretch) entities uniformly in all 3 axes.
<num>
is a numeric expression yielding a positive scaling factor.
-sh=<point>
Shift (translate) entities. <point>
is a point expression yielding movement relative to the current graphic control position.
-st=<nums>
Up to 3 stretch factors for scaling co-ordinates in one or more of the 3
axes (X-axis, Y-axis, Z-axis). Negative stretch factors will mirror as
well as stretch.
-x=<angle>
Rotate about the X-axis.
-y=<angle>
Rotate about the Y-axis.
-z=<angle>
Rotate about the Z-axis.
The current angle mode (angle_mode) is used when evaluating rotation angles. The rotation about an axis is counterclockwise. If local axes are in effect in the current graphic window, all operations are performed relative to these axes.
Sub-entities of compounds may be manipulated in isolation from their parent entities, but not when operating in "variable mapsheet" mode.
Rotate all entities in the these group.
xform -z=45
Rotate about a specific point, then shift, all entities in the these group.
xform -p=(100,100),-z=45,-sh=e:500&n:500
Consider an array of mapsheet transformations:
atable xforms structure ~xforms.mapsheet_t { string m_name numeric m_xform[6] } ~xforms.mapsheet_t mapsheets[] mapsheets[1].m_name = 'sheet1' mapsheets[1].m_xform = <500,500,2*degs,0,1000,0> mapsheets[2].m_name = 'sheet2' mapsheets[2].m_xform = <500,500,4*degs,0,2000,0> mapsheets[3].m_name = 'sheet3' mapsheets[3].m_xform = <500,500,-2*degs,0,3000,0>
Consider also some entity objects of the following 2 classes:
atable streets gstructure ~streets.road_gt { string msheet } compound ~streets.road_ct { string msheet entity e[] }
Note how both classes have a member msheet.
We will not include the entity creation code here, but will assume that every
object has an msheet value of 'sheet1','sheet2'
or 'sheet3'.
We can now transform the objects, e.g.
xform all,-mem='msheet',-mps=mapsheets
Those objects with an msheet value of 'sheet1', will get transformed by the mapsheet[1] transform,
those with an msheet value of 'sheet2', will get transformed by the mapsheet[2] transform, and so on.
Commands: |
axes, entity, enlarge, mirror, rotate, shift, stretch, group |
Identifiers: |
angle_mode (string), current_filter (filter), these (group) |
Structures: |