Scheme Extensions |
|
|
|
Technical Article |
||
| body | body or a list of bodies |
| dft-opts | defeature_options |
| acis-opts | acis-options |
;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_options | defeature_options scheme object |
;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_options | defeature_options scheme object |
;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_options | defeature_options scheme object |
;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_options | defeature_options |
;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_options | defeature_options scheme object |
| index | integer |
;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_options | defeature_options scheme object |
| index | integer |
;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_options | defeature_options scheme object |
| index | integer |
;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_options | defeature_options scheme object |
| index | integer |
;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_options | defeature_options scheme object |
;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_options | defeature_options scheme object |
;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_options | defeature_options scheme object |
;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_options | defeature_options scheme object |
;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_options | defeature_options |
;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_options | defeature_options |
;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_options | defeature_options scheme object |
;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_options | defeature_options |
;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_options | defeature_options |
;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_options | defeature_options scheme object |
;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]
| feature_face | FACE |
| keep_it | boolean |
| defeature_options | defeature_options scheme object |
;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]
| feature_face | FACE |
| defeature_options | defeature_options scheme object |
;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]
| "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]
© 1989-2007 Spatial Corp., a Dassault Systèmes company. All rights reserved.