Revision: 45887
http://brlcad.svn.sourceforge.net/brlcad/?rev=45887&view=rev
Author: brlcad
Date: 2011-08-10 06:12:35 +0000 (Wed, 10 Aug 2011)
Log Message:
-----------
and with this, we should now have all primitives getting written out
identically in brep and implicit form (export needed the idb_type to be set).
dsp is hozered, so disable.
Modified Paths:
--------------
brlcad/trunk/src/proc-db/csgbrep.cpp
Modified: brlcad/trunk/src/proc-db/csgbrep.cpp
===================================================================
--- brlcad/trunk/src/proc-db/csgbrep.cpp 2011-08-10 06:11:28 UTC (rev
45886)
+++ brlcad/trunk/src/proc-db/csgbrep.cpp 2011-08-10 06:12:35 UTC (rev
45887)
@@ -54,15 +54,26 @@
if (!fp || !ip || !name)
return;
+ /* write the object in implicit form */
+ struct bu_external ext;
+ int ret = rt_db_cvt_to_external5(&ext, name, ip, 1.0, fp->dbip,
&rt_uniresource, ip->idb_major_type);
+ if (ret) {
+ bu_log("ERROR: failure converting [%s] to external format\n", name);
+ return;
+ }
+ BU_CK_EXTERNAL(&ext);
+ int flags = db_flags_internal(ip);
+ ret = wdb_export_external(fp, &ext, name, flags, ip->idb_type);
+ if (ret) {
+ bu_log("ERROR: failure writing [%s] to disk\n", name);
+ return;
+ }
+
/* write the object in brep/nurbs form */
brep = ON_Brep::New();
ip->idb_meth->ft_brep(&brep, ip, tol);
mk_brep(fp, bname.c_str(), brep);
// delete brep;
-
- /* write the object in implicit form */
- ip->idb_meth = NULL; /* so we don't call ifree */
- wdb_put_internal(fp, name, ip, 1.0);
}
@@ -103,6 +114,7 @@
VSET(arb4.pt[6], -1000, 1000, -1000);
VSET(arb4.pt[7], -1000, 1000, -1000);
tmp_internal.idb_ptr = (genptr_t)&arb4;
+ tmp_internal.idb_type = ID_ARB8;
tmp_internal.idb_meth = &rt_functab[ID_ARB8];
write_out(outfp, &tmp_internal, "arb4", &tol);
@@ -118,6 +130,7 @@
VSET(arb5.pt[6], -1000, 0, 0);
VSET(arb5.pt[7], -1000, 0, 0);
tmp_internal.idb_ptr = (genptr_t)&arb5;
+ tmp_internal.idb_type = ID_ARB8;
tmp_internal.idb_meth = &rt_functab[ID_ARB8];
write_out(outfp, &tmp_internal, "arb5", &tol);
@@ -133,6 +146,7 @@
VSET(arb6.pt[6], -1000, 0, 1000);
VSET(arb6.pt[7], -1000, 0, 1000);
tmp_internal.idb_ptr = (genptr_t)&arb6;
+ tmp_internal.idb_type = ID_ARB8;
tmp_internal.idb_meth = &rt_functab[ID_ARB8];
write_out(outfp, &tmp_internal, "arb6", &tol);
@@ -148,6 +162,7 @@
VSET(arb7.pt[6], -1000, 1000, 500);
VSET(arb7.pt[7], -1000, -1000, -500);
tmp_internal.idb_ptr = (genptr_t)&arb7;
+ tmp_internal.idb_type = ID_ARB8;
tmp_internal.idb_meth = &rt_functab[ID_ARB8];
write_out(outfp, &tmp_internal, "arb7", &tol);
@@ -163,6 +178,7 @@
VSET(arb8.pt[6], -985, 1000, 1005);
VSET(arb8.pt[7], -985, -1000, 1005);
tmp_internal.idb_ptr = (genptr_t)&arb8;
+ tmp_internal.idb_type = ID_ARB8;
tmp_internal.idb_meth = &rt_functab[ID_ARB8];
write_out(outfp, &tmp_internal, "arb8", &tol);
@@ -188,6 +204,7 @@
VSET(arbn.eqn[7], -0.57735, -0.57735, -0.57735);
arbn.eqn[7][3] = 1000;
tmp_internal.idb_ptr = (genptr_t)&arbn;
+ tmp_internal.idb_type = ID_ARBN;
tmp_internal.idb_meth = &rt_functab[ID_ARBN];
write_out(outfp, &tmp_internal, "arbn", &tol);
bu_free(arbn.eqn, "free arbn eqn");
@@ -218,10 +235,12 @@
ttol.rel = 0.01;
ttol.norm = 0.0;
tmp_internal.idb_ptr = (genptr_t)&arbnmg8;
+ tmp_internal.idb_type = ID_ARB8;
tmp_internal.idb_meth = &rt_functab[ID_ARB8];
tmp_internal.idb_meth->ft_tessellate(&r, m, &tmp_internal, &ttol, &tol);
tmp_internal.idb_ptr = m;
+ tmp_internal.idb_type = ID_NMG;
tmp_internal.idb_meth = &rt_functab[ID_NMG];
write_out(outfp, &tmp_internal, "nmg", &tol);
FREE_MODEL(m);
@@ -234,6 +253,7 @@
VSET(sph.b, 0.0, 5.0, 0.0);
VSET(sph.c, 0.0, 0.0, 5.0);
tmp_internal.idb_ptr = (genptr_t)&sph;
+ tmp_internal.idb_type = ID_SPH;
tmp_internal.idb_meth = &rt_functab[ID_SPH];
write_out(outfp, &tmp_internal, "sph", &tol);
@@ -245,6 +265,7 @@
VSET(ell.b, 0.0, 3.0, 0.0);
VSET(ell.c, 0.0, 0.0, 1.0);
tmp_internal.idb_ptr = (genptr_t)ℓ
+ tmp_internal.idb_type = ID_ELL;
tmp_internal.idb_meth = &rt_functab[ID_ELL];
write_out(outfp, &tmp_internal, "ell", &tol);
@@ -257,6 +278,7 @@
rhc.rhc_r = 1000.0;
rhc.rhc_c = 400.0;
tmp_internal.idb_ptr = (genptr_t)&rhc;
+ tmp_internal.idb_type = ID_RHC;
tmp_internal.idb_meth = &rt_functab[ID_RHC];
write_out(outfp, &tmp_internal, "rhc", &tol);
@@ -270,6 +292,7 @@
VSCALE(rpc.rpc_B, rpc.rpc_B, 2000.0);
rpc.rpc_r = 1000.0;
tmp_internal.idb_ptr = (genptr_t)&rpc;
+ tmp_internal.idb_type = ID_RPC;
tmp_internal.idb_meth = &rt_functab[ID_RPC];
write_out(outfp, &tmp_internal, "rpc", &tol);
@@ -282,6 +305,7 @@
epa.epa_r1 = 1000.0;
epa.epa_r2 = 500.0;
tmp_internal.idb_ptr = (genptr_t)&epa;
+ tmp_internal.idb_type = ID_EPA;
tmp_internal.idb_meth = &rt_functab[ID_EPA];
write_out(outfp, &tmp_internal, "epa", &tol);
@@ -295,6 +319,7 @@
ehy.ehy_r2 = 500;
ehy.ehy_c = 400;
tmp_internal.idb_ptr = (genptr_t)&ehy;
+ tmp_internal.idb_type = ID_EHY;
tmp_internal.idb_meth = &rt_functab[ID_EHY];
write_out(outfp, &tmp_internal, "ehy", &tol);
@@ -307,6 +332,7 @@
hyp.hyp_b = 50;
hyp.hyp_bnr = 0.5;
tmp_internal.idb_ptr = (genptr_t)&hyp;
+ tmp_internal.idb_type = ID_HYP;
tmp_internal.idb_meth = &rt_functab[ID_HYP];
write_out(outfp, &tmp_internal, "hyp", &tol);
@@ -320,6 +346,7 @@
VSET(tgc.c, 250, 0, 0);
VSET(tgc.d, 0, 500, 0);
tmp_internal.idb_ptr = (genptr_t)&tgc;
+ tmp_internal.idb_type = ID_TGC;
tmp_internal.idb_meth = &rt_functab[ID_TGC];
write_out(outfp, &tmp_internal, "tgc", &tol);
@@ -331,6 +358,7 @@
tor.r_a = 5.0;
tor.r_h = 2.0;
tmp_internal.idb_ptr = (genptr_t)&tor;
+ tmp_internal.idb_type = ID_TOR;
tmp_internal.idb_meth = &rt_functab[ID_TOR];
write_out(outfp, &tmp_internal, "tor", &tol);
@@ -343,6 +371,7 @@
eto.eto_r = 800;
eto.eto_rd = 100;
tmp_internal.idb_ptr = (genptr_t)&eto;
+ tmp_internal.idb_type = ID_ETO;
tmp_internal.idb_meth = &rt_functab[ID_ETO];
write_out(outfp, &tmp_internal, "eto", &tol);
@@ -379,6 +408,7 @@
BU_LIST_INSERT(&pipe.pipe_segs_head, &pipe1[i].l);
}
tmp_internal.idb_ptr = (genptr_t)&pipe;
+ tmp_internal.idb_type = ID_PIPE;
tmp_internal.idb_meth = &rt_functab[ID_PIPE];
write_out(outfp, &tmp_internal, "pipe", &tol);
@@ -445,6 +475,7 @@
skt.curve.segment[5] = (genptr_t)&csg;
tmp_internal.idb_ptr = (genptr_t)&skt;
+ tmp_internal.idb_type = ID_SKETCH;
tmp_internal.idb_meth = &rt_functab[ID_SKETCH];
write_out(outfp, &tmp_internal, "sketch", &tol);
@@ -522,6 +553,7 @@
extrude.sketch_name = bu_strdup(esketch_name);
extrude.skt = &eskt;
tmp_internal.idb_ptr = (genptr_t)&extrude;
+ tmp_internal.idb_type = ID_EXTRUDE;
tmp_internal.idb_meth = &rt_functab[ID_EXTRUDE];
write_out(outfp, &tmp_internal, "extrude", &tol);
@@ -593,11 +625,15 @@
revolve.magic = RT_REVOLVE_INTERNAL_MAGIC;
VSET(revolve.v3d, -2000.0, 0.0, 0.0);
VSET(revolve.axis3d, 0.0, 1.0, 0.0);
+ BU_VLS_INIT(&revolve.sketch_name);
+ bu_vls_strcat(&revolve.sketch_name, "rsketch.brep");
revolve.sk = &rskt;
tmp_internal.idb_ptr = (genptr_t)&revolve;
+ tmp_internal.idb_type = ID_REVOLVE;
tmp_internal.idb_meth = &rt_functab[ID_REVOLVE];
write_out(outfp, &tmp_internal, "revolve", &tol);
+/*
bu_log("DSP\n");
struct rt_dsp_internal dsp;
dsp.magic = RT_DSP_INTERNAL_MAGIC;
@@ -614,9 +650,11 @@
dsp.dsp_bip = NULL;
dsp.dsp_datasrc = RT_DSP_SRC_FILE;
tmp_internal.idb_ptr = (genptr_t)&dsp;
+ tmp_internal.idb_type = ID_DSP;
tmp_internal.idb_meth = &rt_functab[ID_DSP];
write_out(outfp, &tmp_internal, "dsp", &tol);
bu_vls_free(&dsp.dsp_name);
+*/
/* clean up */
wdb_close(outfp);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model
configuration take the hassle out of deploying and managing Subversion and
the tools developers use with it. Learn more about uberSVN and get a free
download at: http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits