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.

body:defeature

Action
Finds and removes features from a body or a list of bodies.

Filename
scm/scmextdft/dft_scm.cpp

APIs
api_find_and_remove_features

Syntax
(body:defeature body [dft-opts] [acis-opts])

Arg Types
body body or a list of bodies
dft-opts defeature_options
acis-opts acis-options

Returns
body
Description
This extension defeatures the given body or list of bodies.
Arguments
body is an input body or an entity list of bodies.


dft-opts contains options to control the defeaturing algorithm.


acis-opts contains journaling and versioning information.
Example
;Build the part
(part:clear)
;#t
(view:gl)
;#[view 853142]
(define blockthickness 8)
;blockthickness
(define baseblock (solid:block (position -60 -30 0) (position 60 30 blockthickness)))
;baseblock
;Create the hole
(define holecenter (position 0 0 0))
;holecenter
(define holenormal (gvector 0 0 1))
;holenormal
(define holeradius 10)
;holeradius
(define holecutoutface (face:planar-disk holecenter holenormal holeradius))
;holecutoutface
(define holecutoutbody (sweep:law holecutoutface blockthickness))
;holecutoutbody
(bool:subtract baseblock holecutoutbody)
;#[entity 1 1]
;Blend one side
(define blendface (pick:face (ray (position -60.1 0 2.5) (gvector 1 0 0))))
;blendface
(define blendedgelist (entity:edges (car (entity:loops blendface))))
;blendedgelist
(solid:blend-edges blendedgelist 1)
;(#[entity 1 1])
;Chamfer the other side
(define chamferface (pick:face (ray (position 60.1 0 2.5) (gvector -1 0 0))))
;chamferface
(define chamferedgelist (entity:edges (car (entity:loops chamferface))))
;chamferedgelist
(solid:chamfer-edges chamferedgelist 2)
;(#[entity 1 1])
; Create a spherical hole
(define sphere (solid:sphere (position -40 -20 blockthickness) 5))
;sphere
(bool:subtract baseblock sphere)
;#[entity 1 1]
; Sample creation is done 
; Now, do the defeaturing
(define newbody (list-ref (part:entities) 0))
;newbody
; Create a defeature_options object with "pause_after_recognize" set to TRUE
(define newdftopt (defeature:options "pause_after_recognize" #t "hole_max_dia" 20))
;newdftopt
; Make the first call which just recognizes features
(body:defeature newbody newdftopt )
;#[entity 1 1]
(print (defeature:get-num-features newdftopt ))
;4
; Make the second call which does the feature removal
(body:defeature newbody newdftopt )
;#[entity 1 1]

[Top]


defeature:clear-features

Action
Clears the user-specified feature parameter settings in the defeature_options object.
Filename
scm/scmextdft/dft_scm.cpp
APIs
None
Syntax
(defeature:clear-features defeature_options)
Arg Types
defeature_options defeature_options scheme object

Returns
None
Description
This extension clears the user-specified feature parameter settings in the defeature_options object and returns them to their default values.
Arguments
defeature_options is the scheme object to be queried.
Example
;Refer to (body:defeature) script to build sample part
;(#[entity 21 1])
(view:gl)
;#[view 4523106]
(define newbody (list-ref (part:entities) 0))
;newbody
; Do the feature recognition and removal
(define newdftopt (defeature:options "pause_after_recognize" #f "hole_max_dia" 20))
;newdftopt
(define (print-face inputface)
  (print inputface))
;print-face

(define (print-faces elist)
  (for-each print-face elist))
;print-faces

; Do the recognize and remove
(body:defeature newbody newdftopt)
;#[entity 21 1]
; Query for number of failed features
(define numfeatures (defeature:get-num-failed-features newdftopt))
;numfeatures
; Print out the type and all faces of the failed features
(do ((i 0 (+ i 1)))
    ((= i numfeatures) 'finish)
    (
      (print (defeature:get-failed-feature-type newdftopt i ))
     (print-faces (defeature:get-failed-feature newdftopt i))
      )
    )
;finish
; Clear all feature information in the options object
(defeature:clear-features newdftopt)
;()	

[Top]


defeature:clone

Action
Returns a clone of the defeature_options object.
Filename
scm/scmextdft/dft_scm.cpp
APIs
None
Syntax
(defeature:clone defeature_options)
Arg Types
defeature_options defeature_options scheme object

Returns
scheme-object
representing a cloned copy of the specified defeature_options object
Description
This extension returns a clone of the defeature_options.
Arguments
defeature_options contains options to control the defeaturing algorithm.
Example
;Refer to (body:defeature) script to build sample part
;(#[entity 6 1])
(view:gl)
;#[view 1836238]
(define newbody (list-ref (part:entities) 0))
;newbody
; Do the feature recognition and removal
(define olddftopt (defeature:options "pause_after_recognize" #f "hole_max_dia" 20))
;olddftopt
(define newdftopt (defeature:clone olddftopt))
;newdftopt
(define (print-face inputface)
  (print inputface))
;print-face

(define (print-faces elist)
  (for-each print-face elist))
;print-faces

; Do the recognize and remove
(body:defeature newbody newdftopt)
;#[entity 6 1]
; Query for number of failed features
(define numfeatures (defeature:get-num-failed-features newdftopt))
;numfeatures
(print numfeatures)
;0
; Print out the type and all faces of the failed features
(do ((i 0 (+ i 1)))
    ((= i numfeatures) 'finish)
    (
     (print (defeature:get-failed-feature-type newdftopt i ))
     (print-faces (defeature:get-failed-feature newdftopt i))
     )
   )

[Top]


defeature:get-blends-max-radius

Action
Retrieves the current blend_max_radius parameter setting in the specified defeature_options object.

Filename
scm/scmextdft/dft_scm.cpp

APIs
None

Syntax
(defeature:get-blends-max-radius defeature_options)

Arg Types
defeature_options defeature_options scheme object

Returns
real
Description
This extension retrieves the current blend_max_radius parameter setting in the specified defeature_options object.
Arguments
defeature_options is the scheme object to be queried.
Example
;Refer to (body:defeature) script to build sample part
;(#[entity 1 1])
(view:gl)
;#[view 5702882]
(define newbody (list-ref (part:entities) 0))
;newbody
; Create a defeature_options object with "pause_after_recognize" set to TRUE
(define newdftopt (defeature:options "pause_after_recognize" #t "hole_max_dia" 20))
;newdftopt
; This line will output the default value for "blend_max_radius"
;(print (defeature:get-blends-max-radius newdftopt ))
; 10

[Top]


defeature:get-chamfers-max-width

Action
Retrieves the current cham_max_width parameter setting in the specified defeature_options object.

Filename
scm/scmextdft/dft_scm.cpp

APIs
None

Syntax
(defeature:get-chamfers-max-width defeature_options)

Arg Types
defeature_options defeature_options

Returns
real
Description
This extension retrieves the current cham_max_width parameter setting in the specified defeature_options object.
Arguments
defeature_options is the scheme object to be queried.
Example
;Refer to (body:defeature) script to build sample part
;(#[entity 1 1])
(view:gl)
;#[view 1246330]
(define newbody (list-ref (part:entities) 0))
;newbody
; Create a defeature_options object with "pause_after_recognize" set to TRUE
(define newdftopt (defeature:options "pause_after_recognize" #t "hole_max_dia" 20))
;newdftopt
; This line will output the default value for "cham_max_width"
(print (defeature:get-chamfers-max-width newdftopt ))
;10

[Top]


defeature:get-failed-feature

Action
Retrieves a list of faces having the feature (specified by index) which could not be removed for the specified defeature_options object.
Filename
scm/scmextdft/dft_scm.cpp
APIs
None
Syntax
(defeature:get-failed-feature defeature_options index)
Arg Types
defeature_options defeature_options scheme object
index integer

Returns
Pair having a string
and a list of faces
Description
This extension retrieves a list of faces having the feature (specified by index) which could not be removed for the specified defeature_options object.
Arguments
defeature_options is the scheme object to be queried.


index is an integer value representing a particular feature from a list of features that failed to be removed.
Example
;Refer to (body:defeature) script to build sample part
;(#[entity 4 1])
(view:gl)
;#[view 2557204]
(define newbody (list-ref (part:entities) 0))
;newbody
; Do the feature recognition and removal
(define newdftopt (defeature:options "pause_after_recognize" #f "hole_max_dia" 20))
;newdftopt
(define (print-face inputface)
  (print inputface))
;print-face

(define (print-faces elist)
  (for-each print-face elist))
;print-faces
(define (show-output i)
  (
          (print (defeature:get-failed-feature-type newdftopt i ))
          (print-faces (defeature:get-failed-feature newdftopt i))
  )
)
;show-output
;Do the recognize and remove

(body:defeature newbody newdftopt)
;#[entity 4 1]
; Query for number of failed features
(define numfeatures (defeature:get-num-failed-features newdftopt))
;numfeatures
(print numfeatures)
;0
; Print out the type and all faces of the failed features
(do ((i 0 (+ i 1)))
    ((= i numfeatures) 'finish)
    (show-output i)
 )
;finish
		

[Top]


defeature:get-failed-feature-type

Action
Retrieves the type of feature which could not be removed, as specified by the defeature_options object and index.
Filename
scm/scmextdft/dft_scm.cpp
APIs
None
Syntax
(defeature:get-failed-feature-type defeature_options index)
Arg Types
defeature_options defeature_options scheme object
index integer

Returns
string
describing the type of feature
Description
This extension retrieves the type of feature which could not be removed, as specified by the defeature_options object and index.
Arguments
defeature_options is the scheme object to be queried.


index is an integer value representing a particular feature from a list of features that failed to be removed.
Example
;Refer to (body:defeature) script to build sample part
;(#[entity 4 1])
(view:gl)
;#[view 2557204]
(define newbody (list-ref (part:entities) 0))
;newbody
; Do the feature recognition and removal
(define newdftopt (defeature:options "pause_after_recognize" #f "hole_max_dia" 20))
;newdftopt
(define (print-face inputface)
  (print inputface))
;print-face

(define (print-faces elist)
  (for-each print-face elist))
;print-faces
(define (show-output i)
  (
          (print (defeature:get-failed-feature-type newdftopt i ))
          (print-faces (defeature:get-failed-feature newdftopt i))
  )
)
;show-output
;Do the recognize and remove

(body:defeature newbody newdftopt)
;#[entity 4 1]
; Query for number of failed features
(define numfeatures (defeature:get-num-failed-features newdftopt))
;numfeatures
(print numfeatures)
;0
; Print out the type and all faces of the failed features
(do ((i 0 (+ i 1)))
    ((= i numfeatures) 'finish)
    (show-output i)
 )
;finish
		

[Top]


defeature:get-feature

Action
Retrieves the list of faces having the recognized feature, as specified by the defeature_options object and index.
Filename
scm/scmextdft/dft_scm.cpp
APIs
None
Syntax
(defeature:get-feature defeature_options index)
Arg Types
defeature_options defeature_options scheme object
index integer

Returns
list of faces
Description
This extension retrieves the list of faces of the recognized feature, as specified by the defeature_options object and index.
Arguments
defeature_options is the scheme object to be queried.


index is an integer value representing a particular feature from a list of features that were recognized.
Example
;Refer to (body:defeature) script to build sample part
;(#[entity 22 1])
(view:gl)
;#[view 4064398]
(define newbody (list-ref (part:entities) 0))
;newbody
(define newdftopt (defeature:options "pause_after_recognize" #t "hole_max_dia" 20))
;newdftopt
;The actual call to keep-face
(define (keep-face inputface)
  (defeature:keep-face inputface #t newdftopt))
;keep-face
(define (keep-faces elist)
  (for-each keep-face elist))
;keep-faces

; Do the recognize

(body:defeature newbody newdftopt)
;#[entity 22 1]

; Query for number of recognized features

(define numfeatures (defeature:get-num-features newdftopt))
;numfeatures

; Look for the recognized hole feature and mark the faces in the hole features so they are not removed during the feature removal
(do ((i 0 (+ i 1)))
    ((= i numfeatures) 'finish)
    (if
      (test:equal  "hole" (defeature:get-feature-type newdftopt i ) "Not Equal")
      (keep-faces (defeature:get-feature newdftopt i))
      (print "Other Type")
   )
    )
;*** Error: Not Equal
;"Other Type"
;*** Error: Not Equal
;"Other Type"
;finish
; Do the actual defeaturing. The hole is not removed.
(define newbody (body:defeature newbody newdftopt))
;newbody
		

[Top]


defeature:get-feature-type

Action
Retrieves the recognized feature type, as specified by the defeature_options object and index.
Filename
scm/scmextdft/dft_scm.cpp
APIs
None
Syntax
(defeature:get-feature-type defeature_options index)
Arg Types
defeature_options defeature_options scheme object
index integer

Returns
string describing the type of feature
Description
This extension retrieves the recognized feature type, as specified by the defeature_options object and index.
Arguments
defeature_options is the scheme object to be queried.


index is an integer value representing a particular feature from a list of features that were recognized.
Example
;Refer to (body:defeature) script to build sample part
;(#[entity 22 1])
(view:gl)
;#[view 4064398]
(define newbody (list-ref (part:entities) 0))
;newbody
(define newdftopt (defeature:options "pause_after_recognize" #t "hole_max_dia" 20))
;newdftopt
;The actual call to keep-face
(define (keep-face inputface)
  (defeature:keep-face inputface #t newdftopt))
;keep-face
(define (keep-faces elist)
  (for-each keep-face elist))
;keep-faces

; Perform recognize

(body:defeature newbody newdftopt)
;#[entity 22 1]

; Query for number of recognized features

(define numfeatures (defeature:get-num-features newdftopt))
;numfeatures

; Look for the recognized hole feature and mark the faces in the hole features so that they are not removed during the feature removal
(do ((i 0 (+ i 1)))
    ((= i numfeatures) 'finish)
    (if
      (test:equal  "hole" (defeature:get-feature-type newdftopt i ) "Not Equal")
      (keep-faces (defeature:get-feature newdftopt i))
      (print "Other Type")
   )
    )
;*** Error: Not Equal
;"Other Type"
;*** Error: Not Equal
;"Other Type"
;finish
; Perform defeaturing. The hole is not removed.
(define newbody (body:defeature newbody newdftopt))
;newbody

[Top]


defeature:get-holes-max-dia

Action
Retrieves the current hole_max_dia parameter setting in the specified defeature_options object.

Filename
scm/scmextdft/dft_scm.cpp

APIs
None

Syntax
(defeature:get-holes-max-dia defeature_options)

Arg Types
defeature_options defeature_options scheme object

Returns
real
Description
This extension retrieves the current hole_max_dia parameter setting in the specified defeature_options object.
Arguments
defeature_options is the scheme object to be queried.
Example
;Refer to (body:defeature) script to build sample part
;(#[entity 1 1])
(view:gl)
;#[view 2884706]
(define newbody (list-ref (part:entities) 0))
;newbody
; Create a defeature_options object with "pause_after_recognize" set to TRUE
(define newdftopt (defeature:options "pause_after_recognize" #t "hole_max_dia" 20))
;newdftopt
; This line outputs the set value of "hole_max_dia"  which is 20
(print (defeature:get-holes-max-dia newdftopt ))
;20

[Top]


defeature:get-kept-faces

Action
Queries the defeature_options object for all faces to be kept (that is, to be not removed) during the feature removal process.
Filename
scm/scmextdft/dft_scm.cpp
APIs
None
Syntax
(defeature:get-kept-faces defeature_options)
Arg Types
defeature_options defeature_options scheme object

Returns
list of faces
Description
This extension queries the defeature_options object for all faces to be kept (that is, to be not removed) during the feature removal process.
Arguments
defeature_options is the scheme object to be queried.
Example
;Refer to (body:defeature) script to build sample part
;(#[entity 18 1])
(view:gl)
;#[view 4457570]
(define newbody (list-ref (part:entities) 0))
;newbody
(define newdftopt (defeature:options "pause_after_recognize" #t "hole_max_dia" 20))
;newdftopt
;The actual call to keep-face
(define (keep-face inputface)
  (defeature:keep-face inputface #t newdftopt))
;keep-face
(define (keep-faces elist)
  (for-each keep-face elist))
;keep-faces
; Do the recognize
(body:defeature newbody newdftopt)
;#[entity 18 1]
; Query for number of recognized features
(define numfeatures (defeature:get-num-features newdftopt))
;numfeatures
; Look for the recognized hole feature and mark the faces in the hole features so that they are not removed during the feature removal
(do ((i 0 (+ i 1)))
    ((= i numfeatures) 'finish)
    (if
      (test:equal  "hole" (defeature:get-feature-type newdftopt i ) "Not Equal")
      (keep-faces (defeature:get-feature newdftopt i))
      )
    )
;*** Error: Not Equal
;*** Error: Not Equal
;finish
; Do the actual defeaturing
(define newbody (body:defeature newbody newdftopt))
;newbody
; Print list of kept faces
(define facelist (defeature:get-kept-faces newdftopt))
;facelist
(define (printface inputface) (print inputface) )
;printface
(for-each printface facelist)
;#[entity 19 1]
;#[entity 20 1]
;()

[Top]


defeature:get-num-failed-features

Action
Retrieves the number of features that failed to be removed by the call to body:defeature, even though they were marked for removal by the do_remove parameter set to true.
Filename
scm/scmextdft/dft_scm.cpp
APIs
None
Syntax
(defeature:get-num-failed-features defeature_options)
Arg Types
defeature_options defeature_options scheme object

Returns
integer
Description
This extension retrieves the number of features that failed to be removed by the call to body:defeature, even though they were marked for removal by the do_remove parameter set to true. The parameter setting is in the specified defeature_options object.
Arguments
defeature_options is the scheme object to be queried.
Limitations
This call is valid only when feature removal has been completed.
Example
;Refer to (body:defeature) script to build sample part
;(#[entity 1 1])
(view:gl)
;#[view 4064432]
(define newbody (list-ref (part:entities) 0))
;newbody
; Create a defeature_options object with "pause_after_recognize" set to TRUE
(define newdftopt (defeature:options "pause_after_recognize" #t "hole_max_dia" 20))
;newdftopt
; Make the first call which just recognizes features
(body:defeature newbody newdftopt )
;#[entity 1 1]
(print (defeature:get-num-features newdftopt ))
;3
; Make the second call which does the feature removal
(body:defeature newbody newdftopt )
;#[entity 1 1]
(print (defeature:get-num-failed-features newdftopt ))
;0

[Top]


defeature:get-num-features

Action
Retrieves the number of features recognized by the call to body:defeature.
Filename
scm/scmextdft/dft_scm.cpp
APIs
None
Syntax
(defeature:get-num-features defeature_options)
Arg Types
defeature_options defeature_options scheme object

Returns
integer
Description
This extension retrieves the number of features recognized by the call to body:defeature.
Arguments
defeature_options is the scheme object to be queried.
Limitations
This call is valid only when feature recognition has been completed and feature removal has not yet been completed.
Example
;Refer to (body:defeature) script to build sample part
;(#[entity 1 1])
(view:gl)
;#[view 2819248]
(define newbody (list-ref (part:entities) 0))
;newbody
; create a defeature_options object with "pause_after_recognize" set to true
(define newdftopt (defeature:options "pause_after_recognize" #t "hole_max_dia" 20))
;newdftopt
; make the first call which just recognizes features
(body:defeature newbody newdftopt )
;#[entity 1 1]
(print (defeature:get-num-features newdftopt ))
;3
; make the second call which does the feature removal
(body:defeature newbody newdftopt )
;#[entity 1 1]
(print (defeature:get-num-failed-features newdftopt ))
;0

[Top]


defeature:get-recognize-blends

Action
Retrieves the current recognize_blends parameter setting in the specified defeature_options object.

Filename
scm/scmextdft/dft_scm.cpp

APIs
None

Syntax
(defeature:get-recognize-blends defeature_options)

Arg Types
defeature_options defeature_options

Returns
boolean
Description
This extension retrieves the recognize_blends parameter setting (true or false) in the specified defeature_options object.
Arguments
defeature_options is the scheme object to be queried.
Example
;Refer to (body:defeature) script to build sample part
;(#[entity 1 1])
(view:gl)
;#[view 2098370]
(define newbody (list-ref (part:entities) 0))
;newbody
; Create a defeature_options object with "pause_after_recognize" set to TRUE
(define newdftopt (defeature:options "pause_after_recognize" #t "hole_max_dia" 20))
;newdftopt
; This line will output #t because the default for "recognize_blends" is TRUE
(print (defeature:get-recognize-blends newdftopt ))
;#t

[Top]


defeature:get-recognize-chamfers

Action
Retrieves the current recognize_chamfers parameter setting in the specified defeature_options object.

Filename
scm/scmextdft/dft_scm.cpp

APIs
None

Syntax
(defeature:get-recognize-chamfers defeature_options)

Arg Types
defeature_options defeature_options

Returns
boolean
Description
This extension retrieves the current recognize_chamfers parameter setting (true or false) in the specified defeature_options object.
Arguments
defeature_options is the scheme object to be queried.
Example
;Refer to (body:defeature) script to build sample part
;(#[entity 1 1])
(view:gl)
;#[view 984186]
(define newbody (list-ref (part:entities) 0))
;newbody
; Create a defeature_options object with "pause_after_recognize" set to TRUE
(define newdftopt (defeature:options "pause_after_recognize" #t "hole_max_dia" 20))
;newdftopt
; This line will output #t because the default for "recognize_chamfers" is TRUE
(print (defeature:get-recognize-chamfers newdftopt ))
;#t

[Top]


defeature:get-recognize-done

Action
Queries whether feature recognition has been done (as specified in the options object).
Filename
scm/scmextdft/dft_scm.cpp
APIs
None
Syntax
(defeature:get-recognize-done defeature_options)
Arg Types
defeature_options defeature_options scheme object

Returns
boolean
Description
This extension queries whether feature recognition has been done (as specified in the options object).
Arguments
defeature_options is the scheme object to be queried.
Example
;Refer to (body:defeature) script to build sample part
;(#[entity 1 1])
(view:gl)
;#[view 4326576]
(define newbody (list-ref (part:entities) 0))
;newbody
; Create a defeature_options object with "pause_after_recognize" set to TRUE
(define newdftopt (defeature:options "pause_after_recognize" #t "hole_max_dia" 20))
;newdftopt
; Make the first call which just recognizes features
(body:defeature newbody newdftopt )
;#[entity 1 1]
(print (defeature:get-recognize-done newdftopt ))
;#t

[Top]


defeature:get-recognize-holes

Action
Retrieves the current recognize_holes parameter setting in the specified defeature_options object.

Filename
scm/scmextdft/dft_scm.cpp

APIs
None

Syntax
(defeature:get-recognize-holes defeature_options)

Arg Types
defeature_options defeature_options

Returns
boolean
Description
This extension retrieves the current recognize_holes parameter setting in the specified defeature_options object.
Arguments
defeature_options is the scheme object to be queried.
Example
;Refer to (body:defeature) script to build sample part
;(#[entity 2 1])
(view:gl)
;#[view 1836154]
(define newbody (list-ref (part:entities) 0))
;newbody
; Create a defeature_options object with "pause_after_recognize" set to TRUE
(define newdftopt (defeature:options "pause_after_recognize" #t "hole_max_dia" 20))
;newdftopt
; This line will output #t because the default for "recognize_holes" is TRUE
;(print (defeature:get-recognize-holes newdftopt ))

[Top]


defeature:get-recognize-spherical-holes

Action
Retrieves the current include_spherical_holes parameter setting in the specified defeature_options object.

Filename
scm/scmextdft/dft_scm.cpp

APIs
None

Syntax
(defeature:get-recognize-spherical-holes defeature_options)

Arg Types
defeature_options defeature_options

Returns
boolean
Description
This extension retrieves the current include_spherical_holes parameter setting in the specified defeature_options object.
Arguments
defeature_options is the scheme object to be queried.
Example
;Refer to (body:defeature) script to build sample part
;(#[entity 2 1])
(view:gl)
;#[view 6423796]
(define newbody (list-ref (part:entities) 0))
;newbody
; Create a defeature_options object with "pause_after_recognize" set to TRUE
(define newdftopt (defeature:options "pause_after_recognize" #t "hole_max_dia" 20))
;newdftopt
; This line will output #t because the default for "include_spherical_holes" is TRUE
(print (defeature:get-recognize-spherical-holes newdftopt ))
;#t

[Top]


defeature:get-remove-done

Action
Queries whether feature removal has been done for the specified options object.
Filename
scm/scmextdft/dft_scm.cpp
APIs
None
Syntax
(defeature:get-remove-done defeature_options)
Arg Types
defeature_options defeature_options scheme object

Returns
boolean
Description
This extension queries whether feature removal has been done for the specified options object.
Arguments
defeature_options is the scheme object to be queried.
Example
;Refer to (body:defeature) script to build sample part
;(#[entity 1 1])
(view:gl)
;#[view 2032834]
(define newbody (list-ref (part:entities) 0))
;newbody
; Create a defeature_options object with "pause_after_recognize" set to TRUE
(define newdftopt (defeature:options "pause_after_recognize" #t "hole_max_dia" 20))
;newdftopt
; Make the first call which just recognizes features
(body:defeature newbody newdftopt )
;#[entity 1 1]
; The following line prints #f
(print (defeature:get-remove-done newdftopt ))
;#f
; Make the second call which does the feature removal
(body:defeature newbody newdftopt )
;#[entity 1 1]
; The following line prints #t
(print (defeature:get-remove-done newdftopt ))
;#t

[Top]


defeature:keep-face

Action
Marks a face so that any feature containing it is not removed during the feature removal process.
Filename
scm/scmextdft/dft_scm.cpp
APIs
None
Syntax
(defeature:keep-face feature_face [keep_it] defeature_options)
Arg Types
feature_face FACE
keep_it boolean
defeature_options defeature_options scheme object

Returns
void (indicates unspecified)
Description
This extension marks a face so that any feature containing it is not removed during the feature removal process.
Arguments
feature_face is the face not to be removed.


keep_it specifies whether the specified face is to be removed. Valid values are #t (true) and #f (false). The default value is #t.


defeature_options is the scheme object to be queried.
Example
;Refer to (body:defeature) script to build sample part
;(#[entity 6 1])
(view:gl)
;#[view 7013620]
(define newbody (list-ref (part:entities) 0))
;newbody
(define newdftopt (defeature:options "pause_after_recognize" #t "hole_max_dia" 20))
;newdftopt
;The actual call to keep-face
(define (keep-face inputface)
   (defeature:keep-face inputface #t newdftopt))
;keep-face
 (define (keep-faces elist)
   (for-each keep-face elist))
;keep-faces
; Do the recognize
(body:defeature newbody newdftopt)
;#[entity 6 1]
; Query for number of recognized features
(define numfeatures (defeature:get-num-features newdftopt))
;numfeatures
; Look for the recognized hole feature and mark the faces in the hole features so they are not removed during the feature removal
(do ((i 0 (+ i 1)))
     ((= i numfeatures) 'finish)
     (if
       (test:equal  "hole" (defeature:get-feature-type newdftopt i ) "Not Equal")
       (keep-faces (defeature:get-feature newdftopt i))
       (print "Other Type")
    )
  )
;*** Error: Not Equal
;"Other Type"
;*** Error: Not Equal
;"Other Type"
;finish
; Do the actual defeaturing. The hole is not removed.
(define newbody (body:defeature newbody newdftopt))
;newbody		

[Top]


defeature:kept-face

Action
Queries whether a face was kept.
Filename
scm/scmextdft/dft_scm.cpp
APIs
None
Syntax
(defeature:kept-face feature_face defeature_options)
Arg Types
feature_face FACE
defeature_options defeature_options scheme object

Returns
boolean
Description
This extension queries whether a face was kept during the feature removal process.
Arguments
feature_face is the face to be queried whether it was removed.


defeature_options is the scheme object to be queried.
Example
;Refer to (body:defeature) script to build sample part
(view:gl)
;#[view 2294926]
(define newbody (list-ref (part:entities) 0))
;newbody
(define newdftopt (defeature:options "pause_after_recognize" #t "hole_max_dia" 20))
;newdftopt
;The actual call to keep-face
(define (keep-face inputface)
  (defeature:keep-face inputface #t newdftopt))
;keep-face
(define (keep-faces elist)
  (for-each keep-face elist))
;keep-faces
; Do the recognize
(body:defeature newbody newdftopt)
;#[entity 9 1]
; Query for number of recognized features
(define numfeatures (defeature:get-num-features newdftopt))
;numfeatures
; Look for the recognized hole feature and mark the faces in the hole features so they are not removed during the feature removal

(do ((i 0 (+ i 1)))
    ((= i numfeatures) 'finish)
    (if
      (test:equal  "hole" (defeature:get-feature-type newdftopt i ) "Not Equal")
      (keep-faces (defeature:get-feature newdftopt i))
      (print "Other Type")
   )
    )
;*** Error: Not Equal
;"Other Type"
;*** Error: Not Equal
;"Other Type"
;finish
; Do the actual defeaturing. The hole is not removed.
(define newbody (body:defeature newbody newdftopt))
;newbody
; Query and print list of kept faces
(define facelist (entity:faces newbody))
;facelist
(define (printface inputface) (if (defeature:kept-face inputface newdftopt)
                                  (print inputface)
                                  ))
;printface

(for-each printface facelist)
;#[entity 10 1]
;#[entity 11 1]
;()

[Top]


defeature:options

Action
Sets the options in the data structure to be used by body:defeature.
Filename
scm/scmextdft/dft_scm.cpp
APIs
None
Syntax
(defeature:options "name-of-option" {value})
Arg Types
"name-of-option" string
value real | boolean | integer

Returns
defeature_options
Description
This extension defines elements in the defeature_options data structure that are later used for body:defeature.
Arguments
"name-of-option" is a string placed within quotation marks. Multiple pairs of "name-of-option" and its value can be specified simultaneously.


value is either a real, boolean, or integer. If value is a real, the argument does not require delimiters.

Valid values for "name-of-option" and for value include:

"name-of-option" value
pause_after_recognize boolean
recognize_blends boolean
blend_max_radius real
blend_num_curvature_samples integer
recognize_chamfers boolean
cham_max_width real
recognize_holes boolean
hole_max_dia real
include_spherical_holes boolean
;(#[entity 1 1])
(view:gl)
;#[view 1639572]
(define newbody (list-ref (part:entities) 0))
;newbody
; Create a defeature_options object with "pause_after_recognize" set to FALSE (Default is FALSE)
; Configure the options object such that only holes are recognized
(define newdftopt (defeature:options "hole_max_dia" 20 "recognize_blends" #f "recognize_chamfers" #f))
;newdftopt
; Make the defeaturing call which recognizes and removes features
(body:defeature newbody newdftopt )
;#[entity 1 1]
(print (defeature:get-num-failed-features newdftopt ))
;0

[Top]