Action:
|
Creates a new wire by offsetting the given wire using offset and twist laws.
|
|
Filename:
|
ofst/ofst_scm/woff_scm.cxx
|
|
APIs:
|
api_offset_planar_wire
|
|
Syntax:
|
(wire-body:offset wire offset-distance-law
|
|
|
[twist-law] [gap-type] [trim] [direction])
|
|
Arg Types:
|
wire
|
wire
|
|
offset-distance-law
|
law | real
|
|
twist-law
|
law
|
|
gap-type
|
string
|
|
trim
|
boolean
|
|
direction
|
par-pos | gvector
|
|
|
|
Returns:
|
wire
|
|
Description:
|
Assume that the planar wire body
wire, is re-parameterized to the variable
x, becoming curve(x).
T is the tangent to curve(x), and
N is a normal to the wire's plane. The double bars around the cross product
T x N and
N mean they are unitized. The offset curve to the wire body at
x is then given by the following equation.
|
|
|
|
|
wire must be a planar wire body entity.
|
|
|
offset-distance-law is the offset distance to use when offsetting. In the simplest case,
offset-distance-law is a constant.
|
|
|
If the
twist-law is not specified, it is assumed to be 0. Thus, the offset curve becomes simply a function of the given
offset-distance-law at the curve parameter
x. In such a case and if the
offset-distance-law is a constant, the unitized cross product
T x N specifies the positive direction for the offset.
|
|
|
If the
twist-law is specified, the given equation determines where the offset curve at curve parameter
x lies in three dimensional space. Twisting is about the tangent vector
T of the
wire curve and in the plane created by
T x N and
N. The
twist-law specifies the angle in the
TxN and
N plane for the offset curve. (The
twist-law evaluates to a number that is input as radians to the
cos and
sin law functions.)
|
|
|
For example, if the
offset-distance-law is the constant 2 and the
twist-law is simply the law function "x", then the result is a helix of radius 2 that winds around
wire.
|
|
|
gap-type is a string that specifies how to fill in gaps created by offsetting; valid strings are "N" for "natural", the default (2), "R" for "round" (0), and "E" for "extend" (1). Consider the wirebody made up of a square and a circle, as shown. When this wirebody is offset, a gap is created at certain junctures. "natural" extends the two shapes along their natural curves, e.g., along the circle and along the straight edge, until they intersect. "round" creates a rounded corner between the two segments. "extend" draws two straight lines from the ends of each segment until they intersect. The default is "natural."
|
|
|
|
|
|
trim is an optional argument specifying whether or not to repair the self intersecting wire.
|
|
|
direction specifies the plane normal to be used for offsetting the non-planar wires.
|
|
Limitations:
|
Non-constant offset laws and non-zero twist laws are not supported by the gap fill feature and may not produce the desired results.
|
|
Example:
|
; wire-body:offset
|
|
; Create a wire-body by offsetting a wire by
|
|
; a given distance.
|
|
; Create edge 1.
|
|
(define edge1
|
|
|
(edge:circular (position 10 0 0) 10))
|
|
;; edge1
|
|
; Create a wire-body from the edges.
|
|
(define wirebody1 (wire-body (list edge1)))
|
|
;; wirebody1
|
|
; OUTPUT Original
|
|
|
; Offset a wire-body outside the original wire-body.
|
|
(define offset (wire-body:offset wirebody1 5 "2*x"))
|
|
;; offset
|
|
; OUTPUT Result
|
|
|
|
|
Figure 2-3. wire-body:offset
|
|
|
; Another example using laws.
|
|
(part:clear)
|
|
;; #t
|
|
(define edge1 (edge:circular (position 0 0 0) 20))
|
|
;; edge1
|
|
; OUTPUT Original
|
|
|
(define wirebody2 (wire-body edge1))
|
|
;; wirebody2
|
|
(define offset1
|
|
|
(wire-body:offset wirebody2
|
|
|
"20+10*cos(x*10)"))
|
|
;; offset1
|
|
; OUTPUT Result
|
|
|
|
|
Figure 2-4. wire-body:offset - Using Laws to Define Geometry
|