law:make-rails
List of: Scheme Extensions
Subjects: Laws, Sweeping
Contents: Kernel

Action: Creates a rail law or a list of rail laws for use by sweeping.

Filename: kern/kern_scm/law_scm.cxx

APIs: api_make_rails

Syntax: (law:make-rails path [twist [axis [faces


[user-rails [version]]]]])

Arg Types: path edge | wire

twist law

axis law | (law ...)

faces face | (face ...)

user-rails law | (law ...)

version version_tag

Returns: law | (law ...)

Description: This produces a rail law or a list of rail laws that can be used by sweeping or law:hedgehog.


If the path is a single edge or a wire with a single underlying edge, then a single rail law is produced. Otherwise, the extension creates multiple rail laws, one for each underlying edge in the path.


The only required argument is the path. If no other arguments are supplied, then the following default rails are created:


- If the path is planar, the rail law is the planar normal.

- If the path is a helix, the rail law points towards the axis.

- If all edges in the wire are planar, then an array of rail laws is created, whereby each law in the array corresponds to an edge in the wire. The rail laws correspond to the planar normal of edges.

- If the path isn't one of the above cases, the rail uses minimum rotation.


Because the input arguments are chained together, "NULL" arguments (double quotation marks required) must be supplied for early elements in the argument list in order to change later arguments. If the input path is composed of multiple pieces, such as a wire with more than one underlying edge, then list arguments must supply the same number of elements as the number of path elements. They may pad their list with "NULL" arguments (double quotation marks required).


For example, assume that an input path has three underlying edges. Assume that a list of axis laws are to be supplied, but no twist law. The list of axis laws would have to contain three elements. The list of axis laws could contain "NULL", which would result in the default rail for those corresponding portions of the path. The example call might look like:


(law:make-rails my-path "NULL"


(list "NULL" my-law "NULL"))


The twist argument works on the whole rail. After the other rail parameters have been input and calculated, the law provided by twist operates on the whole set of rails. This takes in an angle of twist per distance along the path. The twist argument can be "NULL".


The axis argument is used for path segments that have an implied center axis. An example of this might be a helix, an expanding helix, or the coil of a telephone handset cable. The axis argument is the derivative of the implied center axis, which tells the implied axis direction. When the axis is supplied, the created rails point towards it. The axis list can be padded with "NULL" for sections of the path that do not have an implied axis.


The face argument is used when a portion of the path segments borders a non-analytic face. The coedge of the wire provided as path must actually belong to the face entity supplied. The face must be non-analytic. The resulting rail is oriented to the face normal. The face list can be padded with "NULL" for sections of the path that do not have such a face.


The user-rails argument permits any default rail for a given section of the path to be overridden by the user-supplied law in the list. The user-rails list can be padded with "NULL" for sections of the path that are to use the default.


The version argument permits the user to specify a versiontag leaving the min_rotation_law as the rail. This behavior is not recommended for performance and robustness.

Example: ; law:make-rails

; is:helix

(define path1 (wire-body:offset (wire-body


(edge:linear (position 0 0 0) (position 0 0 20)))


5 "x"))

;; path1

(define rail-1 (law:make-rails path1))

;; rail-1

; #[law

; "NORM(CROSS(DOMAIN(VEC(-(5*COS(X)),

; -(5*SIN(X)),1),0,20),VEC(0,0,1)))"]

; IF YOU WANT TO SEE THE RAILS, use law:hedgehog
PDF/KERN/14SCI.PDF
HTM/DATA/KERN/KERN/14SCI/0018.HTM