Curves and Sketches
A common concept for solid constructions is the extrusion of a 2-dimensional sketch. This section describes how sketches are created in trCAD.
Curves
In general, the curvedata type represents a 1-dimensional path in 2- or 3-dimensional space. The most simple curve may be a straight line that starts at a point p1 and extends to another point p2. To build such a curve, the curve link operator '->' is used:
Example
vector p1 = <[-3,2]>
vector p2 = <[5,7]>
curve c1 = p1 -> p2
In the same way the curve can be extended to a polygonal chain:
Example
vector p3 = <[2,6]>
vector p4 = <[4,-1]>
curve c2 = p1 -> p2 -> p3 -> p4
The curve can be closed to form a polygon by either explicitly returning to the starting point or by using the curve closure operator '-><-':
Example
curve c3 = p1 -> p2 -> p3 -> p4 -> p1
curve c4 = p1 -> p2 -> p3 -> p4 -><-
Non-linear curve segments
In the previous example, the curve link operator '->' was used onto single points what caused them to be connected via straight lines. Sometimes, other types of connections are desired. This can be achieved by using one of the following curve segment constructors:
line_to | line_dir | arc |
arc_to | bezier |
Example
curve c5 = <[3,0]> ->
arc( <[0,0]>, PI * 0.5 ) ->
line_dir( <[-2,0]> ) ->
line_dir( <[0,-3]> )
Sketches
In the context of trCAD, a sketch is a set of one or more 2-dimensional closed curves. A sketch can be formed by "adding" or "subtracting" multiple curves:
Example
curve c1 = <[8,0]> -> arc( <[0,0]>, 2PI )
curve c2 = <[4,3]> -> arc( <[3,3]>, 2PI )
curve c3 = <[-4,3]> -> arc( <[-3,3]>, 2PI )
curve c4 = <[5,-1.5]> -> arc_to( <[-5,-1.5]>, 5.5, false ) -> arc_to( <[5,-1.5]>, 5.2 )
sketch s = c1 - c2 - c3 - c4