Sweep Results

From DocR25

Jump to: navigation, search

The options in this category allow for additional specification of the resulting body from the sweep operation. The Sweep Results options are:

  • solid determines whether a wire body sweep results in a closed solid body.
  • two_sided defines a resulting open body as consisting of single-sided or double-sided faces.
  • cut_end_off establishes the end type.
  • keep_start_face retains the original face profile.
  • miter dictates the handling of corners.
  • merge dictates the merging of lateral faces.

Contents

Specifying a Closed Solid Body

The solid option is a logical flag that specifies whether the result of sweeping a wire body profile is intended to be a closed solid body or an open body. The default is TRUE, meaning the result should be a closed solid, unless the profile is a non-closed wire or edge. If the intended result is an open solid body, then the solid and two_sided options should be set to FALSE.

Solid Option Example

; sweep with solid = true
; Define a solid cylinder
(define circ1 (edge:circular (position -20 0 0) 7.5))
(define path1 (edge:linear (position -20 0 0)(position -20 0 20)))
(define cyl (sweep:law circ1 path1 (sweep:options "solid" #t)))

Specifying a Single-Sided or Double-Sided Open Body

If solid is set to FALSE and two_sided is set to TRUE, then the sweep operation creates a sheet body, consisting of double-sided faces. If the intended result is an open solid body consisting of single-sided faces, then the solid and two_sided options should be set to FALSE. If solid is set to TRUE, this option has no effect.

Two-Sided Option Example

; Define a two sided straw
(define circ2 (edge:circular (position -10 20 0) 7.5))
(define path2 (edge:linear (position -10 20 0)
       (position -10 20 20)))
(define straw (sweep:law circ2 path2
       (sweep:options "solid" #f "two_sided" #t)))

Specifying an End Type

The cut_end_off option determines whether or not the end of the swept surface should be cut off squarely. When TRUE, the end of sweeping is planar and perpendicular to the path. When FALSE, the sweeping operation is faster and a non-planar profile is not cut off at the end of the sweep path. The default is FALSE.

End Type Option Example

; Sweeping with cut_end_off = false
(define path1 (edge:linear (position 15 0 0)(position 15 20 20)))
(define profile1 (edge:circular (position 15 0 0) 5))
(define opts1 (sweep:options "cut_end_off" #f))
(define sweep1 (sweep:law profile1 path1 opts1))
(entity:set-color sweep1 3)
; OUTPUT Angled End Cut
 
; Sweeping with cut_end_off = true
(define path2 (edge:linear (position 0 0 0)(position 0 20 20)))
(define profile2 (edge:circular (position 0 0 0) 5))
(define opts2 (sweep:options "cut_end_off" #t))
(define sweep2 (sweep:law profile2 path2 opts2))
(entity:set-color sweep2 1)
; OUTPUT Flat End Cut
Sweep with Draft (Default End Orientation)
Sweep with Draft with End Cut Off

Keep Profile Face on Closed Sweep

The keep_start_face option specifies that the profile face used in the sweep, remains available after the sweep operation. This is useful when the sweep path is a closed loop, or when Selective Booleans will be used after the sweep.

For example, a circular profile can be swept around a circle, resulting in a torus. By default, once the torus is created, the start face is removed, along with information about where the torus surface starts and ends. When keep_start_face is turned on, the start face is left as part of the resulting model, as demonstrated in the following example. This acts as a handle for the start and end location. If the swept torus is used in a Selective Boolean process, the handle would be necessary. For example, the API function api_boolean_tube_body makes use of the start face.

The sweep_to_body option should not be used with keep_start_face.

Keep Profile Face Option Example

; Keep start face
(option:set "sil" #t)
(define profile (edge:ellipse (position 10 0 0)(gvector 0 0 1) 2.5))
(entity:set-color profile 2)
(define path (edge:ellipse (position 0 0 0) (gvector 0 1 0) 10))
(define torus1 (sweep:law profile path))
; OUTPUT Sweep to Body
 
(part:clear)
(option:set "sil" #t)
(define profile2 (edge:ellipse (position 10 0 0)(gvector 0 0 1) 2.5))
(entity:set-color profile2 2)
(define path2 (edge:ellipse (position 0 0 0) (gvector 0 1 0) 10))
(define torus2 (sweep:law profile2 path2 (sweep:options "keep_start_face" #t)))
; OUTPUT Keep Start Face
Keep Start Face

Miter Options

Multi-edge path sweeping mitering determines the behavior at the non-G1 point between two adjacent path edges. The miter option specifies how mitering is performed. The default is the enumeration value default_miter, which takes the system default which is new_miter. Other options include old_miter, crimp_miter and bend_miter. Refer to the following example for some demonstrations of this option. The three miter options: new_miter, crimp_miter and bend_miter can only be used in the case of a perpendicular sweep.

Note: During a sweep operation along a non-smooth path, mitering occurs at the non-G1-connected path locations. Depending upon the sweep profile and path configuration, a rotation of the profile around the path may occur.


  • new_miter – reflects the profile to the other side of the corner up to the discontinuous point. The two sides are then extended, intersected, and new edges formed as necessary. The ending profile is the same as the starting profile. However, the new_miter approach fails in specific situations especially when the path wire is non-planar. When the new_miter approach fails, sweeping automatically switches back to the old_miter.
  • old_miter – intersects the plane which is perpendicular to the path at the half angle of the corner. The resulting profile on the plane is then swept continuing along the next path. Profile for any subsequent path is the intersection of previous path's lateral surface and the miter plane between previous path and this path. Note the u-isoparameter lines in Figure. Old Miter Option below compared to Figure. New Miter Option. The u-isoparameter lines show the shape of the profile for that path.
  • crimp_miter – reflects the profile to the other side of the corner up to the discontinuous point. The portions of the two sides that are not intersecting are connected using a smooth rotation about the discontinuous point.
  • bend_miter – requires specification of a minimum radius to fillet the path using api_fillet_vertex to fillet the path before sweeping.

Limitations

  • bend_miter, crimp_miter and new_miter may only be used for swept bodies that become solids.
  • For sheet bodies, that is when sweep option solid is set to FALSE, only old_miter can be used. The new_miter, bend_miter, and crimp_miter are not implemented for sheet bodies. A work around is to use vertex filleting on the body before sweeping. Note that the radius has to be greater than half of the profile length, otherwise self-intersecting surfaces may occur.

Miter Example

; Sweep miter options
(part:clear)
; Define a profile and path
(define profile (edge:ellipse (position 0 0 0)(gvector 0 1 0) 2))
(define edge1 (edge:linear (position 0 0 0) (position 0 10 0)))
(define edge2 (edge:spline (list (position 0 10 0) (position 10 5 0) (position 15 0 0)(position 20 -2 0))))
(define path (wire-body (list edge1 edge2)))
 
; Example 1
(view:gl)
(define sweep (sweep:law profile path (sweep:options "miter_type" "new_miter")))
;; OUTPUT New Miter
 
; Example 2
(roll -1)
(define sweep (sweep:law profile path (sweep:options "miter_type" "old_miter" )))
;; OUTPUT Old Miter
; Example 3
(roll -1)
(define sweep (sweep:law profile path (sweep:options "miter_type" "crimp_miter" )))
;; OUTPUT Crimp Miter
; Example 4
(roll -1)
(define sweep (sweep:law profile path (sweep:options "miter_type" "bend_miter" 3 )))
;; OUTPUT Bend Miter
New Miter Option
Old Miter Option
Crimp Miter Option
Bend Miter Option
;; Case to demonstrate the difference between crimp miter and bend miter
(part:clear)
; Define a profile and path
(define profile (edge:ellipse (position 0 0 0)(gvector 0 1 0) 5))
(define edge1 (edge:linear (position 0 0 0) (position 0 10 0)))
(define edge2 (edge:linear (position 0 10 0) (position 10 10 0)))
(define path (wire-body (list edge1 edge2)))
 
; Example 5
(define sweep (sweep:law profile path (sweep:options "miter_type" "crimp_miter")))
;; OUTPUT Crimp Miter
 
; Example 6
(roll)
(define sweep (sweep:law profile path (sweep:options "miter_type" "bend_miter" 6 )))
;; OUTPUT Bend Miter
Crimp Miter Option
Bend Miter Option

Merge Options

The merge_type option specifies how lateral faces are merged during sweeping. The possible values include merge_none, merge_all, merge_vertical, merge_lateral, and merge_unset.

  • merge_none – Does not merge any of the tangent edges.
  • merge_all – Merges all tangent edges.
  • merge_vertical – Merges tangent edges of lateral faces created by same progenitor profile in multi_stage sweeping with draft.
  • merge_lateral – Merges tangent edges of lateral faces generated in the same sweeping stage. (The image below is two-stage sweeping due to the cone reaching the singularity.)
  • merge_unset – Merging is dependent on the global merge option. If the global option is set to TRUE, it results in merge_all behavior. If the global option is set to FALSE it results in merge_none behavior.

Refer to the following example for demonstrations of this option.

Merge Example

(part:clear)
; Define a profile and path
 
(define edge1 (edge:linear (position 0 5 0) (position 6 2 0)))
(define edge2 (edge:linear (position 6 2 0) (position 10 0 0)))
(define edge3 (edge:linear (position 10 0 0) (position 15 0 0)))
(define edge4 (edge:ellipse (position 15 1 0)(gvector 0  0 1) (gvector 0 -1 0) 1 0 180))
(define profile (wire-body (list edge1 edge2 edge3 edge4)))
(define path (gvector 0 0 15))
(option:set 'merge 0)
 
; Example 1
(view:gl)
(view:edges #t)
(view:vertices #t)
(view:shaded #f)
(zoom-all)
(render:rebuild)
(define sweep (sweep:law profile path (sweep:options "merge_type" "merge_all" "draft_angle" -10)))
;; OUTPUT merge_type merge_all
 
; Example 2
(roll -1)
(define sweep (sweep:law profile path (sweep:options "merge_type" "merge_none" "draft_angle" -10)))
;; OUTPUT merge_type merge_none
 
; Example 3
(roll)
(define sweep (sweep:law profile path (sweep:options "merge_type" "merge_vertical" "draft_angle" -10)))
;; OUTPUT merge_type merge_vertical
 
; Example 4
(roll)
(define sweep (sweep:law profile path (sweep:options "merge_type" "merge_lateral" "draft_angle" -10)))
;; OUTPUT merge_type merge_lateral
Profile used for sweeping with merge_type options
merge_none Option
merge_all Option
merge_vertical Option
merge_lateral Option
Personal tools