[brlcad-commits] SF.net SVN: brlcad:[33827] brlcad/trunk
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <br...@us...> - 2009-02-19 19:29:20
|
Revision: 33827 http://brlcad.svn.sourceforge.net/brlcad/?rev=33827&view=rev Author: brlcad Date: 2009-02-19 19:29:16 +0000 (Thu, 19 Feb 2009) Log Message: ----------- change pc_mk_constraint() to mk_constraint() since it was moved into libwdb, making it consistent with the others. update the pc_test example to use it. Modified Paths: -------------- brlcad/trunk/include/wdb.h brlcad/trunk/src/libwdb/constraint.c brlcad/trunk/src/util/pc_test.c Modified: brlcad/trunk/include/wdb.h =================================================================== --- brlcad/trunk/include/wdb.h 2009-02-19 19:10:45 UTC (rev 33826) +++ brlcad/trunk/include/wdb.h 2009-02-19 19:29:16 UTC (rev 33827) @@ -216,6 +216,14 @@ WDB_EXPORT WDB_EXTERN(int mk_ars, (struct rt_wdb *fp, const char *name, int ncurves, int pts_per_curve, fastf_t *curves[]) ); +/** + * Given the appropriate parameters, makes the non-geometric + * constraint object and writes it to the database using + * wdb_put_internal. Only supported on database version 5 or above + */ +WDB_EXPORT WDB_EXTERN(int mk_constraint, (struct rt_wdb *wdbp, const char *name, const char *expr)); + + typedef enum { WDB_BINUNIF_FLOAT, WDB_BINUNIF_DOUBLE, Modified: brlcad/trunk/src/libwdb/constraint.c =================================================================== --- brlcad/trunk/src/libwdb/constraint.c 2009-02-19 19:10:45 UTC (rev 33826) +++ brlcad/trunk/src/libwdb/constraint.c 2009-02-19 19:29:16 UTC (rev 33827) @@ -1,4 +1,4 @@ -/* P C _ M A I N . C +/* C O N S T R A I N T . C * BRL-CAD * * Copyright (c) 2008-2009 United States Government as represented by @@ -19,13 +19,10 @@ */ /** @addtogroup pcdbio */ /** @{ */ -/** @file pc_main.c +/** @file constraint.c * * @brief External C Routines of Parametrics and Constraints API * - * @author Dawn Thomas - * - * */ #include "common.h" @@ -34,44 +31,33 @@ #include "raytrace.h" #include "wdb.h" -#include "pc.h" -/** - * PC_MK_CONSTRAINT - * - * Given the appropriate parameters, makes the non-geometric - * constraint object and writes it to the database using - * wdb_put_internal. Only supported on database version 5 or above - * - */ + int -pc_mk_constraint( - struct rt_wdb *wdbp, - const char *name, - const char *expr ) +mk_constraint(struct rt_wdb *wdbp, const char *name, const char *expr) { - struct rt_db_internal intern; + struct rt_db_internal intern; struct rt_constraint_internal *constraint; RT_CK_WDB(wdbp); RT_INIT_DB_INTERNAL(&intern); + /* Create a fresh new object for export */ - BU_GETSTRUCT( constraint, rt_constraint_internal ); + BU_GETSTRUCT(constraint, rt_constraint_internal); constraint->magic = RT_CONSTRAINT_MAGIC; - /* bu_vls_init( &constraint->shader );*/ + intern.idb_major_type = DB5_MAJORTYPE_BRLCAD; intern.idb_type = ID_CONSTRAINT; intern.idb_ptr = (genptr_t)constraint; intern.idb_meth = &rt_functab[ID_CONSTRAINT]; - /* Add data */ - constraint->id=1432; - constraint->type=323; + /* Add data */ + constraint->id=1432; + constraint->type=323; /* The internal representation will be freed */ - return wdb_put_internal( wdbp, name, &intern, mk_conv2mm ); - /*return wdb_export(wdbp,name,(genptr_t) constraint,ID_CONSTRAINT, mk_conv2mm);*/ + return wdb_put_internal(wdbp, name, &intern, mk_conv2mm); } /** @} */ Modified: brlcad/trunk/src/util/pc_test.c =================================================================== --- brlcad/trunk/src/util/pc_test.c 2009-02-19 19:10:45 UTC (rev 33826) +++ brlcad/trunk/src/util/pc_test.c 2009-02-19 19:29:16 UTC (rev 33827) @@ -46,7 +46,7 @@ int main(int argc, char **argv) { - int i,ret; + int i, ret; struct rt_wdb *fp; struct directory *dp; struct rt_db_internal ip; @@ -67,16 +67,16 @@ solnam[7] = '1'; solnam[8] = '\0'; - /*rt_init_resource(&rt_uniresource,0,NULL);*/ + /*rt_init_resource(&rt_uniresource, 0, NULL);*/ if (argc!=2) { - bu_exit(1,"Too few arguments, Please provide output filename\n"); + bu_exit(1, "Too few arguments, Please provide output filename\n"); } if ((fp = wdb_fopen(argv[1])) == NULL) { perror(argv[2]); return 1; } - mk_id(fp,"Parametrics test"); + mk_id(fp, "Parametrics test"); cent[0] = 3.4; cent[1] = 4.5; cent[2] = 5.3; @@ -99,13 +99,13 @@ rad = 153.2; mk_sph(fp, solnam, cent, rad); - if ((dp = db_lookup(fp->dbip,solnam,LOOKUP_QUIET)) == DIR_NULL) + if ((dp = db_lookup(fp->dbip, solnam, LOOKUP_QUIET)) == DIR_NULL) return 2; /*rt_db_get_internal(&intern, dp, fp->dbip, NULL, &rt_uniresource);*/ - pc_mk_constraint(fp,"Constraint",0); - if ((dp = db_lookup(fp->dbip,"Constraint",LOOKUP_QUIET)) == DIR_NULL) + mk_constraint(fp, "Constraint", 0); + if ((dp = db_lookup(fp->dbip, "Constraint", LOOKUP_QUIET)) == DIR_NULL) return 3; wdb_import(fp, &ip,solnam, (matp_t)NULL); ip.idb_meth->ft_params(&pcs,&ip); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |