Journaling

From DocR21

Jump to: navigation, search


The ACIS Journaling capability provides features for creation of "snapshots" for supported ACIS APIs. These are useful for bug reporting and debugging. ACIS Journaling creates both Scheme files and SAT files. The Scheme file contains script that loads SAT files and recreates the function calls. This file also defines positions, rational numbers, logicals, for example. The SAT file stores the ENTITYs that were passed as input to the function calls.

Using the ACIS Journaling capability, you can isolate the problem when a function does not perform as required. You can run the Scheme file created as output of ACIS Journaling in steps, to narrow down the scope of error. This provides a clear view of the values or topology that have been used in the API before it performs any operation.

Note: Ensure that FileInfois set before calling any journaled API as it will need to save a SAT file. We recommend doing this by calling api_set_file_info while initializing the modeler.


Contents

Journal File Name Convention

The journal files are, by default, created in the working directory. The default prefix for all of the files created (both SAT and Scheme files) is ACISJour. The full default file name for the Scheme file is of the form ACISJour_x.scm where x denotes the next index found in the directory where the journal file is stored. The full default file name for the SAT file is of the form ACISJour_x_y.sat where x and y are the next indices found in the directory where the journal file is stored.

If desired, you can assign a specific name to the journal files using the appropriate API. In such a case, the Scheme file will be assigned name.scm while the corresponding SAT files will be assigned name_x.sat where x is an incremental counter starting from zero. This API also provides the ability to set the x counter. For example, when you specify a name, myname and an index of 0, the Scheme file is named myname.scm and its corresponding SAT files are named myname_0.sat, myname_1.sat, myname_2.sat and so on. The next time when these files are created, the Scheme file is overwritten and the counter starts from zero for SAT files (hence, they are overwritten as well).

Important: Not all APIs are journaled. Refer to the Library Reference to verify whether the journaling capability is available for the API you wish to use.


Limitations

  • Embedded APIs are never journaled.
  • Results from previous journals cannot be used in new journals. The part is cleared and the arguments are loaded and/or defined before calling the APIs' Scheme extension.
  • Only APIs with Scheme extensions can be journaled.
  • Some APIs are meant to be used in sequences (for example, Skinning's slinterface). If journal is executed for a function within the sequence, the resulting script would lack previous information or initialization procedures.

Implementation

Classes

Functions

Scheme Extensions

Examples

Example 1

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.

Listing. C++ use of the snapshot journal
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_vertice5;
profile_vertice0 = SPAposition(1, -0.2, -0.2);
profile_vertice1 = SPAposition(1, -0.2, 0.2);
profile_vertice2 = SPAposition(1, 0.2, 0.2);
profile_vertice3 = SPAposition(1, 0.2, -0.2);
profile_vertice4 = 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_edge4;
api_mk_ed_line(SPAposition(0,0,0),
               SPAposition(1,0,0),
               profile_edge0);
api_mk_ed_line(SPAposition(0,0,0),
               SPAposition(0,2,0),
               profile_edge1);
api_mk_ed_line(SPAposition(0,2,0),
               SPAposition(1,2,0),
               profile_edge2);
api_mk_ed_ellipse(SPAposition(1, 1, 0), 
                  SPAunit_vector(0, 0, 1), 
                  SPAvector(0, -1, 0), 
                  1.0, 
                  0.0,
                  M_PI, profile_edge3);
BODY* e1 = NULL;
BODY* e2 = NULL;
BODY* e3 = NULL;
api_make_ewire(1, &profile_edge0, path);
api_make_ewire(1, &profile_edge1, e1);
api_make_ewire(1, &profile_edge2, e2);
api_make_ewire(1, &profile_edge3, 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;

Example 1 Output

Listing. Scheme output of snapshot journal
;<<<< ACIS Journal Copyright (c) by Spatial Corp.>>>>>
(view:delete)
(view:gl 0 0 500 500)
(view:edges )
(view:polygonoffset )
(view:vertices )
(option:set "match_paren" )
 
;+-  api_bool - unite ---+
; --
; Options not set to default value
(option:set "black_box" "one")
(option:set "breakup_debug_file" "e:/Debug/breakup_messages.txt")
(option:set "cap_pref" "old")
(option:set "catia_save_author" "")
(option:set "catia_save_model_name" "")
(option:set "cell_granularity" "manifold")
(option:set "d3_d" "data/")
(option:set "face_norm" )
(option:set "iges_dbt_file" "iges_04.dbt")
(option:set "intcurve_save_approx_level" "optimal")
(option:set "interrupt_action" "normal")
(option:set "match_paren" )
(option:set "miter_type" "new")
(option:set "mmgrfile" "mmgr.log")
(option:set "old_bs3_curve_debug" )
(option:set "restore_locale" "C")
(option:set "sketch_mesh" "face")
(option:set "sketch_tcoedge" "nominal")
(option:set "spline_save_approx_level" "optimal")
(option:set "ssi_files" "")
(option:set "stp_tool_path" "$A3DT/step/tools/nt")
(option:set "subset" "spline")
(option:set "validate_lop" "validate_and_lop")
; Note: remember that some options may be already
; set in previous snapshots
 
; --
(part:clear)
(part:load "JOURNAL_3D_0.sat")
(define tool (list-ref (part:entities) 0))
(entity:set-color tool 1)
(define blank (list-ref (part:entities) 1))
(entity:set-color blank 3)
(define boolBody (bool:unite blank tool ))
(iso)
(zoom-all)
 
;+-  api_bool - unite ---+
; --
; Options not set to default value
(option:set "black_box" "one")
(option:set "breakup_debug_file" "e:/Debug/breakup_messages.txt")
(option:set "cap_pref" "old")
(option:set "catia_save_author" "")
(option:set "catia_save_model_name" "")
(option:set "cell_granularity" "manifold")
(option:set "d3_d" "data/")
(option:set "face_norm" )
(option:set "iges_dbt_file" "iges_04.dbt")
(option:set "intcurve_save_approx_level" "optimal")
(option:set "interrupt_action" "normal")
(option:set "match_paren" )
(option:set "miter_type" "new")
(option:set "mmgrfile" "mmgr.log")
(option:set "old_bs3_curve_debug" )
(option:set "restore_locale" "C")
(option:set "sketch_mesh" "face")
(option:set "sketch_tcoedge" "nominal")
(option:set "spline_save_approx_level" "optimal")
(option:set "ssi_files" "")
(option:set "stp_tool_path" "$A3DT/step/tools/nt")
(option:set "subset" "spline")
(option:set "validate_lop" "validate_and_lop")
; Note: remember that some options may be already
; set in previous snapshots
 
; --
(part:clear)
(part:load "JOURNAL_3D_1.sat")
(define tool (list-ref (part:entities) 0))
(entity:set-color tool 1)
(define blank (list-ref (part:entities) 1))
(entity:set-color blank 3)
(define boolBody (bool:unite blank tool ))
(iso)
(zoom-all)
 
;+-  api_sweep_with_options - along a path --+
; --
; Options not set to default value
(option:set "black_box" "one")
(option:set "breakup_debug_file" "e:/Debug/breakup_messages.txt")
(option:set "cap_pref" "old")
(option:set "catia_save_author" "")
(option:set "catia_save_model_name" "")
(option:set "cell_granularity" "manifold")
(option:set "d3_d" "data/")
(option:set "face_norm" )
(option:set "iges_dbt_file" "iges_04.dbt")
(option:set "intcurve_save_approx_level" "optimal")
(option:set "interrupt_action" "normal")
(option:set "match_paren" )
(option:set "miter_type" "new")
(option:set "mmgrfile" "mmgr.log")
(option:set "old_bs3_curve_debug" )
(option:set "restore_locale" "C")
(option:set "sketch_mesh" "face")
(option:set "sketch_tcoedge" "nominal")
(option:set "spline_save_approx_level" "optimal")
(option:set "ssi_files" "")
(option:set "stp_tool_path" "$A3DT/step/tools/nt")
(option:set "subset" "spline")
(option:set "validate_lop" "validate_and_lop")
; Note: remember that some options may be already
; set in previous snapshots
 
; --
(part:clear)
(part:load "JOURNAL_3D_2.sat")
(define profile (list-ref (part:entities) 0))
(entity:set-color profile 1)
(entity:check profile)
(define path (list-ref (part:entities) 1))
(entity:set-color path 3)
(entity:check path)
(define options (sweep:options))
(zoom-all)
(define sweep (sweep:law profile path options))
(entity:check sweep)
(iso)
(zoom-all)
 
;+-  api_bool - unite ---+
; --
; Options not set to default value
(option:set "black_box" "one")
(option:set "breakup_debug_file" "e:/Debug/breakup_messages.txt")
(option:set "cap_pref" "old")
(option:set "catia_save_author" "")
(option:set "catia_save_model_name" "")
(option:set "cell_granularity" "manifold")
(option:set "d3_d" "data/")
(option:set "face_norm" )
(option:set "iges_dbt_file" "iges_04.dbt")
(option:set "intcurve_save_approx_level" "optimal")
(option:set "interrupt_action" "normal")
(option:set "match_paren" )
(option:set "miter_type" "new")
(option:set "mmgrfile" "mmgr.log")
(option:set "old_bs3_curve_debug" )
(option:set "restore_locale" "C")
(option:set "sketch_mesh" "face")
(option:set "sketch_tcoedge" "nominal")
(option:set "spline_save_approx_level" "optimal")
(option:set "ssi_files" "")
(option:set "stp_tool_path" "$A3DT/step/tools/nt")
(option:set "subset" "spline")
(option:set "validate_lop" "validate_and_lop")
; Note: remember that some options may be already
; set in previous snapshots
 
; --
(part:clear)
(part:load "JOURNAL_3D_3.sat")
(define tool (list-ref (part:entities) 0))
(entity:set-color tool 1)
(define blank (list-ref (part:entities) 1))
(entity:set-color blank 3)
(define boolBody (bool:unite blank tool ))
(iso)
(zoom-all)
 
;+-  api_bool - unite ---+
; --
; Options not set to default value
(option:set "black_box" "one")
(option:set "breakup_debug_file" "e:/Debug/breakup_messages.txt")
(option:set "cap_pref" "old")
(option:set "catia_save_author" "")
(option:set "catia_save_model_name" "")
(option:set "cell_granularity" "manifold")
(option:set "d3_d" "data/")
(option:set "face_norm" )
(option:set "iges_dbt_file" "iges_04.dbt")
(option:set "intcurve_save_approx_level" "optimal")
(option:set "interrupt_action" "normal")
(option:set "match_paren" )
(option:set "miter_type" "new")
(option:set "mmgrfile" "mmgr.log")
(option:set "old_bs3_curve_debug" )
(option:set "restore_locale" "C")
(option:set "sketch_mesh" "face")
(option:set "sketch_tcoedge" "nominal")
(option:set "spline_save_approx_level" "optimal")
(option:set "ssi_files" "")
(option:set "stp_tool_path" "$A3DT/step/tools/nt")
(option:set "subset" "spline")
(option:set "validate_lop" "validate_and_lop")
; Note: remember that some options may be already
; set in previous snapshots
 
; --
(part:clear)
(part:load "JOURNAL_3D_4.sat")
(define tool (list-ref (part:entities) 0))
(entity:set-color tool 1)
(define blank (list-ref (part:entities) 1))
(entity:set-color blank 3)
(define boolBody (bool:unite blank tool ))
(iso)
(zoom-all)
;<<<< ACIS Journal Completed

Example 2

The following example illustrates a journaling operation through Scheme extensions. In this example, the snapshot journal for a boolean and a blending operation is created from a Scheme script using the ACIS Journal and ACIS Option Scheme extensions.

Listing. Scheme journaling operation
(define j1 (acis_journal:set "file" "journal_bend3"))
(define ao (acisoptions:set "journal" j1))
(acis_journal:start ao)
(part:clear)
(define block1 (solid:block (position 0 0 0)(position 20 5 1)))
(bool:subtract block1 (solid:block (position 0 1 0)
	(position 20 4 1)) ao)
(solid:unite block1 (solid:cylinder (position 20 -4 .5)
	(position 20 8 .5) .6))
(bool:unite block1 (solid:block (position 11 0 0)
	(position 12 5 1)))
(bool:unite block1 (solid:block (position -2 -5 1)
	(position 6 10 3)))
 
(define block2 (solid:block (position 6 1 -8)(position 7 4 12)))
(bool:subtract block2 (solid:block (position 6 2 -8)
	(position 7 3 12)))
(solid:unite block2 (solid:cylinder (position 6.5 -4 -8)
	(position 6.5 8 -8) .6))
(solid:unite block2 (solid:block (position 4 -4 8)
	(position 6 9 16)))
 
(define wheel1 (bool:unite (solid:cylinder (position 0 0 0)
	(position 0 1 0) 1) (solid:cylinder (position 0 .5 0)
	(position 0 .5 2) .25)))
(define wheel2 (entity:copy wheel1))
(define wheel3 (entity:copy wheel1))
(define wheel4 (entity:copy wheel1))
(entity:rotate wheel3 0 1 0 -90)
(entity:rotate wheel4 0 1 0 -90)
(entity:move wheel1 20 -3 -2)
(bool:unite block1 wheel1)
(entity:move wheel2 20 7 -2)
(bool:unite block1 wheel2)
(entity:move wheel3 8.5 -4 -8)
(bool:unite block2 wheel3)
(entity:move wheel4 8.5 8 -8)
(bool:unite block2 wheel4)
 
(define root (position 12 0 0 ))
(define axis (gvector 0 1 0))
(define direction (gvector 0 0 1))
(entity:bend block1 root axis direction -1 60 8 ao)
 
(define root2 (position 7 1 -3))
(define axis2 (gvector 0 1 0))
(define direction2 (gvector 1 0 0))
(entity:bend block2 root2 axis2 direction2 -1 -60 5)
 
(define root3 (position 6 1 4))
(define axis3 (gvector 0 1 0))
(define direction3 (gvector -1 0 0))
(entity:bend block2 root3 axis3 direction3 -1 -60 4)
 
(bool:unite block1 block2)
 
(acis_journal:end ao)

Example 2 Output

Listing. Scheme journaling operation output
;<<<< ACIS Journal Copyright (c) by Spatial Corp.>>>>>
(view:delete)
(view:gl 0 0 500 500)
(view:edges #t)
(view:polygonoffset #t)
(view:vertices #t)
(option:set "match_paren" #f)
 
;+--------------  api_bool - subtract ---------------+
; --------------------------------------------------
; Options not set to default value
(option:set "black_box" "one")
(option:set "breakup_debug_file" "e:/Debug/breakup_messages.txt")
(option:set "cap_pref#erence" "old")
(option:set "catia_save_author" "")
(option:set "catia_save_model_name" "")
(option:set "cell_granularity" "manifold")
(option:set "d3_d#ata_dir" "data/")
(option:set "face_norm#als" #t)
(option:set "iges_dbt_file" "iges_04.dbt")
(option:set "intcurve_save_approx_level" "optimal")
(option:set "interrupt_action" "normal")
(option:set "match_paren" #f)
(option:set "miter_type" "new")
(option:set "mmgrfile" "mmgr.log")
(option:set "old_bs3_curve_debug" #f)
(option:set "restore_locale" "C")
(option:set "sketch_mesh" "face")
(option:set "sketch_tcoedge" "nominal")
(option:set "spline_save_approx_level" "optimal")
(option:set "ssi_files" "")
(option:set "stp_tool_path" "$A3DT/step/tools/nt")
(option:set "subset#ting" "spline")
(option:set "validate_lop" "validate_and_lop")
; Note: remember that some options may be already
; set in previous snapshots
 
; --------------------------------------------------
(part:clear)
(part:load "journal_bend3_0.sat")
(define tool (list-ref (part:entities) 0))
(entity:set-color tool 1)
(define blank (list-ref (part:entities) 1))
(entity:set-color blank 3)
(define boolBody (bool:subtract blank tool ))
(iso)
(zoom-all)
 
;+-----------------  api_bend_entity ---------------+
; --------------------------------------------------
(part:clear)
(part:load "journal_bend3_1.sat")
(define in_body (list-ref (part:entities) 0))
(define neutral_root (position 12.000000 0.000000 0.000000))
(define neutral_axis (gvector 0.000000 1.000000 0.000000))
(define bend_direction (gvector 0.000000 0.000000 1.000000))
(define radius -1.000000)
(define angle 60.000000)
(define width 8.000000)
(define center_bend #f)
(define bent_body (entity:bend in_body neutral_root neutral_axis bend_direction radius angle width center_bend ))
(iso)
(zoom-all)
;<<<< ACIS Journal Completed


See Also

Personal tools
Live