cgma-dev
Threads by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
June 2008
- 2 participants
- 19 discussions
Author: janehu
Date: 2008-06-11 14:08:53 -0500 (Wed, 11 Jun 2008)
New Revision: 1891
Modified:
cgm/trunk/geom/OCC/OCCCurve.cpp
cgm/trunk/geom/OCC/OCCCurve.hpp
cgm/trunk/geom/OCC/OCCModifyEngine.cpp
cgm/trunk/geom/OCC/OCCQueryEngine.cpp
cgm/trunk/test/modify.cpp
Log:
Test-passed one case of imprint-project-curve. project curvecould return different results, haven't test them all yet.
Modified: cgm/trunk/geom/OCC/OCCCurve.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCurve.cpp 2008-06-11 01:14:43 UTC (rev 1890)
+++ cgm/trunk/geom/OCC/OCCCurve.cpp 2008-06-11 19:08:53 UTC (rev 1891)
@@ -969,6 +969,7 @@
// Date : 01/08
//===============================================================================
Curve* OCCCurve::project_curve(Surface* face_ptr,
+ DLIList<Point*>& normal_proj_points,
CubitBoolean closed,
const CubitVector* third_point)
{
@@ -998,35 +999,84 @@
return (Curve*) NULL;
}
- TopTools_ListOfShape projections;
- projections = aProjection.Generated(*edge);
- int num_projection = projections.Extent();
- if (num_projection == 0)
+ TopoDS_Shape new_shape = aProjection.Projection();//compound shape
+ int num_projection = 0;
+ if (new_shape.IsNull())
{
PRINT_ERROR("Cannot project the curve to the surface.\n");
return (Curve*) NULL;
}
+ else
+ {
+ //count how many free edges and vertices the new_shape has.
+ TopExp_Explorer Ex;
+ for (Ex.Init(new_shape,TopAbs_EDGE); Ex.More(); Ex.Next())
+ num_projection++;
+ for (Ex.Init(new_shape,TopAbs_VERTEX, TopAbs_EDGE); Ex.More(); Ex.Next())
+ num_projection++;
+ }
+
+ if(num_projection == 0)
+ {
+ PRINT_INFO("No projection on the surface.\n");
+ return (Curve*) NULL;
+ }
+
else if ( num_projection == 1 )
{
if(closed == true)
PRINT_WARNING("Cannot project the curve to create a closed projection.\n" "There is only one projection segment.\n");
- TopoDS_Shape new_shape = aProjection.Projection();//compound shape
- TopoDS_Edge new_edge = TopoDS::Edge(new_shape);
- return OCCQueryEngine::instance()->populate_topology_bridge(new_edge);
+ TopExp_Explorer Ex;
+ TopoDS_Edge new_edge;
+ TopoDS_Vertex new_point;
+ for (Ex.Init(new_shape,TopAbs_EDGE); Ex.More(); Ex.Next())
+ {
+ new_edge = TopoDS::Edge(Ex.Current());
+ return OCCQueryEngine::instance()->populate_topology_bridge(new_edge);
+ }
+ for(Ex.Init(new_shape,TopAbs_VERTEX);Ex.More(); Ex.Next())
+ {
+ new_point = TopoDS::Vertex(Ex.Current());
+ normal_proj_points.append(OCCQueryEngine::instance()->populate_topology_bridge(new_point));
+ }
+ return (Curve*) NULL;
}
else if (num_projection == 2)
{
double d;
double first, last;
- TopoDS_Shape shape1 = projections.First();
- TopoDS_Edge edge1 = TopoDS::Edge(shape1);
+ TopExp_Explorer Ex;
+ TopoDS_Edge edge1, edge2;
+ TopoDS_Vertex point;
- TopoDS_Shape shape2 = projections.Last();
- TopoDS_Edge edge2 = TopoDS::Edge(shape2);
+ int count = 0;
+ for (Ex.Init(new_shape,TopAbs_EDGE); Ex.More(); Ex.Next())
+ {
+ count++;
+ if(count == 1)
+ edge1 = TopoDS::Edge(Ex.Current());
+ if(count == 2)
+ edge2 = TopoDS::Edge(Ex.Current());
+ }
+ for(Ex.Init(new_shape,TopAbs_VERTEX);Ex.More(); Ex.Next())
+ {
+ point = TopoDS::Vertex(Ex.Current());
+ normal_proj_points.append(OCCQueryEngine::instance()->populate_topology_bridge(point));
+ }
+
+ if(edge1.IsNull())
+ return OCCQueryEngine::instance()->populate_topology_bridge(edge2);
+
+ if(edge2.IsNull())
+ return OCCQueryEngine::instance()->populate_topology_bridge(edge1);
+
+ if(edge1.IsNull() && edge2.IsNull())
+ return (Curve*) NULL;
+
Handle(Geom_Curve) myCurve1 =
BRep_Tool::Curve(edge1,first,last);
@@ -1055,9 +1105,8 @@
}
double d2 = projOncurve2.LowerDistance();
- TopoDS_Shape new_shape =
- d > d2 ? projections.Last() : projections.First() ;
- TopoDS_Edge new_edge = TopoDS::Edge(new_shape);
+ TopoDS_Edge new_edge =
+ d > d2 ? edge2 : edge1 ;
return OCCQueryEngine::instance()->populate_topology_bridge(new_edge);
}
Modified: cgm/trunk/geom/OCC/OCCCurve.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCurve.hpp 2008-06-11 01:14:43 UTC (rev 1890)
+++ cgm/trunk/geom/OCC/OCCCurve.hpp 2008-06-11 19:08:53 UTC (rev 1891)
@@ -327,6 +327,7 @@
BRepAlgoAPI_BooleanOperation *op = NULL );
Curve* project_curve(Surface* face_ptr,
+ DLIList<Point*>& normal_proj_points,
CubitBoolean closed,
const CubitVector* third_point);
protected:
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-06-11 01:14:43 UTC (rev 1890)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-06-11 19:08:53 UTC (rev 1891)
@@ -239,8 +239,9 @@
if(face_ptr == NULL)
return curve;
+ DLIList<Point*> points;
new_curve =
- CAST_TO(curve, OCCCurve)->project_curve(face_ptr, closed, third_point);
+ CAST_TO(curve, OCCCurve)->project_curve(face_ptr, points, closed, third_point);
delete curve;
return new_curve;
@@ -2913,6 +2914,7 @@
TopExp_Explorer Ex;
TopoDS_Face the_face;
TopoDS_Shape ashape = *(body->get_TopoDS_Shape());
+ M.Clear();
TopExp::MapShapesAndAncestors(ashape, TopAbs_FACE, TopAbs_COMPSOLID, M);
if(!M.Contains(*topo_face))
continue;
@@ -3248,6 +3250,7 @@
{
CubitVector* v = NULL;
Curve* projected_curve = NULL;
+ DLIList<Point*> points;
//project curves onto surfaces.
for(int i = 0; i < ref_edge_list.size(); i++)
{
@@ -3267,11 +3270,13 @@
}
projected_curve = NULL;
- projected_curve = curve->project_curve(surface, CUBIT_FALSE, v);
+ projected_curve = curve->project_curve(surface, points, CUBIT_FALSE, v);
if(projected_curve)
- projected_curves.append(projected_curve);
+ projected_curves.append_unique(projected_curve);
}
}
+ while(points.size() > 0)
+ delete points.pop();
return CUBIT_SUCCESS;
}
Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp 2008-06-11 01:14:43 UTC (rev 1890)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp 2008-06-11 19:08:53 UTC (rev 1891)
@@ -1582,9 +1582,9 @@
{
delete occ_shell->my_body();
delete occ_shell->my_lump();
- CubitStatus stat = unhook_ShellSM_from_OCC(occ_shell);
DLIList<TopologyBridge*> tb_surfaces;
occ_shell->get_children_virt(tb_surfaces);
+ CubitStatus stat = unhook_ShellSM_from_OCC(occ_shell);
for(int k = 0; k < tb_surfaces.size(); k++)
delete_solid_model_entities(CAST_TO(tb_surfaces.get_and_step(), Surface));
delete occ_shell;
Modified: cgm/trunk/test/modify.cpp
===================================================================
--- cgm/trunk/test/modify.cpp 2008-06-11 01:14:43 UTC (rev 1890)
+++ cgm/trunk/test/modify.cpp 2008-06-11 19:08:53 UTC (rev 1891)
@@ -343,7 +343,7 @@
n = new_bodies.get()->num_ref_edges();//n = 17
- OCCBody* check_body = CAST_TO(face_list.get()->body()->get_body_sm_ptr(), OCCBody);
+ new_bodies.clean_out();
stat = gmti->imprint(face_list, ref_edges, new_bodies, CUBIT_FALSE);
//test for multi-cut imprint for subtract.
@@ -403,14 +403,9 @@
tool_body = gmti->brick(4, 4, 4);
CubitVector v_move3(0,1,0);
gti->translate(tool_body,v_move3);
- BodySM* copy_bodysm = ome->copy_body(tool_body->get_body_sm_ptr());
Body* copy_tool_body = gmti->copy_body(tool_body);
Body* copy_tool_body2 = gmti->copy_body(tool_body);
- //test shell body imprint
- //TopoDS_Shape* tool_shape = CAST_TO(copy_bodysm,OCCBody)->get_TopoDS_Shape();
- //TopoDS_Shape* from_shape = CAST_TO(bodysm,OCCBody)->shell()->get_TopoDS_Shell();
- //ome->imprint_toposhapes(tool_shape, from_shape);
from_bodies.clean_out();
new_bodies.clean_out();
from_bodies.append(copy_tool_body);
@@ -456,6 +451,31 @@
from_bodies.append(tool_body);
stat = gmti->imprint(from_bodies, new_bodies, CUBIT_FALSE);
+ //test imprint projected edges
+ bodies.clean_out();
+ gti->bodies(bodies);
+ //delete all entities
+ gti->delete_Body(bodies);
+
+ free_entities.clean_out();
+ gti->get_free_ref_entities(free_entities);
+
+ OCCQueryEngine* oqe = OCCQueryEngine::instance();
+ DLIList <OCCBody* > *occ_bodies = oqe->BodyList;
+
+ from_body = gmti->brick(4, 4, 4);
+ CubitVector v_move9(0,3,0);
+ gti->translate(from_body,v_move9);
+ ref_faces.clean_out();
+ from_body->ref_faces(ref_faces);
+ tool_body = gmti->brick(11, 1, 1);
+ ref_edges.clean_out();
+ tool_body->ref_edges(ref_edges);
+ new_bodies.clean_out();
+ gmti->imprint_projected_edges(ref_faces,ref_edges, new_bodies, CUBIT_TRUE,
+ CUBIT_FALSE);
+ if(new_bodies.size())
+ n = new_bodies.get()->num_ref_faces();
return CUBIT_SUCCESS;
}
1
0
Author: janehu
Date: 2008-06-10 14:34:51 -0500 (Tue, 10 Jun 2008)
New Revision: 1887
Modified:
cgm/trunk/geom/OCC/OCCCurve.cpp
cgm/trunk/geom/OCC/OCCModifyEngine.cpp
cgm/trunk/geom/OCC/OCCModifyEngine.hpp
Log:
Added imprint_projected_curve function, testing.
Modified: cgm/trunk/geom/OCC/OCCCurve.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCurve.cpp 2008-06-10 14:31:31 UTC (rev 1886)
+++ cgm/trunk/geom/OCC/OCCCurve.cpp 2008-06-10 19:34:51 UTC (rev 1887)
@@ -437,6 +437,7 @@
gp_Pnt p(location.x(), location.y(), location.z()), newP(0.0, 0.0, 0.0);
double newVal=0.0, global_newVal = 0.0;
int i;
+ CubitBoolean found = CUBIT_FALSE;
BRepLProp_CLProps CLP(acurve, 2, Precision::PConfusion());
Extrema_ExtPC ext(p, acurve, Precision::Approximation());
if (ext.IsDone() && (ext.NbExt() > 0)) {
@@ -447,6 +448,7 @@
global_newVal = newVal;
if(newVal <= global_newVal)
{
+ found = CUBIT_TRUE;
global_newVal = newVal;
newP = ext.Point(i).Value();
CLP.SetParameter(newVal);
@@ -454,7 +456,7 @@
}
}
}
- if(global_newVal > 0.0)
+ if(found)
{
closest_location = CubitVector(newP.X(), newP.Y(), newP.Z());
if (tangent_ptr != NULL) {
@@ -967,8 +969,8 @@
// Date : 01/08
//===============================================================================
Curve* OCCCurve::project_curve(Surface* face_ptr,
- CubitBoolean closed,
- const CubitVector* third_point)
+ CubitBoolean closed,
+ const CubitVector* third_point)
{
TopoDS_Edge* edge = get_TopoDS_Edge();
if (edge == NULL)
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-06-10 14:31:31 UTC (rev 1886)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-06-10 19:34:51 UTC (rev 1887)
@@ -69,6 +69,7 @@
#include "BRepPrimAPI_MakeSphere.hxx"
#include "BRepPrimAPI_MakeBox.hxx"
#include "BRepPrimAPI_MakeWedge.hxx"
+#include "BRepTools_WireExplorer.hxx"
#include "Handle_Geom_TrimmedCurve.hxx"
#include "Handle_Geom_RectangularTrimmedSurface.hxx"
#include "BndLib_Add3dCurve.hxx"
@@ -2139,9 +2140,47 @@
face = OCCQueryEngine::instance()->populate_topology_bridge(from_face);
OCCSurface* occ_face = CAST_TO(face, OCCSurface);
+ DLIList<Curve*> common_curves;
for(; Itor.More(); Itor.Next())
{
TopoDS_Edge edge = TopoDS::Edge(Itor.Value());
+ //copy the edge for imprinting.
+ BRepBuilderAPI_Copy api_copy(edge);
+ TopoDS_Shape newShape = api_copy.ModifiedShape(edge);
+ edge = TopoDS::Edge(newShape);
+ Curve* curve = NULL;
+ curve = OCCQueryEngine::instance()->populate_topology_bridge(edge);
+ if(curve)
+ common_curves.append(curve);
+ }
+
+ DLIList<DLIList<TopoDS_Edge*>*> temp_edge_lists;
+ list_of_edges.Clear();
+ if (common_curves.size() >= 1)
+ {
+ sort_curves(common_curves, temp_edge_lists);
+ DLIList<TopoDS_Edge*>* edge_list;
+ int size = temp_edge_lists.size();
+ for(int i = 0; i < size; i++)
+ {
+ edge_list = temp_edge_lists.pop();
+ //make sure the copied edges are sharing vertices.
+ BRepBuilderAPI_MakeWire myWire;
+ edge_list->reset();
+ for(int i = 0; i < edge_list->size(); i++)
+ {
+ TopoDS_Edge e = *(edge_list->get_and_step());
+ myWire.Add(e);
+ }
+ TopoDS_Wire wire = myWire.Wire();
+ BRepTools_WireExplorer Ex(wire);
+ for(; Ex.More(); Ex.Next())
+ list_of_edges.Append(Ex.Current());
+ }
+ }
+ for(Itor.Initialize(list_of_edges); Itor.More(); Itor.Next())
+ {
+ TopoDS_Edge edge = TopoDS::Edge(Itor.Value());
//check to see if the intersection edge is on from_face
TopExp_Explorer Ex;
CubitBoolean added = CUBIT_FALSE;
@@ -2164,7 +2203,7 @@
{
for (Ex.Init(from_face, TopAbs_EDGE); Ex.More(); Ex.Next())
{
- //check if the edge is on from_face edges, add such edge on existing
+ //check if the edge is on from_face edges, add such edge on existing
//edge to split it.
TopoDS_Edge from_edge = TopoDS::Edge(Ex.Current());
@@ -3153,20 +3192,89 @@
//===============================================================================
// Function : imprint_projected_edges
// Member Type: PUBLIC
-// Description:
-// Author : John Fowler
-// Date : 10/02
+// Description: Projects a list of Curves on to a list of Surfaces
+// and imprint the faces with the new Curves
+// Author : Jane Hu
+// Date : 06/08
//===============================================================================
-CubitStatus OCCModifyEngine::imprint_projected_edges( DLIList<Surface*> &/*ref_face_list*/,
- DLIList<Curve*> &/*ref_edge_list*/,
- DLIList<BodySM*>& /*new_body_list*/,
- bool /*keep_old_body*/,
- bool /*keep_free_edges*/) const
+CubitStatus
+OCCModifyEngine::imprint_projected_edges( DLIList<Surface*> &ref_face_list,
+ DLIList<Curve*> &ref_edge_list,
+ DLIList<BodySM*>& new_body_list,
+ bool keep_old_body,
+ bool keep_free_edges) const
{
- PRINT_ERROR("Option not supported for mesh based geometry.\n");
- return CUBIT_FAILURE;
+ DLIList<Curve*> projected_curves;
+ CubitStatus
+ stat = project_curves(ref_face_list, ref_edge_list, projected_curves);
+ if(!stat)
+ return stat;
+
+ // imprint Surface with curves
+ stat = imprint(ref_face_list, projected_curves, new_body_list, keep_old_body );
+
+ if(keep_free_edges)
+ return stat;
+
+ PRINT_INFO( "Removing projected curves \n");
+ for(int i=0; i< projected_curves.size();i++)
+ {
+ // Now delete this Curve and its underlying solid model entities
+
+ Curve* curve = projected_curves.get_and_step();
+ stat = OCCQueryEngine::instance()->delete_solid_model_entities( curve );
+ if (stat == CUBIT_FAILURE)
+ {
+ PRINT_ERROR("In OCCQueryEngine::delete_geometry\n"
+ " Could not delete OCCCurve.\n"
+ " The Model database is likely corrupted "
+ "due to\n this unsuccessful deletion.\n" );
+ }
+ }
+ return stat;
}
+//===============================================================================
+// Function : project_curves
+// Member Type: PRIVATE
+// Description: Projects a list of Curves on to a list of Surfaces
+// Author : Jane Hu
+// Date : 06/08
+//===============================================================================
+CubitStatus
+ OCCModifyEngine::project_curves( DLIList<Surface*> &ref_face_list,
+ DLIList<Curve*> &ref_edge_list,
+ DLIList<Curve*> &projected_curves)const
+{
+ CubitVector* v = NULL;
+ Curve* projected_curve = NULL;
+ //project curves onto surfaces.
+ for(int i = 0; i < ref_edge_list.size(); i++)
+ {
+ OCCCurve* curve = CAST_TO(ref_edge_list.get_and_step(), OCCCurve);
+ if(!curve)
+ continue;
+
+ for (int j = 0; j < ref_face_list.size(); j++)
+ {
+ OCCSurface* surface = CAST_TO(ref_face_list.get_and_step(), OCCSurface);
+ if(!surface)
+ continue;
+ if(surface->is_closed_in_U() || surface->is_closed_in_V())
+ {
+ PRINT_ERROR("This function can't project curves on closed surfaces.\n");
+ return CUBIT_FAILURE;
+ }
+
+ projected_curve = NULL;
+ projected_curve = curve->project_curve(surface, CUBIT_FALSE, v);
+ if(projected_curve)
+ projected_curves.append(projected_curve);
+ }
+ }
+ return CUBIT_SUCCESS;
+}
+
//===============================================================================
// Function : imprint_projected_edges
// Member Type: PUBLIC
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.hpp 2008-06-10 14:31:31 UTC (rev 1886)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.hpp 2008-06-10 19:34:51 UTC (rev 1887)
@@ -683,6 +683,10 @@
bool keep_old ) const;
void shape_to_bodySM( DLIList<TopoDS_Shape*> shape_list,
DLIList<BodySM*>& new_body_list)const;
+
+ CubitStatus project_curves( DLIList<Surface*> &ref_face_list,
+ DLIList<Curve*> &ref_edge_list,
+ DLIList<Curve*> &projected_curves)const;
} ;
#endif
1
0
Author: janehu
Date: 2008-06-09 14:28:19 -0500 (Mon, 09 Jun 2008)
New Revision: 1883
Modified:
cgm/trunk/geom/OCC/OCCCurve.cpp
cgm/trunk/geom/OCC/OCCModifyEngine.cpp
cgm/trunk/geom/OCC/OCCModifyEngine.hpp
cgm/trunk/test/modify.cpp
Log:
Test-passed using point to split curve on body.
Modified: cgm/trunk/geom/OCC/OCCCurve.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCurve.cpp 2008-06-09 18:11:52 UTC (rev 1882)
+++ cgm/trunk/geom/OCC/OCCCurve.cpp 2008-06-09 19:28:19 UTC (rev 1883)
@@ -454,7 +454,7 @@
}
}
}
- if(global_newVal < 10^10)
+ if(global_newVal > 0.0)
{
closest_location = CubitVector(newP.X(), newP.Y(), newP.Z());
if (tangent_ptr != NULL) {
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-06-09 18:11:52 UTC (rev 1882)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-06-09 19:28:19 UTC (rev 1883)
@@ -2976,6 +2976,26 @@
}
DLIList<BodySM*> new_body_list;
+ shape_to_bodySM(shape_list, new_body_list);
+
+ if (new_body_list.size() == 1)
+ {
+ new_body = new_body_list.get();
+ return CUBIT_SUCCESS;
+ }
+ return CUBIT_FAILURE;
+}
+
+//===============================================================================
+// Function : shape_to_bodySM
+// Member Type: PRIVATE
+// Description: After imprint, update shape list to bodySM_list
+// Author : Jane Hu
+// Date : 06/08
+//===============================================================================
+void OCCModifyEngine::shape_to_bodySM( DLIList<TopoDS_Shape*> shape_list,
+ DLIList<BodySM*>& new_body_list)const
+{
for(int j = 0; j < shape_list.size(); j ++)
{
DLIList<TopologyBridge*> tbs;
@@ -2998,13 +3018,6 @@
new_body_list.append_unique(CAST_TO(tbs.get(),BodySM));
}
}
-
- if (new_body_list.size() == 1)
- {
- new_body = new_body_list.get();
- return CUBIT_SUCCESS;
- }
- return CUBIT_FAILURE;
}
//===============================================================================
@@ -3046,7 +3059,9 @@
CubitBoolean on_curve = CUBIT_FALSE;
for (int j = 0; j < vector_list.size(); j ++)
{
- CubitVector* v = vector_list.get_and_step();
+ CubitVector* v = vector_list[j];
+ if(v == NULL)
+ continue;
for (int k = 0; k < curves.size(); k ++)
{
OCCCurve* curve = curves.get_and_step();
@@ -3066,9 +3081,24 @@
TopoDS_Vertex vertex = BRepBuilderAPI_MakeVertex(pt);
double param = curve->u_from_position(*v);
splitor.Add(vertex, param, edge);
+
+ //update the curve_list
+ TopTools_ListOfShape edge_shapes;
+ edge_shapes.Assign(splitor.DescendantShapes(edge));
+ while(edge_shapes.Extent())
+ {
+ TopoDS_Shape edge_shape = edge_shapes.First();
+ TopoDS_Edge occ_edge = TopoDS::Edge(edge_shape);
+ OCCCurve* test_curve;
+ test_curve = CAST_TO(OCCQueryEngine::instance()->populate_topology_bridge(occ_edge), OCCCurve);
+ if(test_curve)
+ curves.append(test_curve);
+ edge_shapes.RemoveFirst();
+ }
+ curves.remove(curve);
+
TopTools_ListOfShape shapes;
shapes.Assign(splitor.DescendantShapes(*from_shape));
- BRepBuilderAPI_MakeShape* pointor = NULL;
if(from_shape->TShape()->ShapeType() ==TopAbs_COMPSOLID)
OCCBody::update_OCC_entity(*from_shape, shapes.First(),
(BRepBuilderAPI_MakeShape*) NULL, &splitor);
@@ -3086,6 +3116,10 @@
OCCSurface::update_OCC_entity(TopoDS::Face(*from_shape),
shapes.First(),
(BRepBuilderAPI_MakeShape*) NULL, &splitor);
+
+ from_shape->Nullify();
+ delete from_shape;
+ from_shape = new TopoDS_Shape(shapes.First());
break;
}
}
@@ -3110,6 +3144,9 @@
}
}
}
+
+ shape_to_bodySM(shape_list, new_body_list);
+
return stat;
}
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.hpp 2008-06-09 18:11:52 UTC (rev 1882)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.hpp 2008-06-09 19:28:19 UTC (rev 1883)
@@ -681,6 +681,8 @@
DLIList<TopoDS_Face*>& face_list,
DLIList<TopoDS_Shape*>& shape_list,
bool keep_old ) const;
+ void shape_to_bodySM( DLIList<TopoDS_Shape*> shape_list,
+ DLIList<BodySM*>& new_body_list)const;
} ;
#endif
Modified: cgm/trunk/test/modify.cpp
===================================================================
--- cgm/trunk/test/modify.cpp 2008-06-09 18:11:52 UTC (rev 1882)
+++ cgm/trunk/test/modify.cpp 2008-06-09 19:28:19 UTC (rev 1883)
@@ -313,10 +313,6 @@
face_list.step();
}
assert(face_list.size() == 1);
- new_bodies.clean_out();
- vertices.clean_out();
- cp_from_body2->ref_vertices(vertices);
- vertices.clean_out();
ref_edges.step_and_get()->ref_vertices(vertices);
stat = gmti->imprint(unimprint_faces, ref_edges, new_bodies, CUBIT_FALSE);
@@ -332,11 +328,21 @@
face_list.step();
}
- vertices.clean_out();
- face_list.get()->ref_vertices(vertices);
- vertices.clean_out();
- ref_edges.step_and_get()->ref_vertices(vertices);
+ //imprint a point on an edge, split it
+ CubitVector pp1(10,1,8);
+ CubitVector pp2(10,5,9);
+ CubitVector pp3(10,1,6);
+ DLIList<CubitVector*> vectors;
+ vectors.append(&pp1);
+ vectors.append(&pp2);
+ vectors.append(&pp3);
+ from_bodies.clean_out();
+ from_bodies.append(cp_from_body2);
+ new_bodies.clean_out();
+ stat = gmti->imprint(from_bodies, vectors, new_bodies, CUBIT_FALSE);
+ n = new_bodies.get()->num_ref_edges();//n = 17
+
OCCBody* check_body = CAST_TO(face_list.get()->body()->get_body_sm_ptr(), OCCBody);
stat = gmti->imprint(face_list, ref_edges, new_bodies, CUBIT_FALSE);
1
0
Author: janehu
Date: 2008-06-06 14:45:15 -0500 (Fri, 06 Jun 2008)
New Revision: 1879
Modified:
cgm/trunk/geom/OCC/OCCBody.cpp
cgm/trunk/geom/OCC/OCCBody.hpp
cgm/trunk/geom/OCC/OCCCurve.cpp
cgm/trunk/geom/OCC/OCCLump.cpp
cgm/trunk/geom/OCC/OCCLump.hpp
cgm/trunk/geom/OCC/OCCModifyEngine.cpp
cgm/trunk/geom/OCC/OCCShell.cpp
cgm/trunk/geom/OCC/OCCShell.hpp
cgm/trunk/geom/OCC/OCCSurface.cpp
cgm/trunk/geom/OCC/OCCSurface.hpp
Log:
Added a vertex on surface structure, added split edge or face by point function.
Modified: cgm/trunk/geom/OCC/OCCBody.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.cpp 2008-06-06 14:22:00 UTC (rev 1878)
+++ cgm/trunk/geom/OCC/OCCBody.cpp 2008-06-06 19:45:15 UTC (rev 1879)
@@ -53,6 +53,7 @@
#include "GProp_GProps.hxx"
#include "BRepGProp.hxx"
#include "Standard_Boolean.hxx"
+#include "LocOpe_SplitShape.hxx"
//-------------------------------------------------------------------------
// Purpose : A constructor with a list of lumps that are attached.
//
@@ -400,7 +401,8 @@
//----------------------------------------------------------------
CubitStatus OCCBody::update_OCC_entity(TopoDS_Shape& old_shape,
TopoDS_Shape& new_shape,
- BRepBuilderAPI_MakeShape *op)
+ BRepBuilderAPI_MakeShape *op,
+ LocOpe_SplitShape* sp)
{
//set the Shells
TopTools_IndexedMapOfShape M;
@@ -413,7 +415,11 @@
TopoDS_Solid solid = TopoDS::Solid(M(ii));
TopTools_ListOfShape shapes;
- shapes.Assign(op->Modified(solid));
+ if(op)
+ shapes.Assign(op->Modified(solid));
+ else if(sp)
+ shapes.Assign(sp->DescendantShapes(solid));
+
if (shapes.Extent() == 1)
shape = shapes.First();
@@ -435,8 +441,8 @@
continue;
}
- if(shapes.Extent() > 0 || op->IsDeleted(solid))
- OCCLump::update_OCC_entity(solid, shape, op);
+ if(shapes.Extent() > 0 || (op && op->IsDeleted(solid)))
+ OCCLump::update_OCC_entity(solid, shape, op, sp);
}
if(!old_shape.IsSame(new_shape))
OCCQueryEngine::instance()->update_OCC_map(old_shape, new_shape);
Modified: cgm/trunk/geom/OCC/OCCBody.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.hpp 2008-06-06 14:22:00 UTC (rev 1878)
+++ cgm/trunk/geom/OCC/OCCBody.hpp 2008-06-06 19:45:15 UTC (rev 1879)
@@ -41,6 +41,7 @@
class BRepBuilderAPI_Transform;
class BRepAlgoAPI_BooleanOperation;
class BRepBuilderAPI_MakeShape;
+class LocOpe_SplitShape;
// ********** END FORWARD DECLARATIONS **********
class OCCBody : public BodySM
@@ -181,7 +182,8 @@
static CubitStatus update_OCC_entity(TopoDS_Shape& old_shape,
TopoDS_Shape& new_shape,
- BRepBuilderAPI_MakeShape *op);
+ BRepBuilderAPI_MakeShape *op,
+ LocOpe_SplitShape* sp = NULL );
OCCSurface* my_sheet_surface(){if(IsSheetBody) return mySheetSurface;
return (OCCSurface*) NULL;}
Modified: cgm/trunk/geom/OCC/OCCCurve.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCurve.cpp 2008-06-06 14:22:00 UTC (rev 1878)
+++ cgm/trunk/geom/OCC/OCCCurve.cpp 2008-06-06 19:45:15 UTC (rev 1879)
@@ -435,7 +435,7 @@
{
BRepAdaptor_Curve acurve(*myTopoDSEdge);
gp_Pnt p(location.x(), location.y(), location.z()), newP(0.0, 0.0, 0.0);
- double newVal=0.0;
+ double newVal=0.0, global_newVal = 0.0;
int i;
BRepLProp_CLProps CLP(acurve, 2, Precision::PConfusion());
Extrema_ExtPC ext(p, acurve, Precision::Approximation());
@@ -443,26 +443,33 @@
for ( i = 1 ; i <= ext.NbExt() ; i++ ) {
if ( ext.IsMin(i) ) {
newVal = ext.Point(i).Parameter();
- newP = ext.Point(i).Value();
- CLP.SetParameter(newVal);
+ if(i == 1)
+ global_newVal = newVal;
+ if(newVal <= global_newVal)
+ {
+ global_newVal = newVal;
+ newP = ext.Point(i).Value();
+ CLP.SetParameter(newVal);
+ }
}
}
}
- closest_location = CubitVector(newP.X(), newP.Y(), newP.Z());
- if (tangent_ptr != NULL) {
+ if(global_newVal < 10^10)
+ {
+ closest_location = CubitVector(newP.X(), newP.Y(), newP.Z());
+ if (tangent_ptr != NULL) {
gp_Dir tangent;
if (CLP.IsTangentDefined()) {
CLP.Tangent(tangent);
*tangent_ptr = CubitVector(tangent.X(), tangent.Y(), tangent.Z());
}
- }
- if (curvature_ptr != NULL)
- get_curvature( location, *curvature_ptr);
+ }
+ if (curvature_ptr != NULL)
+ get_curvature( location, *curvature_ptr);
- if (param != NULL) {
+ if (param != NULL)
*param = newVal;
- }
-
+ }
return CUBIT_SUCCESS;
}
Modified: cgm/trunk/geom/OCC/OCCLump.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLump.cpp 2008-06-06 14:22:00 UTC (rev 1878)
+++ cgm/trunk/geom/OCC/OCCLump.cpp 2008-06-06 19:45:15 UTC (rev 1879)
@@ -49,6 +49,7 @@
#include "TopExp_Explorer.hxx"
#include "TopoDS.hxx"
#include "BRep_Tool.hxx"
+#include "LocOpe_SplitShape.hxx"
// ********** END CUBIT INCLUDES **********
// ********** BEGIN FORWARD DECLARATIONS **********
@@ -353,7 +354,8 @@
//----------------------------------------------------------------
CubitStatus OCCLump::update_OCC_entity(TopoDS_Solid& old_solid,
TopoDS_Shape& new_shape,
- BRepBuilderAPI_MakeShape *op)
+ BRepBuilderAPI_MakeShape *op,
+ LocOpe_SplitShape* sp)
{
//set the Shells
TopTools_IndexedMapOfShape M;
@@ -375,7 +377,11 @@
TopoDS_Shell shell = TopoDS::Shell(M(ii));
TopTools_ListOfShape shapes;
- shapes.Assign(op->Modified(shell));
+ if (op)
+ shapes.Assign(op->Modified(shell));
+ else if(sp)
+ shapes.Assign(sp->DescendantShapes(shell));
+
if (shapes.Extent() == 1)
shape = shapes.First();
@@ -397,8 +403,8 @@
continue;
}
- if(shapes.Extent() > 0 || op->IsDeleted(shell))
- OCCShell::update_OCC_entity(shell, shape, op);
+ if(shapes.Extent() > 0 || (op && op->IsDeleted(shell)))
+ OCCShell::update_OCC_entity(shell, shape, op, sp);
}
if(!old_solid.IsSame(new_shape))
OCCQueryEngine::instance()->update_OCC_map(old_solid, new_solid);
Modified: cgm/trunk/geom/OCC/OCCLump.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLump.hpp 2008-06-06 14:22:00 UTC (rev 1878)
+++ cgm/trunk/geom/OCC/OCCLump.hpp 2008-06-06 19:45:15 UTC (rev 1879)
@@ -39,6 +39,7 @@
class BRepBuilderAPI_Transform;
class BRepBuilderAPI_MakeShape;
class BRepAlgoAPI_BooleanOperation;
+class LocOpe_SplitShape;
// ********** END FORWARD DECLARATIONS **********
class OCCLump : public Lump
@@ -157,7 +158,8 @@
BRepAlgoAPI_BooleanOperation *op = NULL);
static CubitStatus update_OCC_entity(TopoDS_Solid& old_shape,
TopoDS_Shape& new_shape,
- BRepBuilderAPI_MakeShape *op);
+ BRepBuilderAPI_MakeShape *op,
+ LocOpe_SplitShape* sp = NULL);
protected:
private:
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-06-06 14:22:00 UTC (rev 1878)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-06-06 19:45:15 UTC (rev 1879)
@@ -54,6 +54,7 @@
#include "BRepBuilderAPI_MakeFace.hxx"
#include "BRepBuilderAPI_Sewing.hxx"
#include "BRepBuilderAPI_Copy.hxx"
+#include "LocOpe_SplitShape.hxx"
#include "BRep_Tool.hxx"
#include "BRep_Builder.hxx"
#include "GProp_GProps.hxx"
@@ -2576,6 +2577,9 @@
for(int i = 0; i <BodySM_list.size(); i++)
{
occ_body = CAST_TO(BodySM_list.get_and_step(), OCCBody);
+ if (!occ_body)
+ continue;
+
OCCSurface* surface = occ_body->my_sheet_surface();
OCCShell* shell = occ_body->shell();
if(surface)
@@ -3006,19 +3010,107 @@
//===============================================================================
// Function : imprint
// Member Type: PUBLIC
-// Description: Imprints locations to bodies (for splitting curves or putting
-// hardpoints on surfaces).
+// Description: Imprints locations to bodies (for splitting curves, there's
+// no known ways to put hard points on surfaces in OCC, so I just
+// add free_vertex on OCCSurface definition, mesh should look on
+// this structure).
// Author : Jane Hu
// Date : 06/08
//===============================================================================
-CubitStatus OCCModifyEngine::imprint( DLIList<BodySM*> &/*body_list*/,
- DLIList<CubitVector*> &/*vector_list*/,
- DLIList<BodySM*>& /*new_body_list*/,
- bool keep_old /*keep_old_body*/,
+CubitStatus OCCModifyEngine::imprint( DLIList<BodySM*> &body_list,
+ DLIList<CubitVector*> &vector_list,
+ DLIList<BodySM*>& new_body_list,
+ bool keep_old,
DLIList<TopologyBridge*>*,
DLIList<TopologyBridge*>* ) const
{
- return CUBIT_FAILURE;
+ DLIList<TopoDS_Shape*> shape_list;
+ CubitStatus stat = get_shape_list(body_list, shape_list, keep_old);
+
+ if(!stat)
+ return stat;
+
+ for (int i = 0; i < body_list.size(); i++)
+ {
+ OCCBody* body = CAST_TO(body_list.get_and_step(), OCCBody);
+ TopoDS_Shape* from_shape = shape_list.get_and_step();
+ if (!body)
+ continue;
+ DLIList<OCCSurface*> surfaces;
+ DLIList<OCCCurve*> curves;
+
+ body->get_all_surfaces(surfaces);
+ body->get_all_curves(curves);
+
+ CubitBoolean on_vertex = CUBIT_FALSE;
+ CubitBoolean on_curve = CUBIT_FALSE;
+ for (int j = 0; j < vector_list.size(); j ++)
+ {
+ CubitVector* v = vector_list.get_and_step();
+ for (int k = 0; k < curves.size(); k ++)
+ {
+ OCCCurve* curve = curves.get_and_step();
+ CubitPointContainment pc = curve->point_containment(*v);
+ if(pc == CUBIT_PNT_BOUNDARY)
+ {
+ on_vertex = CUBIT_TRUE;
+ break;
+ }
+
+ else if( pc == CUBIT_PNT_INSIDE)
+ {
+ LocOpe_SplitShape splitor(*from_shape);
+ on_curve = CUBIT_TRUE;
+ TopoDS_Edge edge = *curve->get_TopoDS_Edge();
+ gp_Pnt pt = gp_Pnt(v->x(), v->y(), v->z());
+ TopoDS_Vertex vertex = BRepBuilderAPI_MakeVertex(pt);
+ double param = curve->u_from_position(*v);
+ splitor.Add(vertex, param, edge);
+ TopTools_ListOfShape shapes;
+ shapes.Assign(splitor.DescendantShapes(*from_shape));
+ BRepBuilderAPI_MakeShape* pointor = NULL;
+ if(from_shape->TShape()->ShapeType() ==TopAbs_COMPSOLID)
+ OCCBody::update_OCC_entity(*from_shape, shapes.First(),
+ (BRepBuilderAPI_MakeShape*) NULL, &splitor);
+ else if(shapes.First().TShape()->ShapeType() == TopAbs_SOLID)
+ OCCLump::update_OCC_entity(TopoDS::Solid(*from_shape),
+ shapes.First(),
+ (BRepBuilderAPI_MakeShape*) NULL, &splitor);
+
+ else if(shapes.First().TShape()->ShapeType() == TopAbs_SHELL)
+ OCCShell::update_OCC_entity(TopoDS::Shell(*from_shape),
+ shapes.First(),
+ (BRepBuilderAPI_MakeShape*) NULL, &splitor);
+
+ else if(shapes.First().TShape()->ShapeType() == TopAbs_FACE)
+ OCCSurface::update_OCC_entity(TopoDS::Face(*from_shape),
+ shapes.First(),
+ (BRepBuilderAPI_MakeShape*) NULL, &splitor);
+ break;
+ }
+ }
+ if(on_vertex || on_curve)
+ continue;
+
+ //check possible on surface
+ for(int n = 0; n < surfaces.size(); n ++)
+ {
+ OCCSurface* surface = surfaces.get_and_step();
+ if(!surface->is_position_on(*v))
+ continue;
+
+ CubitPointContainment ps = surface->point_containment(*v);
+ if(ps == CUBIT_PNT_INSIDE)
+ {
+ Point* p = make_Point(*v);
+ if(p)
+ surface->add_hardpoint(CAST_TO(p, OCCPoint));
+ break;
+ }
+ }
+ }
+ }
+ return stat;
}
//===============================================================================
Modified: cgm/trunk/geom/OCC/OCCShell.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCShell.cpp 2008-06-06 14:22:00 UTC (rev 1878)
+++ cgm/trunk/geom/OCC/OCCShell.cpp 2008-06-06 19:45:15 UTC (rev 1879)
@@ -43,6 +43,7 @@
#include "BRepBuilderAPI_Transform.hxx"
#include "BRepAlgoAPI_BooleanOperation.hxx"
#include "BRepBuilderAPI_MakeShape.hxx"
+#include "LocOpe_SplitShape.hxx"
// ********** END CUBIT INCLUDES **********
// ********** BEGIN STATIC DECLARATIONS **********
@@ -260,7 +261,8 @@
//----------------------------------------------------------------
CubitStatus OCCShell::update_OCC_entity(TopoDS_Shell& old_shell,
TopoDS_Shape& new_shell,
- BRepBuilderAPI_MakeShape *op)
+ BRepBuilderAPI_MakeShape *op,
+ LocOpe_SplitShape* sp)
{
//set the surfaces
TopTools_IndexedMapOfShape M;
@@ -270,14 +272,18 @@
for(int ii=1; ii<=M.Extent(); ii++)
{
TopoDS_Face face = TopoDS::Face(M(ii));
- shapes.Assign(op->Modified(face));
+ if (op)
+ shapes.Assign(op->Modified(face));
+ else if(sp)
+ shapes.Assign(sp->DescendantShapes(face));
+
if(shapes.Extent() == 1)
shape = shapes.First();
else
shape.Nullify();
- if(shapes.Extent() > 0 || op->IsDeleted(face))
- OCCSurface::update_OCC_entity(face,shape, op);
+ if(shapes.Extent() > 0 || (op && op->IsDeleted(face)))
+ OCCSurface::update_OCC_entity(face,shape, op, sp);
}
if(!old_shell.IsSame(new_shell))
OCCQueryEngine::instance()->update_OCC_map(old_shell, new_shell);
Modified: cgm/trunk/geom/OCC/OCCShell.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCShell.hpp 2008-06-06 14:22:00 UTC (rev 1878)
+++ cgm/trunk/geom/OCC/OCCShell.hpp 2008-06-06 19:45:15 UTC (rev 1879)
@@ -37,6 +37,7 @@
class BRepBuilderAPI_Transform;
class BRepAlgoAPI_BooleanOperation;
class BRepBuilderAPI_MakeShape;
+class LocOpe_SplitShape;
// ********** END CUBIT INCLUDES **********
class OCCShell : public ShellSM
@@ -122,7 +123,8 @@
double measure(); //area of the shell
static CubitStatus update_OCC_entity(TopoDS_Shell& old_shell,
TopoDS_Shape& new_shell,
- BRepBuilderAPI_MakeShape *op);
+ BRepBuilderAPI_MakeShape *op,
+ LocOpe_SplitShape* sp = NULL);
protected:
private:
Modified: cgm/trunk/geom/OCC/OCCSurface.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCSurface.cpp 2008-06-06 14:22:00 UTC (rev 1878)
+++ cgm/trunk/geom/OCC/OCCSurface.cpp 2008-06-06 19:45:15 UTC (rev 1879)
@@ -47,7 +47,7 @@
#include "BRepBuilderAPI_MakeShape.hxx"
#include "BRepTools_WireExplorer.hxx"
#include "BRep_Tool.hxx"
-
+#include "LocOpe_SplitShape.hxx"
// ********** END CUBIT INCLUDES **********
@@ -831,7 +831,8 @@
//----------------------------------------------------------------
CubitStatus OCCSurface::update_OCC_entity(TopoDS_Face& old_surface,
TopoDS_Shape& new_surface,
- BRepBuilderAPI_MakeShape *op)
+ BRepBuilderAPI_MakeShape *op,
+ LocOpe_SplitShape* sp)
{
//set the Wires
TopTools_IndexedMapOfShape M;
@@ -844,7 +845,11 @@
{
TopoDS_Wire wire = TopoDS::Wire(M(ii));
TopTools_ListOfShape shapes;
- shapes.Assign(op->Modified(wire));
+ if(op)
+ shapes.Assign(op->Modified(wire));
+ else if(sp)
+ shapes.Assign(sp->DescendantShapes(wire));
+
if (shapes.Extent() == 1)
shape = shapes.First();
else if(shapes.Extent() > 1)
@@ -870,7 +875,11 @@
for(Ex.Init(wire); Ex.More();Ex.Next())
{
TopoDS_Edge edge = Ex.Current();
- shapes.Assign(op->Modified(edge));
+ if(op)
+ shapes.Assign(op->Modified(edge));
+ else if(sp)
+ shapes.Assign(sp->DescendantShapes(edge));
+
if (shapes.Extent() == 1)
shape_edge = shapes.First();
else if (shapes.Extent() > 1)
@@ -879,23 +888,21 @@
shape_edge.Nullify();
else
shape_edge = edge;
-/*
- if(wire.Orientation() == TopAbs_REVERSED && !shape_edge.IsNull())
- {
- shape_edge.Orientation(
- shape_edge.Orientation()==TopAbs_FORWARD? TopAbs_REVERSED:TopAbs_FORWARD);
- }
-*/
+
//update vertex
TopoDS_Vertex vertex = Ex.CurrentVertex();
- shapes.Assign(op->Modified(vertex));
+ if(op)
+ shapes.Assign(op->Modified(vertex));
+ else if(sp)
+ shapes.Assign(sp->DescendantShapes(vertex));
+
if (shapes.Extent() == 1)
shape_vertex = shapes.First();
else
shape_vertex.Nullify();
- if(!vertex.IsSame(shape_vertex) && (shapes.Extent() > 0 || op->IsDeleted(vertex)))
+ if(!vertex.IsSame(shape_vertex) && (shapes.Extent() > 0 || (op && op->IsDeleted(vertex))))
OCCQueryEngine::instance()->update_OCC_map(vertex, shape_vertex);
if (!edge.IsSame(shape_edge))
Modified: cgm/trunk/geom/OCC/OCCSurface.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCSurface.hpp 2008-06-06 14:22:00 UTC (rev 1878)
+++ cgm/trunk/geom/OCC/OCCSurface.hpp 2008-06-06 19:45:15 UTC (rev 1879)
@@ -50,6 +50,7 @@
class BRepBuilderAPI_Transform;
class BRepAlgoAPI_BooleanOperation;
class BRepBuilderAPI_MakeShape;
+class LocOpe_SplitShape;
//// class CubitTransformMatrix;
class OCCSurface : public Surface
@@ -64,7 +65,8 @@
static CubitStatus update_OCC_entity(TopoDS_Face& old_surface,
TopoDS_Shape& new_surface,
- BRepBuilderAPI_MakeShape *op);
+ BRepBuilderAPI_MakeShape *op,
+ LocOpe_SplitShape* sp = NULL);
void add_shell(OCCShell* shell) { myShellList.append_unique(shell);}
@@ -72,6 +74,9 @@
void remove_shell(OCCShell* shell) {myShellList.remove(shell);}
void clean_shells(){myShellList.clean_out();}
+ void add_hardpoint(OCCPoint* HardPoint){myHardPoints.append(HardPoint);}
+ void remove_hardpoint(OCCPoint* HardPoint){myHardPoints.remove(HardPoint);}
+
virtual void append_simple_attribute_virt(CubitSimpleAttrib*);
//R void
//I
@@ -433,6 +438,7 @@
OCCShell* myShell;
OCCLump* myLump;
OCCBody* myBody;
+ DLIList<OCCPoint*> myHardPoints;
};
1
0
Author: janehu
Date: 2008-06-05 14:19:34 -0500 (Thu, 05 Jun 2008)
New Revision: 1876
Modified:
cgm/trunk/geom/OCC/OCCModifyEngine.cpp
cgm/trunk/geom/OCC/OCCModifyEngine.hpp
Log:
Added imprint surface list by corresponding curve_lists_listt, each curve should cut the surface into at least two, otherwise it will fail,tto use a series of curves to make one cut, have to make them into one curve, or[create a shell or solid out of the curves and use that as a tool to imprint.
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-06-05 18:26:07 UTC (rev 1875)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-06-05 19:19:34 UTC (rev 1876)
@@ -2783,19 +2783,73 @@
// Author : Jane Hu
// Date : 05/08
//===============================================================================
-CubitStatus OCCModifyEngine::imprint( DLIList<Surface*> &ref_face_list,
- DLIList<Curve*> &edge_list,
- DLIList<BodySM*>& new_body_list,
- bool keep_old ) const
+CubitStatus OCCModifyEngine::imprint( DLIList<Surface*> &ref_face_list,
+ DLIList<Curve*> &edge_list,
+ DLIList<BodySM*>& new_body_list,
+ bool keep_old ) const
{
DLIList<TopoDS_Face*> face_list;
DLIList<TopoDS_Shape*> shape_list;
+
+ face_edge_imprint(ref_face_list, edge_list, face_list, shape_list, keep_old);
+
+ for(int j = 0; j < shape_list.size(); j ++)
+ {
+ DLIList<TopologyBridge*> tbs;
+ TopoDS_Shape* shape = shape_list.get_and_step();
+ if (shape->TShape()->ShapeType() == TopAbs_COMPSOLID)
+ {
+ if(!OCCQueryEngine::instance()->OCCMap->IsBound(*shape))
+ {
+ TopExp_Explorer Ex;
+ for (Ex.Init(*shape, TopAbs_SOLID);Ex.More(); Ex.Next())
+ {
+ tbs += OCCQueryEngine::instance()->populate_topology_bridge(Ex.Current());
+ new_body_list.append_unique(CAST_TO(tbs.get(),BodySM));
+ }
+ }
+ }
+ else
+ {
+ tbs += OCCQueryEngine::instance()->populate_topology_bridge(*shape);
+ new_body_list.append_unique(CAST_TO(tbs.get(),BodySM));
+ }
+ }
+
+ if (keep_old)
+ {
+ for(int i = 0; i < face_list.size(); i++)
+ {
+ TopoDS_Face* face = face_list.get();
+ face->Nullify();
+ delete face;
+ }
+ }
+ return CUBIT_SUCCESS;
+}
+
+//===============================================================================
+// Function : face_edge_imprint
+// Member Type: PRIVATE
+// Description: to be consistante with Acis imprint.
+// The surfaces must be part of a body, but the curves
+// just have to be valid OCC edge.
+// Author : Jane Hu
+// Date : 05/08
+//===============================================================================
+CubitStatus
+OCCModifyEngine::face_edge_imprint( DLIList<Surface*> &ref_face_list,
+ DLIList<Curve*> &edge_list,
+ DLIList<TopoDS_Face*>& face_list,
+ DLIList<TopoDS_Shape*>& shape_list,
+ bool keep_old ) const
+{
for(int i = 0; i <ref_face_list.size(); i++)
{
OCCSurface* surface = CAST_TO(ref_face_list.get_and_step(), OCCSurface);
if(!surface)
continue;
-
+
TopoDS_Face* topo_face = surface->get_TopoDS_Face();
face_list.append(topo_face);
@@ -2803,7 +2857,7 @@
shape_list.append(surface->my_shell()->get_TopoDS_Shell());
else if(surface->my_body()) //a sheet body
shape_list.append(topo_face);
- else
+ else
{
//int size = shape_list.size();
OCCQueryEngine* oqe = OCCQueryEngine::instance();
@@ -2818,7 +2872,7 @@
TopoDS_Shape ashape = *(body->get_TopoDS_Shape());
TopExp::MapShapesAndAncestors(ashape, TopAbs_FACE, TopAbs_COMPSOLID, M);
if(!M.Contains(*topo_face))
- continue;
+ continue;
shape_list.append_unique(body->get_TopoDS_Shape());
}
}
@@ -2844,12 +2898,12 @@
face_list.change_to(face);
}
}
- face_list.step();
+ face_list.step();
}
shape_list.change_to(Shape1);
shape_list.step();
}
- }
+ }
for (int i = 0; i < edge_list.size(); i++)
{
@@ -2861,22 +2915,70 @@
if (edge->IsNull())
continue;
- DLIList<OCCPoint*> point_list;
- curve->get_points(point_list);
for(int j = 0; j < shape_list.size(); j ++)
{
TopoDS_Shape* shape = shape_list.get_and_step();
imprint_toposhapes(shape, (TopoDS_Shape*)edge, &face_list);
}
}
+ return CUBIT_SUCCESS;
+}
+//===============================================================================
+// Function : imprint
+// Member Type: PUBLIC
+// Description: To be consistent with AcisModifyEngine, althought it's hard
+// to have a GUI interface for users to input. All surface must
+// on the same body.
+// Author : Jane HU
+// Date : 06/08
+//===============================================================================
+CubitStatus OCCModifyEngine::imprint( DLIList<Surface*>& surface_list,
+ DLIList<DLIList<Curve*>*>& curve_lists_list,
+ BodySM*& new_body,
+ bool keep_old ) const
+{
+ DLIList<TopoDS_Face*> face_list;
+ DLIList<TopoDS_Shape*> shape_list;
+ DLIList<TopoDS_Shape*> shape_list_all;
+
+ assert (surface_list.size() == curve_lists_list.size());
+ for(int j = 0; j < surface_list.size(); j++)
+ {
+ Surface* surface = surface_list.get_and_step();
+ DLIList<Surface*> ref_face_list;
+ ref_face_list.append(surface);
+ DLIList<Curve*> *edge_list = curve_lists_list.get_and_step();
+ face_edge_imprint(ref_face_list, *edge_list, face_list, shape_list, keep_old);
+
+ for(int i = 0; i < shape_list.size(); i++)
+ {
+ TopoDS_Shape* shape = shape_list.get_and_step();
+ shape_list_all.append_unique(shape);
+ }
+ shape_list.clean_out();
+
+ if (keep_old)
+ {
+ for(int i = 0; i < face_list.size(); i++)
+ {
+ TopoDS_Face* face = face_list.get();
+ face->Nullify();
+ delete face;
+ }
+ }
+
+ face_list.clean_out();
+ }
+
+ DLIList<BodySM*> new_body_list;
for(int j = 0; j < shape_list.size(); j ++)
{
DLIList<TopologyBridge*> tbs;
TopoDS_Shape* shape = shape_list.get_and_step();
if (shape->TShape()->ShapeType() == TopAbs_COMPSOLID)
{
- if(!OCCQueryEngine::instance()->OCCMap->IsBound(*shape))
+ if(!OCCQueryEngine::instance()->OCCMap->IsBound(*shape))
{
TopExp_Explorer Ex;
for (Ex.Init(*shape, TopAbs_SOLID);Ex.More(); Ex.Next())
@@ -2893,40 +2995,21 @@
}
}
- if (keep_old)
+ if (new_body_list.size() == 1)
{
- for(int i = 0; i < face_list.size(); i++)
- {
- TopoDS_Face* face = face_list.get();
- face->Nullify();
- delete face;
- }
+ new_body = new_body_list.get();
+ return CUBIT_SUCCESS;
}
- return CUBIT_SUCCESS;
-}
-
-//===============================================================================
-// Function : imprint
-// Member Type: PUBLIC
-// Description: imprint boolean operation on facet-based bodies
-// Author : John Fowler
-// Date : 10/02
-//===============================================================================
-CubitStatus OCCModifyEngine::imprint( DLIList<Surface*> &/*surface_list*/,
- DLIList<DLIList<Curve*>*> &/*curve_lists_list*/,
- BodySM*& /*new_body*/,
- bool /*keep_old_body*/ ) const
-{
- PRINT_ERROR("Option not supported for mesh based geometry.\n");
return CUBIT_FAILURE;
}
//===============================================================================
// Function : imprint
// Member Type: PUBLIC
-// Description: imprint boolean operation on facet-based bodies
-// Author : John Fowler
-// Date : 10/02
+// Description: Imprints locations to bodies (for splitting curves or putting
+// hardpoints on surfaces).
+// Author : Jane Hu
+// Date : 06/08
//===============================================================================
CubitStatus OCCModifyEngine::imprint( DLIList<BodySM*> &/*body_list*/,
DLIList<CubitVector*> &/*vector_list*/,
@@ -2935,7 +3018,6 @@
DLIList<TopologyBridge*>*,
DLIList<TopologyBridge*>* ) const
{
- PRINT_ERROR("Option not supported for mesh based geometry.\n");
return CUBIT_FAILURE;
}
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.hpp 2008-06-05 18:26:07 UTC (rev 1875)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.hpp 2008-06-05 19:19:34 UTC (rev 1876)
@@ -676,7 +676,11 @@
CubitStatus get_shape_list(DLIList<BodySM*> BodySM_list,
DLIList<TopoDS_Shape*>& shape_list,
bool keep_old) const;
-
+ CubitStatus face_edge_imprint( DLIList<Surface*> &ref_face_list,
+ DLIList<Curve*> &edge_list,
+ DLIList<TopoDS_Face*>& face_list,
+ DLIList<TopoDS_Shape*>& shape_list,
+ bool keep_old ) const;
} ;
#endif
1
0
Author: janehu
Date: 2008-06-04 15:32:48 -0500 (Wed, 04 Jun 2008)
New Revision: 1874
Modified:
cgm/trunk/geom/OCC/OCCBody.cpp
cgm/trunk/geom/OCC/OCCBody.hpp
cgm/trunk/geom/OCC/OCCLump.cpp
cgm/trunk/geom/OCC/OCCModifyEngine.cpp
cgm/trunk/geom/OCC/OCCQueryEngine.cpp
cgm/trunk/geom/OCC/OCCShell.cpp
cgm/trunk/geom/OCC/OCCSurface.cpp
cgm/trunk/test/modify.cpp
Log:
fixed the Error of Edge with no vertices problem after impriinting, when use the edge to imprint, the edge become one part of the imprinted shape, so if this edge belongs to tool_shape, has to make a copy.
Modified: cgm/trunk/geom/OCC/OCCBody.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.cpp 2008-06-04 18:38:23 UTC (rev 1873)
+++ cgm/trunk/geom/OCC/OCCBody.cpp 2008-06-04 20:32:48 UTC (rev 1874)
@@ -87,7 +87,6 @@
{
if(myTopoDSShape)
delete myTopoDSShape;
-
myTopoDSShape = new TopoDS_CompSolid(theshape);
}
@@ -393,7 +392,56 @@
points.get_and_step()->set_myMarked(CUBIT_FALSE);
}
+
//----------------------------------------------------------------
+// Function: TopoDS_Shape level function to update the core Body
+// for any Boolean operation of the body.
+// Author: Jane Hu
+//----------------------------------------------------------------
+CubitStatus OCCBody::update_OCC_entity(TopoDS_Shape& old_shape,
+ TopoDS_Shape& new_shape,
+ BRepBuilderAPI_MakeShape *op)
+{
+ //set the Shells
+ TopTools_IndexedMapOfShape M;
+ TopExp::MapShapes(old_shape, TopAbs_SOLID, M);
+ TopTools_ListOfShape shapes;
+ TopoDS_Shape shape;
+
+ for(int ii=1; ii<=M.Extent(); ii++)
+ {
+ TopoDS_Solid solid = TopoDS::Solid(M(ii));
+
+ TopTools_ListOfShape shapes;
+ shapes.Assign(op->Modified(solid));
+ if (shapes.Extent() == 1)
+ shape = shapes.First();
+
+ else if(shapes.Extent() > 1)
+ shape.Nullify();
+
+ else if(op->IsDeleted(solid))
+ {
+ TopTools_IndexedMapOfShape M_new;
+ TopExp::MapShapes(new_shape, TopAbs_SOLID, M_new);
+ if (M_new.Extent()== 1)
+ shape = M_new(1);
+ else
+ shape.Nullify();
+ }
+ else
+ {
+ shape = solid;
+ continue;
+ }
+
+ if(shapes.Extent() > 0 || op->IsDeleted(solid))
+ OCCLump::update_OCC_entity(solid, shape, op);
+ }
+ if(!old_shape.IsSame(new_shape))
+ OCCQueryEngine::instance()->update_OCC_map(old_shape, new_shape);
+}
+//----------------------------------------------------------------
// Function: update_bounding_box
// Description: calculate for bounding box of this OCCBody
//
Modified: cgm/trunk/geom/OCC/OCCBody.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.hpp 2008-06-04 18:38:23 UTC (rev 1873)
+++ cgm/trunk/geom/OCC/OCCBody.hpp 2008-06-04 20:32:48 UTC (rev 1874)
@@ -40,6 +40,7 @@
class OCCPoint;
class BRepBuilderAPI_Transform;
class BRepAlgoAPI_BooleanOperation;
+class BRepBuilderAPI_MakeShape;
// ********** END FORWARD DECLARATIONS **********
class OCCBody : public BodySM
@@ -178,6 +179,10 @@
CubitStatus update_OCC_entity( BRepBuilderAPI_Transform *aBRepTrsf,
BRepAlgoAPI_BooleanOperation *op = NULL);
+ static CubitStatus update_OCC_entity(TopoDS_Shape& old_shape,
+ TopoDS_Shape& new_shape,
+ BRepBuilderAPI_MakeShape *op);
+
OCCSurface* my_sheet_surface(){if(IsSheetBody) return mySheetSurface;
return (OCCSurface*) NULL;}
void set_sheet_surface(OCCSurface* surface);
Modified: cgm/trunk/geom/OCC/OCCLump.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLump.cpp 2008-06-04 18:38:23 UTC (rev 1873)
+++ cgm/trunk/geom/OCC/OCCLump.cpp 2008-06-04 20:32:48 UTC (rev 1874)
@@ -400,5 +400,6 @@
if(shapes.Extent() > 0 || op->IsDeleted(shell))
OCCShell::update_OCC_entity(shell, shape, op);
}
- OCCQueryEngine::instance()->update_OCC_map(old_solid, new_solid);
+ if(!old_solid.IsSame(new_shape))
+ OCCQueryEngine::instance()->update_OCC_map(old_solid, new_solid);
}
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-06-04 18:38:23 UTC (rev 1873)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-06-04 20:32:48 UTC (rev 1874)
@@ -2268,38 +2268,38 @@
topo_changed = CUBIT_FALSE;
if(splitor.IsDone())
{
- //take care of on_faces list first.
- if (on_faces && on_faces->size())
+ //take care of on_faces list first:after operation, the on_faces
+ // will have at least one face changed, update the pointer.
+ if (on_faces)
{
- TopoDS_Face* compare_face = on_faces->get();
- if(from_face.IsSame(*compare_face))
+ for(int k = 0; k < on_faces->size(); k++)
{
- on_faces->remove(compare_face);
- TopTools_ListOfShape shapes;
- shapes.Assign(splitor.Modified(from_face));
- while(shapes.Extent() > 0)
+ TopoDS_Face* compare_face = on_faces->get_and_step();
+ if(from_face.IsSame(*compare_face))
{
- TopoDS_Face* face =
- new TopoDS_Face(TopoDS::Face(shapes.First()));
- shapes.RemoveFirst();
- on_faces->append(face);
- list_for_delete.append(face);
+ on_faces->remove(compare_face);
+ TopTools_ListOfShape shapes;
+ shapes.Assign(splitor.Modified(from_face));
+ while(shapes.Extent() > 0)
+ {
+ TopoDS_Face* face =
+ new TopoDS_Face(TopoDS::Face(shapes.First()));
+ shapes.RemoveFirst();
+ on_faces->append(face);
+ list_for_delete.append(face);
+ }
}
}
}
+
TopoDS_Shape new_from_shape = splitor.Shape();
if(from_shape->TShape()->ShapeType() == TopAbs_COMPSOLID)
{
- TopTools_IndexedMapOfShape M;
- TopExp::MapShapes(*from_shape, TopAbs_SOLID, M);
- if (M.Extent() == 1)
- {
- TopoDS_Solid old_solid = TopoDS::Solid(M(1));
- OCCLump::update_OCC_entity(old_solid, new_from_shape, &splitor);
- from_shape->Nullify();
- delete from_shape;
- from_shape = new TopoDS_Shape(new_from_shape);
- }
+ TopoDS_CompSolid old_csolid = TopoDS::CompSolid(*from_shape);
+ OCCBody::update_OCC_entity(old_csolid, new_from_shape, &splitor);
+ from_shape->Nullify();
+ delete from_shape;
+ from_shape = new TopoDS_Shape(new_from_shape);
}
else if(from_shape->TShape()->ShapeType() == TopAbs_SOLID)
@@ -2399,7 +2399,12 @@
if (shapes.First().TShape()->ShapeType() != TopAbs_EDGE)
continue;
if(edge == NULL)
- edge = new TopoDS_Edge(TopoDS::Edge(shapes.First()));
+ {
+ TopoDS_Edge common_edge = TopoDS::Edge(shapes.First());
+ BRepBuilderAPI_Copy api_copy(common_edge);
+ TopoDS_Shape newShape = api_copy.ModifiedShape(common_edge);
+ edge = new TopoDS_Edge(TopoDS::Edge(newShape));
+ }
from_faces.append(new TopoDS_Face(face));
}
return edge;
@@ -2811,34 +2816,10 @@
TopExp_Explorer Ex;
TopoDS_Face the_face;
TopoDS_Shape ashape = *(body->get_TopoDS_Shape());
- if (OCCQueryEngine::instance()->OCCMap->IsBound(ashape))
- TopExp::MapShapesAndAncestors(ashape, TopAbs_FACE, TopAbs_SOLID, M);
- else
- {
- DLIList<Lump*> lumps = body->lumps();
- for(int i = 0; i < lumps.size(); i++)
- {
- OCCLump *occ_lump = (OCCLump *) lumps.get_and_step();
- TopExp::MapShapesAndAncestors(*occ_lump->get_TopoDS_Solid(),
- TopAbs_FACE, TopAbs_SOLID, M);
- }
- }
+ TopExp::MapShapesAndAncestors(ashape, TopAbs_FACE, TopAbs_COMPSOLID, M);
if(!M.Contains(*topo_face))
continue;
- const TopTools_ListOfShape& ListOfShapes =
- M.FindFromKey(*topo_face);
- if (!ListOfShapes.IsEmpty())
- {
- TopTools_ListIteratorOfListOfShape it(ListOfShapes) ;
- for (;it.More(); it.Next())
- {
- TopoDS_Solid solid = TopoDS::Solid(it.Value());
- int k = oqe->OCCMap->Find(solid);
- OCCLump* lump = (OCCLump*)oqe->OccToCGM->find(k)->second;
- if(lump && lump->get_TopoDS_Solid())
- shape_list.append_unique(lump->get_TopoDS_Solid());
- }
- }
+ shape_list.append_unique(body->get_TopoDS_Shape());
}
}
}
@@ -2880,6 +2861,8 @@
if (edge->IsNull())
continue;
+ DLIList<OCCPoint*> point_list;
+ curve->get_points(point_list);
for(int j = 0; j < shape_list.size(); j ++)
{
TopoDS_Shape* shape = shape_list.get_and_step();
@@ -2891,8 +2874,23 @@
{
DLIList<TopologyBridge*> tbs;
TopoDS_Shape* shape = shape_list.get_and_step();
- tbs += OCCQueryEngine::instance()->populate_topology_bridge(*shape);
- new_body_list.append(CAST_TO(tbs.get(),BodySM));
+ if (shape->TShape()->ShapeType() == TopAbs_COMPSOLID)
+ {
+ if(!OCCQueryEngine::instance()->OCCMap->IsBound(*shape))
+ {
+ TopExp_Explorer Ex;
+ for (Ex.Init(*shape, TopAbs_SOLID);Ex.More(); Ex.Next())
+ {
+ tbs += OCCQueryEngine::instance()->populate_topology_bridge(Ex.Current());
+ new_body_list.append_unique(CAST_TO(tbs.get(),BodySM));
+ }
+ }
+ }
+ else
+ {
+ tbs += OCCQueryEngine::instance()->populate_topology_bridge(*shape);
+ new_body_list.append_unique(CAST_TO(tbs.get(),BodySM));
+ }
}
if (keep_old)
Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp 2008-06-04 18:38:23 UTC (rev 1873)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp 2008-06-04 20:32:48 UTC (rev 1874)
@@ -1170,16 +1170,13 @@
{
int k = OCCMap->Find(aShape);
lump = (OCCLump*)(OccToCGM->find(k))->second;
- if (!aShape.IsSame(*lump->get_TopoDS_Solid()))
- {
- lump->set_TopoDS_Solid(aShape);
- OCCBody* body = CAST_TO(lump->get_body(), OCCBody);
- DLIList<Lump*> lumps = body->lumps();
- TopoDS_CompSolid* new_top = body->make_CompSolid(lumps);
- body->set_TopoDS_Shape(*new_top);
- new_top->Nullify();
- delete new_top;
- }
+ lump->set_TopoDS_Solid(aShape);
+ OCCBody* body = CAST_TO(lump->get_body(), OCCBody);
+ DLIList<Lump*> lumps = body->lumps();
+ TopoDS_CompSolid* new_top = body->make_CompSolid(lumps);
+ body->set_TopoDS_Shape(*new_top);
+ new_top->Nullify();
+ delete new_top;
}
TopExp_Explorer Ex;
@@ -1349,6 +1346,7 @@
{
Curve* curve = populate_topology_bridge(Ex.Current());
OCCCurve *occ_curve = CAST_TO(curve, OCCCurve);
+ DLIList<OCCLoop*> loops = occ_curve->loops();
CubitBoolean exist = CUBIT_FALSE;
OCCCoEdge * coedge = NULL;
int size = coedges_old.size();
@@ -1368,8 +1366,29 @@
break;
}
}
+
if(!exist)
{
+ //search through the curve loops
+ for(int i = 0; i < loops.size() ; i++)
+ {
+ OCCLoop* loop = loops.get_and_step();
+ if (!OCCMap->IsBound(*loop->get_TopoDS_Wire()))
+ {
+ DLIList<OCCCoEdge*> coedge_list = loop->coedges();
+ for(int j = 0; j < coedge_list.size(); j++)
+ {
+ OCCCoEdge * test_coedge = coedge_list.get_and_step();
+ if (test_coedge->curve() == curve)
+ {
+ loop->remove_coedge(test_coedge);
+ occ_curve->remove_loop(loop);
+ delete test_coedge;
+ }
+ }
+ delete loop;
+ }
+ }
coedge = new OCCCoEdge( curve, loop, sense);
coedges_new.append(coedge);
occ_curve->add_loop(loop);
Modified: cgm/trunk/geom/OCC/OCCShell.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCShell.cpp 2008-06-04 18:38:23 UTC (rev 1873)
+++ cgm/trunk/geom/OCC/OCCShell.cpp 2008-06-04 20:32:48 UTC (rev 1874)
@@ -279,7 +279,8 @@
if(shapes.Extent() > 0 || op->IsDeleted(face))
OCCSurface::update_OCC_entity(face,shape, op);
}
- OCCQueryEngine::instance()->update_OCC_map(old_shell, new_shell);
+ if(!old_shell.IsSame(new_shell))
+ OCCQueryEngine::instance()->update_OCC_map(old_shell, new_shell);
return CUBIT_SUCCESS;
}
// ********** END PUBLIC FUNCTIONS **********
Modified: cgm/trunk/geom/OCC/OCCSurface.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCSurface.cpp 2008-06-04 18:38:23 UTC (rev 1873)
+++ cgm/trunk/geom/OCC/OCCSurface.cpp 2008-06-04 20:32:48 UTC (rev 1874)
@@ -895,14 +895,17 @@
else
shape_vertex.Nullify();
- if(shapes.Extent() > 0 || op->IsDeleted(vertex))
+ if(!vertex.IsSame(shape_vertex) && (shapes.Extent() > 0 || op->IsDeleted(vertex)))
OCCQueryEngine::instance()->update_OCC_map(vertex, shape_vertex);
- OCCQueryEngine::instance()->update_OCC_map(edge, shape_edge);
+ if (!edge.IsSame(shape_edge))
+ OCCQueryEngine::instance()->update_OCC_map(edge, shape_edge);
}
- OCCQueryEngine::instance()->update_OCC_map(wire, shape);
+ if (!wire.IsSame(shape))
+ OCCQueryEngine::instance()->update_OCC_map(wire, shape);
}
- OCCQueryEngine::instance()->update_OCC_map(old_surface, new_surface);
+ if (!old_surface.IsSame(new_surface))
+ OCCQueryEngine::instance()->update_OCC_map(old_surface, new_surface);
return CUBIT_SUCCESS;
}
Modified: cgm/trunk/test/modify.cpp
===================================================================
--- cgm/trunk/test/modify.cpp 2008-06-04 18:38:23 UTC (rev 1873)
+++ cgm/trunk/test/modify.cpp 2008-06-04 20:32:48 UTC (rev 1874)
@@ -167,10 +167,6 @@
BodySM* stitched_body = NULL;
DLIList<Body*> new_bodies;
gmti->create_solid_bodies_from_surfs(face_list, new_bodies);
- //ome->stitch_surfs(bodysm_list, bodysm);
- //Lump* lump = ome->make_Lump(surface_list);
- //bodysm = CAST_TO(lump, OCCLump)->get_body();
- //gti->make_Body(bodysm);
CubitStatus rsl = CUBIT_SUCCESS;
DLIList<RefEntity*> ref_entity_list;
@@ -223,19 +219,19 @@
// test for sphere making
Body* test_body = gmti->sphere(5);
- d = test_body->measure(); //d =
+ d = test_body->measure(); //d = 523.598
//test for prism making
test_body = gmti->prism(10, 4, 4,2);
- d = test_body->measure(); //d =
+ d = test_body->measure(); //d = 320
//test for pyramid making
test_body = gmti->pyramid(10, 4, 5, 2, 3);
- d = test_body->measure(); //d =
+ d = test_body->measure(); //d = 320
//test for torus making
test_body = gmti->torus(10,5);
- d = test_body->measure(); //d =
+ d = test_body->measure(); //d = 4934.8
//test for planar_sheet making
CubitVector p1(0, 0, 0);
@@ -287,29 +283,19 @@
gti->get_free_ref_entities(free_entities);
//there shouldn't be any free_entites.
- //test for multi-cut imprint for subtract.
from_body = gmti->brick(10, 10, 10);
tool_body = gmti->brick(11, 1, 1);
CubitVector v_move4(0,1,-1);
gti->translate(from_body,v_move4);
Body* cp_from_body = gmti->copy_body(from_body);
- Body* cp_from_body2 = gmti->copy_body(from_body);
- Body* cp_tool_body = gmti->copy_body(tool_body);
- from_bodies.clean_out();
- from_bodies.append(from_body);
- new_bodies.clean_out();
- rsl = gmti->subtract(tool_body, from_bodies, new_bodies,
- CUBIT_TRUE, CUBIT_FALSE);
- n = new_bodies.get()->num_ref_faces();
- //n = 8
- n = new_bodies.get()->num_ref_edges();
- //n = 18
+ Body* cp_from_body2 = gmti->copy_body(cp_from_body);
//test edge imprint on body
ref_edges.clean_out();
- cp_tool_body->ref_edges(ref_edges);
+ tool_body->ref_edges(ref_edges);
from_bodies.clean_out();
from_bodies.append(cp_from_body);
+ new_bodies.clean_out();
CubitStatus stat = gmti->imprint(from_bodies, ref_edges, new_bodies, CUBIT_FALSE, CUBIT_TRUE );
//test edge imprint on surface
@@ -317,17 +303,54 @@
face_list.clean_out();
cp_from_body2->ref_faces(face_list);
int size = face_list.size();
+ DLIList<RefFace*> unimprint_faces;
for(int i = 0; i < size; i++)
{
CubitVector v = face_list.get()->center_point();
if(!v.about_equal(vv))
+ unimprint_faces.append(face_list.remove());
+ else
+ face_list.step();
+ }
+ assert(face_list.size() == 1);
+ new_bodies.clean_out();
+ vertices.clean_out();
+ cp_from_body2->ref_vertices(vertices);
+ vertices.clean_out();
+ ref_edges.step_and_get()->ref_vertices(vertices);
+ stat = gmti->imprint(unimprint_faces, ref_edges, new_bodies, CUBIT_FALSE);
+
+ new_bodies.clean_out();
+ face_list.clean_out();
+ cp_from_body2->ref_faces(face_list);
+ for(int i = 0; i < size; i++)
+ {
+ CubitVector v = face_list.get()->center_point();
+ if(!v.about_equal(vv))
face_list.remove();
else
face_list.step();
}
- assert(face_list.size() == 1);
+
+ vertices.clean_out();
+ face_list.get()->ref_vertices(vertices);
+ vertices.clean_out();
+ ref_edges.step_and_get()->ref_vertices(vertices);
+
+ OCCBody* check_body = CAST_TO(face_list.get()->body()->get_body_sm_ptr(), OCCBody);
stat = gmti->imprint(face_list, ref_edges, new_bodies, CUBIT_FALSE);
+ //test for multi-cut imprint for subtract.
+ from_bodies.clean_out();
+ from_bodies.append(from_body);
+ new_bodies.clean_out();
+ rsl = gmti->subtract(tool_body, from_bodies, new_bodies,
+ CUBIT_TRUE, CUBIT_FALSE);
+ n = new_bodies.get()->num_ref_faces();
+ //n = 8
+ n = new_bodies.get()->num_ref_edges();
+ //n = 18
+
bodies.clean_out();
gti->bodies(bodies);
//delete all entities
1
0
Author: kraftche
Date: 2008-06-04 13:38:23 -0500 (Wed, 04 Jun 2008)
New Revision: 1873
Modified:
cgm/trunk/itaps/SIDL/Makefile.am
Log:
Fix thoroughly broken iGeom SIDL build:
- Build from iGeom sources, not iMesh
- If building a shared lib, need to compile with -fpic
- Remove use of non-existant variable: fixes attempt to create
library in root directory
- Look in the correct locations for input files for separate
build tree
Modified: cgm/trunk/itaps/SIDL/Makefile.am
===================================================================
--- cgm/trunk/itaps/SIDL/Makefile.am 2008-06-04 18:31:30 UTC (rev 1872)
+++ cgm/trunk/itaps/SIDL/Makefile.am 2008-06-04 18:38:23 UTC (rev 1873)
@@ -1,5 +1,6 @@
vpath = gserver bserver
VPATH = gserver bserver
+BABEL_FLAGS = -V$(srcdir)
LD_FLAGS_PIC = -fpic -shared
SERVER_HDRS = iBase_ArrTag_IOR.h iBase_CreationStatus_IOR.h iBase_EntSet_IOR.h \
@@ -7,17 +8,21 @@
iBase_ErrorType_IOR.h iBase_IOR.h iBase_SetBoolOps_IOR.h \
iBase_SetRelation_IOR.h iBase_SetTag_IOR.h iBase_StorageOrder_IOR.h \
iBase_TagValueType_IOR.h iBase_Tag_IOR.h iMesh_AdjacencyInfo_IOR.h \
- iMesh_ArrMod_IOR.h iMesh_Arr_IOR.h iMesh_EntityTopology_IOR.h \
- iMesh_Entity_IOR.h iMesh_IOR.h iMesh_Mesh_IOR.h iMesh_Modify_IOR.h \
- iMesh_SIDL_IOR.h iMesh_SIDL_MeshSidl_IOR.h \
+ iGeom_Construct_IOR.h iGeom_CoreQuery_IOR.h iGeom_Factory_IOR.h \
+ iGeom_Geometry_IOR.h iGeom_IOR.h iGeom_Iterators_IOR.h iGeom_Modify_IOR.h \
+ iGeom_Parametric_IOR.h iGeom_Primitives_IOR.h iGeom_SIDL_GeomSidl_IOR.h \
+ iGeom_SIDL_IOR.h iGeom_Shape_IOR.h iGeom_Tolerance_IOR.h \
+ iGeom_Topology_IOR.h iGeom_Transforms_IOR.h \
iBase.hh iBase_ArrTag.hh iBase_CreationStatus.hh iBase_EntSet.hh \
iBase_EntTag.hh iBase_EntityType.hh iBase_ErrorActions.hh \
iBase_ErrorType.hh iBase_SetBoolOps.hh iBase_SetRelation.hh iBase_SetTag.hh \
iBase_StorageOrder.hh iBase_Tag.hh iBase_TagValueType.hh iMesh.hh \
- iMesh_AdjacencyInfo.hh iMesh_Arr.hh iMesh_ArrMod.hh iMesh_Entity.hh \
- iMesh_EntityTopology.hh iMesh_Mesh.hh iMesh_Modify.hh iMesh_SIDL.hh \
- iMesh_SIDL_MeshSidl.hh sidl.hh sidl_BaseClass.hh sidl_BaseException.hh \
- sidl_BaseInterface.hh sidl_ClassInfo.hh sidl_ClassInfoI.hh sidl_DFinder.hh \
+ iGeom_Booleans.hh iGeom_Construct.hh iGeom_CoreQuery.hh iGeom_Factory.hh \
+ iGeom_Geometry.hh iGeom_Iterators.hh iGeom_Modify.hh iGeom_Parametric.hh \
+ iGeom_Primitives.hh iGeom_SIDL.hh iGeom_SIDL_GeomSidl.hh iGeom_Shape.hh \
+ iGeom_Tolerance.hh iGeom_Topology.hh iGeom_Transforms.hh sidl.hh \
+ sidl_BaseClass.hh sidl_BaseException.hh sidl_BaseInterface.hh \
+ sidl_ClassInfo.hh sidl_ClassInfoI.hh sidl_DFinder.hh \
sidl_DLL.hh sidl_Finder.hh sidl_InvViolation.hh sidl_Loader.hh \
sidl_PostViolation.hh sidl_PreViolation.hh sidl_Resolve.hh \
sidl_SIDLException.hh sidl_Scope.hh sidl_io.hh sidl_io_Deserializer.hh \
@@ -25,13 +30,16 @@
sidl_rmi.hh sidl_rmi_ConnectRegistry.hh sidl_rmi_InstanceHandle.hh \
sidl_rmi_InstanceRegistry.hh sidl_rmi_Invocation.hh \
sidl_rmi_NetworkException.hh sidl_rmi_ProtocolFactory.hh \
- sidl_rmi_Response.hh iMesh_SIDL_MeshSidl_Impl.hh iBase_Error_Impl.hh \
+ sidl_rmi_Response.hh iGeom_SIDL_GeomSidl_Impl.hh iBase_Error_Impl.hh \
iBase_Error_IOR.h iBase_Error.hh
-SERVER_SRCS = iMesh_SIDL_MeshSidl_IOR.c \
+SERVER_CXX_SRCS = \
iBase_ArrTag.cc iBase_EntSet.cc iBase_EntTag.cc \
iBase_SetBoolOps.cc iBase_SetRelation.cc iBase_SetTag.cc iBase_Tag.cc \
- iMesh_Arr.cc iMesh_ArrMod.cc iMesh_Entity.cc iMesh_Mesh.cc iMesh_Modify.cc \
- iMesh_SIDL_MeshSidl.cc sidl_BaseClass.cc sidl_BaseException.cc \
+ iGeom_Booleans.cc iGeom_Construct.cc iGeom_CoreQuery.cc iGeom_Factory.cc \
+ iGeom_Geometry.cc iGeom_Iterators.cc iGeom_Modify.cc iGeom_Parametric.cc \
+ iGeom_Primitives.cc iGeom_SIDL_GeomSidl.cc iGeom_Shape.cc \
+ iGeom_Tolerance.cc iGeom_Topology.cc iGeom_Transforms.cc sidl_BaseClass.cc \
+ sidle_BaseException.cc \
sidl_BaseInterface.cc sidl_ClassInfo.cc sidl_ClassInfoI.cc sidl_DFinder.cc \
sidl_DLL.cc sidl_Finder.cc sidl_InvViolation.cc sidl_Loader.cc \
sidl_PostViolation.cc sidl_PreViolation.cc sidl_SIDLException.cc \
@@ -39,24 +47,12 @@
sidl_io_Serializer.cc sidl_rmi_ConnectRegistry.cc \
sidl_rmi_InstanceHandle.cc sidl_rmi_InstanceRegistry.cc \
sidl_rmi_Invocation.cc sidl_rmi_NetworkException.cc \
- sidl_rmi_ProtocolFactory.cc sidl_rmi_Response.cc iMesh_SIDL_MeshSidl_Skel.cc \
- iMesh_SIDL_MeshSidl_Impl.cc iBase_Error_Impl.cc iBase_Error_IOR.c \
- iBase_Error_Skel.cc iBase_Error.cc
-SERVER_OFILES = iMesh_SIDL_MeshSidl_IOR.o \
- iBase_ArrTag.o iBase_EntSet.o iBase_EntTag.o \
- iBase_SetBoolOps.o iBase_SetRelation.o iBase_SetTag.o iBase_Tag.o \
- iMesh_Arr.o iMesh_ArrMod.o iMesh_Entity.o iMesh_Mesh.o iMesh_Modify.o \
- iMesh_SIDL_MeshSidl.o sidl_BaseClass.o sidl_BaseException.o \
- sidl_BaseInterface.o sidl_ClassInfo.o sidl_ClassInfoI.o sidl_DFinder.o \
- sidl_DLL.o sidl_Finder.o sidl_InvViolation.o sidl_Loader.o \
- sidl_PostViolation.o sidl_PreViolation.o sidl_SIDLException.o \
- sidl_io_Deserializer.o sidl_io_IOException.o sidl_io_Serializeable.o \
- sidl_io_Serializer.o sidl_rmi_ConnectRegistry.o \
- sidl_rmi_InstanceHandle.o sidl_rmi_InstanceRegistry.o \
- sidl_rmi_Invocation.o sidl_rmi_NetworkException.o \
- sidl_rmi_ProtocolFactory.o sidl_rmi_Response.o iMesh_SIDL_MeshSidl_Skel.o \
- iMesh_SIDL_MeshSidl_Impl.o iBase_Error_Impl.o iBase_Error_IOR.o \
- iBase_Error_Skel.o iBase_Error.o
+ sidl_rmi_ProtocolFactory.cc sidl_rmi_Response.cc iGeom_SIDL_GeomSidl_Skel.cc \
+ iGeom_SIDL_GeomSidl_Impl.cc iBase_Error_Impl.cc \
+ iBase_Error_Skel.cc iBase_Error.cc
+SERVER_C_SRCS = iGeom_SIDL_GeomSidl_IOR.c iBase_Error_IOR.c
+
+SERVER_OFILES = $(SERVER_CXX_SRCES:.cc=.o) $(SERVER_C_SRCS:.c=.o)
#bin_PROGRAMS = testgeom
#testgeom_SOURCES = testgeom.cpp
@@ -64,41 +60,43 @@
LDADD = @top_srcdir@/itaps/libiGeom.la @abs_srcdir@/libiGeomserver.so ${BABEL_DIR}/lib/libsidl.la
#testgeom_DEPENDENCIES = @top_srcdir@/itaps/libiGeom.la @abs_srcdir@/libiGeomserver.so ${BABEL_DIR}/lib/libsidl.la
-all: ${iGeom_SIDLLIBDIR}/libiGeomserver.so
+all: libiGeomserver.so
settings:
@echo "FACTORY_OFILES = $(FACTORY_OFILES)"
@echo "SERVER_OFILES = $(SERVER_OFILES)"
#============= iBase =============
-repo/.btimestamp: iBase.sidl
+repo/.btimestamp: $(srcdir)/iBase.sidl
-rm -rf repo
- @BABEL_DIR@/bin/babel -tXML -o repo iBase.sidl
+ @BABEL_DIR@/bin/babel $(BABEL_FLAGS) -tXML -o repo $(srcdir)/iBase.sidl
touch $@
-bserver/babel.make: repo/.btimestamp iBase.sidl
+bserver/babel.make: repo/.btimestamp $(srcdir)/iBase.sidl
-rm -f $@
- @BABEL_DIR@/bin/babel -sC++ -o bserver iBase.sidl
+ @BABEL_DIR@/bin/babel $(BABEL_FLAGS) -sC++ -o bserver $(srcdir)/iBase.sidl
#============= iBase =============
-repo/.gtimestamp: iGeom.sidl
- @BABEL_DIR@/bin/babel -tXML -o repo -Rrepo iGeom.sidl
+repo/.gtimestamp: $(srcdir)/iGeom.sidl bserver/babel.make
+ @BABEL_DIR@/bin/babel $(BABEL_FLAGS) -tXML -o repo -Rrepo $(srcdir)/iGeom.sidl
touch $@
-gserver/babel.make: repo/.gtimestamp repo/.btimestamp iGeom_SIDL.sidl iGeom.sidl
+gserver/babel.make: repo/.gtimestamp repo/.btimestamp $(srcdir)/iGeom_SIDL.sidl $(srcdir)/iGeom.sidl
-rm -f $@
- @BABEL_DIR@/bin/babel -R"repo" -sC++ -o gserver iGeom_SIDL.sidl
+ @BABEL_DIR@/bin/babel $(BABEL_FLAGS) -R"repo" -sC++ -o gserver $(srcdir)/iGeom_SIDL.sidl
-Cclient: repo/.gtimestamp repo/.gtimestamp iGeom_SIDL.sidl
+Cclient: repo/.gtimestamp repo/.gtimestamp $(srcdir)/iGeom_SIDL.sidl
-rm -rf Cclient
- @BABEL_DIR@/bin/babel -R"repo" -cC -o Cclient iGeom_SIDL.sidl
+ @BABEL_DIR@/bin/babel $(BABEL_FLAGS) -R"repo" -cC -o Cclient $(srcdir)/iGeom_SIDL.sidl
-F77client: repo/.gtimestamp repo/.btimestamp iGeom_SIDL.sidl
+F77client: repo/.gtimestamp repo/.btimestamp $(srcdir)/iGeom_SIDL.sidl
-rm -rf F77client
- @BABEL_DIR@/bin/babel -R"repo" -cF77 -o F77client iGeom_SIDL.sidl
+ @BABEL_DIR@/bin/babel $(BABEL_FLAGS) -R"repo" -cF77 -o F77client $(srcdir)/iGeom_SIDL.sidl
-${iGeom_SIDLLIBDIR}/libiGeomserver.so: gserver/babel.make ${SERVER_OFILES}
+
+
+libiGeomserver.so: gserver/babel.make ${SERVER_OFILES}
$(CXX) $(LD_FLAGS) $(LD_FLAGS_PIC) -o $@ ${SERVER_OFILES}
libiGeomCclient.so: Cclient ${CCLIENT_OFILES}
@@ -119,19 +117,19 @@
cd mserver; rm -f ${SERVER_HDRS} ${SERVER_SRCS}
.cxx.o:
- $(CXX) $(CXX_FLAGS) ${iGeom_SIDL_INCLUDES} -o $@ -c $<
+ $(CXX) $(LD_FLAGS_PIC) $(CXX_FLAGS) -I$(BABEL_DIR)/include ${iGeom_SIDL_INCLUDES} -o $@ -c $<
.cpp.o:
- $(CXX) $(CXX_FLAGS) ${iGeom_SIDL_INCLUDES} -o $@ -c $<
+ $(CXX) $(LD_FLAGS_PIC) $(CXX_FLAGS) -I$(BABEL_DIR)/include ${iGeom_SIDL_INCLUDES} -o $@ -c $<
.cc.o:
- $(CXX) $(CXX_FLAGS) ${iGeom_SIDL_INCLUDES} -o $@ -c $<
+ $(CXX) $(LD_FLAGS_PIC) $(CXX_FLAGS) -I$(BABEL_DIR)/include ${iGeom_SIDL_INCLUDES} -o $@ -c $<
.c.o:
- $(CC) $(CC_FLAGS) ${iGeom_SIDL_INCLUDES} -o $@ -c $<
+ $(CC) $(LD_FLAGS_PIC) $(CC_FLAGS) -I$(BABEL_DIR)/include ${iGeom_SIDL_INCLUDES} -o $@ -c $<
.f.o:
- $(FC) $(FC_FLAGS) ${iGeom_SIDL_INCLUDES} -o $@ -c $<
+ $(FC) $(LD_FLAGS_PIC) $(FC_FLAGS) ${iGeom_SIDL_INCLUDES} -o $@ -c $<
# Automake doesn't seem to have a directory defined for
# platform-dependent data (or include) files. So put
1
0
Author: kraftche
Date: 2008-06-04 13:31:30 -0500 (Wed, 04 Jun 2008)
New Revision: 1872
Modified:
cgm/trunk/itaps/SIDL/gserver/iGeom_SIDL_GeomSidl_Impl.cc
cgm/trunk/itaps/SIDL/iGeom.sidl
cgm/trunk/itaps/iGeom.h
cgm/trunk/itaps/iGeom_CGMA.cc
Log:
add missing sphere create method
Modified: cgm/trunk/itaps/SIDL/gserver/iGeom_SIDL_GeomSidl_Impl.cc
===================================================================
--- cgm/trunk/itaps/SIDL/gserver/iGeom_SIDL_GeomSidl_Impl.cc 2008-06-04 13:33:47 UTC (rev 1871)
+++ cgm/trunk/itaps/SIDL/gserver/iGeom_SIDL_GeomSidl_Impl.cc 2008-06-04 18:31:30 UTC (rev 1872)
@@ -3977,6 +3977,23 @@
}
/**
+ * Method: Sphere[]
+ */
+void
+iGeom_SIDL::GeomSidl_impl::Sphere (
+ /* in */ double radius,
+ /* out */ void*& geom_entity )
+throw (
+ ::iBase::Error
+){
+ // DO-NOT-DELETE splicer.begin(iGeom_SIDL.GeomSidl.Sphere)
+ // Insert-Code-Here {iGeom_SIDL.GeomSidl.Sphere} (Sphere method)
+ iGeom_Sphere(igeomInstance, radius, &geom_entity);
+ PROCESS_ERROR;
+ // DO-NOT-DELETE splicer.end(iGeom_SIDL.GeomSidl.Sphere)
+}
+
+/**
* Method: Brick[]
*/
void
Modified: cgm/trunk/itaps/SIDL/iGeom.sidl
===================================================================
--- cgm/trunk/itaps/SIDL/iGeom.sidl 2008-06-04 13:33:47 UTC (rev 1871)
+++ cgm/trunk/itaps/SIDL/iGeom.sidl 2008-06-04 18:31:30 UTC (rev 1872)
@@ -989,6 +989,12 @@
interface Primitives extends Modify
{
+//==========================Sphere=================
+ /* Construct a Sphere with specified radius. */
+ void Sphere(in double radius,
+ out opaque geom_entity)
+ throws iBase.Error;
+
//==========================Brick=================
/* Construct a brick with specified dimensions. If both y and z are
* zero, a cube of dimension x is constructed.
Modified: cgm/trunk/itaps/iGeom.h
===================================================================
--- cgm/trunk/itaps/iGeom.h 2008-06-04 13:33:47 UTC (rev 1871)
+++ cgm/trunk/itaps/iGeom.h 2008-06-04 18:31:30 UTC (rev 1872)
@@ -2059,6 +2059,13 @@
iBase_EntityHandle,
int* err );
+ /**\brief Create a sphere centered on the origin
+ */
+ void iGeom_createSphere( iGeom_Instance,
+ double radius,
+ iBase_EntityHandle* sphere_handle_out,
+ int* err );
+
/**\brief
*
*/
Modified: cgm/trunk/itaps/iGeom_CGMA.cc
===================================================================
--- cgm/trunk/itaps/iGeom_CGMA.cc 2008-06-04 13:33:47 UTC (rev 1871)
+++ cgm/trunk/itaps/iGeom_CGMA.cc 2008-06-04 18:31:30 UTC (rev 1872)
@@ -5135,6 +5135,22 @@
}
void
+iGeom_createSphere( iGeom_Instance instance,
+ double radius,
+ iBase_EntityHandle *geom_entity,
+ int* err )
+{
+ if (radius <= 0.0) {
+ ERROR(iBase_INVALID_ARGUMENT, "Sphere radius must be must be positive.");
+ }
+
+ RefEntity* tmp_body = gmt->sphere( radius );
+ *geom_entity = tmp_body;
+ RETURN ((tmp_body ? iBase_SUCCESS : iBase_FAILURE));
+}
+
+
+void
iGeom_createBrick (iGeom_Instance instance,
/*in*/ double x,
/*in*/ double y,
1
0
Author: janehu
Date: 2008-06-02 13:49:17 -0500 (Mon, 02 Jun 2008)
New Revision: 1868
Modified:
cgm/trunk/geom/OCC/OCCBody.cpp
cgm/trunk/geom/OCC/OCCBody.hpp
cgm/trunk/geom/OCC/OCCModifyEngine.cpp
cgm/trunk/geom/OCC/OCCModifyEngine.hpp
cgm/trunk/geom/OCC/OCCQueryEngine.cpp
Log:
make sure the TopoDS_shapes get updated correctly after first edge imprint, getting ready to make a second edge imprint before update OCC entities, still has error showing a curve with no vertices, checking on it.
Modified: cgm/trunk/geom/OCC/OCCBody.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.cpp 2008-05-30 23:45:17 UTC (rev 1867)
+++ cgm/trunk/geom/OCC/OCCBody.cpp 2008-06-02 18:49:17 UTC (rev 1868)
@@ -94,6 +94,15 @@
OCCBody::OCCBody(DLIList<Lump*>& my_lumps)
{
myLumps += my_lumps;
+ TopoDS_CompSolid* new_top = make_CompSolid(my_lumps);
+ myTopoDSShape = new_top;
+ IsSheetBody = CUBIT_FALSE;
+ myShell = NULL;
+ update_bounding_box();
+}
+
+TopoDS_CompSolid* OCCBody::make_CompSolid(DLIList<Lump*>& my_lumps)
+{
BRep_Builder B;
TopoDS_CompSolid Co;
B.MakeCompSolid(Co);
@@ -102,10 +111,8 @@
TopoDS_Solid * solid = CAST_TO(myLumps.get_and_step(), OCCLump)->get_TopoDS_Solid();
B.Add(Co, *solid);
}
- myTopoDSShape = new TopoDS_CompSolid(Co);
- IsSheetBody = CUBIT_FALSE;
- myShell = NULL;
- update_bounding_box();
+ TopoDS_CompSolid* new_top = new TopoDS_CompSolid(Co);
+ return new_top;
}
OCCBody::~OCCBody()
Modified: cgm/trunk/geom/OCC/OCCBody.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.hpp 2008-05-30 23:45:17 UTC (rev 1867)
+++ cgm/trunk/geom/OCC/OCCBody.hpp 2008-06-02 18:49:17 UTC (rev 1868)
@@ -184,8 +184,8 @@
virtual CubitBoolean is_sheet_body(){return IsSheetBody;}
+ TopoDS_CompSolid* make_CompSolid(DLIList<Lump*>& my_lumps);
protected:
-
private:
DLIList<Lump*> myLumps;
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-05-30 23:45:17 UTC (rev 1867)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-06-02 18:49:17 UTC (rev 1868)
@@ -1927,6 +1927,7 @@
//indicate if there's more faces to be imprinted
CubitBoolean more_face = CUBIT_TRUE;
+ DLIList<TopoDS_Face*> list_for_delete;
//list of face on from_shape that has been imprinted
DLIList<TopoDS_Face*> from_faces;
@@ -1943,18 +1944,28 @@
{
if(count == 1)
break;
- common_edge = find_imprinting_edge(*from_shape, TopoDS::Edge(*tool_shape),from_face);
+
+ DLIList<TopoDS_Face*> faces;
+ //need to delete TopoDS_Face* in faces
+ common_edge = find_imprinting_edge(*from_shape, TopoDS::Edge(*tool_shape),faces);
if (common_edge)
{
if (on_faces)
qualified = CUBIT_FALSE;
- for (int i = 0; on_faces && i < on_faces->size(); i++)
+ for(int j = 0; j < faces.size(); j++)
{
- if (from_face.IsSame(*(on_faces->get_and_step())))
+ from_face = *faces.get();
+ for (int i = 0; on_faces && i < on_faces->size(); i++)
{
- qualified = CUBIT_TRUE;
- break;
+ if (from_face.IsSame(*(on_faces->get_and_step())))
+ {
+ qualified = CUBIT_TRUE;
+ break;
+ }
}
+ faces.get()->Nullify();
+ delete faces.get();
+ faces.step();
}
if (qualified && (from_faces.size() == 0 || (from_faces.size() && !from_face.IsSame(*from_faces.get()))) )
list_of_edges.Append(*common_edge);
@@ -2092,6 +2103,13 @@
topo_face->Nullify();
delete topo_face;
}
+
+ for (int iii=0; iii < list_for_delete.size(); iii++)
+ {
+ TopoDS_Face* topo_face = list_for_delete.get_and_step();
+ topo_face->Nullify();
+ delete topo_face;
+ }
continue;
}
@@ -2250,6 +2268,25 @@
topo_changed = CUBIT_FALSE;
if(splitor.IsDone())
{
+ //take care of on_faces list first.
+ if (on_faces && on_faces->size())
+ {
+ TopoDS_Face* compare_face = on_faces->get();
+ if(from_face.IsSame(*compare_face))
+ {
+ on_faces->remove(compare_face);
+ TopTools_ListOfShape shapes;
+ shapes.Assign(splitor.Modified(from_face));
+ while(shapes.Extent() > 0)
+ {
+ TopoDS_Face* face =
+ new TopoDS_Face(TopoDS::Face(shapes.First()));
+ shapes.RemoveFirst();
+ on_faces->append(face);
+ list_for_delete.append(face);
+ }
+ }
+ }
TopoDS_Shape new_from_shape = splitor.Shape();
if(from_shape->TShape()->ShapeType() == TopAbs_COMPSOLID)
{
@@ -2339,16 +2376,16 @@
// Date : 05/08
//===============================================================================
TopoDS_Edge* OCCModifyEngine::find_imprinting_edge(TopoDS_Shape& from_shape,
- TopoDS_Edge& tool_shape,
- TopoDS_Face& face)const
+ TopoDS_Edge& tool_shape,
+ DLIList<TopoDS_Face*>& from_faces)const
{
TopoDS_Edge* edge = NULL;
//list of face on from_shape that has been imprinted
- DLIList<TopoDS_Face*> from_faces;
+ from_faces.clean_out();
TopExp_Explorer Ex;
for (Ex.Init(from_shape, TopAbs_FACE); Ex.More(); Ex.Next())
{
- face = TopoDS::Face(Ex.Current());
+ TopoDS_Face face = TopoDS::Face(Ex.Current());
BRepAlgoAPI_Common intersector(face, tool_shape);
TopTools_ListOfShape shapes;
shapes.Assign(intersector.Modified(tool_shape));
@@ -2361,10 +2398,10 @@
}
if (shapes.First().TShape()->ShapeType() != TopAbs_EDGE)
continue;
- edge = new TopoDS_Edge(TopoDS::Edge(shapes.First()));
- return edge;
+ if(edge == NULL)
+ edge = new TopoDS_Edge(TopoDS::Edge(shapes.First()));
+ from_faces.append(new TopoDS_Face(face));
}
- face.Nullify();
return edge;
}
@@ -2763,7 +2800,7 @@
shape_list.append(topo_face);
else
{
- int size = shape_list.size();
+ //int size = shape_list.size();
OCCQueryEngine* oqe = OCCQueryEngine::instance();
DLIList <OCCBody* > *bodies = oqe->BodyList;
TopTools_IndexedDataMapOfShapeListOfShape M;
@@ -2773,11 +2810,19 @@
body = bodies->get_and_step();
TopExp_Explorer Ex;
TopoDS_Face the_face;
- for (Ex.Init(*(body->get_TopoDS_Shape()), TopAbs_FACE);Ex.More(); Ex.Next())
- the_face = TopoDS::Face(Ex.Current());
-
- TopExp::MapShapesAndAncestors(*(body->get_TopoDS_Shape()),
- TopAbs_FACE, TopAbs_SOLID, M);
+ TopoDS_Shape ashape = *(body->get_TopoDS_Shape());
+ if (OCCQueryEngine::instance()->OCCMap->IsBound(ashape))
+ TopExp::MapShapesAndAncestors(ashape, TopAbs_FACE, TopAbs_SOLID, M);
+ else
+ {
+ DLIList<Lump*> lumps = body->lumps();
+ for(int i = 0; i < lumps.size(); i++)
+ {
+ OCCLump *occ_lump = (OCCLump *) lumps.get_and_step();
+ TopExp::MapShapesAndAncestors(*occ_lump->get_TopoDS_Solid(),
+ TopAbs_FACE, TopAbs_SOLID, M);
+ }
+ }
if(!M.Contains(*topo_face))
continue;
const TopTools_ListOfShape& ListOfShapes =
@@ -2806,6 +2851,20 @@
BRepBuilderAPI_Copy api_copy(*shape);
TopoDS_Shape newShape = api_copy.ModifiedShape(*shape);
TopoDS_Shape* Shape1 = new TopoDS_Shape(newShape);
+ for(int j = 0; j < face_list.size(); j++)
+ {
+ TopoDS_Face* face = face_list.get();
+ TopExp_Explorer Ex;
+ for (Ex.Init(*shape, TopAbs_FACE); Ex.More(); Ex.Next())
+ {
+ if(face->IsSame(Ex.Current()))
+ {
+ face = new TopoDS_Face(TopoDS::Face(api_copy.ModifiedShape(*face)));
+ face_list.change_to(face);
+ }
+ }
+ face_list.step();
+ }
shape_list.change_to(Shape1);
shape_list.step();
}
@@ -2836,6 +2895,15 @@
new_body_list.append(CAST_TO(tbs.get(),BodySM));
}
+ if (keep_old)
+ {
+ for(int i = 0; i < face_list.size(); i++)
+ {
+ TopoDS_Face* face = face_list.get();
+ face->Nullify();
+ delete face;
+ }
+ }
return CUBIT_SUCCESS;
}
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.hpp 2008-05-30 23:45:17 UTC (rev 1867)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.hpp 2008-06-02 18:49:17 UTC (rev 1868)
@@ -663,7 +663,7 @@
TopoDS_Edge* find_imprinting_edge(TopoDS_Shape& from_shape,
TopoDS_Edge& tool_shape,
- TopoDS_Face& face)const;
+ DLIList<TopoDS_Face*>& faces)const;
CubitStatus sort_curves(DLIList<Curve*> curve_list,
DLIList<DLIList<TopoDS_Edge*>*>& topo_edges_loops)const;
Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp 2008-05-30 23:45:17 UTC (rev 1867)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp 2008-06-02 18:49:17 UTC (rev 1868)
@@ -1170,7 +1170,16 @@
{
int k = OCCMap->Find(aShape);
lump = (OCCLump*)(OccToCGM->find(k))->second;
- lump->set_TopoDS_Solid(aShape);
+ if (!aShape.IsSame(*lump->get_TopoDS_Solid()))
+ {
+ lump->set_TopoDS_Solid(aShape);
+ OCCBody* body = CAST_TO(lump->get_body(), OCCBody);
+ DLIList<Lump*> lumps = body->lumps();
+ TopoDS_CompSolid* new_top = body->make_CompSolid(lumps);
+ body->set_TopoDS_Shape(*new_top);
+ new_top->Nullify();
+ delete new_top;
+ }
}
TopExp_Explorer Ex;
1
0