SchemeExt:Entity:spring-back
From DocR23
Contents |
Action
Modifies a body or list of bodies by performing a spring back warp.
Filename
scm/scmext/sb/spring_back_scm.cpp
APIs
api_spring_back, api_part_note_state, api_pm_start_state
Syntax
(entity:spring-back body-list sbd [sbo] [ao])
Argument Types
| Argument | Scheme Data Type |
|---|---|
| body-list | entity | (entity...) |
| sbd | spring-back-definition |
| sbo | spring-back-options |
| ao | acis-options |
Returns
entity | (entity...)
Description
The spring back operation is defined through the argument sbd, and allows the imposition of both shaping and fixed constraints involving curves, areas, and points. Optional behavior is obtained through sbo; this may be left unspecified if the default behavior is desired. The extension attempts to modify all bodies given by body-list, in a failsafe manner. That is, the extension performs all modifications that it can, regardless of any failures along the way. (Refer to Failsafe Behavior.)
Arguments
- body-list is the list of bodies to be deformed.
- sbd is the object defining the desired deformation.
- sbo is used to configure optional behavior.
- ao contains versioning and journaling information.
Example
; entity:spring-back ; Create a sheet body (define b (sheet:2d (sheet:face (face:plane (position 0 0 0) 10 10)))) ;; b ; Get its face, which we will set as "fixed" for the spring back (define f (car (entity:faces b))) ;; f ; Add an attached sheet, at an angle (define t (sheet:2d (sheet:face (face:plane (position 0 0 0) 10 10)))) ;; t (entity:transform t (transform:rotation (position 0 0 0) (gvector 0 1 0) -100)) ;; #[entity 5 1] (solid:unite b t) ;; #[entity 2 1] ; Define the edge to be moved (define edges (entity:edges b)) ;; edges (define e1 (list-ref edges 1)) ;; e1 ; Make a wire body containing the base curve (define eb1 (entity:copy e1)) ;; eb1 (define wb1 (wire-body eb1)) ;; wb1 ; Make a wire body containing the target curve (define et1 (entity:transform (entity:copy e1) (transform:translation (gvector 1 0 0)))) ;; et1 (define wt1 (wire-body et1)) ;; wt1 ; Define the press direction for the spring back (define g (gvector 0 0 -1)) ;; g ; Set base-, target-, and fixed-constraint lists (define wb-list (list wb1)) ;; wb-list (define wt-list (list wt1)) ;; wt-list (define wf-list (list f)) ;; wf-list ; Create a spring back definition (define sbd (spring-back:definition g)) ;; sbd ; Add constraints to the definition (spring-back-definition:add-shaping-constraint sbd wb-list wt-list) ;; () (spring-back-definition:add-fixed-constraint sbd wf-list) ;; () ; Define a default options object (define sbo (spring-back:options)) ;; sbo ; Perform the spring back (entity:spring-back b sbd sbo) ;; #[entity 2 1]