star-cad

Geometric operators for computer-aided design
git clone git://git.meso-star.fr/star-cad.git
Log | Files | Refs | README | LICENSE

commit b1370883d1c7ee17419589d20de45c36e8bf3de0
parent 81f446948e84c9365d8f8213275dc4057c1a4a75
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Mon,  9 Jan 2023 17:42:08 +0100

Add an option to help debugging star-cad auto-synchronize feature.

Diffstat:
Msrc/scad.c | 2+-
Msrc/scad.h | 3++-
Msrc/scad_device.c | 17++++++-----------
3 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/src/scad.c b/src/scad.c @@ -200,7 +200,7 @@ scad_synchronize } gmshModelOccSynchronize(&ierr); - get_device()->need_synchro = 0; + get_device()->need_synchro = dev->options.Misc.DebugOpenCascadeSync; ERR(gmsh_err_to_res_T(ierr)); exit: diff --git a/src/scad.h b/src/scad.h @@ -97,6 +97,7 @@ struct scad_options { int Step; /* Run UI when entering any scad API function; requires a FLTK-enabled gmsh build */ int SynchronizeOnRunUI; int LogOpenCascadeTagsRefCounting; + int DebugOpenCascadeSync; /* Systematic call to synchronize; if results change there is a sync bug in star-cad! */ } Misc; }; @@ -104,7 +105,7 @@ struct scad_options { { { Scad_frontal_Delaunay, Scad_surfaces_and_volumes, 1, 36, 1, 1e+22, 0, \ 1, Scad_one_solid_per_physical_surface }, \ { Scad_verbosity_errors, 1 }, \ - { 0, 0, 0 } \ + { 0, 0, 0, 0 } \ } static const struct scad_options SCAD_DEFAULT_OPTIONS = SCAD_DEFAULT_OPTIONS__; diff --git a/src/scad_device.c b/src/scad_device.c @@ -174,11 +174,7 @@ device_register_tags struct htable_tags2geom* t2g; struct htable_geometries* geoms; char one = 1; - if(dim != 2 && dim != 3) { - /* other dims not managed yet */ - res = RES_BAD_ARG; - goto error; - } + CHK(dim == 2 || dim == 3); /* other dims not managed yet */ /* Add geom to the geometries that use tag@dim */ t2g = g_device->tags2geom + (dim-2); geoms = htable_tags2geom_find(t2g, &tag); @@ -246,11 +242,7 @@ device_unregister_tags struct htable_tags2geom* t2g; struct htable_geometries* geoms; size_t n; - if(dim != 2 && dim != 3) { - /* other dims not managed yet */ - res = RES_BAD_ARG; - goto error; - } + CHK(dim == 2 || dim == 3); /* other dims not managed yet */ t2g = g_device->tags2geom + (dim-2); geoms = htable_tags2geom_find(t2g, &tag); n = htable_geometries_erase(geoms, &geom); @@ -267,6 +259,7 @@ device_unregister_tags if(log) { log_message(dev, "Dim %d tag %d removed.\n", dim, tag); } + gmshModelOccRemove(dimTags+i, 2, 1, &ierr); ERR(gmsh_err_to_res_T(ierr)); } @@ -313,11 +306,12 @@ scad_initialize } g_device->logger = logger ? logger : LOGGER_DEFAULT; g_device->allocator = allocator; + g_device->need_synchro = g_device->options.Misc.DebugOpenCascadeSync; + g_device->verbose = verbose; htable_names_init(allocator, &g_device->geometry_names); htable_geometries_init(allocator, &g_device->allgeom); htable_tags2geom_init(allocator, &g_device->tags2geom[0]); htable_tags2geom_init(allocator, &g_device->tags2geom[1]); - g_device->verbose = verbose; /* Init to default */ scad_set_options(NULL); @@ -411,6 +405,7 @@ scad_set_options (void)actual_options->Misc.Step; /* int boolean: always OK */ (void)actual_options->Misc.SynchronizeOnRunUI; /* int boolean: always OK */ (void)actual_options->Misc.LogOpenCascadeTagsRefCounting; /* int boolean: always OK */ + (void)actual_options->Misc.DebugOpenCascadeSync; /* int boolean: always OK */ } dev->options = *actual_options;