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.

phlv5:clean

Action
Removes hidden line data.

Filename
scm/scmextcatia/phlv5/phlv5_scm.cpp

APIs
api_phlv5_clean

Syntax
(phlv5:clean [token=0] body-list [acis-opts])

Arg Types
token integer
body-list body | (body ... )
acis-opts acis-options

Returns
unspecified

Description
This extension removes and deletes any PHLV5 attributes with a matching view token from the list of bodies.

When bodies are cleaned, attributes are removed via the lose function and are not stored. These attributes cannot be retrieved using the phlv5:retrieve extension.

Arguments
The optional token is an integer index; the default is 0. When token is 0, no action is taken. A non-zero token causes hidden line data to be removed from attributes attached to the bodies.
 
body-list specifies a list of bodies.
 
acis-opts specifies versioning and journaling options.
; phlv5:clean
; create a body
(define block (solid:block (position 0 0 0)
    (position 10 10 10)))
;; block
(iso)
;; #[view 395052]
(zoom-all)
;; #[view 395052]
(define data (phlv5:compute block 1))
;; data
(part:save "phlv5.sat")
;; #t
(part:clear)
;; #t
(define entities (part:load "phlv5.sat"))
;; entities
(define data (phlv5:retrieve (car (part:entities)) 1))
;; data
(phlv5:draw data)
;; #[phlv5-data 8839cd8]
(phlv5:clean 1 entities)
;; ()
(define data (phlv5:retrieve (car (part:entities)) 1))
;; data
(phlv5:draw data)
;; #[phlv5-data 8839d58]

[Top]


phlv5:compute

Action
Computes a hidden line view of the part.

Filename
scm/scmextcatia/phlv5/phlv5_scm.cpp

APIs
api_phlv5_compute

Syntax
(phlv5:compute [body-list] [token=0] [view=active]
    [phlv5-options=0] [acis-opts])

Arg Types
token integer
body-list wire-body | (wire-body ...)
view view
phlv5-options phlv5-options
acis-opts acis-options

Returns
phlv5-data

Description
This extension computes the hidden line removal data for the given viewing parameters and list of bodies.

Note: The scheme command phlv5:compute can be set to render the polyline data or the modeling curve returned from the PHLV5_EDGE. To render the polyline data, set this global ACIS option to false (option:set "phlv5_render_curves" #f).

Arguments
The optional token is an integer index. The default value is 0. When the token is 0, hidden line data is computed for drawing, but it is not stored in attributes attached to the bodies. If the token is non-zero, the data is stored on the model as attributes and identified by a token. Existing attributes identified by the same token are replaced.
 
body-list specifies a list of bodies.
 
view specifies a view. If view is not specified, active view is taken.
 
phlv5-options object contains hidden line options.
 
acis-opts specifies versioning and journaling options.

Limitations
Wire data is ignored. Bodies must not be self-intersecting.
; phlv5:compute
; create a body
(define block (solid:block (position 0 0 0)
    (position 10 10 10)))
;; block
(iso)
;; #[view 526136]
(zoom-all)
;; #[view 526136]
(phlv5:compute )
;; #t

[Top]


phlv5:draw

Action
Computes a hidden line view of the part.

Filename
scm/scmextcatia/phlv5/phlv5_scm.cpp

APIs
None

Syntax
(phlv5:draw phlv5-data)

Arg Types
phlv5-data phlv5-data

Returns
boolean
Arguments
phlv5-data specifies the phlv5-data from phlv5:compute or phlv5:retrieve.
; phlv5:draw
; Compute and draw hidden lines for a view.
; create a body
(define block (solid:block (position 0 0 0)
    (position 10 10 10)))
;; block
(iso)
;; #[view 526124]
(zoom-all)
;; #[view 526124]
; OUTPUT Original
(define data (phlv5:compute block 1))
;; data
(phlv5:draw data)
;; #[phlv5-data 8839cd8]
; OUTPUT Result

Figure. phlv5:draw

[Top]


phlv5:options

Action
Creates an phlv5-options object. The phlv5-options object contains hidden line options.

Filename
scm/scmextcatia/phlv5/phlv5_scm.cpp

APIs
None

Syntax
(phlv5:options "name-of-option" {value})

Arg Types
"name-of-option" string
value string | boolean | real

Returns
phlv5-options
Arguments
"name-of-option" specifies the option.
 
value specifies the value of the option. The valid options, with their value types and defaults are:
"hidden_line_style" string("hidden")
"sag_resolution" real(0.02)
"resolution" real (0.001)
"self_calibrate" boolean (#t)
"use_surface_approx" boolean (#t)
"thick_and_thinning" boolean (#f)
The valid values for option "hidden_line_style" are:
-        "hidden"
-        "dashed"
-        "colored"

"self_calibrate" - Calculates resolution and sag resolution based on model extends. It is recommended that this be left as true.

"use_surface_approx" - Uses procedural approximations as primary surface type.

"thick_and_thinning" - Draws PHLV5 segments marked as Outer with a thickened line type. If set to false, all lines are drawn with the same width.
; phlv5:options
; create a body
(define block (solid:block (position 0 0 0)
    (position 10 10 10)))
;; block
(iso)
;; #[view 657196]
(zoom-all)
;; #[view 657196]
; OUTPUT Original
(define opts
    (phlv5:options "hidden_line_style" "dashed"))
;; opts
(phlv5:compute opts)
;; #f
; OUTPUT Result

Figure. phlv5:options

[Top]


phlv5:retrieve

Action
Retrieves hidden line data from attributes attached to the bodies.

Filename
scm/scmextcatia/phlv5/phlv5_scm.cpp

APIs
api_phlv5_retrieve

Syntax
(phlv5:retrieve [token=0] body-list)

Arg Types
token integer
body-list body | (body ...)

Returns
phlv5-data

Description
This extension retrieves the data stored in PHLV5 attributes with a matching view token and returns an ENTITY_LIST of PHLV5_EDGEs.

All data returned is a copy of the data stored in attributes on the body.

Arguments
The optional token is an integer index; the default is 0. When token is 0, no action is taken. A non-zero token retrieves hidden line data from attributes corresponding to the views attached to the bodies.
 
body-list specifies a list of bodies.
; phlv5:retrieve
(view:dl)
;; #[view 4589092]
(part:clear)
;; #t
; create a body
(define block (solid:block 0 0 0 1 1 1))
;; block
(iso)
;; #[view 526124]
(zoom-all)
;; #[view 526124]
(define data (phlv5:compute (part:entities) 1))
;; data
(part:save "c:/phlv5.sat")
;; #t
(part:clear)
;; #t
(part:load "c:/phlv5.sat")
;; (#[entity 2 1])
(define data (phlv5:retrieve (part:entities) 1))
;; data
(phlv5:draw data)
;; #[phlv5-data 8839cd8]

[Top]