Scheme Extensions |
|
|
Technical Article |
Scheme is a public domain programming language, based on the LISP language, that uses an interpreter to run commands. ACIS provides extensions (written in C++) to the native Scheme language that can be used by an application to interact with ACIS through its Scheme Interpreter. The C++ source files for ACIS Scheme extensions are provided with the product. Spatial's Scheme based demonstration application, Scheme ACIS Interface Driver Extension (Scheme AIDE), also uses these Scheme extensions and the Scheme Interpreter. |
input-ent | face |
offset | real |
gap-type | integer |
use-transform | transform |
acis-opts | acis-options |
Description
Offsets the loops in a face, input-ent,
by the specified amount given in offset.
The default gap-type at the corners
is natural (2), but gap-type
can be changed to corner (0) or arc (1). The use-transform
is also optional and specifies where the output entity is to be transformed
to.
; face:offset-loops ; Create a face to offset. (define f1 (face:plane (position 0 0 0) 10 15)) ;; f1 (define f2 (face:offset-loops f1 15)) ;; f2 (define f3 (face:offset-loops f1 25 1)) ;; f3 ; OUTPUT Example |
[Top]
wire | wire-body |
body | entity |
vector | gvector |
distance | real |
acis-opts | acis-options |
Description
The projection is imprinted onto the body.
This means, for example, a circle could be projected onto the face of
a block and then the resulting circular face swept to make a post on the
block.
The project:wire extension
is implemented using a rigid sweep and imprint. First the wire is swept
by the distance in the direction
specified by vector, then the
swept body and the given body are imprinted. It is not necessary that
the wire being projected be planar.
; project:wire ; Create a cylinder (define cylinder1 (solid:cylinder (position -50 0 50) (position 50 0 50) 25)) ;; cylinder1 ; cylinder1 => #[entity 2 1] ; Create an ellipse (define ellipse1 (edge:elliptical (position 0 0 0) (position 20 0 0) 1 0 360)) ;; ellipse1 ; create a wire body of the ellipse1 (define wire1 (wire-body (list ellipse1))) ;; wire1 (zoom-all) ;; #[view 5375160] ; OUTPUT Original ; Project wire1 onto one side of cylinder1 (define project (project:wire wire1 cylinder1 (gvector 0 0 1) 50)) ;; project ; OUTPUT Result |
[Top]
in-obj | face |
Description
The entity that is returned is a path equivalent to what was used to create
the original sweep.
; sweep:get-path ; Create some geometry. (define e1 (edge:spline (list (position 0 0 0) (position 2 5 10)) (gvector 0 0 1) (gvector 0 0 1))) ;; e1 (define e2 (edge:linear (position 0 0 -10) (position 0 0 0))) ;; e2 (define path (wire-body (list e1 e2))) ;; path (define reverse (wire:reverse path)) ;; reverse (define prof (wire-body (edge:ellipse (position 0 0 -4.5) (gvector 0 0 1) 0.9))) ;; prof (zoom-all) ;; #[view 1077017040] (render:rebuild) ;; () (define start (position -1.5 -1.5 6.5)) ;; start (define start-mark (solid:sphere start 0.15)) ;; start-mark (entity:set-color start-mark 2) ;; () (define end (position -1.5 -1.5 -6.5)) ;; end (define end-mark (solid:sphere end 0.15)) ;; end-mark (entity:set-color end-mark 1) ;; () (define opts (sweep:options "portion" "between_points" start end)) ;; opts (define sw (sweep:law prof path opts)) ;; sw (define sw-path (sweep:get-path (car (entity:faces sw)))) ;; sw-path (env:set-highlight-color 1) ;; () (define highlight (entity:set-highlight sw-path #t)) ;; highlight ; OUTPUT Example |
[Top]
in-obj | face |
; sweep:get-profile ; Create some geometry (define e1 (edge:spline (list (position 0 0 0) (position 2 5 10)) (gvector 0 0 1) (gvector 0 0 1))) ;; e1 (define e2 (edge:linear (position 0 0 -10) (position 0 0 0))) ;; e2 (define path (wire-body (list e1 e2))) ;; path (define reverse (wire:reverse path)) ;; reverse (define prof (wire-body (edge:ellipse (position 0 0 -4.5) (gvector 0 0 1) 0.9))) ;; prof (zoom-all) ;; #[view 1077017040] (render:rebuild) ;; () (define start (position -1.5 -1.5 6.5)) ;; start (define start-mark (solid:sphere start 0.15)) ;; start-mark (entity:set-color start-mark 2) ;; () (define end (position -1.5 -1.5 -6.5)) ;; end (define end-mark (solid:sphere end 0.15)) ;; end-mark (entity:set-color end-mark 1) ;; () (define opts (sweep:options "portion" "between_points" start end)) ;; opts (define sw (sweep:law prof path opts)) ;; sw (define sw-profile (sweep:get-profile (car (entity:faces sw)))) ;; sw-profile (define highlight (entity:set-highlight sw-profile #t)) ;; highlight |
[Top]
profile | wire-body | face | edge |
path | wire-body | edge |
distance | real |
vector | gvector |
axis | position . vector |
sweep-options | Sweep_Options |
Description
The sweep:law extension creates
a sheet body or solid body from a profile
and a path. The path
can be defined as a path, a distance, a vector, or an axis (position and
vector).
The sweep:law extension is complicated, but not difficult. We have presented, explained, and provided examples for a variety of scenarios and option combinations to get you started, but can not provide every one. There are also some that will simply fail (causes self-intersections). It is up to you to experiment and explore whatever remaining scenarios and option combinations you can design.
Numerous additional sweep:law Scheme examples are provided in the Technical Articles section.
; sweep:law - Example 1 ; Sweeping an edge along a vector (define edge1 (edge:linear (position 10 0 0) (position 10 10 0))) ;; edge1 ; OUTPUT Original (define sweep1 (sweep:law edge1 (gvector 0 0 10))) ;; sweep1 ; Convert the single-sided entity into double-sided. (define 2dconvert (sheet:2d sweep1)) ;; 2dconvert ; OUTPUT Result ; sweep:law - Example 2 ; Sweeping a face a distance (part:clear) ;; #t (define face2 (face:plane (position 0 20 0) 10 10 (gvector 0 0 1))) ;; face2 ; OUTPUT Original (define sweep3 (sweep:law face2 5)) ;; sweep3 ; OUTPUT Result ; sweep:law - Example 3 ; Revolving a face. (part:clear) ;; #t ; Create a solid block. (define block1 (solid:block (position -10 -10 0) (position 25 25 25))) ;; block1 ; Separate faces from block1. (define entities (entity:faces block1)) ;; entities ; Extract a single planar face. (define face1 (car (cdr (cdr entities)))) ;; face1 ; Verify transform applied. (define fix (entity:fix-transform block1)) ;; fix ; OUTPUT Original ; Define extent of sweep. (define opts (sweep:options "sweep_angle" 60)) ;; opts ; Revolve the planar face by a gvector around a ; position. (define sweep1 (sweep:law face1 (position -10 -10 -10) (gvector 1 0 0) opts)) ;; sweep1 ; OUTPUT Result ; sweep:law - Example 4 ; Revolving a wire. (part:clear) ;; #t ; Create 4 linear edges. (define edge1 (edge:linear (position 0 0 0) (position 20 0 0))) ;; edge1 (define edge2 (edge:linear (position 20 0 0) (position 20 20 0))) ;; edge2 (define edge3 (edge:linear (position 20 20 0) (position 0 20 0))) ;; edge3 (define edge4 (edge:linear (position 0 20 0) (position 0 0 0))) ;; edge4 ; Create a wirebody from the 4 edges. (define wirebody (wire-body (list edge1 edge2 edge3 edge4))) ;; wirebody ; OUTPUT Original ; Create a solid by revolving the wire body. (define sweep1 (sweep:law wirebody (position 0 0 0) (gvector 0 1 0) (sweep:options "sweep_angle" 60))) ;; sweep1 ; OUTPUT Result ; sweep:law - Example 5 ; Sweeping a Planar Face. (part:clear) ;; #t ; Create a solid block. (define block1 (solid:block (position -10 -10 -10) (position 30 30 30))) ;; block1 ; Get a list of the solid block's faces. (define faces (entity:faces block1)) ;; faces ; Select a single face to sweep (define face (car (cdr (cdr faces)))) ;; face ; OUTPUT Original ; Create a new solid by sweeping the face along a ; gvector. (define sweep1 (sweep:law face 7.5 (sweep:options "draft_angle" -45))) ;; sweep1 ; OUTPUT Result |
[Top]
"name-of-option" | string |
value | string | law | real | gvector | entity | boolean | integer | body | face |
location | position |
direction | gvector |
Description
The sweep:options scheme extension
defines elements in the Sweep_Options
data structure that are later used for the sweep:law
operation.
; 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 |
[Top]
© 1989-2007 Spatial Corp., a Dassault Systèmes company. All rights reserved.