Revision: 35388 http://brlcad.svn.sourceforge.net/brlcad/?rev=35388&view=rev Author: bob1961 Date: 2009-07-29 21:13:08 +0000 (Wed, 29 Jul 2009)
Log Message: ----------- Modified ged_clone (v5 only) to return the name of the clone, as before, as well as a list of all cloned objects. Modified Paths: -------------- brlcad/trunk/src/libged/clone.c Modified: brlcad/trunk/src/libged/clone.c =================================================================== --- brlcad/trunk/src/libged/clone.c 2009-07-29 20:21:26 UTC (rev 35387) +++ brlcad/trunk/src/libged/clone.c 2009-07-29 21:13:08 UTC (rev 35388) @@ -83,6 +83,7 @@ fastf_t mirpos; /* Point on axis to mirror copy */ int autoview; /* Execute autoview after drawing all objects */ int updpos; /* Position of number to update (for -c) */ + struct bu_vls olist; /* List of cloned object names */ }; struct name { @@ -417,8 +418,8 @@ RT_CK_DB_INTERNAL(&intern); /* pull the new name */ dp = db_lookup(dbip, bu_vls_addr(name), LOOKUP_QUIET); - bu_vls_free(name); if (!dp) { + rt_db_free_internal(&intern, &rt_uniresource); bu_vls_free(name); continue; } @@ -426,7 +427,9 @@ /* write the new matrix to the new object */ if (rt_db_put_internal(dp, dbip, &intern, &rt_uniresource) < 0) bu_vls_printf(&state->gedp->ged_result_str, "ERROR: clone internal error copying %s\n", proto->d_namep); - rt_db_free_internal(&intern, &rt_uniresource); + + bu_vls_printf(&state->olist, "%V ", name); + bu_vls_free(name); } /* end make n copies */ return; @@ -629,6 +632,7 @@ bu_vls_free(name); return NULL; } + bu_vls_printf(&state->olist, "%V ", name); bu_vls_free(name); rt_db_free_internal(&dbintern, &rt_uniresource); } @@ -794,7 +798,7 @@ static void print_usage(struct ged *gedp) { - bu_vls_printf(&gedp->ged_result_str, "Usage: clone [-abhimnprtv] <object>\n\n"); + bu_vls_printf(&gedp->ged_result_str, "Usage: clone [-abhimnprtv] object\n\n"); bu_vls_printf(&gedp->ged_result_str, "-a <n> <x> <y> <z>\t- Specifies a translation split between n copies.\n"); bu_vls_printf(&gedp->ged_result_str, "-b <n> <x> <y> <z>\t- Specifies a rotation around x, y, and z axes \n\t\t\t split between n copies.\n"); bu_vls_printf(&gedp->ged_result_str, "-c\t\t\t- Increment the second number in object names.\n"); @@ -930,7 +934,6 @@ { struct ged_clone_state state; struct directory *copy; - static const char *usage = ""; GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR); GED_CHECK_READ_ONLY(gedp, GED_ERROR); @@ -949,9 +952,14 @@ if (get_args(gedp, argc, (char **)argv, &state) == GED_ERROR) return GED_ERROR; + bu_vls_init(&state.olist); + if ((copy = deep_copy_object(&rt_uniresource, &state)) != (struct directory *)NULL) bu_vls_printf(&gedp->ged_result_str, "%s", copy->d_namep); + bu_vls_printf(&gedp->ged_result_str, " {%V}", &state.olist); + bu_vls_free(&state.olist); + return GED_OK; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ BRL-CAD Source Commits mailing list brlcad-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/brlcad-commits