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. |
edge-list | edge | edge ... |
coin-tol | real |
min-length | real |
ao | acis-options |
Description
This extension takes the list of noncontinuous edges defined in the first
argument (edge-list), snaps the
vertices to the edges, and unites the edges to create sheet bodies.
; body:edge-regions ; Define geometry to demonstrate command. ; Use planar edges to create faces bounded by them. (define edge1 (edge:linear (position 0 0 0) (position 10 0 0))) ;; edge1 (define edge2 (edge:linear (position 10 0 0) (position 10 5 0))) ;; edge2 (define edge3 (edge:linear (position 0 5 0) (position 0 0 0))) ;; edge3 (define edge4 (edge:linear (position 0 5 0) (position 10 5 0))) ;; edge4 (define edge5 (edge:linear (position 5 0 0) (position 5 5 0))) ;; edge5 (define eds (part:entities)) ;; eds ; create two bodies from the edges (body:edge-regions eds) ; stage 1: verify input edge set (5 edges). ; stage 2: cleanup overlapping edges ; (5 edges) 4 ; stage 3: unite edges into wire body. ; (5 edges) 5 ; no short edge. ; stage 4: create regions from edges. ; Review edge regions. ;; (#[entity 7 1] #[entity 8 1]) |
[Top]
edge1 | edge |
edge2 | edge |
ao | acis-options |
Description
Combines the edges and they should be at least G1. If they are not G1,
the resulting edge will not work with all other operations in ACIS.
; edge:combine ; Create a circular edge to illustrate command. (define edge1 (edge:circular-3pt (position 10 0 0) (position 0 0 10) (position -10 0 0))) ;; edge1 ; Split the edge into two edges. (define split (edge:split edge1 (position 0 0 10))) ;; split ; Set new color to second entity to show the split. (entity:set-color (entity 3 1) 1) ;; () ; OUTPUT Original ; Combine the two edges to make a single edge. (define combine (edge:combine (entity 2) (entity 3))) ;; combine ; OUTPUT Result Figure. edge:combine |
[Top]
edges | edge | edge ... |
; edge:scan-gaps ; Find the gap between a vertex to the nearest ; entity. (define edge1 (edge:linear (position 0 0 0) (position 10 0 0))) ;; edge1 (define edge2 (edge:linear (position 10 0 0) (position 10 11 0))) ;; edge2 (define edge3 (edge:linear (position 9 8 0) (position 0 11 0))) ;; edge3 (define edge4 (edge:linear (position 0 11 0) (position 0 0 0))) ;; edge4 (define eds (part:entities)) ;; eds (edge:scan-gaps eds) ; acis> (edge:scan-gaps eds) ; vertex (10.0000 11.0000 0.0000) has gap 3.16228 ; vertex (9.0000 8.0000 0.0000) has gap 1 ;; 3.16227766016838 |
[Top]
edges | edge | edge ... |
Description
Given a list of edges, this command copies all edges that belong to other
topology entities (coedges). All higher level topology entities (coedge,
loop, wire, face, shell, lump, body, etc.) are deleted. Returns a list
of edges that do not have an owner.
; edge:set-free ; Create solid block. (define block1 (solid:block (position -20 -20 -20) (position 20 20 20))) ;; block1 ; get list of all edges. (define edges (entity:edges block1)) ;; edges (define list1 (entity:edges block1)) ;; list1 ; Free one edge. (define free (edge:set-free (entity 4))) ; (1 edges) 0 ;; free |
[Top]
edges | edge | (edge ...) |
; edge:shortest ; Find short edges. ; Load a file containing a bad part (part:load "heal1.sat") ;; (#[entity 2 1] #[entity 3 1] #[entity 4 1] ;; #[entity 5 1]) (zoom-all) ;; #[view 1076700200] ; Combine the faces into a body (define body1 (hh:combine (list (entity 2) (entity 3) (entity 4) (entity 5)))) ;; body1 ; Prepare the body for healing (define heal (hh:preprocess body1)) ;; heal ; #[entity 6 1] ; OUTPUT Original (hh:analyze-body body1) ; GEOMBUILD CHECK RESULTS ; ========= ; Statistics of the body from geombuild check : ; no. of edges = 17 ; no. of bad edges = 4 ; no. of coedges = 17 ; no. of bad coedges = 4 ; no. of vertices = 17 ; no. of bad vertices = 0 ; no. of bad tangent edges = 0 ; no. of bad tangent edges analytic = 0 ; no. of G1 bad tangent edges analytic = 0 ; no. of bad tangent edges uv_uv = 0 ; no. of bad tangent edges boundary uv_uv = 0 ; no. of bad tangent edges uv_nonuv = 0 ; no. of bad tangent edges nonuv_nonuv = 0 ; no. of bad tangent edges 3_4_sided = 0 ; no. of surfaces = 4 ; no. of discontinuous surfaces = 0 ; percentage of good geom = 92 ;; 92 (edge:shortest body1) ; shortest edge: 4.489976 ;; #[entity 7 1] |
[Top]
body | body |
"multiple" | string |
Description
This extension modifies a sheet body by covering each of its simple loops
of external edges with a face.
A simple external loop of a sheet body is a list of connected edges where each edge has only a single face. For instance, a block with only five faces will have an external loop for the edges around the missing face. This Scheme extension attempts to calculate a surface containing the edges and creates a face containing the loop of these edges.
For a body with multiple external loops, this extension computes distinct surfaces for each connected, planar face. For example, a block with uncovered top and bottom will be closed. Only sheets with single external loops can be fitted with a NURBS surface, provided that they contain only three or four edges. In the case of three edges, a degenerate NURBS surface is calculated which has a parametric pole on one edge.
The option "multiple" is used to cover a loop of external edges with multiple planes, if possible. The default value for "multiple" is false.
If a surface can not be calculated, a face with no geometric definition is created and a warning message displayed.
; sheet:cover ; Create a solid block. (define block1 (solid:block (position -20 -20 -20) (position 20 20 20))) ;; block1 ; Get a list of block's faces. (define faces1 (entity:faces block1)) ;; faces1 ; Remove the top and front faces. (define uncover (face:uncover (car faces1))) ;; uncover (define uncoverlist (face:uncover (car (cdr (cdr (cdr (cdr faces1))))))) ;; uncoverlist ; Create a sheet body from the wire body. (define sheetcover (sheet:cover block1)) ;; sheetcover |
[Top]
w1 | edge |
w2 | edge | (edge ...) |
fa | face |
ao | acis_options |
Description
This extension covers the provided closed circuits of connected edges with a face.
(part:clear) (define b (solid:block 0 0 0 10 10 10)) (define s (solid:sphere 10 10 10 5)) (iso) (zoom-all) (define b (solid:subtract b s)) (ray:queue 210.381 91.3469 111.311 -0.834673 -0.344149 -0.42998 1) (define f (pick-face)) (define elist (entity:edges f)) ; remove the face (entity:delete (face:unhook f)) ; cover the hole (sheet:cover-circuit elist) (render:rebuild) |
[Top]
list | string |
w1 | wire-body |
w2 | wire-body | (wire-body ...) |
Description
Covers multiple co-planar wire bodies into a sheet body having a single
planar face by converting the first wire in the list into the peripheral
loop and the rest of the wires in the list into the hole loops.
; sheet:cover-wire-loops ; Create geometry to demonstrate command: create ; 3 wire bodies. (define wire1 (wire-body (edge:circular (position 0 0 0) 10 0 360))) ;; wire1 (define wire2 (wire-body (edge:circular (position 5 0 0) 3 0 360))) ;; wire2 (define wire3 (wire-body (edge:circular (position -5 0 0) 3 0 360))) ;; wire3 ; Cover the wires so wire1 becomes the peripheral ; loop and wire2 becomes the hole loop. (define sheet (sheet:cover-wire-loops (list wire1 wire2 wire3))) ;; sheet |
[Top]
body | wire-body |
surf | face |
acis-opts | acis-options |
Description
This extension makes a sheet body from a wire body. It attempts to determine
a surface which contains the edges of each wire. If a surface can be calculated,
it is used for the geometry of the face. If a surface can not be calculated,
a face with no geometric definition is created and a warning message displayed.
The wire must be closed and not self-intersecting. When a face is defined
with the optional surf argument, the
underlying surface of that face is used for the geometry in covering the
wire body.
; sheet:cover-wires ; Create circular edge 1. (define edge1 (edge:circular (position 0 0 0) 20 0 180)) ;; edge1 ; Create linear edge 2. ; Set a color for edge1 (entity:set-color edge1 2) ;; () (define edge2 (edge:linear (position -20 0 0) (position -20 0 20))) ;; edge2 ; Set a color for edge2 (entity:set-color edge2 3) ;; () ; Create circular edge 3. (define edge3 (edge:circular (position 0 0 20) 20 0 180)) ;; edge3 ; Set a color for edge3 (entity:set-color edge3 4) ;; () ; Create linear edge 4. (define edge4 (edge:linear (position 20 0 20) (position 20 0 0))) ;; edge4 ; Set a color for edge4 (entity:set-color edge4 6) ;; () ; Create a wire body from the edges. (define wire_body (wire-body (list edge1 edge2 edge3 edge4))) ;; wire_body ; OUTPUT Wire Body ; Create a sheet body from the wire body. (define sheet_body (sheet:cover-wires wire_body)) ;; sheet_body ; OUTPUT Sheet Body Figure. sheet:cover-wires |
[Top]
edge-list | edge | edge ... |
coin-tol | real |
min-length | real |
wire | string |
ao | acis-options |
Description
This extension takes the list of noncontinuous edges defined in the first
argument (edge-list), snaps the
vertices to the edges, and unites the edges to create a single wire body.
; sheet:edge-regions ; Create topology to illustrate example. (define edge1 (edge:linear (position 0 0 0) (position 10 0 0))) ;; edge1 (define edge2 (edge:linear (position 10.1 0 0) (position 10 10.15 0))) ;; edge2 (define edge3 (edge:linear (position 10 10 0) (position 0 10 0))) ;; edge3 (define edge4 (edge:linear (position 0 10.1 0) (position 0.1 0.15 0))) ;; edge4 ; Create a sheet from edges that are not continuous. (define sheet (sheet:edge-regions (part:entities) 1 0.1)) ; stage 1: verify input edge set (4 edges). ; stage 2: snap vertices to edges. ; (8 free vertices) ; > can not snap vertex at position 0.0000 0.0000 0.0000 ; > nearest entity is at position 0.0000 10.0000 ; 0.0000 (distance 10) ; 8 ; 7 vertices snapped. ; 1 edges split. ; stage 3: cleanup overlapping edges ; (5 edges) 4 ; stage 4: unite edges into wire body. ; (5 edges) 5 ; stage 5: remove edges under length tolerance. ; (5 edges) no short edge. ; stage 6: create regions from edges. ; (sheet:edge-regions) 1 faces created with 4 edges ; shortest edge length in the faces is 10 ; (vs 0.1) ;; sheet (entity:check sheet) ; checked: ; 1 lumps ; 1 shells ; 0 wires ; 1 faces ; 1 loops ; 4 coedges ; 4 edges ; 4 vertices ;; () (define 2d (sheet:2d sheet)) ;; 2d (roll) ;; -1 ; Create wire only (define wire (sheet:edge-regions (part:entities) 0.1 0.1 "wire")) ; stage 1: verify input edge set (4 edges). ; stage 2: snap vertices to edges. ; (0 free vertices) 0 ; stage 3: cleanup overlapping edges ; (4 edges) 3 ; stage 4: unite edges into wire body. ; (4 edges) 4 ; stage 5: remove edges under length tolerance. ; (4 edges) no short edge. ;; wire (entity:check wire) ; checked: ; 1 lumps ; 1 shells ; 1 wires ; 0 faces ; 0 loops ; 4 coedges ; 4 edges ; 4 vertices ;; () |
[Top]
edge-list | (edge ...) |
option | string |
Description
This extension makes a planar sheet body from a planar wire body.
; sheet:planar-edges ; create topology to illustrate command. (define ellipse (edge:ellipse (position 5 5 0) (gvector 0 0 1) 4)) ;; ellipse (define points1 (wire-body:points (list (position 0 0 0) (position 18 0 0) (position 18 10 0) (position 0 10 0) (position 0 0 0)))) ;; points1 (define points2 (wire-body:points (list (position 4 2 0) (position 12 2 0) (position 12 8 0) (position 4 8 0) (position 4 2 0)))) ;; points2 (define ellipse2 (edge:ellipse (position 15 5 0) (gvector 0 0 1) 2)) ;; ellipse2 (define points3 (wire-body:points (list (position 24 2 0) (position 32 2 0) (position 32 8 0) (position 24 8 0) (position 24 2 0)))) ;; points3 (define ellipse3 (edge:ellipse (position 28 5 0) (gvector 0 0 1) 3.5)) ;; ellipse3 (define eds (edge:set-free (part:entities))) ;; eds (define sheet (sheet:planar-edges eds)) ;; sheet |
[Top]
body | body |
Description
This extension makes a planar sheet body from planar wire body.
; sheet:planar-wire ; Create circular edge 1. (define edge1 (edge:circular (position 0 0 0) 20 0 180)) ;; edge1 ; Create linear edge 2. (define edge2 (edge:linear (position -20 0 0) (position 20 0 0))) ;; edge2 ; Create a wire body from the edges. (define wire_body (wire-body (list edge1 edge2))) ;; wire_body ; Create a planar sheet from the wire body. (define sheet_body (sheet:planar-wire wire_body)) ;; sheet_body |
[Top]
wire-bodies | body |
"nest" | string |
union | boolean |
Description
This extension makes a planar sheet body from multiple planar wire bodies.
Default is Boolean union.
Sketching a planar wireframe is often the first step of creating a solid model. This gives users better control over planar entities and can allow them to attach dimensions/constrains to the sketch. This command assists in handling unorganized planar entities, such as edges and wires. The planar entities are covered by planar faces and can be used for later solid construction operations, such as sweeping, lofting.
; sheet:planar-wires ; Create topology to illustrate command. (define e1 (edge:ellipse (position 0 0 0) (gvector 0 0 1) 10))) ;; e1 (define w1 (wire-body e1)) ;; w1 (define e2 (edge:ellipse (position 0 0 0) (gvector 0 0 1) 20))) ;; e2 (define w2 (wire-body e2)) ;; w2 ; hole in the center (define planar (sheet:planar-wires (list w1 w2) "nest" #t)) ;; planar (roll) ;; -1 ; illustrate command with no hole (define nohole (sheet:planar-wires (list w1 w2) "nest" #f)) ;; nohole |
[Top]
edges | edge | edge ... |
ao | acis-options |
Description
Performs a non-regularized unite on a list of edges to create a wire body.
The resulting body may have faces, edges, and/or vertices not needed to
support the topology. These are not removed before returning the resulting
body.
; wire:unite-edges ; Create topology to illustrate command. (define edge1 (edge:linear (position -1 0 0) (position 11 0 0))) ;; edge1 (define edge2 (edge:linear (position 10 -1 0) (position 10 11 0))) ;; edge2 (define edge3 (edge:linear (position 11 10 0) (position -1 10 0))) ;; edge3 (define edge4 (edge:linear (position 0 11 0) (position 0 -1 0))) ;; edge4 (define w (wire:unite-edges (part:entities))) ; (4 edges) 4 ;; w ; check for bad wires, geometry, and topology. (entity:check w) ;; () |
[Top]
© 1989-2007 Spatial Corp., a Dassault Systèmes company. All rights reserved.