Index: /cgm/trunk/test/modify.cpp =================================================================== --- /cgm/trunk/test/modify.cpp (revision 2144) +++ /cgm/trunk/test/modify.cpp (revision 2153) @@ -730,4 +730,5 @@ refentities.append(sweep_face); RefFace* draft_face = gmti->make_RefFace(sweep_face); + RefFace* perp_face = gmti->make_RefFace(sweep_face); gmti->sweep_translational(refentities, v_move8, 0, 1, CUBIT_FALSE, CUBIT_FALSE); body = CAST_TO(refentities.get(), Body); @@ -748,4 +749,11 @@ d = body->measure(); //d = area = 90.1292 theoretica calculation is 90.5754, error 0.49% + refentities.clean_out(); + refentities.append(perp_face); + gmti->sweep_perpendicular(refentities, 10, 0.087, 1, CUBIT_FALSE, CUBIT_FALSE); + body = CAST_TO(refentities.get(), Body); + d = body->measure(); + //d = 66.3676 theoretical calculation is 66.7833, error 0.62% + return CUBIT_SUCCESS; } Index: /cgm/trunk/geom/GeometryModifyTool.cpp =================================================================== --- /cgm/trunk/geom/GeometryModifyTool.cpp (revision 2144) +++ /cgm/trunk/geom/GeometryModifyTool.cpp (revision 2153) @@ -3515,4 +3515,12 @@ status = CUBIT_FAILURE; + body_list.clean_out(); + for(int i = 0; i < result_list.size(); i++) + { + Body* body = CAST_TO(result_list.get_and_step()->topology_entity(),Body ); + if(body) + body_list.append(body); + } + CAST_LIST( body_list, ref_ent_list, RefEntity); return status; } Index: /cgm/trunk/geom/OCC/OCCModifyEngine.cpp =================================================================== --- /cgm/trunk/geom/OCC/OCCModifyEngine.cpp (revision 2144) +++ /cgm/trunk/geom/OCC/OCCModifyEngine.cpp (revision 2153) @@ -4011,20 +4011,53 @@ // Member Type: PUBLIC // Description: -// Author : John Fowler -// Date : 10/02 +// Author : Jane Hu +// Date : 10/08 //=============================================================================== CubitStatus OCCModifyEngine:: sweep_perpendicular( - DLIList& /*ref_ent_list*/, - DLIList& /*result_body_list*/, - double /*distance*/, - double /*draft_angle*/, - int /*draft_type*/, - bool /*switchside*/, - bool /*rigid*/, + DLIList& ref_ent_list, + DLIList& result_body_list, + double distance, + double draft_angle, + int draft_type, + bool switchside, //has no effect + bool rigid, //has no effect Surface* stop_surf, BodySM* to_body) const { - PRINT_ERROR("Option not supported for mesh based geometry.\n"); - return CUBIT_FAILURE; + //find the vector perpendicular to the ref_ent normal, and sweep_translate + //the 'distance' along this vector + DLIList edge_list; + CubitVector vec; + for(int i = 0; i < ref_ent_list.size(); i++) + { + GeometryEntity *ref_ent = ref_ent_list.get_and_step(); + Surface *face = CAST_TO(ref_ent, Surface); + Curve* edge = CAST_TO(ref_ent, Curve); + DLIList face_list; + if(face != NULL) + { + OCCSurface* occ_face = CAST_TO(face, OCCSurface); + CubitVector center = occ_face->center_point(); + CubitVector closest_p, unit_normal; + CubitStatus stat = + occ_face->closest_point(center, &closest_p, &unit_normal); + if(stat) + { + vec = distance * unit_normal; + face_list.append(ref_ent); + stat = sweep_translational(face_list, result_body_list, vec, + draft_angle, draft_type, switchside, + rigid, stop_surf, to_body); + } + } + else if (edge != NULL) + { + edge_list.append(ref_ent); + } + } + if(edge_list.size()) + PRINT_ERROR("Curves cannot be swept perpendicularly, please use the vector sweep.\n"); + + return CUBIT_SUCCESS; }