BRL-CAD
blast.c
Go to the documentation of this file.
1 /* B L A S T . C
2  * BRL-CAD
3  *
4  * Copyright (c) 2008-2014 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 /** @file libged/blast.c
21  *
22  * The blast command.
23  *
24  */
25 
26 #include "ged.h"
27 
28 /*
29  * Erase all currently displayed geometry and draw the specified object(s)
30  *
31  * Usage:
32  * blast object(s)
33  *
34  */
35 int
36 ged_blast(struct ged *gedp, int argc, const char *argv[])
37 {
38  static const char *usage = "object(s)";
39 
42  GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
43 
44  /* initialize result */
45  bu_vls_trunc(gedp->ged_result_str, 0);
46 
47  /* must be wanting help */
48  if (argc == 1) {
49  bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
50  return GED_HELP;
51  }
52 
53  /* First, clear the screen */
54  {
55  const char *av[2];
56 
57  av[0] = "zap";
58  av[1] = (char *)0;
59  ged_zap(gedp, 1, av);
60  }
61 
62  /* Draw the new object(s) */
63  return ged_draw(gedp, argc, argv);
64 }
65 
66 
67 /*
68  * Local Variables:
69  * tab-width: 8
70  * mode: C
71  * indent-tabs-mode: t
72  * c-file-style: "stroustrup"
73  * End:
74  * ex: shiftwidth=4 tabstop=8
75  */
void usage(struct ged *gedp)
Definition: coil.c:315
Definition: ged.h:338
int ged_blast(struct ged *gedp, int argc, const char *argv[])
Definition: blast.c:36
void bu_vls_trunc(struct bu_vls *vp, int len)
Definition: vls.c:198
#define GED_CHECK_ARGC_GT_0(_gedp, _argc, _flags)
Definition: ged.h:202
int ged_draw(struct ged *gedp, int argc, const char *argv[])
Definition: draw.c:1212
#define GED_ERROR
Definition: ged.h:61
#define GED_CHECK_DATABASE_OPEN(_gedp, _flags)
Definition: ged.h:114
#define GED_CHECK_DRAWABLE(_gedp, _flags)
Definition: ged.h:129
int ged_zap(struct ged *gedp, int argc, const char *argv[])
Definition: zap.c:42
struct bu_vls * ged_result_str
Definition: ged.h:357
void bu_vls_printf(struct bu_vls *vls, const char *fmt,...) _BU_ATTR_PRINTF23
Definition: vls.c:694
#define GED_HELP
Definition: ged.h:62