SchemeExt:Sweep:options

From DocR23

Jump to: navigation, search

Contents

Action

Provides a data structure for sweeping operations to be used in the function api_sweep_with_options.

Filename

scm/scmext/swp/swp_scm.cpp

APIs

None

Syntax

(sweep:options name-of-option {value | location direction})

Argument Types

Argument Scheme Data Type
name-of-option string
value string | law | real | gvector | entity | boolean | integer | body | face
location position
direction gvector

Returns

Sweep_Options

Description

This extension defines elements in the Sweep_Options data structure that are later used for the sweep:law operation. The sweeping options are explained in detail in the article Sweeping with Options.

Arguments

  • name-of-option is a string placed within quotation marks.
  • If value is a real, it does not require delimiters. If value is a string representing a law, it should be enclosed in quotation marks. If value is a law, only the variable name for the law is required.

Multiple pairs of name-of-option and value can be specified simultaneously, for example:

(sweep:options "draft_angle" 5 "solid" #f)
The various sweeping options are listed in the following table:
Table. Sweeping Options
Option Type Description Default Value
bool_type string Specifies the boolean operation to be used along with the option sweep_to_body. Valid values are "limit", "unite", "intersect", "subtract", and "keep_both". "limit"
close_to_axis boolean If a revolve operation is required, and the profile is open and far away from the rotation axis, it will close the gap that could be produced between the profile and the axis. #f
cut_end_off boolean Cuts the end of the swept body squarely, with a perpendicular plane to the end of the profile. #f
draft_angle real Defines the draft angle in degrees. 0.0
draft_hole string Specifies the orientation of the draft angle in interior holes in faces being swept with draft: "no_draft", "with_periphery", "against_periphery", and "by_angle". If "by_angle" is specified, a draft_hole_angle must be supplied, in degrees. "against_periphery"
draft_law law Defines the draft angle with a law. none
draft_repair string Specifies the type of repairs done internally to complete a draft operation: "no_repair", "first_self_intersection", "first_degeneracy", "self_intersection", "degeneracy", and "error_on_repair". "degeneracy"
end_draft_dist real Alternative way to set up a draft operation, by specifying the final offset distance. 0.0
gap_type string Specifies the type of face that will fill up the gaps made by draft operations. It is of type "EXTENDED", "ROUNDED", or "NATURAL". "NATURAL"
keep_branches boolean Option to keep extra branches produced in sweep_to_body or to_face operations. #f
keep_law law The resulting graph of the sweep_to_body or to_face operations can be defined using a customized law. none
keep_start_face boolean Specifies if in a closed path operation or a full revolution revolve operation, the original profile face should remain topologically in the same place, instead of getting absorbed by the new closed body. #f
merge_type string Specifies how the tangent lateral edges will be merged. Valid values are "merge_none", "merge_lateral", "merge_vertical", or "merge_all". If merge option value is not specified explicitly, then the global merge option controls the behavior. "merge_unset"
miter_type string The type of mitering operation to be used: "old", "crimp", "bend", or "new". If "bend" is specified, a real value for the miter_amount should be provided also. "new"
portion string Specifies the portions of the path to be used: "as_is", "to_profile", "from_profile", "between_points", "sweep_to", and "entire_path". If "between_points" is specified, the portion_start and portion_end positions must be supplied. If "sweep_to" is specified, a position should be supplied. "entire_path"
rail_laws law or (list law1 law2 ...) Laws that define the rails (for orientation) for the operation. If a list is provided, it will define the rail_law_num. none
rigid boolean Orientation of the profile at miter planes or end of path. #f
self_int_test integer Specifies if a self-intersecting surface check should be performed and if the operation is allowed to complete even when a self-intersecting situation has been found. If 0 is specified, no check is performed. If 1 is specified, check and error occur. If 2 is specified, check is performed but only warns about self-intersecting surfaces. 1
simplify boolean Specifies that surfaces are to be simplified into lighter forms whenever possible. #t
solid boolean The result body should be a closed solid body when possible. #t
start_draft_dist real Start offset distance used in draft operations. 0.0
steps integer Number of linear divisions in revolve operations. 0
sweep_angle real Revolve angle, in degrees. 360
to_body body Defines a body that will limit the sweep operation. none
to_face face Defines a surface from an input face that will limit the sweep operation. none
twist_angle real Defines an angle that the profile will twist by the end of the sweep operation in degrees. 0.0
twist_law law Defines the twist angle with a law. NULL
two_sided or 2d boolean Specifies if an open body is created, if its faces should be single or double sided. #t
twist_normal_from_profile boolean Specifies if profile normal or path start direction to use for rigid sweep with twist #f
Also, refer to sweep:test for a demonstration of all sweep options.
  • The sweep option draft_angle is a real number that represents the angle with which the swept profile is to draft while sweeping. Drafting has two mutually exclusive options which are draft_angle and draft_law. The default for draft_angle is 0.0. One application of drafting is for molded items. As the profile is swept, the ending profile has been offset by an equal distance, which helps with the removal of the item from a mold. Extreme draft angles or draft laws can result in errors due to self-intersecting bodies, incomplete lateral faces (likely at corners), and/or unsupported topologies.
  • The sweep option end_draft_dist defines where to stop the end of the draft.
  • Twisting has two mutually exclusive options: twist_angle and twist_law. Only one can be set by the sweep:options extension. When one is set, the other is cleared out. The default is twist_angle set to 0. Moreover, if the rail_law array was set up using law:make-rails and it included a twist law, then rail_law would be mutually exclusive with the twist_law option (that is, do not use the twist law more than once).

Limitations

The two twist options are mutually exclusive. When the rail law array includes a twist law, do not apply another twist law as part of a sweep option. Some options only appear if they are explicitly specified out or are non-selected and mutually exclusive.

Example

; sweep:options
; Define the sweep options to use.
; These are the default options.
(define sweep1 (sweep:options))
;; sweep1
; Define new sweep options where all values are
; default except the draft_law.
(define s1 (sweep:options
    "draft_law" "sin(x)"))
;; s1
; Define another set of sweep options that is almost
; the same as s1 except for a minor change
; to the gap-type
(define s2 (sweep:options
    "gap_type" "n" "draft_law" "sin(x)"))
;; s2
; Create a sweep path from points
(define plist1 (list (position 0 0 0)
    (position 20 0 0) (position 20 20 0)
    (position 20 20 20)))
;; plist1
(define start1 (gvector 1 0 0))
;; start1
(define end1 (gvector 0 0 10))
;; end1
(define path1 (edge:spline plist1
    start1 end1))
;; path1
(define law1 (law "cur (edge1)" path1))
;; law1
(define rail1 (law "minrot (law1,vec (0,-1,0))"
    law1))
;; rail1
(define edgelist1 (list (edge:linear (position 0 3 3)
    (position 0 3 -3)) (edge:linear (position 0 3 -3)
    (position 0 -3 -3)) (edge:linear
    (position 0 -3 -3) (position 0 -3 3))
    (edge:linear (position 0 -3 3)
    (position 0 3 3))))
;; edgelist1
(define profile1 (wire-body edgelist1))
;; profile1
(define sweep1 (sweep:law profile1 path1
    (sweep:options "rail_law" rail1)))
;; sweep1
Personal tools