The following example illustrates the use of the snapshot journal. The AcisOptions object is created and the name JOURNAL_3D is assigned. The AcisOptions object is passed into every API (remember that this object also contains the version information). The journal is inactive until
api_start_journal is called. The function produces scripts only after the journal is enabled. The journal operation can be paused, resumed or ended.
|
|
This example generates
JOURNAL_3D.scm and five SAT files - JOURNAL_3D_0.sat,
JOURNAL_3D_1.sat,
JOURNAL_3D_2.sat,
JOURNAL_3D_3.sat,
JOURNAL_3D_4.sat.
JOURNAL_3D.scm contains the snapshots of five API calls. The options set in the scheme file might vary depending on the state of
ACIS.
|
|
BODY*
|
|
|
profile
|
|
= NULL;
|
BODY*
|
|
|
path
|
|
= NULL;
|
BODY*
|
|
|
new_body
|
|
= NULL;
|
AcisOptions*
|
acis_options
|
= NULL;
|
|
acis_options = ACIS_NEW AcisOptions();
|
api_set_journal_name(acis_options,"JOURNAL_3D");
|
api_start_journal(acis_options);
|
|
sweep_options swopts;
|
|
// Create a profile
|
position profile_vertice[5];
|
profile_vertice[0] = SPAposition(1, -0.2, -0.2);
|
profile_vertice[1] = SPAposition(1, -0.2, 0.2);
|
profile_vertice[2] = SPAposition(1, 0.2, 0.2);
|
profile_vertice[3] = SPAposition(1, 0.2, -0.2);
|
profile_vertice[4] = SPAposition(1, -0.2, -0.2);
|
api_make_wire(NULL,5,profile_vertice,profile);
|
|
// Create a path
|
// This algorithm can be done easier,
|
// but for illustrating the boolean operations
|
|
EDGE* profile_edge[4];
|
api_mk_ed_line(SPAposition(0,0,0), SPAposition(1,0,0),
|
|
|
|
profile_edge[0]);
|
api_mk_ed_line(SPAposition(0,0,0), SPAposition(0,2,0),
|
|
|
|
profile_edge[1]);
|
api_mk_ed_line(SPAposition(0,2,0), SPAposition(1,2,0),
|
|
|
|
profile_edge[2]);
|
api_mk_ed_ellipse(SPAposition(1,1,0), SPAunit_vector(0,0,1),
|
|
|
|
SPAvector(0,-1,0), 1.0, 0.0, M_PI,profile_edge[3]);
|
BODY* e1 = NULL;
|
BODY* e2 = NULL;
|
BODY* e3 = NULL;
|
api_make_ewire(1,&profile_edge[0], path);
|
api_make_ewire(1,&profile_edge[1], e1);
|
api_make_ewire(1,&profile_edge[2], e2);
|
api_make_ewire(1,&profile_edge[3], e3);
|
api_unite(e1, path, acis_options);
|
|
api_pause_journal(acis_options);
|
api_unite(e2, path, acis_options);
|
|
api_resume_journal(acis_options);
|
api_unite(e3, path, acis_options);
|
api_sweep_with_options(profile,path,&swopts,new_body, acis_options);
|
|
BODY* d2 = NULL;
|
BODY* d3 = NULL;
|
api_copy_entity(profile, (ENTITY*&)d2);
|
api_copy_entity(profile, (ENTITY*&)d3);
|
api_transform_entity(d2,rotate_transf(-M_PI/2,SPAvector(1,0,0)));
|
api_transform_entity(d2,rotate_transf(-M_PI/2,SPAvector(0,0,1)));
|
api_transform_entity(d2,translate_transf(SPAvector(0,0,2)));
|
api_transform_entity(d3,rotate_transf(M_PI/2,SPAvector(0,1,0)));
|
api_transform_entity(d3,rotate_transf(M_PI/2,SPAvector(0,0,1)));
|
|
api_unite(d2, profile, acis_options);
|
api_unite(d3, profile, acis_options);
|
api_end_journal(acis_options);
|
ACIS_DELETE acis_options;
|