mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-26 05:50:32 +05:00
* Added OpenCascade XDE Support to enable importing of individual surface colours from STEP Geometry
* Extended the Clipping Planes functionality to the Geometry mode for OCC Geometry * Added the option to specify the maximum mesh size for each individual face in an OCC Geometry
This commit is contained in:
parent
34bfd4a349
commit
85867fb240
@ -564,8 +564,9 @@ namespace netgen
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Philippose - 15/01/2009
|
||||||
double maxh = mparam.maxh;
|
double maxh = geom.face_maxh[k-1];
|
||||||
|
//double maxh = mparam.maxh;
|
||||||
mparam.checkoverlap = 0;
|
mparam.checkoverlap = 0;
|
||||||
// int noldpoints = mesh->GetNP();
|
// int noldpoints = mesh->GetNP();
|
||||||
int noldsurfel = mesh.GetNSE();
|
int noldsurfel = mesh.GetNSE();
|
||||||
@ -1112,7 +1113,6 @@ namespace netgen
|
|||||||
|
|
||||||
mesh->SetLocalH (bb.PMin(), bb.PMax(), 0.5);
|
mesh->SetLocalH (bb.PMin(), bb.PMax(), 0.5);
|
||||||
|
|
||||||
|
|
||||||
if (mparam.uselocalh)
|
if (mparam.uselocalh)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -1126,7 +1126,6 @@ namespace netgen
|
|||||||
double maxedgelen = 0;
|
double maxedgelen = 0;
|
||||||
double minedgelen = 1e99;
|
double minedgelen = 1e99;
|
||||||
|
|
||||||
|
|
||||||
multithread.task = "Setting local mesh size (elements per edge)";
|
multithread.task = "Setting local mesh size (elements per edge)";
|
||||||
|
|
||||||
// setting elements per edge
|
// setting elements per edge
|
||||||
@ -1147,15 +1146,44 @@ namespace netgen
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double localh = len/mparam.segmentsperedge;
|
double localh = len/mparam.segmentsperedge;
|
||||||
double s0, s1;
|
double s0, s1;
|
||||||
|
|
||||||
|
// Philippose - 23/01/2009
|
||||||
|
// Find all the parent faces of a given edge
|
||||||
|
// and limit the mesh size of the edge based on the
|
||||||
|
// mesh size limit of the face
|
||||||
|
TopTools_IndexedDataMapOfShapeListOfShape edge_face_map;
|
||||||
|
edge_face_map.Clear();
|
||||||
|
|
||||||
|
TopExp::MapShapesAndAncestors(geom.shape, TopAbs_EDGE, TopAbs_FACE, edge_face_map);
|
||||||
|
const TopTools_ListOfShape& parent_faces = edge_face_map.FindFromKey(e);
|
||||||
|
|
||||||
|
TopTools_ListIteratorOfListOfShape parent_face_list;
|
||||||
|
|
||||||
|
for(parent_face_list.Initialize(parent_faces); parent_face_list.More(); parent_face_list.Next())
|
||||||
|
{
|
||||||
|
TopoDS_Face parent_face = TopoDS::Face(parent_face_list.Value());
|
||||||
|
|
||||||
|
int face_index = geom.fmap.FindIndex(parent_face);
|
||||||
|
|
||||||
|
if(face_index >= 1) localh = min(localh,geom.face_maxh[face_index - 1]);
|
||||||
|
}
|
||||||
|
|
||||||
Handle(Geom_Curve) c = BRep_Tool::Curve(e, s0, s1);
|
Handle(Geom_Curve) c = BRep_Tool::Curve(e, s0, s1);
|
||||||
|
|
||||||
maxedgelen = max (maxedgelen, len);
|
maxedgelen = max (maxedgelen, len);
|
||||||
minedgelen = min (minedgelen, len);
|
minedgelen = min (minedgelen, len);
|
||||||
|
|
||||||
int maxj = 2 * (int) ceil (localh/len);
|
// Philippose - 23/01/2009
|
||||||
|
// Modified the calculation of maxj, because the
|
||||||
|
// method used so far always results in maxj = 2,
|
||||||
|
// which causes the localh to be set only at the
|
||||||
|
// starting, mid and end of the edge.
|
||||||
|
// Old Algorithm:
|
||||||
|
// int maxj = 2 * (int) ceil (localh/len);
|
||||||
|
int maxj = max((int) ceil(len/localh), 2);
|
||||||
|
|
||||||
for (int j = 0; j <= maxj; j++)
|
for (int j = 0; j <= maxj; j++)
|
||||||
{
|
{
|
||||||
gp_Pnt pnt = c->Value (s0+double(j)/maxj*(s1-s0));
|
gp_Pnt pnt = c->Value (s0+double(j)/maxj*(s1-s0));
|
||||||
@ -1163,12 +1191,8 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
multithread.task = "Setting local mesh size (edge curvature)";
|
multithread.task = "Setting local mesh size (edge curvature)";
|
||||||
|
|
||||||
|
|
||||||
// setting edge curvature
|
// setting edge curvature
|
||||||
|
|
||||||
int nsections = 20;
|
int nsections = 20;
|
||||||
@ -1194,7 +1218,6 @@ namespace netgen
|
|||||||
if (curvature >= 1e99)
|
if (curvature >= 1e99)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
||||||
gp_Pnt pnt = c->Value (s);
|
gp_Pnt pnt = c->Value (s);
|
||||||
|
|
||||||
mesh->RestrictLocalH (Point3d(pnt.X(), pnt.Y(), pnt.Z()),
|
mesh->RestrictLocalH (Point3d(pnt.X(), pnt.Y(), pnt.Z()),
|
||||||
@ -1203,8 +1226,6 @@ namespace netgen
|
|||||||
// (*testout) << "edge " << i << " max. curvature: " << maxcur << endl;
|
// (*testout) << "edge " << i << " max. curvature: " << maxcur << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
multithread.task = "Setting local mesh size (face curvature)";
|
multithread.task = "Setting local mesh size (face curvature)";
|
||||||
|
|
||||||
// setting face curvature
|
// setting face curvature
|
||||||
@ -1247,7 +1268,6 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// setting close edges
|
// setting close edges
|
||||||
|
|
||||||
if (stlparam.resthcloseedgeenable)
|
if (stlparam.resthcloseedgeenable)
|
||||||
@ -1346,13 +1366,11 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
multithread.task = savetask;
|
multithread.task = savetask;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (multithread.terminate || perfstepsend <= MESHCONST_ANALYSE)
|
if (multithread.terminate || perfstepsend <= MESHCONST_ANALYSE)
|
||||||
return TCL_OK;
|
return TCL_OK;
|
||||||
|
|
||||||
@ -1419,8 +1437,6 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef LOG_STREAM
|
#ifdef LOG_STREAM
|
||||||
(*logout) << "Edges meshed" << endl
|
(*logout) << "Edges meshed" << endl
|
||||||
<< "time = " << GetTime() << " sec" << endl
|
<< "time = " << GetTime() << " sec" << endl
|
||||||
@ -1455,8 +1471,6 @@ namespace netgen
|
|||||||
if (multithread.terminate || perfstepsend <= MESHCONST_OPTSURFACE)
|
if (multithread.terminate || perfstepsend <= MESHCONST_OPTSURFACE)
|
||||||
return TCL_OK;
|
return TCL_OK;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (perfstepsstart <= MESHCONST_MESHVOLUME)
|
if (perfstepsstart <= MESHCONST_MESHVOLUME)
|
||||||
{
|
{
|
||||||
multithread.task = "Volume meshing";
|
multithread.task = "Volume meshing";
|
||||||
@ -1498,7 +1512,6 @@ namespace netgen
|
|||||||
if (multithread.terminate || perfstepsend <= MESHCONST_MESHVOLUME)
|
if (multithread.terminate || perfstepsend <= MESHCONST_MESHVOLUME)
|
||||||
return TCL_OK;
|
return TCL_OK;
|
||||||
|
|
||||||
|
|
||||||
if (perfstepsstart <= MESHCONST_OPTVOLUME)
|
if (perfstepsstart <= MESHCONST_OPTVOLUME)
|
||||||
{
|
{
|
||||||
multithread.task = "Volume optimization";
|
multithread.task = "Volume optimization";
|
||||||
@ -1518,7 +1531,6 @@ namespace netgen
|
|||||||
<< "points: " << mesh->GetNP() << endl;
|
<< "points: " << mesh->GetNP() << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// cout << "Optimization complete" << endl;
|
// cout << "Optimization complete" << endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1531,8 +1543,6 @@ namespace netgen
|
|||||||
for (int i = 1; i <= mesh->GetNSeg(); i++)
|
for (int i = 1; i <= mesh->GetNSeg(); i++)
|
||||||
(*testout) << mesh->LineSegment(i) << endl;
|
(*testout) << mesh->LineSegment(i) << endl;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return TCL_OK;
|
return TCL_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -841,6 +841,14 @@ namespace netgen
|
|||||||
facemeshstatus.SetSize (fmap.Extent());
|
facemeshstatus.SetSize (fmap.Extent());
|
||||||
facemeshstatus = 0;
|
facemeshstatus = 0;
|
||||||
|
|
||||||
|
// Philippose - 15/01/2009
|
||||||
|
face_maxh.SetSize (fmap.Extent());
|
||||||
|
face_maxh = mparam.maxh;
|
||||||
|
|
||||||
|
// Philippose - 17/01/2009
|
||||||
|
face_sel_status.SetSize (fmap.Extent());
|
||||||
|
face_sel_status = 0;
|
||||||
|
|
||||||
fvispar.SetSize (fmap.Extent());
|
fvispar.SetSize (fmap.Extent());
|
||||||
evispar.SetSize (emap.Extent());
|
evispar.SetSize (emap.Extent());
|
||||||
vvispar.SetSize (vmap.Extent());
|
vvispar.SetSize (vmap.Extent());
|
||||||
@ -1127,60 +1135,136 @@ namespace netgen
|
|||||||
return occgeo;
|
return occgeo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Philippose - 29/01/2009
|
||||||
|
/* Special STEP File load function including the ability
|
||||||
|
to extract individual surface colours via the extended
|
||||||
|
OpenCascade XDE and XCAF Feature set.
|
||||||
|
*/
|
||||||
OCCGeometry * LoadOCC_STEP (const char * filename)
|
OCCGeometry * LoadOCC_STEP (const char * filename)
|
||||||
{
|
{
|
||||||
OCCGeometry * occgeo;
|
OCCGeometry * occgeo;
|
||||||
occgeo = new OCCGeometry;
|
occgeo = new OCCGeometry;
|
||||||
|
|
||||||
STEPControl_Reader reader;
|
// Initiate a dummy XCAF Application to handle the STEP XCAF Document
|
||||||
|
static Handle_XCAFApp_Application dummy_app = XCAFApp_Application::GetApplication();
|
||||||
|
|
||||||
|
// Create an XCAF Document to contain the STEP file itself
|
||||||
|
Handle_TDocStd_Document step_doc;
|
||||||
|
|
||||||
|
// Check if a STEP File is already open under this handle, if so, close it to prevent
|
||||||
|
// Segmentation Faults when trying to create a new document
|
||||||
|
if(dummy_app->NbDocuments() > 0)
|
||||||
|
{
|
||||||
|
dummy_app->GetDocument(1,step_doc);
|
||||||
|
dummy_app->Close(step_doc);
|
||||||
|
}
|
||||||
|
dummy_app->NewDocument ("STEP-XCAF",step_doc);
|
||||||
|
|
||||||
|
STEPCAFControl_Reader reader;
|
||||||
|
|
||||||
Standard_Integer stat = reader.ReadFile((char*)filename);
|
Standard_Integer stat = reader.ReadFile((char*)filename);
|
||||||
Standard_Integer nb = reader.NbRootsForTransfer();
|
|
||||||
reader.TransferRoots (); // Tranlate STEP -> OCC
|
|
||||||
|
|
||||||
|
// Enable transfer of colours
|
||||||
|
reader.SetColorMode(Standard_True);
|
||||||
|
|
||||||
|
reader.Transfer(step_doc);
|
||||||
|
|
||||||
occgeo->shape = reader.OneShape();
|
// Read in the shape(s) and the colours present in the STEP File
|
||||||
occgeo->changed = 1;
|
Handle_XCAFDoc_ShapeTool step_shape_contents = XCAFDoc_DocumentTool::ShapeTool(step_doc->Main());
|
||||||
occgeo->BuildFMap();
|
Handle_XCAFDoc_ColorTool step_colour_contents = XCAFDoc_DocumentTool::ColorTool(step_doc->Main());
|
||||||
//
|
|
||||||
//Handle(ShapeFix_Shape) sfs = new ShapeFix_Shape;
|
|
||||||
//sfs->Init(occgeo->shape);
|
|
||||||
//sfs->Perform();
|
|
||||||
//Handle(ShapeFix_Wireframe) sfwf = new ShapeFix_Wireframe(occgeo->shape);
|
|
||||||
//sfwf->FixSmallEdges();
|
|
||||||
//sfwf->FixWireGaps();
|
|
||||||
|
|
||||||
|
|
||||||
|
TDF_LabelSequence step_shapes;
|
||||||
|
step_shape_contents->GetShapes(step_shapes);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// JS
|
// List out the available colours in the STEP File as Colour Names
|
||||||
TopoDS_Compound aRes;
|
TDF_LabelSequence allColours;
|
||||||
BRep_Builder aBuilder;
|
stepColourContents->GetColors(allColours);
|
||||||
aBuilder.MakeCompound (aRes);
|
cout << "Number of colours in STEP = " << allColours.Length() << endl;
|
||||||
|
for(int i = 1; i <= allColours.Length(); i++)
|
||||||
for (TopExp_Explorer exp(occgeo->shape, TopAbs_SOLID); exp.More(); exp.Next())
|
|
||||||
{
|
{
|
||||||
aBuilder.Add (aRes, exp.Current());
|
Quantity_Color col;
|
||||||
cout << "solid" << endl;
|
stepColourContents->GetColor(allColours.Value(i),col);
|
||||||
|
cout << "Colour [" << i << "] = " << col.StringName(col.Name()) << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (TopExp_Explorer exp(aRes, TopAbs_SOLID); exp.More(); exp.Next())
|
|
||||||
{
|
|
||||||
cout << "compound has shapes solid" << endl;
|
|
||||||
}
|
|
||||||
occgeo->shape = aRes;
|
|
||||||
occgeo->changed = 1;
|
|
||||||
occgeo->BuildFMap();
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
occgeo->shape = step_shape_contents->GetShape(step_shapes.Value(1));
|
||||||
|
occgeo->face_colours = step_colour_contents;
|
||||||
|
occgeo->changed = 1;
|
||||||
|
occgeo->BuildFMap();
|
||||||
|
|
||||||
//
|
|
||||||
occgeo->BuildVisualizationMesh();
|
occgeo->BuildVisualizationMesh();
|
||||||
PrintContents (occgeo);
|
PrintContents (occgeo);
|
||||||
|
|
||||||
return occgeo;
|
return occgeo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Philippose - 29/01/2009
|
||||||
|
// The LOADOCC_STEP Function has been replaced by the one
|
||||||
|
// above, which also includes support for the OpenCascade
|
||||||
|
// XDE Features.
|
||||||
|
//
|
||||||
|
// OCCGeometry * LoadOCC_STEP (const char * filename)
|
||||||
|
// {
|
||||||
|
// OCCGeometry * occgeo;
|
||||||
|
// occgeo = new OCCGeometry;
|
||||||
|
//
|
||||||
|
// STEPControl_Reader reader;
|
||||||
|
// Standard_Integer stat = reader.ReadFile((char*)filename);
|
||||||
|
// Standard_Integer nb = reader.NbRootsForTransfer();
|
||||||
|
// reader.TransferRoots (); // Tranlate STEP -> OCC
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// occgeo->shape = reader.OneShape();
|
||||||
|
// occgeo->changed = 1;
|
||||||
|
// occgeo->BuildFMap();
|
||||||
|
// //
|
||||||
|
// //Handle(ShapeFix_Shape) sfs = new ShapeFix_Shape;
|
||||||
|
// //sfs->Init(occgeo->shape);
|
||||||
|
// //sfs->Perform();
|
||||||
|
// //Handle(ShapeFix_Wireframe) sfwf = new ShapeFix_Wireframe(occgeo->shape);
|
||||||
|
// //sfwf->FixSmallEdges();
|
||||||
|
// //sfwf->FixWireGaps();
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// /*
|
||||||
|
// // JS
|
||||||
|
// TopoDS_Compound aRes;
|
||||||
|
// BRep_Builder aBuilder;
|
||||||
|
// aBuilder.MakeCompound (aRes);
|
||||||
|
//
|
||||||
|
// for (TopExp_Explorer exp(occgeo->shape, TopAbs_SOLID); exp.More(); exp.Next())
|
||||||
|
// {
|
||||||
|
// aBuilder.Add (aRes, exp.Current());
|
||||||
|
// cout << "solid" << endl;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// for (TopExp_Explorer exp(aRes, TopAbs_SOLID); exp.More(); exp.Next())
|
||||||
|
// {
|
||||||
|
// cout << "compound has shapes solid" << endl;
|
||||||
|
// }
|
||||||
|
// occgeo->shape = aRes;
|
||||||
|
// occgeo->changed = 1;
|
||||||
|
// occgeo->BuildFMap();
|
||||||
|
// */
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// occgeo->BuildVisualizationMesh();
|
||||||
|
// PrintContents (occgeo);
|
||||||
|
//
|
||||||
|
// return occgeo;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
OCCGeometry * LoadOCC_BREP (const char * filename)
|
OCCGeometry * LoadOCC_BREP (const char * filename)
|
||||||
{
|
{
|
||||||
OCCGeometry * occgeo;
|
OCCGeometry * occgeo;
|
||||||
|
@ -11,9 +11,9 @@
|
|||||||
|
|
||||||
#include <meshing.hpp>
|
#include <meshing.hpp>
|
||||||
|
|
||||||
#include <BRep_Tool.hxx>
|
#include "BRep_Tool.hxx"
|
||||||
#include <Geom_Curve.hxx>
|
#include "Geom_Curve.hxx"
|
||||||
#include <Geom2d_Curve.hxx>
|
#include "Geom2d_Curve.hxx"
|
||||||
#include "Geom_Surface.hxx"
|
#include "Geom_Surface.hxx"
|
||||||
#include "GeomAPI_ProjectPointOnSurf.hxx"
|
#include "GeomAPI_ProjectPointOnSurf.hxx"
|
||||||
#include "GeomAPI_ProjectPointOnCurve.hxx"
|
#include "GeomAPI_ProjectPointOnCurve.hxx"
|
||||||
@ -37,6 +37,7 @@
|
|||||||
#include "TopoDS.hxx"
|
#include "TopoDS.hxx"
|
||||||
#include "TopoDS_Solid.hxx"
|
#include "TopoDS_Solid.hxx"
|
||||||
#include "TopExp_Explorer.hxx"
|
#include "TopExp_Explorer.hxx"
|
||||||
|
#include "TopTools_ListIteratorOfListOfShape.hxx"
|
||||||
#include "BRep_Tool.hxx"
|
#include "BRep_Tool.hxx"
|
||||||
#include "Geom_Curve.hxx"
|
#include "Geom_Curve.hxx"
|
||||||
#include "Geom2d_Curve.hxx"
|
#include "Geom2d_Curve.hxx"
|
||||||
@ -62,8 +63,6 @@
|
|||||||
#include "Poly_Triangle.hxx"
|
#include "Poly_Triangle.hxx"
|
||||||
#include "GProp_GProps.hxx"
|
#include "GProp_GProps.hxx"
|
||||||
#include "BRepGProp.hxx"
|
#include "BRepGProp.hxx"
|
||||||
#include "IGESControl_Reader.hxx"
|
|
||||||
#include "STEPControl_Reader.hxx"
|
|
||||||
#include "TopoDS_Shape.hxx"
|
#include "TopoDS_Shape.hxx"
|
||||||
#include "TopoDS_Face.hxx"
|
#include "TopoDS_Face.hxx"
|
||||||
#include "IGESToBRep_Reader.hxx"
|
#include "IGESToBRep_Reader.hxx"
|
||||||
@ -80,8 +79,33 @@
|
|||||||
#include "Bnd_Box.hxx"
|
#include "Bnd_Box.hxx"
|
||||||
#include "ShapeAnalysis.hxx"
|
#include "ShapeAnalysis.hxx"
|
||||||
#include "ShapeBuild_ReShape.hxx"
|
#include "ShapeBuild_ReShape.hxx"
|
||||||
|
|
||||||
|
// Philippose - 29/01/2009
|
||||||
|
// OpenCascade XDE Support
|
||||||
|
// Include support for OpenCascade XDE Features
|
||||||
|
#include "TDocStd_Document.hxx"
|
||||||
|
#include "Quantity_Color.hxx"
|
||||||
|
#include "XCAFApp_Application.hxx"
|
||||||
|
#include "XCAFDoc_ShapeTool.hxx"
|
||||||
|
#include "XCAFDoc_Color.hxx"
|
||||||
|
#include "XCAFDoc_ColorTool.hxx"
|
||||||
|
#include "XCAFDoc_ColorType.hxx"
|
||||||
|
#include "XCAFDoc_LayerTool.hxx"
|
||||||
|
#include "XCAFDoc_DimTolTool.hxx"
|
||||||
|
#include "XCAFDoc_MaterialTool.hxx"
|
||||||
|
#include "XCAFDoc_DocumentTool.hxx"
|
||||||
|
#include "TDF_Label.hxx"
|
||||||
|
#include "TDF_LabelSequence.hxx"
|
||||||
|
#include "STEPCAFControl_Reader.hxx"
|
||||||
|
#include "STEPCAFControl_Writer.hxx"
|
||||||
|
#include "IGESCAFControl_Reader.hxx"
|
||||||
|
#include "IGESCAFControl_Writer.hxx"
|
||||||
|
|
||||||
|
#include "IGESControl_Reader.hxx"
|
||||||
|
#include "STEPControl_Reader.hxx"
|
||||||
#include "IGESControl_Writer.hxx"
|
#include "IGESControl_Writer.hxx"
|
||||||
#include "STEPControl_Writer.hxx"
|
#include "STEPControl_Writer.hxx"
|
||||||
|
|
||||||
#include "StlAPI_Writer.hxx"
|
#include "StlAPI_Writer.hxx"
|
||||||
#include "STEPControl_StepModelType.hxx"
|
#include "STEPControl_StepModelType.hxx"
|
||||||
|
|
||||||
@ -97,7 +121,6 @@ namespace netgen
|
|||||||
|
|
||||||
#define PROJECTION_TOLERANCE 1e-10
|
#define PROJECTION_TOLERANCE 1e-10
|
||||||
|
|
||||||
|
|
||||||
#define ENTITYISVISIBLE 1
|
#define ENTITYISVISIBLE 1
|
||||||
#define ENTITYISHIGHLIGHTED 2
|
#define ENTITYISHIGHLIGHTED 2
|
||||||
#define ENTITYISDRAWABLE 4
|
#define ENTITYISDRAWABLE 4
|
||||||
@ -139,8 +162,6 @@ public:
|
|||||||
{ code &= ~ENTITYISDRAWABLE;}
|
{ code &= ~ENTITYISDRAWABLE;}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
inline double Det3 (double a00, double a01, double a02,
|
inline double Det3 (double a00, double a01, double a02,
|
||||||
double a10, double a11, double a12,
|
double a10, double a11, double a12,
|
||||||
double a20, double a21, double a22)
|
double a20, double a21, double a22)
|
||||||
@ -148,8 +169,6 @@ inline double Det3 (double a00, double a01, double a02,
|
|||||||
return a00*a11*a22 + a01*a12*a20 + a10*a21*a02 - a20*a11*a02 - a10*a01*a22 - a21*a12*a00;
|
return a00*a11*a22 + a01*a12*a20 + a10*a21*a02 - a20*a11*a02 - a10*a01*a22 - a21*a12*a00;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define OCCGEOMETRYVISUALIZATIONNOCHANGE 0
|
#define OCCGEOMETRYVISUALIZATIONNOCHANGE 0
|
||||||
#define OCCGEOMETRYVISUALIZATIONFULLCHANGE 1
|
#define OCCGEOMETRYVISUALIZATIONFULLCHANGE 1
|
||||||
// == compute transformation matrices and redraw
|
// == compute transformation matrices and redraw
|
||||||
@ -166,9 +185,26 @@ public:
|
|||||||
Array<bool> fsingular, esingular, vsingular;
|
Array<bool> fsingular, esingular, vsingular;
|
||||||
Box<3> boundingbox;
|
Box<3> boundingbox;
|
||||||
|
|
||||||
|
// Philippose - 29/01/2009
|
||||||
|
// OpenCascade XDE Support
|
||||||
|
// XCAF Handle to make the face colours available to the rest of
|
||||||
|
// the system
|
||||||
|
Handle_XCAFDoc_ColorTool face_colours;
|
||||||
|
|
||||||
int changed;
|
int changed;
|
||||||
Array<int> facemeshstatus;
|
Array<int> facemeshstatus;
|
||||||
|
|
||||||
|
// Philippose - 15/01/2009
|
||||||
|
// Maximum mesh size for a given face
|
||||||
|
// (Used to explicitly define mesh size limits on individual faces)
|
||||||
|
Array<double> face_maxh;
|
||||||
|
|
||||||
|
// Philippose - 15/01/2009
|
||||||
|
// Indicates which faces have been selected by the user in geometry mode
|
||||||
|
// (Currently handles only selection of one face at a time, but an array would
|
||||||
|
// help to extend this to multiple faces)
|
||||||
|
Array<bool> face_sel_status;
|
||||||
|
|
||||||
Array<EntityVisualizationCode> fvispar, evispar, vvispar;
|
Array<EntityVisualizationCode> fvispar, evispar, vvispar;
|
||||||
|
|
||||||
double tolerance;
|
double tolerance;
|
||||||
@ -178,7 +214,6 @@ public:
|
|||||||
bool makesolids;
|
bool makesolids;
|
||||||
bool splitpartitions;
|
bool splitpartitions;
|
||||||
|
|
||||||
|
|
||||||
OCCGeometry()
|
OCCGeometry()
|
||||||
{
|
{
|
||||||
somap.Clear();
|
somap.Clear();
|
||||||
@ -189,7 +224,6 @@ public:
|
|||||||
vmap.Clear();
|
vmap.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BuildFMap();
|
void BuildFMap();
|
||||||
|
|
||||||
Box<3> GetBoundingBox()
|
Box<3> GetBoundingBox()
|
||||||
@ -198,6 +232,11 @@ public:
|
|||||||
int NrSolids()
|
int NrSolids()
|
||||||
{ return somap.Extent();}
|
{ return somap.Extent();}
|
||||||
|
|
||||||
|
// Philippose - 17/01/2009
|
||||||
|
// Total number of faces in the geometry
|
||||||
|
int NrFaces()
|
||||||
|
{ return fmap.Extent();}
|
||||||
|
|
||||||
void SetCenter()
|
void SetCenter()
|
||||||
{ center = boundingbox.Center();}
|
{ center = boundingbox.Center();}
|
||||||
|
|
||||||
@ -207,14 +246,12 @@ public:
|
|||||||
void Project (int surfi, Point<3> & p) const;
|
void Project (int surfi, Point<3> & p) const;
|
||||||
bool FastProject (int surfi, Point<3> & ap, double& u, double& v) const;
|
bool FastProject (int surfi, Point<3> & ap, double& u, double& v) const;
|
||||||
|
|
||||||
|
|
||||||
OCCSurface GetSurface (int surfi)
|
OCCSurface GetSurface (int surfi)
|
||||||
{
|
{
|
||||||
cout << "OCCGeometry::GetSurface using PLANESPACE" << endl;
|
cout << "OCCGeometry::GetSurface using PLANESPACE" << endl;
|
||||||
return OCCSurface (TopoDS::Face(fmap(surfi)), PLANESPACE);
|
return OCCSurface (TopoDS::Face(fmap(surfi)), PLANESPACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BuildVisualizationMesh ();
|
void BuildVisualizationMesh ();
|
||||||
|
|
||||||
void RecursiveTopologyTree (const TopoDS_Shape & sh,
|
void RecursiveTopologyTree (const TopoDS_Shape & sh,
|
||||||
@ -235,6 +272,60 @@ public:
|
|||||||
|
|
||||||
void HealGeometry();
|
void HealGeometry();
|
||||||
|
|
||||||
|
// Philippose - 15/01/2009
|
||||||
|
// Sets the maximum mesh size for a given face
|
||||||
|
// (Note: Local mesh size limited by the global max mesh size)
|
||||||
|
void SetFaceMaxH(int facenr, double faceh)
|
||||||
|
{
|
||||||
|
if((facenr> 0) && (facenr <= fmap.Extent()))
|
||||||
|
{
|
||||||
|
face_maxh[facenr-1] = min(mparam.maxh,faceh);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Philippose - 15/01/2009
|
||||||
|
// Returns the local mesh size of a given face
|
||||||
|
double GetFaceMaxH(int facenr)
|
||||||
|
{
|
||||||
|
if((facenr> 0) && (facenr <= fmap.Extent()))
|
||||||
|
{
|
||||||
|
return face_maxh[facenr-1];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Philippose - 17/01/2009
|
||||||
|
// Returns the index of the currently selected face
|
||||||
|
int SelectedFace()
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for(i = 1; i <= fmap.Extent(); i++)
|
||||||
|
{
|
||||||
|
if(face_sel_status[i-1])
|
||||||
|
{
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Philippose - 17/01/2009
|
||||||
|
// Sets the currently selected face
|
||||||
|
void SetSelectedFace(int facenr)
|
||||||
|
{
|
||||||
|
face_sel_status = 0;
|
||||||
|
|
||||||
|
if((facenr >= 1) && (facenr <= fmap.Extent()))
|
||||||
|
{
|
||||||
|
face_sel_status[facenr-1] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void LowLightAll()
|
void LowLightAll()
|
||||||
{
|
{
|
||||||
for (int i = 1; i <= fmap.Extent(); i++)
|
for (int i = 1; i <= fmap.Extent(); i++)
|
||||||
@ -252,7 +343,6 @@ public:
|
|||||||
void WriteOCC_STL(char * filename);
|
void WriteOCC_STL(char * filename);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void PrintContents (OCCGeometry * geom);
|
void PrintContents (OCCGeometry * geom);
|
||||||
|
|
||||||
OCCGeometry * LoadOCC_IGES (const char * filename);
|
OCCGeometry * LoadOCC_IGES (const char * filename);
|
||||||
|
@ -9,18 +9,25 @@
|
|||||||
#include <csg.hpp>
|
#include <csg.hpp>
|
||||||
#include <stlgeom.hpp>
|
#include <stlgeom.hpp>
|
||||||
|
|
||||||
#include <visual.hpp>
|
|
||||||
|
|
||||||
// #include <parallel.hpp>
|
// #include <parallel.hpp>
|
||||||
|
|
||||||
|
#ifdef OCCGEOMETRY
|
||||||
|
// Philippose - 30/01/2009
|
||||||
|
// Required for OpenCascade XDE Support
|
||||||
|
#include <occgeom.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <visual.hpp>
|
||||||
|
|
||||||
|
|
||||||
namespace netgen
|
namespace netgen
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#ifdef OCCGEOMETRY
|
||||||
|
// Philippose - 30/01/2009
|
||||||
|
// Required for OpenCascade XDE Support
|
||||||
|
extern OCCGeometry * occgeometry;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
extern AutoPtr<Mesh> mesh;
|
extern AutoPtr<Mesh> mesh;
|
||||||
@ -1025,6 +1032,23 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef OCCGEOMETRY
|
||||||
|
// Philippose - 30/01/2009
|
||||||
|
// OpenCascade XDE Support
|
||||||
|
// Update the colour of each face based on the STEP File Data
|
||||||
|
// if the advanced OpenCascade XDE Support has been enabled
|
||||||
|
if((col == 1) && (occgeometry))
|
||||||
|
{
|
||||||
|
TopoDS_Face face = TopoDS::Face(occgeometry->fmap(el.GetIndex()));
|
||||||
|
Quantity_Color face_colour;
|
||||||
|
occgeometry->face_colours->GetColor(face,XCAFDoc_ColorSurf,face_colour);
|
||||||
|
matcol[0] = face_colour.Red();
|
||||||
|
matcol[1] = face_colour.Green();
|
||||||
|
matcol[2] = face_colour.Blue();
|
||||||
|
matcol[3] = 1.0;
|
||||||
|
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, matcol);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool drawel = !el.IsDeleted();
|
bool drawel = !el.IsDeleted();
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#ifdef OCCGEOMETRY
|
#ifdef OCCGEOMETRY
|
||||||
|
|
||||||
|
|
||||||
#include <mystdlib.h>
|
#include <mystdlib.h>
|
||||||
#include <myadt.hpp>
|
#include <myadt.hpp>
|
||||||
#include <meshing.hpp>
|
#include <meshing.hpp>
|
||||||
@ -30,20 +29,14 @@
|
|||||||
|
|
||||||
#include "incvis.hpp"
|
#include "incvis.hpp"
|
||||||
|
|
||||||
|
|
||||||
namespace netgen
|
namespace netgen
|
||||||
{
|
{
|
||||||
#include "mvdraw.hpp"
|
#include "mvdraw.hpp"
|
||||||
|
|
||||||
|
|
||||||
extern OCCGeometry * occgeometry;
|
extern OCCGeometry * occgeometry;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* *********************** Draw OCC Geometry **************** */
|
/* *********************** Draw OCC Geometry **************** */
|
||||||
|
|
||||||
|
|
||||||
VisualSceneOCCGeometry :: VisualSceneOCCGeometry ()
|
VisualSceneOCCGeometry :: VisualSceneOCCGeometry ()
|
||||||
: VisualScene()
|
: VisualScene()
|
||||||
{
|
{
|
||||||
@ -87,25 +80,26 @@ void VisualSceneOCCGeometry :: DrawScene ()
|
|||||||
glMaterialf (GL_FRONT_AND_BACK, GL_SHININESS, shine);
|
glMaterialf (GL_FRONT_AND_BACK, GL_SHININESS, shine);
|
||||||
glLogicOp (GL_COPY);
|
glLogicOp (GL_COPY);
|
||||||
|
|
||||||
|
|
||||||
float mat_col[] = { 0.2f, 0.2f, 0.8f, 1.0f};
|
float mat_col[] = { 0.2f, 0.2f, 0.8f, 1.0f};
|
||||||
glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat_col);
|
glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat_col);
|
||||||
|
|
||||||
glPolygonOffset (1, 1);
|
glPolygonOffset (1, 1);
|
||||||
glEnable (GL_POLYGON_OFFSET_FILL);
|
glEnable (GL_POLYGON_OFFSET_FILL);
|
||||||
|
|
||||||
|
// Philippose - 30/01/2009
|
||||||
|
// Added clipping planes to Geometry view
|
||||||
|
SetClippingPlane();
|
||||||
|
|
||||||
GLfloat matcoledge[] = { 0, 0, 1, 1};
|
GLfloat matcoledge[] = { 0, 0, 1, 1};
|
||||||
GLfloat matcolhiedge[] = { 1, 0, 0, 1};
|
GLfloat matcolhiedge[] = { 1, 0, 0, 1};
|
||||||
|
|
||||||
glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE,
|
glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, matcoledge);
|
||||||
matcoledge);
|
|
||||||
glLineWidth (1.0f);
|
glLineWidth (1.0f);
|
||||||
|
|
||||||
if (vispar.occshowedges) glCallList (linelists.Get(1));
|
if (vispar.occshowedges) glCallList (linelists.Get(1));
|
||||||
if (vispar.occshowsurfaces) glCallList (trilists.Get(1));
|
if (vispar.occshowsurfaces) glCallList (trilists.Get(1));
|
||||||
|
|
||||||
glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE,
|
glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, matcolhiedge);
|
||||||
matcolhiedge);
|
|
||||||
glLineWidth (5.0f);
|
glLineWidth (5.0f);
|
||||||
|
|
||||||
if (vispar.occshowedges) glCallList (linelists.Get(2));
|
if (vispar.occshowedges) glCallList (linelists.Get(2));
|
||||||
@ -113,8 +107,7 @@ void VisualSceneOCCGeometry :: DrawScene ()
|
|||||||
for (int i = 1; i <= occgeometry->vmap.Extent(); i++)
|
for (int i = 1; i <= occgeometry->vmap.Extent(); i++)
|
||||||
if (occgeometry->vvispar[i-1].IsHighlighted())
|
if (occgeometry->vvispar[i-1].IsHighlighted())
|
||||||
{
|
{
|
||||||
glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE,
|
glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, matcolhiedge);
|
||||||
matcolhiedge);
|
|
||||||
glLineWidth (5.0f);
|
glLineWidth (5.0f);
|
||||||
|
|
||||||
glBegin (GL_LINES);
|
glBegin (GL_LINES);
|
||||||
@ -130,7 +123,6 @@ void VisualSceneOCCGeometry :: DrawScene ()
|
|||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
glDisable (GL_POLYGON_OFFSET_FILL);
|
glDisable (GL_POLYGON_OFFSET_FILL);
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
@ -141,7 +133,6 @@ void VisualSceneOCCGeometry :: DrawScene ()
|
|||||||
glDisable (GL_POLYGON_OFFSET_FILL);
|
glDisable (GL_POLYGON_OFFSET_FILL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
void VisualSceneOCCGeometry :: BuildScene (int zoomall)
|
void VisualSceneOCCGeometry :: BuildScene (int zoomall)
|
||||||
{
|
{
|
||||||
@ -371,7 +362,6 @@ void VisualSceneOCCGeometry :: BuildScene (int zoomall)
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
void VisualSceneOCCGeometry :: BuildScene (int zoomall)
|
void VisualSceneOCCGeometry :: BuildScene (int zoomall)
|
||||||
{
|
{
|
||||||
if (occgeometry -> changed == OCCGEOMETRYVISUALIZATIONFULLCHANGE)
|
if (occgeometry -> changed == OCCGEOMETRYVISUALIZATIONFULLCHANGE)
|
||||||
@ -425,7 +415,6 @@ void VisualSceneOCCGeometry :: BuildScene (int zoomall)
|
|||||||
CalcTransformationMatrices();
|
CalcTransformationMatrices();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Clear lists
|
// Clear lists
|
||||||
|
|
||||||
for (int i = 1; i <= linelists.Size(); i++)
|
for (int i = 1; i <= linelists.Size(); i++)
|
||||||
@ -436,7 +425,6 @@ void VisualSceneOCCGeometry :: BuildScene (int zoomall)
|
|||||||
glDeleteLists (trilists.Elem(i), 1);
|
glDeleteLists (trilists.Elem(i), 1);
|
||||||
trilists.SetSize(0);
|
trilists.SetSize(0);
|
||||||
|
|
||||||
|
|
||||||
// Total wireframe
|
// Total wireframe
|
||||||
|
|
||||||
linelists.Append (glGenLists (1));
|
linelists.Append (glGenLists (1));
|
||||||
@ -484,7 +472,6 @@ void VisualSceneOCCGeometry :: BuildScene (int zoomall)
|
|||||||
|
|
||||||
glEndList ();
|
glEndList ();
|
||||||
|
|
||||||
|
|
||||||
// Highlighted edge list
|
// Highlighted edge list
|
||||||
|
|
||||||
linelists.Append (glGenLists (1));
|
linelists.Append (glGenLists (1));
|
||||||
@ -532,10 +519,6 @@ void VisualSceneOCCGeometry :: BuildScene (int zoomall)
|
|||||||
|
|
||||||
glEndList ();
|
glEndList ();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// display faces
|
// display faces
|
||||||
|
|
||||||
trilists.Append (glGenLists (1));
|
trilists.Append (glGenLists (1));
|
||||||
@ -549,11 +532,17 @@ void VisualSceneOCCGeometry :: BuildScene (int zoomall)
|
|||||||
float mat_col[4];
|
float mat_col[4];
|
||||||
mat_col[3] = 1;
|
mat_col[3] = 1;
|
||||||
|
|
||||||
|
TopoDS_Face face = TopoDS::Face(occgeometry->fmap(i));
|
||||||
|
|
||||||
if (!occgeometry->fvispar[i-1].IsHighlighted())
|
if (!occgeometry->fvispar[i-1].IsHighlighted())
|
||||||
{
|
{
|
||||||
mat_col[0] = 0.2;
|
// Philippose - 30/01/2009
|
||||||
mat_col[1] = 0.2;
|
// OpenCascade XDE Support
|
||||||
mat_col[2] = 0.8;
|
Quantity_Color face_colour;
|
||||||
|
occgeometry->face_colours->GetColor(face,XCAFDoc_ColorSurf,face_colour);
|
||||||
|
mat_col[0] = face_colour.Red();
|
||||||
|
mat_col[1] = face_colour.Green();
|
||||||
|
mat_col[2] = face_colour.Blue();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -564,7 +553,6 @@ void VisualSceneOCCGeometry :: BuildScene (int zoomall)
|
|||||||
|
|
||||||
glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat_col);
|
glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat_col);
|
||||||
|
|
||||||
TopoDS_Face face = TopoDS::Face(occgeometry->fmap(i));
|
|
||||||
TopLoc_Location loc;
|
TopLoc_Location loc;
|
||||||
Handle(Geom_Surface) surf = BRep_Tool::Surface (face);
|
Handle(Geom_Surface) surf = BRep_Tool::Surface (face);
|
||||||
BRepAdaptor_Surface sf(face, Standard_False);
|
BRepAdaptor_Surface sf(face, Standard_False);
|
||||||
@ -634,13 +622,11 @@ void VisualSceneOCCGeometry :: MouseDblClick (int px, int py)
|
|||||||
GLuint selbuf[10000];
|
GLuint selbuf[10000];
|
||||||
glSelectBuffer (10000, selbuf);
|
glSelectBuffer (10000, selbuf);
|
||||||
|
|
||||||
|
|
||||||
glRenderMode (GL_SELECT);
|
glRenderMode (GL_SELECT);
|
||||||
|
|
||||||
GLint viewport[4];
|
GLint viewport[4];
|
||||||
glGetIntegerv (GL_VIEWPORT, viewport);
|
glGetIntegerv (GL_VIEWPORT, viewport);
|
||||||
|
|
||||||
|
|
||||||
glMatrixMode (GL_PROJECTION);
|
glMatrixMode (GL_PROJECTION);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|
||||||
@ -651,8 +637,6 @@ void VisualSceneOCCGeometry :: MouseDblClick (int px, int py)
|
|||||||
gluPickMatrix (px, viewport[3] - py, 1, 1, viewport);
|
gluPickMatrix (px, viewport[3] - py, 1, 1, viewport);
|
||||||
glMultMatrixd (projmat);
|
glMultMatrixd (projmat);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
glClearColor(backcolor, backcolor, backcolor, 1.0);
|
glClearColor(backcolor, backcolor, backcolor, 1.0);
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
@ -661,8 +645,6 @@ void VisualSceneOCCGeometry :: MouseDblClick (int px, int py)
|
|||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glMultMatrixf (transformationmat);
|
glMultMatrixf (transformationmat);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
glInitNames();
|
glInitNames();
|
||||||
glPushName (1);
|
glPushName (1);
|
||||||
|
|
||||||
@ -671,6 +653,30 @@ void VisualSceneOCCGeometry :: MouseDblClick (int px, int py)
|
|||||||
|
|
||||||
glDisable(GL_CLIP_PLANE0);
|
glDisable(GL_CLIP_PLANE0);
|
||||||
|
|
||||||
|
// Philippose - 30/01/2009
|
||||||
|
// Enable clipping planes for Selection mode in OCC Geometry
|
||||||
|
if (vispar.clipenable)
|
||||||
|
{
|
||||||
|
Vec<3> n(clipplane[0], clipplane[1], clipplane[2]);
|
||||||
|
double len = Abs(n);
|
||||||
|
double mu = -clipplane[3] / (len*len);
|
||||||
|
Point<3> p (mu * n);
|
||||||
|
n /= len;
|
||||||
|
Vec<3> t1 = n.GetNormal ();
|
||||||
|
Vec<3> t2 = Cross (n, t1);
|
||||||
|
|
||||||
|
double xi1mid = (center - p) * t1;
|
||||||
|
double xi2mid = (center - p) * t2;
|
||||||
|
|
||||||
|
glLoadName (0);
|
||||||
|
glBegin (GL_QUADS);
|
||||||
|
glVertex3dv (p + (xi1mid-rad) * t1 + (xi2mid-rad) * t2);
|
||||||
|
glVertex3dv (p + (xi1mid+rad) * t1 + (xi2mid-rad) * t2);
|
||||||
|
glVertex3dv (p + (xi1mid+rad) * t1 + (xi2mid+rad) * t2);
|
||||||
|
glVertex3dv (p + (xi1mid-rad) * t1 + (xi2mid+rad) * t2);
|
||||||
|
glEnd ();
|
||||||
|
}
|
||||||
|
|
||||||
glCallList (trilists.Get(1));
|
glCallList (trilists.Get(1));
|
||||||
|
|
||||||
glDisable (GL_POLYGON_OFFSET_FILL);
|
glDisable (GL_POLYGON_OFFSET_FILL);
|
||||||
@ -685,7 +691,6 @@ void VisualSceneOCCGeometry :: MouseDblClick (int px, int py)
|
|||||||
|
|
||||||
glFlush();
|
glFlush();
|
||||||
|
|
||||||
|
|
||||||
hits = glRenderMode (GL_RENDER);
|
hits = glRenderMode (GL_RENDER);
|
||||||
|
|
||||||
int minname = 0;
|
int minname = 0;
|
||||||
@ -733,20 +738,16 @@ void VisualSceneOCCGeometry :: MouseDblClick (int px, int py)
|
|||||||
|
|
||||||
SelectFaceInOCCDialogTree (minname);
|
SelectFaceInOCCDialogTree (minname);
|
||||||
|
|
||||||
|
// Philippose - 30/01/2009
|
||||||
|
// Set the currently selected face in the array
|
||||||
|
// for local face mesh size definition
|
||||||
|
occgeometry->SetSelectedFace(minname);
|
||||||
|
|
||||||
// selecttimestamp = NextTimeStamp();
|
// selecttimestamp = NextTimeStamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // NOTCL
|
#endif // NOTCL
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user