Author: bmsmith Date: 2008-10-13 09:22:40 -0500 (Mon, 13 Oct 2008) New Revision: 2139 Modified: cgm/trunk/itaps/iGeom.h cgm/trunk/itaps/iGeom_CGMA.cc Log: Added iGeom calls for prism and intersect. Modified: cgm/trunk/itaps/iGeom.h =================================================================== --- cgm/trunk/itaps/iGeom.h 2008-10-10 22:09:37 UTC (rev 2138) +++ cgm/trunk/itaps/iGeom.h 2008-10-13 14:22:40 UTC (rev 2139) @@ -2066,6 +2066,15 @@ iBase_EntityHandle* sphere_handle_out, int* err ); +/**\brief Create a prism centered on the origin + */ +void iGeom_createPrism( iGeom_Instance, + double height, + int n_sides, + double major_rad, + double minor_rad, + iBase_EntityHandle* prism_handle_out, int* err ); + /**\brief * */ @@ -2154,6 +2163,14 @@ iBase_EntityHandle* geom_entity, int* err ); +/**\brief + */ + void iGeom_intersectEnts( iGeom_Instance, + iBase_EntityHandle entity2, + iBase_EntityHandle entity1, + iBase_EntityHandle* geom_entity, + int* err ); + /**\brief * */ Modified: cgm/trunk/itaps/iGeom_CGMA.cc =================================================================== --- cgm/trunk/itaps/iGeom_CGMA.cc 2008-10-10 22:09:37 UTC (rev 2138) +++ cgm/trunk/itaps/iGeom_CGMA.cc 2008-10-13 14:22:40 UTC (rev 2139) @@ -5148,8 +5148,29 @@ *geom_entity = tmp_body; RETURN ((tmp_body ? iBase_SUCCESS : iBase_FAILURE)); } + + +void +iGeom_createPrism( iGeom_Instance instance, + /*in*/ double height, + /*in*/ int n_sides, + /*in*/ double major_rad, + /*in*/ double minor_rad, + /*out*/ iBase_EntityHandle *geom_entity, + int* err ) +{ + if ( 0.0>=height ) { + ERROR(iBase_INVALID_ARGUMENT, "Prism height must be positive."); + } else if ( 3>n_sides ) { + ERROR(iBase_INVALID_ARGUMENT, "Prism must have at least three sides."); + } + RefEntity* tmp_body = gmt->prism( height, n_sides, major_rad, minor_rad ); + *geom_entity = tmp_body; + RETURN ((tmp_body ? iBase_SUCCESS :iBase_FAILURE)); +} + void iGeom_createBrick (iGeom_Instance instance, /*in*/ double x, @@ -5488,6 +5509,44 @@ } void +iGeom_intersectEnt ( iGeom_Instance instance, + /*in*/ iBase_EntityHandle ent1, + /*in*/ iBase_EntityHandle ent2, + /*out*/ iBase_EntityHandle *geom_entity, + int* err ) +{ + Body *this_ent1 = dynamic_cast<Body*>(ENTITY_HANDLE(ent1)); + Body *ent1_copy = gmt->copy_body(this_ent1); + if (NULL == ent1_copy) { + ERROR(iBase_FAILURE, "Trouble copying blank."); + } + Body *this_ent2 = dynamic_cast<Body*>(ENTITY_HANDLE(ent2)); + Body *ent2_copy = gmt->copy_body(this_ent2); + if (NULL == ent2_copy) { + ERROR(iBase_FAILURE, "Trouble copying tool."); + gqt->delete_RefEntity(ent1_copy); + RETURN(iBase_FAILURE); + } + + DLIList<Body*> ent1_list, new_body_list; + ent1_list.append(ent1_copy); + + RefEntity *new_body = NULL; + CubitStatus result = gmt->intersect(ent2_copy, ent1_list, new_body_list); + if (CUBIT_SUCCESS != result || 0 == new_body_list.size()) { + ERROR(iBase_FAILURE, "Intersect failed."); + } + else { + new_body = new_body_list.get(); + *geom_entity = new_body; + gqt->delete_RefEntity(this_ent2); + gqt->delete_RefEntity(this_ent1); + } + + RETURN(iBase_SUCCESS); +} + +void iGeom_sectionEnt (iGeom_Instance instance, /*inout*/ iBase_EntityHandle *geom_entity, /*in*/ double plane_normal_x,
participants (1)
-
bmsmith@mcs.anl.gov