[cgma-dev] r2153 - in cgm/trunk: geom geom/OCC test
janehu at mcs.anl.gov
janehu at mcs.anl.gov
Thu Oct 16 14:27:31 CDT 2008
Author: janehu
Date: 2008-10-16 14:27:31 -0500 (Thu, 16 Oct 2008)
New Revision: 2153
Modified:
cgm/trunk/geom/GeometryModifyTool.cpp
cgm/trunk/geom/OCC/OCCModifyEngine.cpp
cgm/trunk/test/modify.cpp
Log:
Added OCC sweep_perpendicular function, passed test.
Modified: cgm/trunk/geom/GeometryModifyTool.cpp
===================================================================
--- cgm/trunk/geom/GeometryModifyTool.cpp 2008-10-15 18:42:18 UTC (rev 2152)
+++ cgm/trunk/geom/GeometryModifyTool.cpp 2008-10-16 19:27:31 UTC (rev 2153)
@@ -3514,6 +3514,14 @@
if (!sweep_finish("perpendicular", body_list, result_list, change_newids))
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;
}
CubitStatus GeometryModifyTool::sweep_along_curve(DLIList<RefEntity*>& ref_ent_list,
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-10-15 18:42:18 UTC (rev 2152)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-10-16 19:27:31 UTC (rev 2153)
@@ -4010,22 +4010,55 @@
//===============================================================================
// Member Type: PUBLIC
// Description:
-// Author : John Fowler
-// Date : 10/02
+// Author : Jane Hu
+// Date : 10/08
//===============================================================================
CubitStatus OCCModifyEngine:: sweep_perpendicular(
- DLIList<GeometryEntity*>& /*ref_ent_list*/,
- DLIList<BodySM*>& /*result_body_list*/,
- double /*distance*/,
- double /*draft_angle*/,
- int /*draft_type*/,
- bool /*switchside*/,
- bool /*rigid*/,
+ DLIList<GeometryEntity*>& ref_ent_list,
+ DLIList<BodySM*>& 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<GeometryEntity*> 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<GeometryEntity*> 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;
}
//===============================================================================
Modified: cgm/trunk/test/modify.cpp
===================================================================
--- cgm/trunk/test/modify.cpp 2008-10-15 18:42:18 UTC (rev 2152)
+++ cgm/trunk/test/modify.cpp 2008-10-16 19:27:31 UTC (rev 2153)
@@ -729,6 +729,7 @@
DLIList<RefEntity*> refentities;
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);
d = body->measure();
@@ -747,5 +748,12 @@
body = CAST_TO(refentities.get(), Body);
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;
}
More information about the cgma-dev
mailing list