Added make_name and make commands to libged.
svn:revision:31110 svn:branch:trunk svn:account:bob1961
This commit is contained in:
1 parent
b2891246a9
commit
b586ade52b
9 files changed
+1033
-828
No files matched your search
+16
-5
@@ -350,11 +350,6 @@ GED_EXPORT BU_EXTERN(int wdb_make_bb_cmd,
|
||||
Tcl_Interp *interp,
|
||||
int argc,
|
||||
char **argv));
|
||||
GED_EXPORT BU_EXTERN(int wdb_make_name_cmd,
|
||||
(struct rt_wdb *wdbp,
|
||||
Tcl_Interp *interp,
|
||||
int argc,
|
||||
char **argv));
|
||||
GED_EXPORT BU_EXTERN(int wdb_units_cmd,
|
||||
(struct rt_wdb *wdbp,
|
||||
Tcl_Interp *interp,
|
||||
@@ -703,6 +698,22 @@ GED_EXPORT BU_EXTERN(int ged_item, (struct rt_wdb *wdbp, int argc, const char *a
|
||||
*/
|
||||
GED_EXPORT BU_EXTERN(int ged_log, (struct rt_wdb *wdbp, int argc, const char *argv[]));
|
||||
|
||||
/**
|
||||
* Make a new primitive.
|
||||
*
|
||||
* Usage:
|
||||
* make obj type
|
||||
*/
|
||||
GED_EXPORT BU_EXTERN(int ged_make, (struct rt_wdb *wdbp, int argc, char *argv[]));
|
||||
|
||||
/**
|
||||
* Make a unique object name.
|
||||
*
|
||||
* Usage:
|
||||
* make_name template | -s [num]
|
||||
*/
|
||||
GED_EXPORT BU_EXTERN(int ged_make_name, (struct rt_wdb *wdbp, int argc, char *argv[]));
|
||||
|
||||
/**
|
||||
* Modify material information.
|
||||
*
|
||||
|
||||
@@ -157,6 +157,14 @@
|
||||
RelativePath="..\..\..\src\libged\log.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\src\libged\make.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\src\libged\make_name.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\src\libged\mater.c"
|
||||
>
|
||||
|
||||
@@ -7,6 +7,8 @@ set(LIBGED_SOURCES
|
||||
importFg4Section.c
|
||||
item.c
|
||||
log.c
|
||||
make.c
|
||||
make_name.c
|
||||
mater.c
|
||||
mirror.c
|
||||
nirt.c
|
||||
|
||||
@@ -11,6 +11,8 @@ libged_nil_la_SOURCES = \
|
||||
importFg4Section.c \
|
||||
item.c \
|
||||
log.c \
|
||||
make.c \
|
||||
make_name.c \
|
||||
mater.c \
|
||||
mirror.c \
|
||||
nirt.c \
|
||||
|
||||
@@ -0,0 +1,819 @@
|
||||
/* M A K E . C
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (c) 2008 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this file; see the file named COPYING for more
|
||||
* information.
|
||||
*/
|
||||
/** @file make.c
|
||||
*
|
||||
* The make command.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "rtgeom.h"
|
||||
#include "wdb.h"
|
||||
#include "ged.h"
|
||||
|
||||
int
|
||||
ged_make(struct rt_wdb *wdbp, int argc, char *argv[])
|
||||
{
|
||||
int status = GED_OK;
|
||||
int i;
|
||||
int k;
|
||||
int save_bu_optind;
|
||||
register struct directory *dp;
|
||||
fastf_t scale = 1;
|
||||
point_t origin = {0.0, 0.0, 0.0};
|
||||
struct rt_db_internal internal;
|
||||
struct rt_arb_internal *arb_ip;
|
||||
struct rt_ars_internal *ars_ip;
|
||||
struct rt_tgc_internal *tgc_ip;
|
||||
struct rt_ell_internal *ell_ip;
|
||||
struct rt_tor_internal *tor_ip;
|
||||
struct rt_grip_internal *grp_ip;
|
||||
struct rt_half_internal *half_ip;
|
||||
struct rt_rpc_internal *rpc_ip;
|
||||
struct rt_rhc_internal *rhc_ip;
|
||||
struct rt_epa_internal *epa_ip;
|
||||
struct rt_ehy_internal *ehy_ip;
|
||||
struct rt_eto_internal *eto_ip;
|
||||
struct rt_part_internal *part_ip;
|
||||
struct rt_pipe_internal *pipe_ip;
|
||||
struct rt_sketch_internal *sketch_ip;
|
||||
struct rt_extrude_internal *extrude_ip;
|
||||
struct rt_bot_internal *bot_ip;
|
||||
struct rt_arbn_internal *arbn_ip;
|
||||
struct rt_superell_internal *superell_ip;
|
||||
struct rt_metaball_internal *metaball_ip;
|
||||
static const char *usage = "-h | -t | -o origin -s sf name <arb8|arb7|arb6|arb5|arb4|arbn|ars|bot|ehy|ell|ell1|epa|eto|extrude|grip|half|nmg|part|pipe|rcc|rec|rhc|rpc|rpp|sketch|sph|tec|tgc|tor|trc>";
|
||||
|
||||
GED_CHECK_DBI_NULL(wdbp->dbip, GED_ERROR);
|
||||
GED_CHECK_READ_ONLY(wdbp->dbip, GED_ERROR);
|
||||
|
||||
/* initialize result */
|
||||
bu_vls_trunc(&wdbp->wdb_result_str, 0);
|
||||
wdbp->wdb_result = GED_RESULT_NULL;
|
||||
wdbp->wdb_result_flags = 0;
|
||||
|
||||
/* must be wanting help */
|
||||
if (argc == 1) {
|
||||
wdbp->wdb_result_flags |= GED_RESULT_FLAGS_HELP_BIT;
|
||||
bu_vls_printf(&wdbp->wdb_result_str, "Usage: %s %s", argv[0], usage);
|
||||
return GED_OK;
|
||||
}
|
||||
|
||||
bu_optind = 1;
|
||||
|
||||
/* Process arguments */
|
||||
while ((k = bu_getopt(argc, argv, "hHo:O:s:S:tT")) != EOF) {
|
||||
switch (k) {
|
||||
case 'o':
|
||||
case 'O':
|
||||
if (sscanf(bu_optarg, "%lf %lf %lf",
|
||||
&origin[X],
|
||||
&origin[Y],
|
||||
&origin[Z]) != 3) {
|
||||
bu_vls_printf(&wdbp->wdb_result_str, "Usage: %s %s", argv[0], usage);
|
||||
return GED_ERROR;
|
||||
}
|
||||
break;
|
||||
case 's':
|
||||
case 'S':
|
||||
if (sscanf(bu_optarg, "%lf", &scale) != 1) {
|
||||
bu_vls_printf(&wdbp->wdb_result_str, "Usage: %s %s", argv[0], usage);
|
||||
return GED_ERROR;
|
||||
}
|
||||
break;
|
||||
case 't':
|
||||
case 'T':
|
||||
if (argc == 2) {
|
||||
wdbp->wdb_result_flags |= GED_RESULT_FLAGS_HELP_BIT;
|
||||
bu_vls_printf(&wdbp->wdb_result_str, "arb8 arb7 arb6 arb5 arb4 arbn ars bot ehy ell ell1 epa eto extrude grip half nmg part pipe rcc rec rhc rpc rpp sketch sph tec tgc tor trc superell metaball");
|
||||
return GED_OK;
|
||||
}
|
||||
|
||||
bu_vls_printf(&wdbp->wdb_result_str, "Usage: %s %s", argv[0], usage);
|
||||
return GED_ERROR;
|
||||
case 'h':
|
||||
case 'H':
|
||||
wdbp->wdb_result_flags |= GED_RESULT_FLAGS_HELP_BIT;
|
||||
bu_vls_printf(&wdbp->wdb_result_str, "Usage: %s %s", argv[0], usage);
|
||||
return GED_OK;
|
||||
default:
|
||||
bu_vls_printf(&wdbp->wdb_result_str, "Usage: %s %s", argv[0], usage);
|
||||
return GED_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
argc -= bu_optind;
|
||||
|
||||
if (argc != 2) {
|
||||
bu_vls_printf(&wdbp->wdb_result_str, "Usage: %s %s", argv[0], usage);
|
||||
return GED_ERROR;
|
||||
}
|
||||
|
||||
save_bu_optind = bu_optind;
|
||||
|
||||
if (db_lookup(wdbp->dbip, argv[bu_optind], LOOKUP_QUIET) != DIR_NULL) {
|
||||
bu_vls_printf(&wdbp->wdb_result_str, "%s already exists", argv[bu_optind]);
|
||||
return GED_ERROR;
|
||||
}
|
||||
|
||||
RT_INIT_DB_INTERNAL(&internal);
|
||||
|
||||
if (strcmp(argv[bu_optind+1], "arb8") == 0 ||
|
||||
strcmp(argv[bu_optind+1], "rpp") == 0) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_ARB8;
|
||||
internal.idb_meth = &rt_functab[ID_ARB8];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc(sizeof(struct rt_arb_internal), "rt_arb_internal");
|
||||
arb_ip = (struct rt_arb_internal *)internal.idb_ptr;
|
||||
arb_ip->magic = RT_ARB_INTERNAL_MAGIC;
|
||||
VSET(arb_ip->pt[0] ,
|
||||
origin[X] +scale,
|
||||
origin[Y] -scale,
|
||||
origin[Z] -scale);
|
||||
for (i=1; i<8; i++)
|
||||
VMOVE(arb_ip->pt[i], arb_ip->pt[0]);
|
||||
arb_ip->pt[1][Y] += scale;
|
||||
arb_ip->pt[2][Y] += scale;
|
||||
arb_ip->pt[2][Z] += scale;
|
||||
arb_ip->pt[3][Z] += scale;
|
||||
for (i=4; i<8; i++)
|
||||
arb_ip->pt[i][X] -= scale;
|
||||
arb_ip->pt[5][Y] += scale;
|
||||
arb_ip->pt[6][Y] += scale;
|
||||
arb_ip->pt[6][Z] += scale;
|
||||
arb_ip->pt[7][Z] += scale;
|
||||
} else if (strcmp(argv[bu_optind+1], "arb7") == 0) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_ARB8;
|
||||
internal.idb_meth = &rt_functab[ID_ARB8];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc(sizeof(struct rt_arb_internal), "rt_arb_internal");
|
||||
arb_ip = (struct rt_arb_internal *)internal.idb_ptr;
|
||||
arb_ip->magic = RT_ARB_INTERNAL_MAGIC;
|
||||
VSET(arb_ip->pt[0] ,
|
||||
origin[X] + scale,
|
||||
origin[Y] - scale,
|
||||
origin[Z] - 0.5*scale);
|
||||
for (i=1; i<8; i++)
|
||||
VMOVE(arb_ip->pt[i], arb_ip->pt[0]);
|
||||
arb_ip->pt[1][Y] += scale;
|
||||
arb_ip->pt[2][Y] += scale;
|
||||
arb_ip->pt[2][Z] += scale;
|
||||
arb_ip->pt[3][Z] += 0.5*scale;
|
||||
for (i=4; i<8; i++)
|
||||
arb_ip->pt[i][X] -= scale;
|
||||
arb_ip->pt[5][Y] += scale;
|
||||
arb_ip->pt[6][Y] += scale;
|
||||
arb_ip->pt[6][Z] += 0.5*scale;
|
||||
} else if (strcmp(argv[bu_optind+1], "arb6") == 0) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_ARB8;
|
||||
internal.idb_meth = &rt_functab[ID_ARB8];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc(sizeof(struct rt_arb_internal), "rt_arb_internal");
|
||||
arb_ip = (struct rt_arb_internal *)internal.idb_ptr;
|
||||
arb_ip->magic = RT_ARB_INTERNAL_MAGIC;
|
||||
VSET(arb_ip->pt[0],
|
||||
origin[X] +scale,
|
||||
origin[Y] -scale,
|
||||
origin[Z] -scale);
|
||||
for (i=1; i<8; i++)
|
||||
VMOVE(arb_ip->pt[i], arb_ip->pt[0]);
|
||||
arb_ip->pt[1][Y] += scale;
|
||||
arb_ip->pt[2][Y] += scale;
|
||||
arb_ip->pt[2][Z] += scale;
|
||||
arb_ip->pt[3][Z] += scale;
|
||||
for (i=4; i<8; i++)
|
||||
arb_ip->pt[i][X] -= scale;
|
||||
arb_ip->pt[4][Y] += 0.5*scale;
|
||||
arb_ip->pt[5][Y] += 0.5*scale;
|
||||
arb_ip->pt[6][Y] += 0.5*scale;
|
||||
arb_ip->pt[6][Z] += scale;
|
||||
arb_ip->pt[7][Y] += 0.5*scale;
|
||||
arb_ip->pt[7][Z] += scale;
|
||||
} else if (strcmp(argv[bu_optind+1], "arb5") == 0) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_ARB8;
|
||||
internal.idb_meth = &rt_functab[ID_ARB8];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc(sizeof(struct rt_arb_internal), "rt_arb_internal");
|
||||
arb_ip = (struct rt_arb_internal *)internal.idb_ptr;
|
||||
arb_ip->magic = RT_ARB_INTERNAL_MAGIC;
|
||||
VSET(arb_ip->pt[0] ,
|
||||
origin[X] + scale,
|
||||
origin[Y] - scale,
|
||||
origin[Z] - scale);
|
||||
for (i=1; i<8; i++)
|
||||
VMOVE(arb_ip->pt[i], arb_ip->pt[0]);
|
||||
arb_ip->pt[1][Y] += scale;
|
||||
arb_ip->pt[2][Y] += scale;
|
||||
arb_ip->pt[2][Z] += scale;
|
||||
arb_ip->pt[3][Z] += scale;
|
||||
for (i=4; i<8; i++)
|
||||
{
|
||||
arb_ip->pt[i][X] -= scale;
|
||||
arb_ip->pt[i][Y] += 0.5*scale;
|
||||
arb_ip->pt[i][Z] += 0.5*scale;
|
||||
}
|
||||
} else if (strcmp(argv[bu_optind+1], "arb4") == 0) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_ARB8;
|
||||
internal.idb_meth = &rt_functab[ID_ARB8];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc(sizeof(struct rt_arb_internal), "rt_arb_internal");
|
||||
arb_ip = (struct rt_arb_internal *)internal.idb_ptr;
|
||||
arb_ip->magic = RT_ARB_INTERNAL_MAGIC;
|
||||
VSET(arb_ip->pt[0] ,
|
||||
origin[X] +scale,
|
||||
origin[Y] -scale,
|
||||
origin[Z] -scale);
|
||||
for (i=1; i<8; i++)
|
||||
VMOVE(arb_ip->pt[i], arb_ip->pt[0]);
|
||||
arb_ip->pt[1][Y] += scale;
|
||||
arb_ip->pt[2][Y] += scale;
|
||||
arb_ip->pt[2][Z] += scale;
|
||||
arb_ip->pt[3][Y] += scale;
|
||||
arb_ip->pt[3][Z] += scale;
|
||||
for (i=4; i<8; i++)
|
||||
{
|
||||
arb_ip->pt[i][X] -= scale;
|
||||
arb_ip->pt[i][Y] += scale;
|
||||
}
|
||||
} else if (strcmp(argv[bu_optind+1], "arbn") == 0) {
|
||||
point_t view_center;
|
||||
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_ARBN;
|
||||
internal.idb_meth = &rt_functab[ID_ARBN];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc(sizeof(struct rt_arbn_internal), "rt_arbn_internal");
|
||||
arbn_ip = (struct rt_arbn_internal *)internal.idb_ptr;
|
||||
arbn_ip->magic = RT_ARBN_INTERNAL_MAGIC;
|
||||
arbn_ip->neqn = 8;
|
||||
arbn_ip->eqn = (plane_t *)bu_calloc(arbn_ip->neqn,
|
||||
sizeof(plane_t), "arbn plane eqns");
|
||||
VSET(arbn_ip->eqn[0], 1, 0, 0);
|
||||
arbn_ip->eqn[0][3] = 0.5*scale;
|
||||
VSET(arbn_ip->eqn[1], -1, 0, 0);
|
||||
arbn_ip->eqn[1][3] = 0.5*scale;
|
||||
VSET(arbn_ip->eqn[2], 0, 1, 0);
|
||||
arbn_ip->eqn[2][3] = 0.5*scale;
|
||||
VSET(arbn_ip->eqn[3], 0, -1, 0);
|
||||
arbn_ip->eqn[3][3] = 0.5*scale;
|
||||
VSET(arbn_ip->eqn[4], 0, 0, 1);
|
||||
arbn_ip->eqn[4][3] = 0.5*scale;
|
||||
VSET(arbn_ip->eqn[5], 0, 0, -1);
|
||||
arbn_ip->eqn[5][3] = 0.5*scale;
|
||||
VSET(arbn_ip->eqn[6], 0.57735, 0.57735, 0.57735);
|
||||
arbn_ip->eqn[6][3] = 0.5*scale;
|
||||
VSET(arbn_ip->eqn[7], -0.57735, -0.57735, -0.57735);
|
||||
arbn_ip->eqn[7][3] = 0.5*scale;
|
||||
VSET(view_center,
|
||||
origin[X],
|
||||
origin[Y],
|
||||
origin[Z]);
|
||||
for (i=0; i<arbn_ip->neqn; i++) {
|
||||
arbn_ip->eqn[i][3] +=
|
||||
VDOT(view_center, arbn_ip->eqn[i]);
|
||||
}
|
||||
} else if (strcmp(argv[bu_optind+1], "ars") == 0) {
|
||||
int curve;
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_ARS;
|
||||
internal.idb_meth = &rt_functab[ID_ARS];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc(sizeof(struct rt_ars_internal), "rt_ars_internal");
|
||||
ars_ip = (struct rt_ars_internal *)internal.idb_ptr;
|
||||
ars_ip->magic = RT_ARS_INTERNAL_MAGIC;
|
||||
ars_ip->ncurves = 3;
|
||||
ars_ip->pts_per_curve = 3;
|
||||
ars_ip->curves = (fastf_t **)bu_malloc((ars_ip->ncurves+1) * sizeof(fastf_t **), "ars curve ptrs");
|
||||
|
||||
for (curve=0; curve < ars_ip->ncurves; curve++) {
|
||||
ars_ip->curves[curve] = (fastf_t *)bu_calloc(
|
||||
(ars_ip->pts_per_curve + 1) * 3,
|
||||
sizeof(fastf_t), "ARS points");
|
||||
|
||||
if (curve == 0) {
|
||||
VSET(&(ars_ip->curves[0][0]),
|
||||
origin[X],
|
||||
origin[Y],
|
||||
origin[Z]);
|
||||
VMOVE(&(ars_ip->curves[curve][3]), &(ars_ip->curves[curve][0]));
|
||||
VMOVE(&(ars_ip->curves[curve][6]), &(ars_ip->curves[curve][0]));
|
||||
} else if (curve == (ars_ip->ncurves - 1)) {
|
||||
VSET(&(ars_ip->curves[curve][0]),
|
||||
origin[X],
|
||||
origin[Y],
|
||||
origin[Z]+curve*0.5*scale);
|
||||
VMOVE(&(ars_ip->curves[curve][3]), &(ars_ip->curves[curve][0]));
|
||||
VMOVE(&(ars_ip->curves[curve][6]), &(ars_ip->curves[curve][0]));
|
||||
|
||||
} else {
|
||||
fastf_t x, y, z;
|
||||
x = origin[X]+curve*0.5*scale;
|
||||
y = origin[Y]+curve*0.5*scale;
|
||||
z = origin[Z]+curve*0.5*scale;
|
||||
|
||||
VSET(&ars_ip->curves[curve][0],
|
||||
origin[X],
|
||||
origin[Y],
|
||||
z);
|
||||
VSET(&ars_ip->curves[curve][3],
|
||||
x,
|
||||
origin[Y],
|
||||
z);
|
||||
VSET(&ars_ip->curves[curve][6],
|
||||
x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (strcmp(argv[bu_optind+1], "sph") == 0) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_ELL;
|
||||
internal.idb_meth = &rt_functab[ID_ELL];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc(sizeof(struct rt_ell_internal), "rt_ell_internal");
|
||||
ell_ip = (struct rt_ell_internal *)internal.idb_ptr;
|
||||
ell_ip->magic = RT_ELL_INTERNAL_MAGIC;
|
||||
VSET(ell_ip->v, origin[X], origin[Y], origin[Z]);
|
||||
VSET(ell_ip->a, 0.5*scale, 0.0, 0.0); /* A */
|
||||
VSET(ell_ip->b, 0.0, 0.5*scale, 0.0); /* B */
|
||||
VSET(ell_ip->c, 0.0, 0.0, 0.5*scale); /* C */
|
||||
} else if ((strcmp(argv[bu_optind+1], "grp") == 0) ||
|
||||
(strcmp(argv[bu_optind+1], "grip") == 0)) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_GRIP;
|
||||
internal.idb_meth = &rt_functab[ID_GRIP];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc(sizeof(struct rt_grip_internal), "rt_grp_internal");
|
||||
grp_ip = (struct rt_grip_internal *) internal.idb_ptr;
|
||||
grp_ip->magic = RT_GRIP_INTERNAL_MAGIC;
|
||||
VSET(grp_ip->center, origin[X], origin[Y],
|
||||
origin[Z]);
|
||||
VSET(grp_ip->normal, 1.0, 0.0, 0.0);
|
||||
grp_ip->mag = scale;
|
||||
} else if (strcmp(argv[bu_optind+1], "ell1") == 0) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_ELL;
|
||||
internal.idb_meth = &rt_functab[ID_ELL];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc(sizeof(struct rt_ell_internal), "rt_ell_internal");
|
||||
ell_ip = (struct rt_ell_internal *)internal.idb_ptr;
|
||||
ell_ip->magic = RT_ELL_INTERNAL_MAGIC;
|
||||
VSET(ell_ip->v, origin[X], origin[Y], origin[Z]);
|
||||
VSET(ell_ip->a, 0.5*scale, 0.0, 0.0); /* A */
|
||||
VSET(ell_ip->b, 0.0, 0.25*scale, 0.0); /* B */
|
||||
VSET(ell_ip->c, 0.0, 0.0, 0.25*scale); /* C */
|
||||
} else if (strcmp(argv[bu_optind+1], "ell") == 0) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_ELL;
|
||||
internal.idb_meth = &rt_functab[ID_ELL];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc(sizeof(struct rt_ell_internal), "rt_ell_internal");
|
||||
ell_ip = (struct rt_ell_internal *)internal.idb_ptr;
|
||||
ell_ip->magic = RT_ELL_INTERNAL_MAGIC;
|
||||
VSET(ell_ip->v, origin[X], origin[Y], origin[Z]);
|
||||
VSET(ell_ip->a, 0.5*scale, 0.0, 0.0); /* A */
|
||||
VSET(ell_ip->b, 0.0, 0.25*scale, 0.0); /* B */
|
||||
VSET(ell_ip->c, 0.0, 0.0, 0.125*scale); /* C */
|
||||
} else if (strcmp(argv[bu_optind+1], "tor") == 0) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_TOR;
|
||||
internal.idb_meth = &rt_functab[ID_TOR];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc(sizeof(struct rt_tor_internal), "rt_tor_internal");
|
||||
tor_ip = (struct rt_tor_internal *)internal.idb_ptr;
|
||||
tor_ip->magic = RT_TOR_INTERNAL_MAGIC;
|
||||
VSET(tor_ip->v, origin[X], origin[Y], origin[Z]);
|
||||
VSET(tor_ip->h, 1.0, 0.0, 0.0); /* unit normal */
|
||||
tor_ip->r_h = 0.1*scale;
|
||||
tor_ip->r_a = 0.4*scale;
|
||||
tor_ip->r_b = tor_ip->r_a;
|
||||
VSET(tor_ip->a, 0.0, 1, 0.0);
|
||||
VSET(tor_ip->b, 0.0, 0.0, 1);
|
||||
} else if (strcmp(argv[bu_optind+1], "tgc") == 0) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_TGC;
|
||||
internal.idb_meth = &rt_functab[ID_TGC];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc(sizeof(struct rt_tgc_internal), "rt_tgc_internal");
|
||||
tgc_ip = (struct rt_tgc_internal *)internal.idb_ptr;
|
||||
tgc_ip->magic = RT_TGC_INTERNAL_MAGIC;
|
||||
VSET(tgc_ip->v, origin[X], origin[Y], origin[Z]-scale);
|
||||
VSET(tgc_ip->h, 0.0, 0.0, scale);
|
||||
VSET(tgc_ip->a, 0.5*scale, 0.0, 0.0);
|
||||
VSET(tgc_ip->b, 0.0, 0.25*scale, 0.0);
|
||||
VSET(tgc_ip->c, 0.25*scale, 0.0, 0.0);
|
||||
VSET(tgc_ip->d, 0.0, 0.5*scale, 0.0);
|
||||
} else if (strcmp(argv[bu_optind+1], "tec") == 0) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_TGC;
|
||||
internal.idb_meth = &rt_functab[ID_TGC];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc(sizeof(struct rt_tgc_internal), "rt_tgc_internal");
|
||||
tgc_ip = (struct rt_tgc_internal *)internal.idb_ptr;
|
||||
tgc_ip->magic = RT_TGC_INTERNAL_MAGIC;
|
||||
VSET(tgc_ip->v, origin[X], origin[Y], origin[Z]-scale);
|
||||
VSET(tgc_ip->h, 0.0, 0.0, scale);
|
||||
VSET(tgc_ip->a, 0.5*scale, 0.0, 0.0);
|
||||
VSET(tgc_ip->b, 0.0, 0.25*scale, 0.0);
|
||||
VSET(tgc_ip->c, 0.25*scale, 0.0, 0.0);
|
||||
VSET(tgc_ip->d, 0.0, (0.125*scale), 0.0);
|
||||
} else if (strcmp(argv[bu_optind+1], "rec") == 0) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_TGC;
|
||||
internal.idb_meth = &rt_functab[ID_TGC];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc(sizeof(struct rt_tgc_internal), "rt_tgc_internal");
|
||||
tgc_ip = (struct rt_tgc_internal *)internal.idb_ptr;
|
||||
tgc_ip->magic = RT_TGC_INTERNAL_MAGIC;
|
||||
VSET(tgc_ip->v, origin[X], origin[Y], origin[Z]-scale);
|
||||
VSET(tgc_ip->h, 0.0, 0.0, scale);
|
||||
VSET(tgc_ip->a, 0.25*scale, 0.0, 0.0);
|
||||
VSET(tgc_ip->b, 0.0, 0.125*scale, 0.0);
|
||||
VSET(tgc_ip->c, 0.25*scale, 0.0, 0.0);
|
||||
VSET(tgc_ip->d, 0.0, 0.125*scale, 0.0);
|
||||
} else if (strcmp(argv[bu_optind+1], "trc") == 0) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_TGC;
|
||||
internal.idb_meth = &rt_functab[ID_TGC];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc(sizeof(struct rt_tgc_internal), "rt_tgc_internal");
|
||||
tgc_ip = (struct rt_tgc_internal *)internal.idb_ptr;
|
||||
tgc_ip->magic = RT_TGC_INTERNAL_MAGIC;
|
||||
VSET(tgc_ip->v, origin[X], origin[Y], origin[Z]-scale);
|
||||
VSET(tgc_ip->h, 0.0, 0.0, scale);
|
||||
VSET(tgc_ip->a, 0.25*scale, 0.0, 0.0);
|
||||
VSET(tgc_ip->b, 0.0, 0.25*scale, 0.0);
|
||||
VSET(tgc_ip->c, 0.125*scale, 0.0, 0.0);
|
||||
VSET(tgc_ip->d, 0.0, 0.125*scale, 0.0);
|
||||
} else if (strcmp(argv[bu_optind+1], "rcc") == 0) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_TGC;
|
||||
internal.idb_meth = &rt_functab[ID_TGC];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc(sizeof(struct rt_tgc_internal), "rt_tgc_internal");
|
||||
tgc_ip = (struct rt_tgc_internal *)internal.idb_ptr;
|
||||
tgc_ip->magic = RT_TGC_INTERNAL_MAGIC;
|
||||
VSET(tgc_ip->v, origin[X], origin[Y], origin[Z]-scale);
|
||||
VSET(tgc_ip->h, 0.0, 0.0, scale);
|
||||
VSET(tgc_ip->a, 0.25*scale, 0.0, 0.0);
|
||||
VSET(tgc_ip->b, 0.0, 0.25*scale, 0.0);
|
||||
VSET(tgc_ip->c, 0.25*scale, 0.0, 0.0);
|
||||
VSET(tgc_ip->d, 0.0, 0.25*scale, 0.0);
|
||||
} else if (strcmp(argv[bu_optind+1], "half") == 0) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_HALF;
|
||||
internal.idb_meth = &rt_functab[ID_HALF];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc(sizeof(struct rt_half_internal), "rt_half_internal");
|
||||
half_ip = (struct rt_half_internal *)internal.idb_ptr;
|
||||
half_ip->magic = RT_HALF_INTERNAL_MAGIC;
|
||||
VSET(half_ip->eqn, 0.0, 0.0, 1.0);
|
||||
half_ip->eqn[3] = (origin[Z]);
|
||||
} else if (strcmp(argv[bu_optind+1], "rpc") == 0) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_RPC;
|
||||
internal.idb_meth = &rt_functab[ID_RPC];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc(sizeof(struct rt_rpc_internal), "rt_rpc_internal");
|
||||
rpc_ip = (struct rt_rpc_internal *)internal.idb_ptr;
|
||||
rpc_ip->rpc_magic = RT_RPC_INTERNAL_MAGIC;
|
||||
VSET(rpc_ip->rpc_V, origin[X], origin[Y], origin[Z]-scale*0.5);
|
||||
VSET(rpc_ip->rpc_H, 0.0, 0.0, scale);
|
||||
VSET(rpc_ip->rpc_B, 0.0, (scale*0.5), 0.0);
|
||||
rpc_ip->rpc_r = scale*0.25;
|
||||
} else if (strcmp(argv[bu_optind+1], "rhc") == 0) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_RHC;
|
||||
internal.idb_meth = &rt_functab[ID_RHC];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc(sizeof(struct rt_rhc_internal), "rt_rhc_internal");
|
||||
rhc_ip = (struct rt_rhc_internal *)internal.idb_ptr;
|
||||
rhc_ip->rhc_magic = RT_RHC_INTERNAL_MAGIC;
|
||||
VSET(rhc_ip->rhc_V, origin[X], origin[Y], origin[Z]-scale*0.5);
|
||||
VSET(rhc_ip->rhc_H, 0.0, 0.0, scale);
|
||||
VSET(rhc_ip->rhc_B, 0.0, (scale*0.5), 0.0);
|
||||
rhc_ip->rhc_r = scale*0.25;
|
||||
rhc_ip->rhc_c = scale*0.10;
|
||||
} else if (strcmp(argv[bu_optind+1], "epa") == 0) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_EPA;
|
||||
internal.idb_meth = &rt_functab[ID_EPA];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc(sizeof(struct rt_epa_internal), "rt_epa_internal");
|
||||
epa_ip = (struct rt_epa_internal *)internal.idb_ptr;
|
||||
epa_ip->epa_magic = RT_EPA_INTERNAL_MAGIC;
|
||||
VSET(epa_ip->epa_V, origin[X], origin[Y], origin[Z]-scale*0.5);
|
||||
VSET(epa_ip->epa_H, 0.0, 0.0, scale);
|
||||
VSET(epa_ip->epa_Au, 0.0, 1.0, 0.0);
|
||||
epa_ip->epa_r1 = scale*0.5;
|
||||
epa_ip->epa_r2 = scale*0.25;
|
||||
} else if (strcmp(argv[bu_optind+1], "ehy") == 0) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_EHY;
|
||||
internal.idb_meth = &rt_functab[ID_EHY];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc(sizeof(struct rt_ehy_internal), "rt_ehy_internal");
|
||||
ehy_ip = (struct rt_ehy_internal *)internal.idb_ptr;
|
||||
ehy_ip->ehy_magic = RT_EHY_INTERNAL_MAGIC;
|
||||
VSET(ehy_ip->ehy_V, origin[X], origin[Y], origin[Z]-scale*0.5);
|
||||
VSET(ehy_ip->ehy_H, 0.0, 0.0, scale);
|
||||
VSET(ehy_ip->ehy_Au, 0.0, 1.0, 0.0);
|
||||
ehy_ip->ehy_r1 = scale*0.5;
|
||||
ehy_ip->ehy_r2 = scale*0.25;
|
||||
ehy_ip->ehy_c = ehy_ip->ehy_r2;
|
||||
} else if (strcmp(argv[bu_optind+1], "eto") == 0) {
|
||||
fastf_t mag;
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_ETO;
|
||||
internal.idb_meth = &rt_functab[ID_ETO];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc(sizeof(struct rt_eto_internal), "rt_eto_internal");
|
||||
eto_ip = (struct rt_eto_internal *)internal.idb_ptr;
|
||||
eto_ip->eto_magic = RT_ETO_INTERNAL_MAGIC;
|
||||
VSET(eto_ip->eto_V, origin[X], origin[Y], origin[Z]);
|
||||
VSET(eto_ip->eto_N, 0.0, 0.0, 1.0);
|
||||
VSET(eto_ip->eto_C, scale*0.1, 0.0, scale*0.1);
|
||||
mag = MAGNITUDE(eto_ip->eto_C);
|
||||
/* Close enough for now.*/
|
||||
eto_ip->eto_r = scale*0.5 - mag*cos(M_PI_4);
|
||||
eto_ip->eto_rd = scale*0.05;
|
||||
} else if (strcmp(argv[bu_optind+1], "part") == 0) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_PARTICLE;
|
||||
internal.idb_meth = &rt_functab[ID_PARTICLE];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc(sizeof(struct rt_part_internal), "rt_part_internal");
|
||||
part_ip = (struct rt_part_internal *)internal.idb_ptr;
|
||||
part_ip->part_magic = RT_PART_INTERNAL_MAGIC;
|
||||
VSET(part_ip->part_V, origin[X], origin[Y], origin[Z]-scale*0.5);
|
||||
VSET(part_ip->part_H, 0.0, 0.0, 0.6*scale);
|
||||
part_ip->part_vrad = scale*0.25;
|
||||
part_ip->part_hrad = scale*0.15;
|
||||
part_ip->part_type = RT_PARTICLE_TYPE_CONE;
|
||||
} else if (strcmp(argv[bu_optind+1], "nmg") == 0) {
|
||||
struct model *m;
|
||||
struct nmgregion *r;
|
||||
struct shell *s;
|
||||
|
||||
m = nmg_mm();
|
||||
r = nmg_mrsv(m);
|
||||
s = BU_LIST_FIRST(shell, &r->s_hd);
|
||||
nmg_vertex_g(s->vu_p->v_p, origin[X], origin[Y], origin[Z]);
|
||||
(void)nmg_meonvu(s->vu_p);
|
||||
(void)nmg_ml(s);
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_NMG;
|
||||
internal.idb_meth = &rt_functab[ID_NMG];
|
||||
internal.idb_ptr = (genptr_t)m;
|
||||
} else if (strcmp(argv[bu_optind+1], "pipe") == 0) {
|
||||
struct wdb_pipept *ps;
|
||||
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_PIPE;
|
||||
internal.idb_meth = &rt_functab[ID_PIPE];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc(sizeof(struct rt_pipe_internal), "rt_pipe_internal");
|
||||
pipe_ip = (struct rt_pipe_internal *)internal.idb_ptr;
|
||||
pipe_ip->pipe_magic = RT_PIPE_INTERNAL_MAGIC;
|
||||
BU_LIST_INIT(&pipe_ip->pipe_segs_head);
|
||||
BU_GETSTRUCT(ps, wdb_pipept);
|
||||
ps->l.magic = WDB_PIPESEG_MAGIC;
|
||||
VSET(ps->pp_coord, origin[X], origin[Y], origin[Z]-0.5*scale);
|
||||
ps->pp_od = 0.25*scale;
|
||||
ps->pp_id = 0.25*ps->pp_od;
|
||||
ps->pp_bendradius = ps->pp_od;
|
||||
BU_LIST_INSERT(&pipe_ip->pipe_segs_head, &ps->l);
|
||||
BU_GETSTRUCT(ps, wdb_pipept);
|
||||
ps->l.magic = WDB_PIPESEG_MAGIC;
|
||||
VSET(ps->pp_coord, origin[X], origin[Y], origin[Z]+0.5*scale);
|
||||
ps->pp_od = 0.25*scale;
|
||||
ps->pp_id = 0.25*ps->pp_od;
|
||||
ps->pp_bendradius = ps->pp_od;
|
||||
BU_LIST_INSERT(&pipe_ip->pipe_segs_head, &ps->l);
|
||||
} else if (strcmp(argv[bu_optind+1], "bot") == 0) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_BOT;
|
||||
internal.idb_meth = &rt_functab[ID_BOT];
|
||||
BU_GETSTRUCT(bot_ip, rt_bot_internal);
|
||||
internal.idb_ptr = (genptr_t)bot_ip;
|
||||
bot_ip = (struct rt_bot_internal *)internal.idb_ptr;
|
||||
bot_ip->magic = RT_BOT_INTERNAL_MAGIC;
|
||||
bot_ip->mode = RT_BOT_SOLID;
|
||||
bot_ip->orientation = RT_BOT_UNORIENTED;
|
||||
bot_ip->num_vertices = 4;
|
||||
bot_ip->num_faces = 4;
|
||||
bot_ip->faces = (int *)bu_calloc(bot_ip->num_faces * 3, sizeof(int), "BOT faces");
|
||||
bot_ip->vertices = (fastf_t *)bu_calloc(bot_ip->num_vertices * 3, sizeof(fastf_t), "BOT vertices");
|
||||
bot_ip->thickness = (fastf_t *)NULL;
|
||||
bot_ip->face_mode = (struct bu_bitv *)NULL;
|
||||
VSET(&bot_ip->vertices[0], origin[X], origin[Y], origin[Z]);
|
||||
VSET(&bot_ip->vertices[3], origin[X]-0.5*scale, origin[Y]+0.5*scale, origin[Z]-scale);
|
||||
VSET(&bot_ip->vertices[6], origin[X]-0.5*scale, origin[Y]-0.5*scale, origin[Z]-scale);
|
||||
VSET(&bot_ip->vertices[9], origin[X]+0.5*scale, origin[Y]+0.5*scale, origin[Z]-scale);
|
||||
VSET(&bot_ip->faces[0], 0, 1, 3);
|
||||
VSET(&bot_ip->faces[3], 0, 1, 2);
|
||||
VSET(&bot_ip->faces[6], 0, 2, 3);
|
||||
VSET(&bot_ip->faces[9], 1, 2, 3);
|
||||
} else if (strcmp(argv[bu_optind+1], "extrude") == 0) {
|
||||
char *av[8];
|
||||
char center_str[512];
|
||||
char scale_str[128];
|
||||
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_EXTRUDE;
|
||||
internal.idb_meth = &rt_functab[ID_EXTRUDE];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc(sizeof(struct rt_extrude_internal), "rt_extrude_internal");
|
||||
extrude_ip = (struct rt_extrude_internal *)internal.idb_ptr;
|
||||
extrude_ip->magic = RT_EXTRUDE_INTERNAL_MAGIC;
|
||||
VSET(extrude_ip->V, origin[X], origin[Y], origin[Z]);
|
||||
VSET(extrude_ip->h, 0.0, 0.0, scale);
|
||||
VSET(extrude_ip->u_vec, 1.0, 0.0, 0.0);
|
||||
VSET(extrude_ip->v_vec, 0.0, 1.0, 0.0);
|
||||
extrude_ip->keypoint = 0;
|
||||
av[0] = "make_name";
|
||||
av[1] = "skt_";
|
||||
ged_make_name(wdbp, 2, av);
|
||||
extrude_ip->sketch_name = bu_strdup(bu_vls_addr(&wdbp->wdb_result_str));
|
||||
extrude_ip->skt = (struct rt_sketch_internal *)NULL;
|
||||
|
||||
sprintf(center_str, "%lf %lf %lf", V3ARGS(origin));
|
||||
sprintf(scale_str, "%lf", scale);
|
||||
av[0] = "make";
|
||||
av[1] = "-o";
|
||||
av[2] = center_str;
|
||||
av[3] = "-s";
|
||||
av[4] = scale_str;
|
||||
av[5] = extrude_ip->sketch_name;
|
||||
av[6] = "sketch";
|
||||
av[7] = (char *)0;
|
||||
ged_make(wdbp, 7, av);
|
||||
} else if (strcmp(argv[bu_optind+1], "sketch") == 0) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_SKETCH;
|
||||
internal.idb_meth = &rt_functab[ID_SKETCH];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc(sizeof(struct rt_sketch_internal), "rt_sketch_internal");
|
||||
sketch_ip = (struct rt_sketch_internal *)internal.idb_ptr;
|
||||
sketch_ip->magic = RT_SKETCH_INTERNAL_MAGIC;
|
||||
VSET(sketch_ip->u_vec, 1.0, 0.0, 0.0);
|
||||
VSET(sketch_ip->v_vec, 0.0, 1.0, 0.0);
|
||||
VSET(sketch_ip->V, origin[X], origin[Y], origin[Z]);
|
||||
#if 0
|
||||
/* XXX this creates a "default" sketch object -- this
|
||||
code should probably be made optional somewhere
|
||||
else now? */
|
||||
sketch_ip->vert_count = 7;
|
||||
sketch_ip->verts = (point2d_t *)bu_calloc(sketch_ip->vert_count, sizeof(point2d_t), "sketch_ip->verts");
|
||||
sketch_ip->verts[0][0] = 0.25*scale;
|
||||
sketch_ip->verts[0][1] = 0.0;
|
||||
sketch_ip->verts[1][0] = 0.5*scale;
|
||||
sketch_ip->verts[1][1] = 0.0;
|
||||
sketch_ip->verts[2][0] = 0.5*scale;
|
||||
sketch_ip->verts[2][1] = 0.5*scale;
|
||||
sketch_ip->verts[3][0] = 0.0;
|
||||
sketch_ip->verts[3][1] = 0.5*scale;
|
||||
sketch_ip->verts[4][0] = 0.0;
|
||||
sketch_ip->verts[4][1] = 0.25*scale;
|
||||
sketch_ip->verts[5][0] = 0.25*scale;
|
||||
sketch_ip->verts[5][1] = 0.25*scale;
|
||||
sketch_ip->verts[6][0] = 0.125*scale;
|
||||
sketch_ip->verts[6][1] = 0.125*scale;
|
||||
sketch_ip->skt_curve.seg_count = 6;
|
||||
sketch_ip->skt_curve.reverse = (int *)bu_calloc(sketch_ip->skt_curve.seg_count, sizeof(int), "sketch_ip->skt_curve.reverse");
|
||||
sketch_ip->skt_curve.segments = (genptr_t *)bu_calloc(sketch_ip->skt_curve.seg_count, sizeof(genptr_t), "sketch_ip->skt_curve.segments");
|
||||
|
||||
csg = (struct carc_seg *)bu_calloc(1, sizeof(struct carc_seg), "segments");
|
||||
sketch_ip->skt_curve.segments[0] = (genptr_t)csg;
|
||||
csg->magic = CURVE_CARC_MAGIC;
|
||||
csg->start = 4;
|
||||
csg->end = 0;
|
||||
csg->radius = 0.25*scale;
|
||||
csg->center_is_left = 1;
|
||||
csg->orientation = 0;
|
||||
|
||||
lsg = (struct line_seg *)bu_calloc(1, sizeof(struct line_seg), "segments");
|
||||
sketch_ip->skt_curve.segments[1] = (genptr_t)lsg;
|
||||
lsg->magic = CURVE_LSEG_MAGIC;
|
||||
lsg->start = 0;
|
||||
lsg->end = 1;
|
||||
|
||||
lsg = (struct line_seg *)bu_calloc(1, sizeof(struct line_seg), "segments");
|
||||
sketch_ip->skt_curve.segments[2] = (genptr_t)lsg;
|
||||
lsg->magic = CURVE_LSEG_MAGIC;
|
||||
lsg->start = 1;
|
||||
lsg->end = 2;
|
||||
|
||||
lsg = (struct line_seg *)bu_calloc(1, sizeof(struct line_seg), "segments");
|
||||
sketch_ip->skt_curve.segments[3] = (genptr_t)lsg;
|
||||
lsg->magic = CURVE_LSEG_MAGIC;
|
||||
lsg->start = 2;
|
||||
lsg->end = 3;
|
||||
|
||||
lsg = (struct line_seg *)bu_calloc(1, sizeof(struct line_seg), "segments");
|
||||
sketch_ip->skt_curve.segments[4] = (genptr_t)lsg;
|
||||
lsg->magic = CURVE_LSEG_MAGIC;
|
||||
lsg->start = 3;
|
||||
lsg->end = 4;
|
||||
|
||||
csg = (struct carc_seg *)bu_calloc(1, sizeof(struct carc_seg), "segments");
|
||||
sketch_ip->skt_curve.segments[5] = (genptr_t)csg;
|
||||
csg->magic = CURVE_CARC_MAGIC;
|
||||
csg->start = 6;
|
||||
csg->end = 5;
|
||||
csg->radius = -1.0;
|
||||
csg->center_is_left = 1;
|
||||
csg->orientation = 0;
|
||||
#else
|
||||
sketch_ip->vert_count = 0;
|
||||
sketch_ip->verts = (point2d_t *)NULL;
|
||||
sketch_ip->skt_curve.seg_count = 0;
|
||||
sketch_ip->skt_curve.reverse = (int *)NULL;
|
||||
sketch_ip->skt_curve.segments = (genptr_t *)NULL;
|
||||
#endif
|
||||
} else if (strcmp(argv[bu_optind+1], "superell") == 0) {
|
||||
|
||||
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_SUPERELL;
|
||||
internal.idb_meth = &rt_functab[ID_SUPERELL];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc(sizeof(struct rt_superell_internal), "rt_superell_internal");
|
||||
superell_ip = (struct rt_superell_internal *)internal.idb_ptr;
|
||||
superell_ip->magic = RT_SUPERELL_INTERNAL_MAGIC;
|
||||
VSET(superell_ip->v, origin[X], origin[Y], origin[Z]);
|
||||
VSET(superell_ip->a, 0.5*scale, 0.0, 0.0); /* A */
|
||||
VSET(superell_ip->b, 0.0, 0.25*scale, 0.0); /* B */
|
||||
VSET(superell_ip->c, 0.0, 0.0, 0.125*scale); /* C */
|
||||
superell_ip->n = 1.0;
|
||||
superell_ip->e = 1.0;
|
||||
fprintf(stdout, "superell being made with %f and %f\n", superell_ip->n, superell_ip->e);
|
||||
|
||||
} else if (strcmp(argv[bu_optind+1], "hf") == 0) {
|
||||
bu_vls_printf(&wdbp->wdb_result_str, "make: the height field is deprecated and not supported by this command.\nUse the dsp primitive.\n");
|
||||
return GED_ERROR;
|
||||
} else if (strcmp(argv[bu_optind+1], "pg") == 0 ||
|
||||
strcmp(argv[bu_optind+1], "poly") == 0) {
|
||||
bu_vls_printf(&wdbp->wdb_result_str, "make: the polysolid is deprecated and not supported by this command.\nUse the bot primitive.");
|
||||
return GED_ERROR;
|
||||
} else if (strcmp(argv[bu_optind+1], "cline") == 0 ||
|
||||
strcmp(argv[bu_optind+1], "dsp") == 0 ||
|
||||
strcmp(argv[bu_optind+1], "ebm") == 0 ||
|
||||
strcmp(argv[bu_optind+1], "nurb") == 0 ||
|
||||
strcmp(argv[bu_optind+1], "spline") == 0 ||
|
||||
strcmp(argv[bu_optind+1], "submodel") == 0 ||
|
||||
strcmp(argv[bu_optind+1], "vol") == 0) {
|
||||
bu_vls_printf(&wdbp->wdb_result_str, "make: the %s primitive is not supported by this command", argv[bu_optind+1]);
|
||||
return GED_ERROR;
|
||||
} else if (strcmp(argv[bu_optind+1], "metaball") == 0) {
|
||||
struct wdb_metaballpt *mbpt;
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_METABALL;
|
||||
internal.idb_meth = &rt_functab[ID_METABALL];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc(sizeof(struct rt_metaball_internal), "rt_metaball_internal");
|
||||
metaball_ip = (struct rt_metaball_internal *)internal.idb_ptr;
|
||||
metaball_ip->magic = RT_METABALL_INTERNAL_MAGIC;
|
||||
metaball_ip->threshold = 1.0;
|
||||
metaball_ip->method = 1;
|
||||
BU_LIST_INIT(&metaball_ip->metaball_ctrl_head);
|
||||
|
||||
mbpt = (struct wdb_metaballpt *)malloc(sizeof(struct wdb_metaballpt));
|
||||
mbpt->fldstr = 1.0;
|
||||
mbpt->sweat = 1.0;
|
||||
VSET(mbpt->coord, origin[X] - 1.0, origin[Y], origin[Z]);
|
||||
BU_LIST_INSERT(&metaball_ip->metaball_ctrl_head, &mbpt->l);
|
||||
|
||||
mbpt = (struct wdb_metaballpt *)malloc(sizeof(struct wdb_metaballpt));
|
||||
mbpt->fldstr = 1.0;
|
||||
mbpt->sweat = 1.0;
|
||||
VSET(mbpt->coord, origin[X] + 1.0, origin[Y], origin[Z]);
|
||||
BU_LIST_INSERT(&metaball_ip->metaball_ctrl_head, &mbpt->l);
|
||||
|
||||
bu_log("metaball being made with %f threshold and two points using the %s rendering method\n",
|
||||
metaball_ip->threshold, rt_metaball_lookup_type_name(metaball_ip->method));
|
||||
} else {
|
||||
bu_vls_printf(&wdbp->wdb_result_str, "Usage: %s %s", argv[0], usage);
|
||||
return GED_ERROR;
|
||||
}
|
||||
|
||||
/* no interrupts */
|
||||
(void)signal(SIGINT, SIG_IGN);
|
||||
|
||||
if ((dp = db_diradd(wdbp->dbip, argv[save_bu_optind], -1L, 0, DIR_SOLID, (genptr_t)&internal.idb_type)) == DIR_NULL) {
|
||||
bu_vls_printf(&wdbp->wdb_result_str, "An error has occured while adding a new object to the database.");
|
||||
return GED_ERROR;
|
||||
}
|
||||
|
||||
if (rt_db_put_internal(dp, wdbp->dbip, &internal, &rt_uniresource) < 0) {
|
||||
bu_vls_printf(&wdbp->wdb_result_str, "Database write error, aborting\n");
|
||||
status = GED_ERROR;
|
||||
}
|
||||
|
||||
return GED_OK;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* tab-width: 8
|
||||
* mode: C
|
||||
* indent-tabs-mode: t
|
||||
* c-file-style: "stroustrup"
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
@@ -0,0 +1,119 @@
|
||||
/* M A K E _ N A M E . C
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (c) 2008 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this file; see the file named COPYING for more
|
||||
* information.
|
||||
*/
|
||||
/** @file make_name.c
|
||||
*
|
||||
* The make_name command.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ged.h"
|
||||
|
||||
|
||||
int
|
||||
ged_make_name(struct rt_wdb *wdbp,
|
||||
int argc,
|
||||
char *argv[])
|
||||
{
|
||||
int status = GED_OK;
|
||||
struct bu_vls obj_name;
|
||||
char *cp, *tp;
|
||||
static int i = 0;
|
||||
int len;
|
||||
static const char *usage = "template | -s [num]";
|
||||
|
||||
if (wdbp == RT_WDB_NULL) {
|
||||
bu_log("%s: a database must be open to use this command.", argv[0]);
|
||||
return GED_ERROR;
|
||||
}
|
||||
|
||||
GED_CHECK_DBI_NULL(wdbp->dbip, GED_ERROR);
|
||||
GED_CHECK_READ_ONLY(wdbp->dbip, GED_ERROR);
|
||||
|
||||
/* initialize result */
|
||||
bu_vls_trunc(&wdbp->wdb_result_str, 0);
|
||||
wdbp->wdb_result = GED_RESULT_NULL;
|
||||
wdbp->wdb_result_flags = 0;
|
||||
|
||||
/* must be wanting help */
|
||||
if (argc == 1) {
|
||||
wdbp->wdb_result_flags |= GED_RESULT_FLAGS_HELP_BIT;
|
||||
bu_vls_printf(&wdbp->wdb_result_str, "Usage: %s %s", argv[0], usage);
|
||||
return GED_OK;
|
||||
}
|
||||
|
||||
switch (argc) {
|
||||
case 2:
|
||||
if (strcmp(argv[1], "-s") != 0)
|
||||
break;
|
||||
else {
|
||||
i = 0;
|
||||
return GED_OK;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
int new_i;
|
||||
|
||||
if ((strcmp(argv[1], "-s") == 0)
|
||||
&& (sscanf(argv[2], "%d", &new_i) == 1)) {
|
||||
i = new_i;
|
||||
return GED_OK;
|
||||
}
|
||||
}
|
||||
default:
|
||||
bu_vls_printf(&wdbp->wdb_result_str, "Usage: %s %s", argv[0], usage);
|
||||
return GED_ERROR;
|
||||
}
|
||||
|
||||
bu_vls_init(&obj_name);
|
||||
for (cp = argv[1], len = 0; *cp != '\0'; ++cp, ++len) {
|
||||
if (*cp == '@') {
|
||||
if (*(cp + 1) == '@')
|
||||
++cp;
|
||||
else
|
||||
break;
|
||||
}
|
||||
bu_vls_putc(&obj_name, *cp);
|
||||
}
|
||||
bu_vls_putc(&obj_name, '\0');
|
||||
tp = (*cp == '\0') ? "" : cp + 1;
|
||||
|
||||
do {
|
||||
bu_vls_trunc(&obj_name, len);
|
||||
bu_vls_printf(&obj_name, "%d", i++);
|
||||
bu_vls_strcat(&obj_name, tp);
|
||||
}
|
||||
while (db_lookup(wdbp->dbip, bu_vls_addr(&obj_name), LOOKUP_QUIET) != DIR_NULL);
|
||||
|
||||
bu_vls_printf(&wdbp->wdb_result_str, bu_vls_addr(&obj_name));
|
||||
bu_vls_free(&obj_name);
|
||||
|
||||
return GED_OK;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* tab-width: 8
|
||||
* mode: C
|
||||
* indent-tabs-mode: t
|
||||
* c-file-style: "stroustrup"
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
+15
-70
@@ -7700,75 +7700,6 @@ wdb_make_bb_tcl(ClientData clientData,
|
||||
return wdb_make_bb_cmd(wdbp, interp, argc-1, argv+1);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
int
|
||||
wdb_make_name_cmd(struct rt_wdb *wdbp,
|
||||
Tcl_Interp *interp,
|
||||
int argc,
|
||||
char **argv)
|
||||
{
|
||||
struct bu_vls obj_name;
|
||||
char *cp, *tp;
|
||||
static int i = 0;
|
||||
int len;
|
||||
|
||||
switch (argc) {
|
||||
case 2:
|
||||
if (strcmp(argv[1], "-s") != 0)
|
||||
break;
|
||||
else {
|
||||
i = 0;
|
||||
return TCL_OK;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
int new_i;
|
||||
|
||||
if ((strcmp(argv[1], "-s") == 0)
|
||||
&& (sscanf(argv[2], "%d", &new_i) == 1)) {
|
||||
i = new_i;
|
||||
return TCL_OK;
|
||||
}
|
||||
}
|
||||
default:
|
||||
{
|
||||
struct bu_vls vls;
|
||||
|
||||
bu_vls_init(&vls);
|
||||
bu_vls_printf(&vls, "helplib_alias wdb_make_name %s", argv[0]);
|
||||
Tcl_Eval(interp, bu_vls_addr(&vls));
|
||||
bu_vls_free(&vls);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
bu_vls_init(&obj_name);
|
||||
for (cp = argv[1], len = 0; *cp != '\0'; ++cp, ++len) {
|
||||
if (*cp == '@') {
|
||||
if (*(cp + 1) == '@')
|
||||
++cp;
|
||||
else
|
||||
break;
|
||||
}
|
||||
bu_vls_putc(&obj_name, *cp);
|
||||
}
|
||||
bu_vls_putc(&obj_name, '\0');
|
||||
tp = (*cp == '\0') ? "" : cp + 1;
|
||||
|
||||
do {
|
||||
bu_vls_trunc(&obj_name, len);
|
||||
bu_vls_printf(&obj_name, "%d", i++);
|
||||
bu_vls_strcat(&obj_name, tp);
|
||||
}
|
||||
while (db_lookup(wdbp->dbip, bu_vls_addr(&obj_name), LOOKUP_QUIET) != DIR_NULL);
|
||||
Tcl_AppendResult(interp, bu_vls_addr(&obj_name), (char *) NULL);
|
||||
bu_vls_free(&obj_name);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
*@brief
|
||||
* Generate an identifier that is guaranteed not to be the name
|
||||
@@ -7786,8 +7717,22 @@ wdb_make_name_tcl(ClientData clientData,
|
||||
|
||||
{
|
||||
struct rt_wdb *wdbp = (struct rt_wdb *)clientData;
|
||||
Tcl_DString ds;
|
||||
int ret;
|
||||
|
||||
return wdb_make_name_cmd(wdbp, interp, argc-1, argv+1);
|
||||
ret = ged_make_name(wdbp, argc-1, argv+1);
|
||||
|
||||
/* Convert to Tcl codes */
|
||||
if (ret == GED_OK)
|
||||
ret = TCL_OK;
|
||||
else
|
||||
ret = TCL_ERROR;
|
||||
|
||||
Tcl_DStringInit(&ds);
|
||||
Tcl_DStringAppend(&ds, bu_vls_addr(&wdbp->wdb_result_str), -1);
|
||||
Tcl_DStringResult(interp, &ds);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+36
-752
@@ -565,772 +565,56 @@ f_make(ClientData clientData,
|
||||
int argc,
|
||||
char **argv)
|
||||
{
|
||||
register struct directory *dp;
|
||||
int i;
|
||||
struct rt_db_internal internal;
|
||||
struct rt_arb_internal *arb_ip;
|
||||
struct rt_ars_internal *ars_ip;
|
||||
struct rt_tgc_internal *tgc_ip;
|
||||
struct rt_ell_internal *ell_ip;
|
||||
struct rt_tor_internal *tor_ip;
|
||||
struct rt_grip_internal *grp_ip;
|
||||
struct rt_half_internal *half_ip;
|
||||
struct rt_rpc_internal *rpc_ip;
|
||||
struct rt_rhc_internal *rhc_ip;
|
||||
struct rt_epa_internal *epa_ip;
|
||||
struct rt_ehy_internal *ehy_ip;
|
||||
struct rt_eto_internal *eto_ip;
|
||||
struct rt_part_internal *part_ip;
|
||||
struct rt_pipe_internal *pipe_ip;
|
||||
struct rt_sketch_internal *sketch_ip;
|
||||
struct rt_extrude_internal *extrude_ip;
|
||||
struct rt_bot_internal *bot_ip;
|
||||
struct rt_arbn_internal *arbn_ip;
|
||||
struct rt_superell_internal *superell_ip;
|
||||
struct rt_metaball_internal *metaball_ip;
|
||||
|
||||
if (argc == 2) {
|
||||
struct bu_vls vls;
|
||||
|
||||
if (argv[1][0] == '-' && argv[1][1] == 't') {
|
||||
Tcl_AppendElement(interp, "arb8");
|
||||
Tcl_AppendElement(interp, "arb7");
|
||||
Tcl_AppendElement(interp, "arb6");
|
||||
Tcl_AppendElement(interp, "arb5");
|
||||
Tcl_AppendElement(interp, "arb4");
|
||||
Tcl_AppendElement(interp, "arbn");
|
||||
Tcl_AppendElement(interp, "ars");
|
||||
Tcl_AppendElement(interp, "bot");
|
||||
Tcl_AppendElement(interp, "ehy");
|
||||
Tcl_AppendElement(interp, "ell");
|
||||
Tcl_AppendElement(interp, "ell1");
|
||||
Tcl_AppendElement(interp, "epa");
|
||||
Tcl_AppendElement(interp, "eto");
|
||||
Tcl_AppendElement(interp, "extrude");
|
||||
Tcl_AppendElement(interp, "grip");
|
||||
Tcl_AppendElement(interp, "half");
|
||||
Tcl_AppendElement(interp, "nmg");
|
||||
Tcl_AppendElement(interp, "part");
|
||||
Tcl_AppendElement(interp, "pipe");
|
||||
Tcl_AppendElement(interp, "rcc");
|
||||
Tcl_AppendElement(interp, "rec");
|
||||
Tcl_AppendElement(interp, "rhc");
|
||||
Tcl_AppendElement(interp, "rpc");
|
||||
Tcl_AppendElement(interp, "rpp");
|
||||
Tcl_AppendElement(interp, "sketch");
|
||||
Tcl_AppendElement(interp, "sph");
|
||||
Tcl_AppendElement(interp, "tec");
|
||||
Tcl_AppendElement(interp, "tgc");
|
||||
Tcl_AppendElement(interp, "tor");
|
||||
Tcl_AppendElement(interp, "trc");
|
||||
Tcl_AppendElement(interp, "superell");
|
||||
Tcl_AppendElement(interp, "metaball");
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
bu_vls_init(&vls);
|
||||
bu_vls_printf(&vls, "help make");
|
||||
Tcl_Eval(interp, bu_vls_addr(&vls));
|
||||
bu_vls_free(&vls);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
Tcl_DString ds;
|
||||
int ret;
|
||||
|
||||
CHECK_DBI_NULL;
|
||||
CHECK_READ_ONLY;
|
||||
|
||||
if (argc != 3) {
|
||||
struct bu_vls vls;
|
||||
if (argc == 3) {
|
||||
char *av[8];
|
||||
char center[512];
|
||||
char scale[128];
|
||||
|
||||
bu_vls_init(&vls);
|
||||
bu_vls_printf(&vls, "help make");
|
||||
Tcl_Eval(interp, bu_vls_addr(&vls));
|
||||
bu_vls_free(&vls);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
sprintf(center, "%lf %lf %lf",
|
||||
-view_state->vs_vop->vo_center[MDX],
|
||||
-view_state->vs_vop->vo_center[MDY],
|
||||
-view_state->vs_vop->vo_center[MDZ]);
|
||||
sprintf(scale, "%lf", view_state->vs_vop->vo_scale * 2.0);
|
||||
|
||||
if ( db_lookup( dbip, argv[1], LOOKUP_QUIET ) != DIR_NULL ) {
|
||||
aexists( argv[1] );
|
||||
return TCL_ERROR;
|
||||
}
|
||||
av[0] = argv[0];
|
||||
av[1] = "-o";
|
||||
av[2] = center;
|
||||
av[3] = "-s";
|
||||
av[4] = scale;
|
||||
av[5] = argv[1];
|
||||
av[6] = argv[2];
|
||||
av[7] = (char *)0;
|
||||
|
||||
RT_INIT_DB_INTERNAL( &internal );
|
||||
ret = ged_make(wdbp, 7, av);
|
||||
} else
|
||||
ret = ged_make(wdbp, argc, argv);
|
||||
|
||||
/* make name <arb8 | arb7 | arb6 | arb5 | arb4 | ellg | ell | superell
|
||||
* sph | tor | tgc | rec | trc | rcc | grp | half | nmg | bot | sketch | extrude> */
|
||||
if (strcmp(argv[2], "arb8") == 0 ||
|
||||
strcmp(argv[2], "rpp") == 0) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_ARB8;
|
||||
internal.idb_meth = &rt_functab[ID_ARB8];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc( sizeof(struct rt_arb_internal), "rt_arb_internal" );
|
||||
arb_ip = (struct rt_arb_internal *)internal.idb_ptr;
|
||||
arb_ip->magic = RT_ARB_INTERNAL_MAGIC;
|
||||
VSET( arb_ip->pt[0] ,
|
||||
-view_state->vs_vop->vo_center[MDX] +view_state->vs_vop->vo_scale,
|
||||
-view_state->vs_vop->vo_center[MDY] -view_state->vs_vop->vo_scale,
|
||||
-view_state->vs_vop->vo_center[MDZ] -view_state->vs_vop->vo_scale );
|
||||
for ( i=1; i<8; i++ ) VMOVE( arb_ip->pt[i], arb_ip->pt[0] );
|
||||
arb_ip->pt[1][Y] += view_state->vs_vop->vo_scale*2.0;
|
||||
arb_ip->pt[2][Y] += view_state->vs_vop->vo_scale*2.0;
|
||||
arb_ip->pt[2][Z] += view_state->vs_vop->vo_scale*2.0;
|
||||
arb_ip->pt[3][Z] += view_state->vs_vop->vo_scale*2.0;
|
||||
for ( i=4; i<8; i++ )
|
||||
arb_ip->pt[i][X] -= view_state->vs_vop->vo_scale*2.0;
|
||||
arb_ip->pt[5][Y] += view_state->vs_vop->vo_scale*2.0;
|
||||
arb_ip->pt[6][Y] += view_state->vs_vop->vo_scale*2.0;
|
||||
arb_ip->pt[6][Z] += view_state->vs_vop->vo_scale*2.0;
|
||||
arb_ip->pt[7][Z] += view_state->vs_vop->vo_scale*2.0;
|
||||
} else if ( strcmp( argv[2], "arb7" ) == 0 ) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_ARB8;
|
||||
internal.idb_meth = &rt_functab[ID_ARB8];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc( sizeof(struct rt_arb_internal), "rt_arb_internal" );
|
||||
arb_ip = (struct rt_arb_internal *)internal.idb_ptr;
|
||||
arb_ip->magic = RT_ARB_INTERNAL_MAGIC;
|
||||
VSET( arb_ip->pt[0] ,
|
||||
-view_state->vs_vop->vo_center[MDX] +view_state->vs_vop->vo_scale,
|
||||
-view_state->vs_vop->vo_center[MDY] -view_state->vs_vop->vo_scale,
|
||||
-view_state->vs_vop->vo_center[MDZ] -(0.5*view_state->vs_vop->vo_scale) );
|
||||
for ( i=1; i<8; i++ )
|
||||
VMOVE( arb_ip->pt[i], arb_ip->pt[0] );
|
||||
arb_ip->pt[1][Y] += view_state->vs_vop->vo_scale*2.0;
|
||||
arb_ip->pt[2][Y] += view_state->vs_vop->vo_scale*2.0;
|
||||
arb_ip->pt[2][Z] += view_state->vs_vop->vo_scale*2.0;
|
||||
arb_ip->pt[3][Z] += view_state->vs_vop->vo_scale;
|
||||
for ( i=4; i<8; i++ )
|
||||
arb_ip->pt[i][X] -= view_state->vs_vop->vo_scale*2.0;
|
||||
arb_ip->pt[5][Y] += view_state->vs_vop->vo_scale*2.0;
|
||||
arb_ip->pt[6][Y] += view_state->vs_vop->vo_scale*2.0;
|
||||
arb_ip->pt[6][Z] += view_state->vs_vop->vo_scale;
|
||||
} else if ( strcmp( argv[2], "arb6" ) == 0 ) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_ARB8;
|
||||
internal.idb_meth = &rt_functab[ID_ARB8];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc( sizeof(struct rt_arb_internal), "rt_arb_internal" );
|
||||
arb_ip = (struct rt_arb_internal *)internal.idb_ptr;
|
||||
arb_ip->magic = RT_ARB_INTERNAL_MAGIC;
|
||||
VSET( arb_ip->pt[0],
|
||||
-view_state->vs_vop->vo_center[MDX] +view_state->vs_vop->vo_scale,
|
||||
-view_state->vs_vop->vo_center[MDY] -view_state->vs_vop->vo_scale,
|
||||
-view_state->vs_vop->vo_center[MDZ] -view_state->vs_vop->vo_scale );
|
||||
for ( i=1; i<8; i++ )
|
||||
VMOVE( arb_ip->pt[i], arb_ip->pt[0] );
|
||||
arb_ip->pt[1][Y] += view_state->vs_vop->vo_scale*2.0;
|
||||
arb_ip->pt[2][Y] += view_state->vs_vop->vo_scale*2.0;
|
||||
arb_ip->pt[2][Z] += view_state->vs_vop->vo_scale*2.0;
|
||||
arb_ip->pt[3][Z] += view_state->vs_vop->vo_scale*2.0;
|
||||
for ( i=4; i<8; i++ )
|
||||
arb_ip->pt[i][X] -= view_state->vs_vop->vo_scale*2.0;
|
||||
arb_ip->pt[4][Y] += view_state->vs_vop->vo_scale;
|
||||
arb_ip->pt[5][Y] += view_state->vs_vop->vo_scale;
|
||||
arb_ip->pt[6][Y] += view_state->vs_vop->vo_scale;
|
||||
arb_ip->pt[6][Z] += view_state->vs_vop->vo_scale*2.0;
|
||||
arb_ip->pt[7][Y] += view_state->vs_vop->vo_scale;
|
||||
arb_ip->pt[7][Z] += view_state->vs_vop->vo_scale*2.0;
|
||||
} else if ( strcmp( argv[2], "arb5" ) == 0 ) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_ARB8;
|
||||
internal.idb_meth = &rt_functab[ID_ARB8];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc( sizeof(struct rt_arb_internal), "rt_arb_internal" );
|
||||
arb_ip = (struct rt_arb_internal *)internal.idb_ptr;
|
||||
arb_ip->magic = RT_ARB_INTERNAL_MAGIC;
|
||||
VSET( arb_ip->pt[0] ,
|
||||
-view_state->vs_vop->vo_center[MDX] +view_state->vs_vop->vo_scale,
|
||||
-view_state->vs_vop->vo_center[MDY] -view_state->vs_vop->vo_scale,
|
||||
-view_state->vs_vop->vo_center[MDZ] -view_state->vs_vop->vo_scale );
|
||||
for ( i=1; i<8; i++ )
|
||||
VMOVE( arb_ip->pt[i], arb_ip->pt[0] );
|
||||
arb_ip->pt[1][Y] += view_state->vs_vop->vo_scale*2.0;
|
||||
arb_ip->pt[2][Y] += view_state->vs_vop->vo_scale*2.0;
|
||||
arb_ip->pt[2][Z] += view_state->vs_vop->vo_scale*2.0;
|
||||
arb_ip->pt[3][Z] += view_state->vs_vop->vo_scale*2.0;
|
||||
for ( i=4; i<8; i++ )
|
||||
{
|
||||
arb_ip->pt[i][X] -= view_state->vs_vop->vo_scale*2.0;
|
||||
arb_ip->pt[i][Y] += view_state->vs_vop->vo_scale;
|
||||
arb_ip->pt[i][Z] += view_state->vs_vop->vo_scale;
|
||||
}
|
||||
} else if ( strcmp( argv[2], "arb4" ) == 0 ) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_ARB8;
|
||||
internal.idb_meth = &rt_functab[ID_ARB8];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc( sizeof(struct rt_arb_internal), "rt_arb_internal" );
|
||||
arb_ip = (struct rt_arb_internal *)internal.idb_ptr;
|
||||
arb_ip->magic = RT_ARB_INTERNAL_MAGIC;
|
||||
VSET( arb_ip->pt[0] ,
|
||||
-view_state->vs_vop->vo_center[MDX] +view_state->vs_vop->vo_scale,
|
||||
-view_state->vs_vop->vo_center[MDY] -view_state->vs_vop->vo_scale,
|
||||
-view_state->vs_vop->vo_center[MDZ] -view_state->vs_vop->vo_scale );
|
||||
for ( i=1; i<8; i++ )
|
||||
VMOVE( arb_ip->pt[i], arb_ip->pt[0] );
|
||||
arb_ip->pt[1][Y] += view_state->vs_vop->vo_scale*2.0;
|
||||
arb_ip->pt[2][Y] += view_state->vs_vop->vo_scale*2.0;
|
||||
arb_ip->pt[2][Z] += view_state->vs_vop->vo_scale*2.0;
|
||||
arb_ip->pt[3][Y] += view_state->vs_vop->vo_scale*2.0;
|
||||
arb_ip->pt[3][Z] += view_state->vs_vop->vo_scale*2.0;
|
||||
for ( i=4; i<8; i++ )
|
||||
{
|
||||
arb_ip->pt[i][X] -= view_state->vs_vop->vo_scale*2.0;
|
||||
arb_ip->pt[i][Y] += view_state->vs_vop->vo_scale*2.0;
|
||||
}
|
||||
} else if ( strcmp( argv[2], "arbn") == 0 ) {
|
||||
point_t view_center;
|
||||
/* Convert to Tcl codes */
|
||||
if (ret == GED_OK)
|
||||
ret = TCL_OK;
|
||||
else
|
||||
ret = TCL_ERROR;
|
||||
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_ARBN;
|
||||
internal.idb_meth = &rt_functab[ID_ARBN];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc( sizeof( struct rt_arbn_internal), "rt_arbn_internal" );
|
||||
arbn_ip = (struct rt_arbn_internal *)internal.idb_ptr;
|
||||
arbn_ip->magic = RT_ARBN_INTERNAL_MAGIC;
|
||||
arbn_ip->neqn = 8;
|
||||
arbn_ip->eqn = (plane_t *)bu_calloc( arbn_ip->neqn,
|
||||
sizeof( plane_t ), "arbn plane eqns" );
|
||||
VSET( arbn_ip->eqn[0], 1, 0, 0 );
|
||||
arbn_ip->eqn[0][3] = view_state->vs_vop->vo_scale;
|
||||
VSET( arbn_ip->eqn[1], -1, 0, 0 );
|
||||
arbn_ip->eqn[1][3] = view_state->vs_vop->vo_scale;
|
||||
VSET( arbn_ip->eqn[2], 0, 1, 0 );
|
||||
arbn_ip->eqn[2][3] = view_state->vs_vop->vo_scale;
|
||||
VSET( arbn_ip->eqn[3], 0, -1, 0 );
|
||||
arbn_ip->eqn[3][3] = view_state->vs_vop->vo_scale;
|
||||
VSET( arbn_ip->eqn[4], 0, 0, 1 );
|
||||
arbn_ip->eqn[4][3] = view_state->vs_vop->vo_scale;
|
||||
VSET( arbn_ip->eqn[5], 0, 0, -1 );
|
||||
arbn_ip->eqn[5][3] = view_state->vs_vop->vo_scale;
|
||||
VSET( arbn_ip->eqn[6], 0.57735, 0.57735, 0.57735 );
|
||||
arbn_ip->eqn[6][3] = view_state->vs_vop->vo_scale;
|
||||
VSET( arbn_ip->eqn[7], -0.57735, -0.57735, -0.57735 );
|
||||
arbn_ip->eqn[7][3] = view_state->vs_vop->vo_scale;
|
||||
VSET( view_center,
|
||||
-view_state->vs_vop->vo_center[MDX],
|
||||
-view_state->vs_vop->vo_center[MDY],
|
||||
-view_state->vs_vop->vo_center[MDZ] );
|
||||
for ( i=0; i<arbn_ip->neqn; i++ ) {
|
||||
arbn_ip->eqn[i][3] +=
|
||||
VDOT( view_center, arbn_ip->eqn[i] );
|
||||
}
|
||||
} else if ( strcmp( argv[2], "ars" ) == 0 ) {
|
||||
int curve;
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_ARS;
|
||||
internal.idb_meth = &rt_functab[ID_ARS];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc( sizeof(struct rt_ars_internal), "rt_ars_internal" );
|
||||
ars_ip = (struct rt_ars_internal *)internal.idb_ptr;
|
||||
ars_ip->magic = RT_ARS_INTERNAL_MAGIC;
|
||||
ars_ip->ncurves = 3;
|
||||
ars_ip->pts_per_curve = 3;
|
||||
ars_ip->curves = (fastf_t **)bu_malloc((ars_ip->ncurves+1) * sizeof(fastf_t **), "ars curve ptrs" );
|
||||
Tcl_DStringInit(&ds);
|
||||
Tcl_DStringAppend(&ds, bu_vls_addr(&wdbp->wdb_result_str), -1);
|
||||
Tcl_DStringResult(interp, &ds);
|
||||
|
||||
for ( curve=0; curve < ars_ip->ncurves; curve++ ) {
|
||||
ars_ip->curves[curve] = (fastf_t *)bu_calloc(
|
||||
(ars_ip->pts_per_curve + 1) * 3,
|
||||
sizeof(fastf_t), "ARS points");
|
||||
|
||||
if (curve == 0) {
|
||||
VSET( &(ars_ip->curves[0][0]),
|
||||
-view_state->vs_vop->vo_center[MDX],
|
||||
-view_state->vs_vop->vo_center[MDY],
|
||||
-view_state->vs_vop->vo_center[MDZ] );
|
||||
VMOVE(&(ars_ip->curves[curve][3]), &(ars_ip->curves[curve][0]));
|
||||
VMOVE(&(ars_ip->curves[curve][6]), &(ars_ip->curves[curve][0]));
|
||||
} else if (curve == (ars_ip->ncurves - 1) ) {
|
||||
VSET( &(ars_ip->curves[curve][0]),
|
||||
-view_state->vs_vop->vo_center[MDX],
|
||||
-view_state->vs_vop->vo_center[MDY],
|
||||
-view_state->vs_vop->vo_center[MDZ]+curve*(0.25*view_state->vs_vop->vo_scale));
|
||||
VMOVE(&(ars_ip->curves[curve][3]), &(ars_ip->curves[curve][0]));
|
||||
VMOVE(&(ars_ip->curves[curve][6]), &(ars_ip->curves[curve][0]));
|
||||
|
||||
} else {
|
||||
fastf_t x, y, z;
|
||||
x = -view_state->vs_vop->vo_center[MDX]+curve*(0.25*view_state->vs_vop->vo_scale);
|
||||
y = -view_state->vs_vop->vo_center[MDY]+curve*(0.25*view_state->vs_vop->vo_scale);
|
||||
z = -view_state->vs_vop->vo_center[MDZ]+curve*(0.25*view_state->vs_vop->vo_scale);
|
||||
|
||||
VSET(&ars_ip->curves[curve][0],
|
||||
-view_state->vs_vop->vo_center[MDX],
|
||||
-view_state->vs_vop->vo_center[MDY],
|
||||
z);
|
||||
VSET(&ars_ip->curves[curve][3],
|
||||
x,
|
||||
-view_state->vs_vop->vo_center[MDY],
|
||||
z);
|
||||
VSET(&ars_ip->curves[curve][6],
|
||||
x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
} else if ( strcmp( argv[2], "sph" ) == 0 ) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_ELL;
|
||||
internal.idb_meth = &rt_functab[ID_ELL];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc( sizeof(struct rt_ell_internal), "rt_ell_internal" );
|
||||
ell_ip = (struct rt_ell_internal *)internal.idb_ptr;
|
||||
ell_ip->magic = RT_ELL_INTERNAL_MAGIC;
|
||||
VSET( ell_ip->v, -view_state->vs_vop->vo_center[MDX], -view_state->vs_vop->vo_center[MDY], -view_state->vs_vop->vo_center[MDZ] );
|
||||
VSET( ell_ip->a, (0.5*view_state->vs_vop->vo_scale), 0.0, 0.0 ); /* A */
|
||||
VSET( ell_ip->b, 0.0, (0.5*view_state->vs_vop->vo_scale), 0.0 ); /* B */
|
||||
VSET( ell_ip->c, 0.0, 0.0, (0.5*view_state->vs_vop->vo_scale) ); /* C */
|
||||
} else if (( strcmp( argv[2], "grp" ) == 0 ) ||
|
||||
( strcmp( argv[2], "grip") == 0 )) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_GRIP;
|
||||
internal.idb_meth = &rt_functab[ID_GRIP];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc( sizeof(struct rt_grip_internal), "rt_grp_internal" );
|
||||
grp_ip = (struct rt_grip_internal *) internal.idb_ptr;
|
||||
grp_ip->magic = RT_GRIP_INTERNAL_MAGIC;
|
||||
VSET( grp_ip->center, -view_state->vs_vop->vo_center[MDX], -view_state->vs_vop->vo_center[MDY],
|
||||
-view_state->vs_vop->vo_center[MDZ]);
|
||||
VSET( grp_ip->normal, 1.0, 0.0, 0.0);
|
||||
grp_ip->mag = view_state->vs_vop->vo_scale*0.75;
|
||||
} else if ( strcmp( argv[2], "ell1" ) == 0 ) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_ELL;
|
||||
internal.idb_meth = &rt_functab[ID_ELL];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc( sizeof(struct rt_ell_internal), "rt_ell_internal" );
|
||||
ell_ip = (struct rt_ell_internal *)internal.idb_ptr;
|
||||
ell_ip->magic = RT_ELL_INTERNAL_MAGIC;
|
||||
VSET( ell_ip->v, -view_state->vs_vop->vo_center[MDX], -view_state->vs_vop->vo_center[MDY], -view_state->vs_vop->vo_center[MDZ] );
|
||||
VSET( ell_ip->a, (0.5*view_state->vs_vop->vo_scale), 0.0, 0.0 ); /* A */
|
||||
VSET( ell_ip->b, 0.0, (0.25*view_state->vs_vop->vo_scale), 0.0 ); /* B */
|
||||
VSET( ell_ip->c, 0.0, 0.0, (0.25*view_state->vs_vop->vo_scale) ); /* C */
|
||||
} else if ( strcmp( argv[2], "ell" ) == 0 ) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_ELL;
|
||||
internal.idb_meth = &rt_functab[ID_ELL];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc( sizeof(struct rt_ell_internal), "rt_ell_internal" );
|
||||
ell_ip = (struct rt_ell_internal *)internal.idb_ptr;
|
||||
ell_ip->magic = RT_ELL_INTERNAL_MAGIC;
|
||||
VSET( ell_ip->v, -view_state->vs_vop->vo_center[MDX], -view_state->vs_vop->vo_center[MDY], -view_state->vs_vop->vo_center[MDZ] );
|
||||
VSET( ell_ip->a, view_state->vs_vop->vo_scale, 0.0, 0.0 ); /* A */
|
||||
VSET( ell_ip->b, 0.0, (0.5*view_state->vs_vop->vo_scale), 0.0 ); /* B */
|
||||
VSET( ell_ip->c, 0.0, 0.0, (0.25*view_state->vs_vop->vo_scale) ); /* C */
|
||||
} else if ( strcmp( argv[2], "tor" ) == 0 ) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_TOR;
|
||||
internal.idb_meth = &rt_functab[ID_TOR];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc( sizeof(struct rt_tor_internal), "rt_tor_internal" );
|
||||
tor_ip = (struct rt_tor_internal *)internal.idb_ptr;
|
||||
tor_ip->magic = RT_TOR_INTERNAL_MAGIC;
|
||||
VSET( tor_ip->v, -view_state->vs_vop->vo_center[MDX], -view_state->vs_vop->vo_center[MDY], -view_state->vs_vop->vo_center[MDZ] );
|
||||
VSET( tor_ip->h, 1.0, 0.0, 0.0 ); /* unit normal */
|
||||
tor_ip->r_h = 0.5*view_state->vs_vop->vo_scale;
|
||||
tor_ip->r_a = view_state->vs_vop->vo_scale;
|
||||
tor_ip->r_b = view_state->vs_vop->vo_scale;
|
||||
VSET( tor_ip->a, 0.0, view_state->vs_vop->vo_scale, 0.0 );
|
||||
VSET( tor_ip->b, 0.0, 0.0, view_state->vs_vop->vo_scale );
|
||||
} else if ( strcmp( argv[2], "tgc" ) == 0 ) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_TGC;
|
||||
internal.idb_meth = &rt_functab[ID_TGC];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc( sizeof(struct rt_tgc_internal), "rt_tgc_internal" );
|
||||
tgc_ip = (struct rt_tgc_internal *)internal.idb_ptr;
|
||||
tgc_ip->magic = RT_TGC_INTERNAL_MAGIC;
|
||||
VSET( tgc_ip->v, -view_state->vs_vop->vo_center[MDX], -view_state->vs_vop->vo_center[MDY], -view_state->vs_vop->vo_center[MDZ]-view_state->vs_vop->vo_scale );
|
||||
VSET( tgc_ip->h, 0.0, 0.0, (view_state->vs_vop->vo_scale*2) );
|
||||
VSET( tgc_ip->a, (0.5*view_state->vs_vop->vo_scale), 0.0, 0.0 );
|
||||
VSET( tgc_ip->b, 0.0, (0.25*view_state->vs_vop->vo_scale), 0.0 );
|
||||
VSET( tgc_ip->c, (0.25*view_state->vs_vop->vo_scale), 0.0, 0.0 );
|
||||
VSET( tgc_ip->d, 0.0, (0.5*view_state->vs_vop->vo_scale), 0.0 );
|
||||
} else if ( strcmp( argv[2], "tec" ) == 0 ) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_TGC;
|
||||
internal.idb_meth = &rt_functab[ID_TGC];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc( sizeof(struct rt_tgc_internal), "rt_tgc_internal" );
|
||||
tgc_ip = (struct rt_tgc_internal *)internal.idb_ptr;
|
||||
tgc_ip->magic = RT_TGC_INTERNAL_MAGIC;
|
||||
VSET( tgc_ip->v, -view_state->vs_vop->vo_center[MDX], -view_state->vs_vop->vo_center[MDY], -view_state->vs_vop->vo_center[MDZ]-view_state->vs_vop->vo_scale );
|
||||
VSET( tgc_ip->h, 0.0, 0.0, (view_state->vs_vop->vo_scale*2) );
|
||||
VSET( tgc_ip->a, (0.5*view_state->vs_vop->vo_scale), 0.0, 0.0 );
|
||||
VSET( tgc_ip->b, 0.0, (0.25*view_state->vs_vop->vo_scale), 0.0 );
|
||||
VSET( tgc_ip->c, (0.25*view_state->vs_vop->vo_scale), 0.0, 0.0 );
|
||||
VSET( tgc_ip->d, 0.0, (0.125*view_state->vs_vop->vo_scale), 0.0 );
|
||||
} else if ( strcmp( argv[2], "rec" ) == 0 ) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_TGC;
|
||||
internal.idb_meth = &rt_functab[ID_TGC];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc( sizeof(struct rt_tgc_internal), "rt_tgc_internal" );
|
||||
tgc_ip = (struct rt_tgc_internal *)internal.idb_ptr;
|
||||
tgc_ip->magic = RT_TGC_INTERNAL_MAGIC;
|
||||
VSET( tgc_ip->v, -view_state->vs_vop->vo_center[MDX], -view_state->vs_vop->vo_center[MDY], -view_state->vs_vop->vo_center[MDZ]-view_state->vs_vop->vo_scale );
|
||||
VSET( tgc_ip->h, 0.0, 0.0, (view_state->vs_vop->vo_scale*2) );
|
||||
VSET( tgc_ip->a, (0.5*view_state->vs_vop->vo_scale), 0.0, 0.0 );
|
||||
VSET( tgc_ip->b, 0.0, (0.25*view_state->vs_vop->vo_scale), 0.0 );
|
||||
VSET( tgc_ip->c, (0.5*view_state->vs_vop->vo_scale), 0.0, 0.0 );
|
||||
VSET( tgc_ip->d, 0.0, (0.25*view_state->vs_vop->vo_scale), 0.0 );
|
||||
} else if ( strcmp( argv[2], "trc" ) == 0 ) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_TGC;
|
||||
internal.idb_meth = &rt_functab[ID_TGC];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc( sizeof(struct rt_tgc_internal), "rt_tgc_internal" );
|
||||
tgc_ip = (struct rt_tgc_internal *)internal.idb_ptr;
|
||||
tgc_ip->magic = RT_TGC_INTERNAL_MAGIC;
|
||||
VSET( tgc_ip->v, -view_state->vs_vop->vo_center[MDX], -view_state->vs_vop->vo_center[MDY], -view_state->vs_vop->vo_center[MDZ]-view_state->vs_vop->vo_scale );
|
||||
VSET( tgc_ip->h, 0.0, 0.0, (view_state->vs_vop->vo_scale*2) );
|
||||
VSET( tgc_ip->a, (0.5*view_state->vs_vop->vo_scale), 0.0, 0.0 );
|
||||
VSET( tgc_ip->b, 0.0, (0.5*view_state->vs_vop->vo_scale), 0.0 );
|
||||
VSET( tgc_ip->c, (0.25*view_state->vs_vop->vo_scale), 0.0, 0.0 );
|
||||
VSET( tgc_ip->d, 0.0, (0.25*view_state->vs_vop->vo_scale), 0.0 );
|
||||
} else if ( strcmp( argv[2], "rcc" ) == 0 ) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_TGC;
|
||||
internal.idb_meth = &rt_functab[ID_TGC];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc( sizeof(struct rt_tgc_internal), "rt_tgc_internal" );
|
||||
tgc_ip = (struct rt_tgc_internal *)internal.idb_ptr;
|
||||
tgc_ip->magic = RT_TGC_INTERNAL_MAGIC;
|
||||
VSET( tgc_ip->v, -view_state->vs_vop->vo_center[MDX], -view_state->vs_vop->vo_center[MDY], -view_state->vs_vop->vo_center[MDZ]-view_state->vs_vop->vo_scale );
|
||||
VSET( tgc_ip->h, 0.0, 0.0, (view_state->vs_vop->vo_scale*2) );
|
||||
VSET( tgc_ip->a, (0.5*view_state->vs_vop->vo_scale), 0.0, 0.0 );
|
||||
VSET( tgc_ip->b, 0.0, (0.5*view_state->vs_vop->vo_scale), 0.0 );
|
||||
VSET( tgc_ip->c, (0.5*view_state->vs_vop->vo_scale), 0.0, 0.0 );
|
||||
VSET( tgc_ip->d, 0.0, (0.5*view_state->vs_vop->vo_scale), 0.0 );
|
||||
} else if ( strcmp( argv[2], "half" ) == 0 ) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_HALF;
|
||||
internal.idb_meth = &rt_functab[ID_HALF];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc( sizeof(struct rt_half_internal), "rt_half_internal" );
|
||||
half_ip = (struct rt_half_internal *)internal.idb_ptr;
|
||||
half_ip->magic = RT_HALF_INTERNAL_MAGIC;
|
||||
VSET( half_ip->eqn, 0.0, 0.0, 1.0 );
|
||||
half_ip->eqn[3] = (-view_state->vs_vop->vo_center[MDZ]);
|
||||
} else if ( strcmp( argv[2], "rpc" ) == 0 ) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_RPC;
|
||||
internal.idb_meth = &rt_functab[ID_RPC];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc( sizeof(struct rt_rpc_internal), "rt_rpc_internal" );
|
||||
rpc_ip = (struct rt_rpc_internal *)internal.idb_ptr;
|
||||
rpc_ip->rpc_magic = RT_RPC_INTERNAL_MAGIC;
|
||||
VSET( rpc_ip->rpc_V, -view_state->vs_vop->vo_center[MDX], -view_state->vs_vop->vo_center[MDY], -view_state->vs_vop->vo_center[MDZ]-view_state->vs_vop->vo_scale*0.5 );
|
||||
VSET( rpc_ip->rpc_H, 0.0, 0.0, view_state->vs_vop->vo_scale );
|
||||
VSET( rpc_ip->rpc_B, 0.0, (view_state->vs_vop->vo_scale*0.5), 0.0 );
|
||||
rpc_ip->rpc_r = view_state->vs_vop->vo_scale*0.25;
|
||||
} else if ( strcmp( argv[2], "rhc" ) == 0 ) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_RHC;
|
||||
internal.idb_meth = &rt_functab[ID_RHC];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc( sizeof(struct rt_rhc_internal), "rt_rhc_internal" );
|
||||
rhc_ip = (struct rt_rhc_internal *)internal.idb_ptr;
|
||||
rhc_ip->rhc_magic = RT_RHC_INTERNAL_MAGIC;
|
||||
VSET( rhc_ip->rhc_V, -view_state->vs_vop->vo_center[MDX], -view_state->vs_vop->vo_center[MDY], -view_state->vs_vop->vo_center[MDZ]-view_state->vs_vop->vo_scale*0.5 );
|
||||
VSET( rhc_ip->rhc_H, 0.0, 0.0, view_state->vs_vop->vo_scale );
|
||||
VSET( rhc_ip->rhc_B, 0.0, (view_state->vs_vop->vo_scale*0.5), 0.0 );
|
||||
rhc_ip->rhc_r = view_state->vs_vop->vo_scale*0.25;
|
||||
rhc_ip->rhc_c = view_state->vs_vop->vo_scale*0.10;
|
||||
} else if ( strcmp( argv[2], "epa" ) == 0 ) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_EPA;
|
||||
internal.idb_meth = &rt_functab[ID_EPA];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc( sizeof(struct rt_epa_internal), "rt_epa_internal" );
|
||||
epa_ip = (struct rt_epa_internal *)internal.idb_ptr;
|
||||
epa_ip->epa_magic = RT_EPA_INTERNAL_MAGIC;
|
||||
VSET( epa_ip->epa_V, -view_state->vs_vop->vo_center[MDX], -view_state->vs_vop->vo_center[MDY], -view_state->vs_vop->vo_center[MDZ]-view_state->vs_vop->vo_scale*0.5 );
|
||||
VSET( epa_ip->epa_H, 0.0, 0.0, view_state->vs_vop->vo_scale );
|
||||
VSET( epa_ip->epa_Au, 0.0, 1.0, 0.0 );
|
||||
epa_ip->epa_r1 = view_state->vs_vop->vo_scale*0.5;
|
||||
epa_ip->epa_r2 = view_state->vs_vop->vo_scale*0.25;
|
||||
} else if ( strcmp( argv[2], "ehy" ) == 0 ) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_EHY;
|
||||
internal.idb_meth = &rt_functab[ID_EHY];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc( sizeof(struct rt_ehy_internal), "rt_ehy_internal" );
|
||||
ehy_ip = (struct rt_ehy_internal *)internal.idb_ptr;
|
||||
ehy_ip->ehy_magic = RT_EHY_INTERNAL_MAGIC;
|
||||
VSET( ehy_ip->ehy_V, -view_state->vs_vop->vo_center[MDX], -view_state->vs_vop->vo_center[MDY], -view_state->vs_vop->vo_center[MDZ]-view_state->vs_vop->vo_scale*0.5 );
|
||||
VSET( ehy_ip->ehy_H, 0.0, 0.0, view_state->vs_vop->vo_scale );
|
||||
VSET( ehy_ip->ehy_Au, 0.0, 1.0, 0.0 );
|
||||
ehy_ip->ehy_r1 = view_state->vs_vop->vo_scale*0.5;
|
||||
ehy_ip->ehy_r2 = view_state->vs_vop->vo_scale*0.25;
|
||||
ehy_ip->ehy_c = ehy_ip->ehy_r2;
|
||||
} else if ( strcmp( argv[2], "eto" ) == 0 ) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_ETO;
|
||||
internal.idb_meth = &rt_functab[ID_ETO];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc( sizeof(struct rt_eto_internal), "rt_eto_internal" );
|
||||
eto_ip = (struct rt_eto_internal *)internal.idb_ptr;
|
||||
eto_ip->eto_magic = RT_ETO_INTERNAL_MAGIC;
|
||||
VSET( eto_ip->eto_V, -view_state->vs_vop->vo_center[MDX], -view_state->vs_vop->vo_center[MDY], -view_state->vs_vop->vo_center[MDZ] );
|
||||
VSET( eto_ip->eto_N, 0.0, 0.0, 1.0 );
|
||||
VSET( eto_ip->eto_C, view_state->vs_vop->vo_scale*0.1, 0.0, view_state->vs_vop->vo_scale*0.1 );
|
||||
eto_ip->eto_r = view_state->vs_vop->vo_scale*0.5;
|
||||
eto_ip->eto_rd = view_state->vs_vop->vo_scale*0.05;
|
||||
} else if ( strcmp( argv[2], "part" ) == 0 ) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_PARTICLE;
|
||||
internal.idb_meth = &rt_functab[ID_PARTICLE];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc( sizeof(struct rt_part_internal), "rt_part_internal" );
|
||||
part_ip = (struct rt_part_internal *)internal.idb_ptr;
|
||||
part_ip->part_magic = RT_PART_INTERNAL_MAGIC;
|
||||
VSET( part_ip->part_V, -view_state->vs_vop->vo_center[MDX], -view_state->vs_vop->vo_center[MDY], -view_state->vs_vop->vo_center[MDZ]-view_state->vs_vop->vo_scale*0.5 );
|
||||
VSET( part_ip->part_H, 0.0, 0.0, view_state->vs_vop->vo_scale );
|
||||
part_ip->part_vrad = view_state->vs_vop->vo_scale*0.5;
|
||||
part_ip->part_hrad = view_state->vs_vop->vo_scale*0.25;
|
||||
part_ip->part_type = RT_PARTICLE_TYPE_CONE;
|
||||
} else if ( strcmp( argv[2], "nmg" ) == 0 ) {
|
||||
struct model *m;
|
||||
struct nmgregion *r;
|
||||
struct shell *s;
|
||||
|
||||
m = nmg_mm();
|
||||
r = nmg_mrsv( m );
|
||||
s = BU_LIST_FIRST( shell, &r->s_hd );
|
||||
nmg_vertex_g( s->vu_p->v_p, -view_state->vs_vop->vo_center[MDX], -view_state->vs_vop->vo_center[MDY], -view_state->vs_vop->vo_center[MDZ]);
|
||||
(void)nmg_meonvu( s->vu_p );
|
||||
(void)nmg_ml( s );
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_NMG;
|
||||
internal.idb_meth = &rt_functab[ID_NMG];
|
||||
internal.idb_ptr = (genptr_t)m;
|
||||
} else if ( strcmp( argv[2], "pipe" ) == 0 ) {
|
||||
struct wdb_pipept *ps;
|
||||
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_PIPE;
|
||||
internal.idb_meth = &rt_functab[ID_PIPE];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc( sizeof(struct rt_pipe_internal), "rt_pipe_internal" );
|
||||
pipe_ip = (struct rt_pipe_internal *)internal.idb_ptr;
|
||||
pipe_ip->pipe_magic = RT_PIPE_INTERNAL_MAGIC;
|
||||
BU_LIST_INIT( &pipe_ip->pipe_segs_head );
|
||||
BU_GETSTRUCT( ps, wdb_pipept );
|
||||
ps->l.magic = WDB_PIPESEG_MAGIC;
|
||||
VSET( ps->pp_coord, -view_state->vs_vop->vo_center[MDX], -view_state->vs_vop->vo_center[MDY], -view_state->vs_vop->vo_center[MDZ]-view_state->vs_vop->vo_scale );
|
||||
ps->pp_od = 0.5*view_state->vs_vop->vo_scale;
|
||||
ps->pp_id = 0.5*ps->pp_od;
|
||||
ps->pp_bendradius = ps->pp_od;
|
||||
BU_LIST_INSERT( &pipe_ip->pipe_segs_head, &ps->l );
|
||||
BU_GETSTRUCT( ps, wdb_pipept );
|
||||
ps->l.magic = WDB_PIPESEG_MAGIC;
|
||||
VSET( ps->pp_coord, -view_state->vs_vop->vo_center[MDX], -view_state->vs_vop->vo_center[MDY], -view_state->vs_vop->vo_center[MDZ]+view_state->vs_vop->vo_scale );
|
||||
ps->pp_od = 0.5*view_state->vs_vop->vo_scale;
|
||||
ps->pp_id = 0.5*ps->pp_od;
|
||||
ps->pp_bendradius = ps->pp_od;
|
||||
BU_LIST_INSERT( &pipe_ip->pipe_segs_head, &ps->l );
|
||||
} else if ( strcmp( argv[2], "bot" ) == 0 ) {
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_BOT;
|
||||
internal.idb_meth = &rt_functab[ID_BOT];
|
||||
BU_GETSTRUCT( bot_ip, rt_bot_internal );
|
||||
internal.idb_ptr = (genptr_t)bot_ip;
|
||||
bot_ip = (struct rt_bot_internal *)internal.idb_ptr;
|
||||
bot_ip->magic = RT_BOT_INTERNAL_MAGIC;
|
||||
bot_ip->mode = RT_BOT_SOLID;
|
||||
bot_ip->orientation = RT_BOT_UNORIENTED;
|
||||
bot_ip->num_vertices = 4;
|
||||
bot_ip->num_faces = 4;
|
||||
bot_ip->faces = (int *)bu_calloc( bot_ip->num_faces * 3, sizeof( int ), "BOT faces" );
|
||||
bot_ip->vertices = (fastf_t *)bu_calloc( bot_ip->num_vertices * 3, sizeof( fastf_t ), "BOT vertices" );
|
||||
bot_ip->thickness = (fastf_t *)NULL;
|
||||
bot_ip->face_mode = (struct bu_bitv *)NULL;
|
||||
VSET( &bot_ip->vertices[0], -view_state->vs_vop->vo_center[MDX], -view_state->vs_vop->vo_center[MDY], -view_state->vs_vop->vo_center[MDZ]+view_state->vs_vop->vo_scale );
|
||||
VSET( &bot_ip->vertices[3], -view_state->vs_vop->vo_center[MDX]-0.5*view_state->vs_vop->vo_scale, -view_state->vs_vop->vo_center[MDY], -view_state->vs_vop->vo_center[MDZ]-view_state->vs_vop->vo_scale );
|
||||
VSET( &bot_ip->vertices[6], -view_state->vs_vop->vo_center[MDX]-0.5*view_state->vs_vop->vo_scale, -view_state->vs_vop->vo_center[MDY]-0.5*view_state->vs_vop->vo_scale, -view_state->vs_vop->vo_center[MDZ]-view_state->vs_vop->vo_scale );
|
||||
VSET( &bot_ip->vertices[9], -view_state->vs_vop->vo_center[MDX]+0.5*view_state->vs_vop->vo_scale, -view_state->vs_vop->vo_center[MDY]-0.5*view_state->vs_vop->vo_scale, -view_state->vs_vop->vo_center[MDZ]-view_state->vs_vop->vo_scale );
|
||||
VSET( &bot_ip->faces[0], 0, 1, 3 );
|
||||
VSET( &bot_ip->faces[3], 0, 1, 2 );
|
||||
VSET( &bot_ip->faces[6], 0, 2, 3 );
|
||||
VSET( &bot_ip->faces[9], 1, 2, 3 );
|
||||
} else if ( strcmp( argv[2], "extrude" ) == 0 ) {
|
||||
char *av[3];
|
||||
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_EXTRUDE;
|
||||
internal.idb_meth = &rt_functab[ID_EXTRUDE];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc( sizeof( struct rt_extrude_internal), "rt_extrude_internal" );
|
||||
extrude_ip = (struct rt_extrude_internal *)internal.idb_ptr;
|
||||
extrude_ip->magic = RT_EXTRUDE_INTERNAL_MAGIC;
|
||||
VSET( extrude_ip->V, -view_state->vs_vop->vo_center[MDX], -view_state->vs_vop->vo_center[MDY], -view_state->vs_vop->vo_center[MDZ]-view_state->vs_vop->vo_scale*0.5 );
|
||||
VSET( extrude_ip->h, 0.0, 0.0, view_state->vs_vop->vo_scale/3.0 );
|
||||
VSET( extrude_ip->u_vec, 1.0, 0.0, 0.0 );
|
||||
VSET( extrude_ip->v_vec, 0.0, 1.0, 0.0 );
|
||||
extrude_ip->keypoint = 0;
|
||||
av[0] = "make_name";
|
||||
av[1] = "skt_";
|
||||
Tcl_ResetResult( interp );
|
||||
cmd_make_name( (ClientData)NULL, interp, 2, av );
|
||||
extrude_ip->sketch_name = bu_strdup( Tcl_GetStringResult(interp) );
|
||||
Tcl_ResetResult( interp );
|
||||
extrude_ip->skt = (struct rt_sketch_internal *)NULL;
|
||||
av[0] = "make";
|
||||
av[1] = extrude_ip->sketch_name;
|
||||
av[2] = "sketch";
|
||||
f_make( clientData, interp, 3, av );
|
||||
} else if ( strcmp( argv[2], "sketch" ) == 0 ) {
|
||||
#if 0
|
||||
/* used by the now defunct default sketch object */
|
||||
struct carc_seg *csg;
|
||||
struct line_seg *lsg;
|
||||
#endif
|
||||
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_SKETCH;
|
||||
internal.idb_meth = &rt_functab[ID_SKETCH];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc( sizeof(struct rt_sketch_internal), "rt_sketch_internal" );
|
||||
sketch_ip = (struct rt_sketch_internal *)internal.idb_ptr;
|
||||
sketch_ip->magic = RT_SKETCH_INTERNAL_MAGIC;
|
||||
VSET( sketch_ip->u_vec, 1.0, 0.0, 0.0 );
|
||||
VSET( sketch_ip->v_vec, 0.0, 1.0, 0.0 );
|
||||
VSET( sketch_ip->V, -view_state->vs_vop->vo_center[MDX], -view_state->vs_vop->vo_center[MDY], -view_state->vs_vop->vo_center[MDZ]-view_state->vs_vop->vo_scale*0.5 );
|
||||
#if 0
|
||||
/* XXX this creates a "default" sketch object -- this
|
||||
code should probably be made optional somewhere
|
||||
else now? */
|
||||
sketch_ip->vert_count = 7;
|
||||
sketch_ip->verts = (point2d_t *)bu_calloc( sketch_ip->vert_count, sizeof( point2d_t ), "sketch_ip->verts" );
|
||||
sketch_ip->verts[0][0] = 0.25*view_state->vs_vop->vo_scale;
|
||||
sketch_ip->verts[0][1] = 0.0;
|
||||
sketch_ip->verts[1][0] = 0.5*view_state->vs_vop->vo_scale;
|
||||
sketch_ip->verts[1][1] = 0.0;
|
||||
sketch_ip->verts[2][0] = 0.5*view_state->vs_vop->vo_scale;
|
||||
sketch_ip->verts[2][1] = 0.5*view_state->vs_vop->vo_scale;
|
||||
sketch_ip->verts[3][0] = 0.0;
|
||||
sketch_ip->verts[3][1] = 0.5*view_state->vs_vop->vo_scale;
|
||||
sketch_ip->verts[4][0] = 0.0;
|
||||
sketch_ip->verts[4][1] = 0.25*view_state->vs_vop->vo_scale;
|
||||
sketch_ip->verts[5][0] = 0.25*view_state->vs_vop->vo_scale;
|
||||
sketch_ip->verts[5][1] = 0.25*view_state->vs_vop->vo_scale;
|
||||
sketch_ip->verts[6][0] = 0.125*view_state->vs_vop->vo_scale;
|
||||
sketch_ip->verts[6][1] = 0.125*view_state->vs_vop->vo_scale;
|
||||
sketch_ip->skt_curve.seg_count = 6;
|
||||
sketch_ip->skt_curve.reverse = (int *)bu_calloc( sketch_ip->skt_curve.seg_count, sizeof( int ), "sketch_ip->skt_curve.reverse" );
|
||||
sketch_ip->skt_curve.segments = (genptr_t *)bu_calloc( sketch_ip->skt_curve.seg_count, sizeof( genptr_t ), "sketch_ip->skt_curve.segments" );
|
||||
|
||||
csg = (struct carc_seg *)bu_calloc( 1, sizeof( struct carc_seg ), "segments" );
|
||||
sketch_ip->skt_curve.segments[0] = (genptr_t)csg;
|
||||
csg->magic = CURVE_CARC_MAGIC;
|
||||
csg->start = 4;
|
||||
csg->end = 0;
|
||||
csg->radius = 0.25*view_state->vs_vop->vo_scale;
|
||||
csg->center_is_left = 1;
|
||||
csg->orientation = 0;
|
||||
|
||||
lsg = (struct line_seg *)bu_calloc( 1, sizeof( struct line_seg ), "segments" );
|
||||
sketch_ip->skt_curve.segments[1] = (genptr_t)lsg;
|
||||
lsg->magic = CURVE_LSEG_MAGIC;
|
||||
lsg->start = 0;
|
||||
lsg->end = 1;
|
||||
|
||||
lsg = (struct line_seg *)bu_calloc( 1, sizeof( struct line_seg ), "segments" );
|
||||
sketch_ip->skt_curve.segments[2] = (genptr_t)lsg;
|
||||
lsg->magic = CURVE_LSEG_MAGIC;
|
||||
lsg->start = 1;
|
||||
lsg->end = 2;
|
||||
|
||||
lsg = (struct line_seg *)bu_calloc( 1, sizeof( struct line_seg ), "segments" );
|
||||
sketch_ip->skt_curve.segments[3] = (genptr_t)lsg;
|
||||
lsg->magic = CURVE_LSEG_MAGIC;
|
||||
lsg->start = 2;
|
||||
lsg->end = 3;
|
||||
|
||||
lsg = (struct line_seg *)bu_calloc( 1, sizeof( struct line_seg ), "segments" );
|
||||
sketch_ip->skt_curve.segments[4] = (genptr_t)lsg;
|
||||
lsg->magic = CURVE_LSEG_MAGIC;
|
||||
lsg->start = 3;
|
||||
lsg->end = 4;
|
||||
|
||||
csg = (struct carc_seg *)bu_calloc( 1, sizeof( struct carc_seg ), "segments" );
|
||||
sketch_ip->skt_curve.segments[5] = (genptr_t)csg;
|
||||
csg->magic = CURVE_CARC_MAGIC;
|
||||
csg->start = 6;
|
||||
csg->end = 5;
|
||||
csg->radius = -1.0;
|
||||
csg->center_is_left = 1;
|
||||
csg->orientation = 0;
|
||||
#else
|
||||
sketch_ip->vert_count = 0;
|
||||
sketch_ip->verts = (point2d_t *)NULL;
|
||||
sketch_ip->skt_curve.seg_count = 0;
|
||||
sketch_ip->skt_curve.reverse = (int *)NULL;
|
||||
sketch_ip->skt_curve.segments = (genptr_t *)NULL;
|
||||
#endif
|
||||
} else if ( strcmp( argv[2], "superell" ) == 0 ) {
|
||||
|
||||
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_SUPERELL;
|
||||
internal.idb_meth = &rt_functab[ID_SUPERELL];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc( sizeof(struct rt_superell_internal), "rt_superell_internal" );
|
||||
superell_ip = (struct rt_superell_internal *)internal.idb_ptr;
|
||||
superell_ip->magic = RT_SUPERELL_INTERNAL_MAGIC;
|
||||
VSET( superell_ip->v, -view_state->vs_vop->vo_center[MDX], -view_state->vs_vop->vo_center[MDY], -view_state->vs_vop->vo_center[MDZ] );
|
||||
VSET( superell_ip->a, view_state->vs_vop->vo_scale, 0.0, 0.0 ); /* A */
|
||||
VSET( superell_ip->b, 0.0, (0.5*view_state->vs_vop->vo_scale), 0.0 ); /* B */
|
||||
VSET( superell_ip->c, 0.0, 0.0, (0.25*view_state->vs_vop->vo_scale) ); /* C */
|
||||
superell_ip->n = 1.0;
|
||||
superell_ip->e = 1.0;
|
||||
fprintf(stdout, "superell being made with %f and %f\n", superell_ip->n, superell_ip->e);
|
||||
|
||||
} else if (strcmp(argv[2], "hf") == 0) {
|
||||
Tcl_AppendResult(interp, "make: the height field is deprecated and not supported by this command.\nUse the dsp primitive.\n", (char *)NULL);
|
||||
return TCL_ERROR;
|
||||
} else if (strcmp(argv[2], "pg") == 0 ||
|
||||
strcmp(argv[2], "poly") == 0) {
|
||||
Tcl_AppendResult(interp, "make: the polysolid is deprecated and not supported by this command.\nUse the bot primitive.\n", (char *)NULL);
|
||||
return TCL_ERROR;
|
||||
} else if (strcmp(argv[2], "cline") == 0 ||
|
||||
strcmp(argv[2], "dsp") == 0 ||
|
||||
strcmp(argv[2], "ebm") == 0 ||
|
||||
strcmp(argv[2], "nurb") == 0 ||
|
||||
strcmp(argv[2], "spline") == 0 ||
|
||||
strcmp(argv[2], "submodel") == 0 ||
|
||||
strcmp(argv[2], "vol") == 0) {
|
||||
Tcl_AppendResult(interp, "make: the ", argv[2], " primitive is not supported by this command.\n", (char *)NULL);
|
||||
return TCL_ERROR;
|
||||
} else if (strcmp(argv[2], "metaball") == 0) {
|
||||
struct wdb_metaballpt *mbpt;
|
||||
internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
|
||||
internal.idb_type = ID_METABALL;
|
||||
internal.idb_meth = &rt_functab[ID_METABALL];
|
||||
internal.idb_ptr = (genptr_t)bu_malloc( sizeof(struct rt_metaball_internal), "rt_metaball_internal" );
|
||||
metaball_ip = (struct rt_metaball_internal *)internal.idb_ptr;
|
||||
metaball_ip->magic = RT_METABALL_INTERNAL_MAGIC;
|
||||
metaball_ip->threshold = 1.0;
|
||||
metaball_ip->method = 1;
|
||||
BU_LIST_INIT( &metaball_ip->metaball_ctrl_head );
|
||||
|
||||
mbpt = (struct wdb_metaballpt *)malloc(sizeof(struct wdb_metaballpt));
|
||||
mbpt->fldstr = 1.0;
|
||||
mbpt->sweat = 1.0;
|
||||
VSET(mbpt->coord, -view_state->vs_vop->vo_center[MDX] - 1.0, -view_state->vs_vop->vo_center[MDY], -view_state->vs_vop->vo_center[MDZ] );
|
||||
BU_LIST_INSERT(&metaball_ip->metaball_ctrl_head, &mbpt->l);
|
||||
|
||||
mbpt = (struct wdb_metaballpt *)malloc(sizeof(struct wdb_metaballpt));
|
||||
mbpt->fldstr = 1.0;
|
||||
mbpt->sweat = 1.0;
|
||||
VSET(mbpt->coord, -view_state->vs_vop->vo_center[MDX] + 1.0, -view_state->vs_vop->vo_center[MDY], -view_state->vs_vop->vo_center[MDZ] );
|
||||
BU_LIST_INSERT(&metaball_ip->metaball_ctrl_head, &mbpt->l);
|
||||
|
||||
fprintf(stdout, "metaball being made with %f threshold and two points using the %s rendering method\n",
|
||||
metaball_ip->threshold, rt_metaball_lookup_type_name(metaball_ip->method));
|
||||
} else {
|
||||
Tcl_AppendResult(interp, "make: ", argv[2], " is not a known primitive\n",
|
||||
"\tchoices are: arb8, arb7, arb6, arb5, arb4, arbn, ars, bot,\n",
|
||||
"\t\tehy, ell, ell1, epa, eto, extrude, grip, half,\n",
|
||||
"\t\tmetaball, nmg, part, pipe, rcc, rec, rhc, rpc,\n",
|
||||
"\t\tsketch, sph, superell, tec, tgc, tor, trc\n",
|
||||
(char *)NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/* no interuprts */
|
||||
(void)signal( SIGINT, SIG_IGN );
|
||||
|
||||
if ( (dp = db_diradd( dbip, argv[1], -1L, 0, DIR_SOLID, (genptr_t)&internal.idb_type)) == DIR_NULL ) {
|
||||
TCL_ALLOC_ERR_return;
|
||||
}
|
||||
if ( rt_db_put_internal( dp, dbip, &internal, &rt_uniresource ) < 0 ) {
|
||||
TCL_WRITE_ERR_return;
|
||||
}
|
||||
|
||||
{
|
||||
if (wdbp->wdb_result_flags == 0 && ret == TCL_OK) {
|
||||
const char *av[3];
|
||||
|
||||
av[0] = "e";
|
||||
av[1] = argv[1]; /* depends on name being in argv[1] */
|
||||
av[0] = "draw";
|
||||
av[1] = argv[argc-2];
|
||||
av[2] = NULL;
|
||||
|
||||
/* draw the "made" solid */
|
||||
return cmd_draw( clientData, interp, 2, av );
|
||||
cmd_draw(clientData, interp, 2, av);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
+16
-1
@@ -1981,9 +1981,24 @@ cmd_make_name(ClientData clientData,
|
||||
int argc,
|
||||
char **argv)
|
||||
{
|
||||
Tcl_DString ds;
|
||||
int ret;
|
||||
|
||||
CHECK_DBI_NULL;
|
||||
|
||||
return wdb_make_name_cmd(wdbp, interp, argc, argv);
|
||||
ret = ged_make_name(wdbp, argc, argv);
|
||||
|
||||
/* Convert to Tcl codes */
|
||||
if (ret == GED_OK)
|
||||
ret = TCL_OK;
|
||||
else
|
||||
ret = TCL_ERROR;
|
||||
|
||||
Tcl_DStringInit(&ds);
|
||||
Tcl_DStringAppend(&ds, bu_vls_addr(&wdbp->wdb_result_str), -1);
|
||||
Tcl_DStringResult(interp, &ds);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
Reference in new issue
Block a user