6 #include <STEPControl_Reader.hxx>
7 #include <STEPControl_Writer.hxx>
8 #include <StlAPI_Writer.hxx>
10 #include <Message.hxx>
11 #include <Message_Messenger.hxx>
12 #include <Message_PrinterOStream.hxx>
14 #include <TopoDS_Shape.hxx>
15 #include <TopoDS_Face.hxx>
16 #include <Geom_Surface.hxx>
18 #include <Geom_Plane.hxx>
19 #include <Geom_CylindricalSurface.hxx>
20 #include <Geom_ConicalSurface.hxx>
21 #include <Geom_SphericalSurface.hxx>
22 #include <Geom_ToroidalSurface.hxx>
24 #include <Geom_BSplineSurface.hxx>
25 #include <Geom_RectangularTrimmedSurface.hxx>
27 #include <BRep_Tool.hxx>
28 #include <BRepBuilderAPI_MakeFace.hxx>
29 #include <BRepAlgoAPI_Cut.hxx>
30 #include <BRepAlgoAPI_Common.hxx>
31 #include <BRepMesh_IncrementalMesh.hxx>
32 #include <BRepBuilderAPI_Transform.hxx>
34 #include <Bnd_Box.hxx>
35 #include <BRepBndLib.hxx>
38 #include <gp_Cylinder.hxx>
39 #include <gp_Cone.hxx>
40 #include <gp_Sphere.hxx>
41 #include <gp_Torus.hxx>
43 #include <TopExp_Explorer.hxx>
45 #include <TGeoCompositeShape.h>
46 #include <TGeoMatrix.h>
47 #include <TGeoSphere.h>
55 #define _DOT_STEP_ (".stp")
56 #define _DOT_ROOT_ (".root")
57 #define _DOT_SPLIT_ (".split")
71 void EicCadWizard::AddSourceDirectory(
const char *dname) {
73 unsigned stlen = strlen(_DOT_STP_);
77 DIR *curr_dir = opendir(dname); assert(curr_dir);
78 struct dirent *curr_file;
80 while((curr_file = readdir(curr_dir))) {
81 int len = strlen(curr_file->d_name);
84 !memcmp(curr_file->d_name + len - stlen, _DOT_STP_, stlen)) {
85 TString fileName = TString(dname) +
"/" + curr_file->d_name;
100 std::vector<std::pair<EicCadWizardCut*,bool> > *tried_cuts =
new std::vector<std::pair<EicCadWizardCut*,bool> >;
118 return (SS->IsKind(STANDARD_TYPE(Geom_Plane))
119 || SS->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))
120 || SS->IsKind(STANDARD_TYPE(Geom_ConicalSurface))
121 || SS->IsKind(STANDARD_TYPE(Geom_ToroidalSurface))
122 || SS->IsKind(STANDARD_TYPE(Geom_SphericalSurface)));
134 return (SS->IsKind(STANDARD_TYPE(Geom_BSplineSurface))
135 || SS->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface)));
151 if (SS->IsKind(STANDARD_TYPE(Geom_Plane))) {
152 Handle(Geom_Plane) es = Handle(Geom_Plane)::DownCast(SS);
156 if (SS->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) {
157 Handle(Geom_CylindricalSurface) es = Handle(Geom_CylindricalSurface)::DownCast(SS);
162 if (SS->IsKind(STANDARD_TYPE(Geom_ConicalSurface))) {
163 Handle(Geom_ConicalSurface) es = Handle(Geom_ConicalSurface)::DownCast(SS);
168 if (SS->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) {
169 Handle(Geom_SphericalSurface) es = Handle(Geom_SphericalSurface)::DownCast(SS);
174 if (SS->IsKind(STANDARD_TYPE(Geom_ToroidalSurface))) {
175 Handle(Geom_ToroidalSurface) es = Handle(Geom_ToroidalSurface)::DownCast(SS);
187 const std::vector<std::pair<EicCadWizardCut*,bool> > *tried_cuts)
190 unsigned fCounter = 0, stlen = strlen(
_DOT_STEP_);
195 DIR *curr_dir = opendir(dname); assert(curr_dir);
196 struct dirent *curr_file;
198 while((curr_file = readdir(curr_dir))) {
199 int len = strlen(curr_file->d_name);
203 !memcmp(curr_file->d_name + len - stlen,
_DOT_STEP_, stlen)) {
204 TString fileName = TString(dname) +
"/" + curr_file->d_name;
231 #include <TGeoTube.h>
246 if (!gGeoManager) {
return; }
247 if (strlen(matrix->GetName())) {
return; }
249 if (matrix->IsTranslation()) { type =
't'; }
250 if (matrix->IsRotation()) { type =
'r'; }
251 if (matrix->IsScale()) { type =
's'; }
252 if (matrix->IsCombi()) { type =
'c'; }
253 if (matrix->IsGeneral()) { type =
'g'; }
254 TObjArray* matrices = gGeoManager->GetListOfMatrices();
256 if (matrices) { index =matrices->GetEntriesFast() - 1; }
257 matrix->SetName(Form(
"%c%i", type, index));
258 printf(
"Here: %s\n", matrix->GetName());
269 printf(
"--> %s ... \n", dname);
270 DIR *curr_dir = opendir(dname);
271 if (!curr_dir)
printf(
"errno: %d\n", errno);
273 struct dirent *curr_file;
275 while((curr_file = readdir(curr_dir))) {
276 if (!strcmp(curr_file->d_name,
".") || !strcmp(curr_file->d_name,
".."))
continue;
279 TString fname = TString(dname) +
"/" + curr_file->d_name;
282 stat(fname.Data(), &St);
283 if (S_ISDIR(St.st_mode) && strlen(fname) > splen &&
289 int len = strlen(curr_file->d_name);
292 !memcmp(curr_file->d_name + len - rtlen,
_DOT_ROOT_, rtlen)) {
310 snprintf(rname, 1024-1,
"%s.root", geo->
GetDetName()->
name().Data());
322 unsigned vCounter = 0;
324 for(
unsigned fl=0; fl<
mRootFiles.size(); fl++) {
327 printf(
"%3d -> %s\n", fl, fname.Data());
329 TFile *f =
new TFile(fname.Data()); assert(f);
330 TList* l= f->GetListOfKeys();
332 TKey* key = (TKey*) l->At(0);
333 TGeoVolumeAssembly *assembly =
dynamic_cast<TGeoVolumeAssembly*
> (key->ReadObj());
338 unsigned node_num = assembly->GetNode(0)->GetVolume()->GetNtotal();
340 for(
unsigned nd=0; nd<node_num-1; nd++) {
342 TGeoNode *node = assembly->GetNode(0)->GetVolume()->GetNode(nd);
345 TGeoMatrix*
M = node->GetMatrix();
347 gGeoManager->GetListOfMatrices()->Remove(M);
348 TGeoHMatrix* global = gGeoManager->GetHMatrix();
349 gGeoManager->GetListOfMatrices()->Remove(global);
352 TGeoVolume *
volume = node->GetVolume();
356 const char *oname = volume->GetName();
358 printf(
"-> %s\n", volume->GetName());
359 assert(strlen(oname) >= 4 && oname[0] ==
'@' && oname[2] ==
'V' && oname[3] ==
'@');
360 snprintf(vname, 128-1,
"@%cV@%06d", oname[1], vCounter++);
361 volume->SetName(vname);
368 geo->
GetTopVolume()->AddNode(volume, 0, node->GetMatrix());
369 volume->RegisterYourself();
376 TGeoMatrix*
M =
n->GetMatrix();
380 gGeoManager->GetListOfMatrices()->Remove(M);
381 TGeoHMatrix* global = gGeoManager->GetHMatrix();
382 gGeoManager->GetListOfMatrices()->Remove(global);
384 Cave->AddNode(
v1,0, M);
389 TGeoHMatrix *
rw =
new TGeoHMatrix();
392 printf(
"%f\n", rw->GetScale());
417 snprintf(bname, 1024-1,
"%s", fname.Data());
418 bname[strlen(bname)-4] = 0;
423 unsigned csCounter = 0;
424 snprintf(dname, 1024-1,
"%s.split", bname);
430 STEPControl_Reader cReader;
431 IFSelect_ReturnStatus cstatus = cReader.ReadFile(fname.Data());
435 cReader.TransferRoots();
436 printf(
"%d root(s) in STEP file; %d shape(s)\n", cReader.NbRootsForTransfer(), cReader.NbShapes());
441 gp_Pnt x0(0.0, 0.0, 0.0);
444 gp_Dir n0(0.0, 1.0, 0.0);
447 scaling.SetRotation(axis, -90.0 * TMath::DegToRad());
450 scaling.SetScaleFactor(0.10);
451 BRepBuilderAPI_Transform sc(scaling);
454 for(
unsigned sh=0; sh<cReader.NbShapes(); sh++) {
455 TopoDS_Shape shape = cReader.Shape(sh+1);
457 for (TopExp_Explorer itf(shape,TopAbs_SOLID); itf.More(); itf.Next()) {
458 STEPControl_Writer cWriter;
460 sc.Perform(itf.Current());
461 const TopoDS_Shape &
solid = sc.ModifiedShape(itf.Current());
463 cWriter.Transfer(solid, STEPControl_ManifoldSolidBrep);
465 snprintf(qname, 1024-1,
"%s/part-%05d.stp", dname, csCounter);
466 cWriter.Write(qname);
487 const std::vector<std::pair<EicCadWizardCut*,bool> > *tried_cuts)
489 printf(
"\n Entering EicCadWizard::ConvertSourceFileToRoot(): %s ...\n", fname.Data());
493 snprintf(bname, 1024-1,
"%s", fname.Data());
494 bname[strlen(bname)-4] = 0;
501 snprintf(rfile, 1024-1,
"%s.root", bname);
510 snprintf(slink, 1024-1,
"%s.split", bname);
518 unsigned sCounter = 0;
519 STEPControl_Reader cReader;
520 IFSelect_ReturnStatus cstatus = cReader.ReadFile(fname.Data());
524 cReader.TransferRoots();
525 printf(
"%d root(s) in STEP file; %d shape(s)\n", cReader.NbRootsForTransfer(), cReader.NbShapes());
532 for(
unsigned sh=0; sh<cReader.NbShapes(); sh++) {
533 TopoDS_Shape shape = cReader.Shape(sh+1);
535 for (TopExp_Explorer itf(shape,TopAbs_SOLID); itf.More(); itf.Next())
541 if (!sCounter) unlink(fname.Data());
542 printf(
"-> sCounter %d\n", sCounter);
567 const TopoDS_Face *
mFace;
573 const std::vector<std::pair<EicCadWizardCut*,bool> > *tried_cuts)
577 for(
unsigned sh=0; sh<cReader.NbShapes(); sh++) {
578 TopoDS_Shape shape = cReader.Shape(sh+1);
581 for (TopExp_Explorer itf(shape,TopAbs_SOLID); itf.More(); itf.Next()) {
582 const TopoDS_Shape &
solid = itf.Current();
598 double xMin, yMin, zMin, xMax, yMax, zMax;
602 Boundary.Get(xMin, yMin, zMin, xMax, yMax, zMax);
605 bcenter =
new gp_Pnt((xMin+xMax)/2., (yMin+yMax)/2., (zMin+zMax)/2.);
606 bradius = sqrt(
SQR(xMax-xMin) +
SQR(yMax-yMin) +
SQR(zMax-zMin))/2.;
610 std::vector<ObjectFace*> faces;
612 double gxMin, gyMin, gzMin, gxMax, gyMax, gzMax;
616 Gboundary.Get(gxMin, gyMin, gzMin, gxMax, gyMax, gzMax);
620 for (TopExp_Explorer itg(solid,TopAbs_FACE); itg.More(); itg.Next()) {
622 TopoDS_Face &face = (TopoDS_Face&)itg.Current();
625 cout <<
" " << SS->DynamicType() << endl;
631 for(
unsigned tct=0; tct<tried_cuts->size(); tct++) {
650 Boundary.Get(objface->
xMin, objface->
yMin, objface->
zMin,
656 faces.push_back(objface);
659 printf(
"%3d non-trivial faces total!\n", faces.size());
662 if (faces.size() <= 10)
return -1;
670 unsigned ndim = 10, best_st = 0, best_metric = 0;
671 double gMin[3] = {gxMin, gyMin, gzMin}, gMax[3] = {gxMax, gyMax, gzMax}, gStep[3];
672 for(
unsigned iq=0; iq<3; iq++)
673 gStep[iq] = (gMax[iq] - gMin[iq])/ndim;
675 for(
unsigned iq=0; iq<3; iq++) {
676 for(
unsigned st=1; st<ndim; st++) {
677 double coord = gMin[iq] + st*gStep[iq];
680 int left = 0, crossed = 0, right = 0;
681 for(
unsigned fc=0; fc<faces.size(); fc++) {
684 if (objface->
mMin[iq] <= coord && objface->
mMax[iq] <= coord)
687 if(objface->
mMin[iq] >= coord && objface->
mMax[iq] >= coord)
694 if (!left || !right)
continue;
696 unsigned metric =
abs(left - right) + crossed;
697 if (best_iq == -1 || metric < best_metric) {
700 best_metric = metric;
703 printf(
"%3d %3d -> %4d %4d %4d -> %4d\n", iq, st, left, crossed, right,
abs(left-right)+crossed);
707 printf(
"--> %d %d -> %3d\n", best_iq, best_st, best_metric);
708 if (best_iq == -1)
return -1;
716 for(
unsigned iq=0; iq<3; iq++) {
717 pt[iq] = best_iq == iq ? gMin[iq] + best_st*gStep[iq] : 0.0;
718 nn[iq] = best_iq == iq ? 1.0 : 0.0;
720 gp_Pnt x0(pt[0], pt[1], pt[2]);
721 gp_Dir n0(nn[0], nn[1], nn[2]);
728 for(
unsigned tct=0; tct<tried_cuts->size(); tct++) {
732 if (fcut->
IsEqual(tcut))
return -1;
735 TopoDS_Shape commonHalf = BRepAlgoAPI_Common(solid, fcut->
GetSolid());
736 for (TopExp_Explorer itq(commonHalf,TopAbs_SOLID); itq.More(); itq.Next())
739 TopoDS_Shape cutHalf = BRepAlgoAPI_Cut(solid, fcut->
GetSolid());
740 for (TopExp_Explorer itq(cutHalf,TopAbs_SOLID); itq.More(); itq.Next())
741 fcut->
AddCutSolid(
new TopoDS_Shape(itq.Current()));
745 printf(
"-> multi %3d; --> %3d %3d\n",
753 unsigned csCounter = 0;
756 snprintf(dname, 1024-1,
"%s.cut-%05d", bname, 0);
760 for(
unsigned gr=0; gr<2; gr++) {
761 std::vector<TopoDS_Shape*> *group = arr[gr];
762 std::vector<std::pair<EicCadWizardCut*,bool> > *fwd_cuts =
new std::vector<std::pair<EicCadWizardCut*,bool> >;
763 for(
unsigned tct=0; tct<tried_cuts->size(); tct++)
764 fwd_cuts->push_back((*tried_cuts)[tct]);
765 fwd_cuts->push_back(std::pair<EicCadWizardCut*,bool>(fcut, gr == 1));
767 for(
unsigned pt=0; pt<group->size(); pt++) {
768 const TopoDS_Shape &qshape = *(*group)[pt];
770 STEPControl_Writer cWriter;
772 cWriter.Transfer(qshape, STEPControl_ManifoldSolidBrep);
774 snprintf(qname, 1024-1,
"%s/part-%05d.stp", dname, csCounter);
775 cWriter.Write(qname);
794 char dname[1024], lname[1024];
796 snprintf(dname, 1024-1,
"%s.cut-%05d", strrchr(bname,
'/') + 1, 0);
797 snprintf(lname, 1024-1,
"%s.split", bname);
799 symlink(dname, lname);
804 std::vector<std::pair<EicCadWizardCut*,bool> > *fwd_cuts =
new std::vector<std::pair<EicCadWizardCut*,bool> >;
805 for(
unsigned tct=0; tct<tried_cuts->size(); tct++)
806 fwd_cuts->push_back((*tried_cuts)[tct]);
807 fwd_cuts->push_back(std::pair<EicCadWizardCut*,bool>(fcut,
true));
826 const std::vector<std::pair<EicCadWizardCut*,bool> > *tried_cuts)
830 for(
unsigned sh=0; sh<cReader.NbShapes(); sh++) {
831 TopoDS_Shape shape = cReader.Shape(sh+1);
834 for (TopExp_Explorer itf(shape,TopAbs_SOLID); itf.More(); itf.Next()) {
835 const TopoDS_Shape &
solid = itf.Current();
852 double xMin, yMin, zMin, xMax, yMax, zMax;
856 Boundary.Get(xMin, yMin, zMin, xMax, yMax, zMax);
859 bcenter =
new gp_Pnt((xMin+xMax)/2., (yMin+yMax)/2., (zMin+zMax)/2.);
860 bradius = sqrt(
SQR(xMax-xMin) +
SQR(yMax-yMin) +
SQR(zMax-zMin))/2.;
864 bool has_complex_faces =
false;
866 unsigned faceCounter = 0, uCounter = 0;
867 for (TopExp_Explorer itg(solid,TopAbs_FACE); itg.More(); itg.Next())
869 printf(
"%3d faces total!\n", faceCounter);
873 std::vector<std::pair<EicCadWizardCut*,bool> > *cuts =
new std::vector<std::pair<EicCadWizardCut*,bool> >;
876 std::vector<std::vector<std::pair<std::string,bool> > > vgdumb;
878 unsigned single_piece_face_count_max_min = 0, ct_best = 0, tried_already = 0;
879 for (TopExp_Explorer itg(solid,TopAbs_FACE); itg.More(); itg.Next()) {
880 TopoDS_Face &face = (TopoDS_Face&)itg.Current();
882 std::vector<std::pair<std::string,bool> > vldumb;
885 cout <<
" " << SS->DynamicType() << endl;
887 has_complex_faces =
true;
898 for(
unsigned ct=0; ct<cuts->size(); ct++) {
909 if (exists)
continue;
913 cuts->push_back(std::pair<EicCadWizardCut*,bool>(fcut,
true));
921 for(
unsigned tct=0; tct<tried_cuts->size(); tct++) {
927 (*cuts)[cuts->size()-1].second = (*tried_cuts)[tct].second;
935 if (tried)
goto _continue;
940 TopoDS_Shape commonHalf = BRepAlgoAPI_Common(solid, fcut->
GetSolid());
941 for (TopExp_Explorer itq(commonHalf,TopAbs_SOLID); itq.More(); itq.Next())
944 TopoDS_Shape cutHalf = BRepAlgoAPI_Cut(solid, fcut->
GetSolid());
945 for (TopExp_Explorer itq(cutHalf,TopAbs_SOLID); itq.More(); itq.Next())
946 fcut->
AddCutSolid(
new TopoDS_Shape(itq.Current()));
953 printf(
"%4d -> multi %3d; --> %3d %3d\n",
960 unsigned csCounter = 0, fCounter[2] = {0, 0}, single_piece_face_count_max = 0;
963 snprintf(dname, 1024-1,
"%s.cut-%05d", bname, cuts->size()-1);
967 for(
unsigned gr=0; gr<2; gr++) {
968 std::vector<TopoDS_Shape*> *group = arr[gr];
970 for(
unsigned pt=0; pt<group->size(); pt++) {
971 const TopoDS_Shape &qshape = *(*group)[pt];
973 unsigned single_piece_face_count = 0;
974 for (TopExp_Explorer itx(qshape,TopAbs_FACE); itx.More(); itx.Next()) {
976 single_piece_face_count++;
978 if (single_piece_face_count > single_piece_face_count_max)
979 single_piece_face_count_max = single_piece_face_count;
981 STEPControl_Writer cWriter;
983 cWriter.Transfer(qshape, STEPControl_ManifoldSolidBrep);
985 snprintf(qname, 1024-1,
"%s/part-%05d.stp", dname, csCounter);
986 cWriter.Write(qname);
988 vldumb.push_back(std::pair<std::string,bool>(qname, gr == 1));
994 printf(
" --> %4d & %4d faces total; max per piece: %4d!\n",
995 fCounter[0], fCounter[1], single_piece_face_count_max);
997 if (!single_piece_face_count_max_min ||
998 single_piece_face_count_max < single_piece_face_count_max_min) {
999 ct_best = cuts->size()-1;
1000 single_piece_face_count_max_min = single_piece_face_count_max;
1007 vgdumb.push_back(vldumb);
1010 printf(
"%d new cuts total (and %d tried out already)!\n", cuts->size(), tried_already);
1014 char dname[1024], lname[1024];
1016 snprintf(dname, 1024-1,
"%s.cut-%05d", strrchr(bname,
'/') + 1, ct_best);
1017 snprintf(lname, 1024-1,
"%s.split", bname);
1019 symlink(dname, lname);
1022 printf(
"@@@ %d %d\n", vgdumb.size(), ct_best);
1023 std::vector<std::pair<std::string,bool> > &vldumb = vgdumb[ct_best];
1024 for(
unsigned fl=0; fl<vldumb.size(); fl++) {
1025 std::vector<std::pair<EicCadWizardCut*,bool> > *fwd_cuts =
new std::vector<std::pair<EicCadWizardCut*,bool> >;
1026 for(
unsigned tct=0; tct<tried_cuts->size(); tct++)
1027 fwd_cuts->push_back((*tried_cuts)[tct]);
1028 fwd_cuts->push_back(std::pair<EicCadWizardCut*,bool>((*cuts)[ct_best].first, vldumb[fl].second));
1031 if (ret)
return ret;
1050 if (has_complex_faces) {
1056 printf(
"Creating ROOT file with tetrahedra (shape has a complex face, sorry) ...\n");
1063 printf(
"Decomposing into basic ROOT shapes ...\n");
1069 printf(
"Creating ROOT file with tetrahedra (Boolean representation disabled, sorry) ...\n");
1093 snprintf(fname, 1024-1,
"%s.stl", bname);
1097 StlAPI_Writer writer;
1102 writer.ASCIIMode() =
true;
1103 writer.Write(solid, fname);
1114 snprintf(rname, 1024-1,
"%s.root", bname);
1143 gp_Pnt x0 = ax3.Location();
1144 gp_Dir xDir = ax3.XDirection(), yDir = ax3.YDirection(), zDir = ax3.Axis().Direction();
1146 double data[9] = {xDir.X(), yDir.X(), zDir.X(),
1147 xDir.Y(), yDir.Y(), zDir.Y(),
1148 xDir.Z(), yDir.Z(), zDir.Z()};
1149 TGeoRotation *grr =
new TGeoRotation();
1150 grr->SetMatrix(data);
1152 return new TGeoCombiTrans(name,
1153 x0.X() + offset * zDir.X(),
1154 x0.Y() + offset * zDir.Y(),
1155 x0.Z() + offset * zDir.Z(), grr);
1161 const std::vector<std::pair<EicCadWizardCut*,bool> > *cuts,
1172 snprintf(rname, 1024-1,
"%s.root", bname);
1180 static unsigned scounter;
1181 char vname[128], tname[128];
1185 snprintf(vname, 128-1,
"VS%04d", scounter);
1186 snprintf(tname, 128-1,
"TS%04d", scounter++);
1188 cmd = vname + cmd + tname;
1195 TGeoSphere *shell =
new TGeoSphere(vname, 0.0, bradius + 1E-10*scounter);
1196 TGeoCombiTrans *ts =
new TGeoCombiTrans(tname, bcenter->X(),
1199 ts->RegisterYourself();
1202 for(
unsigned ct=0; ct<cuts->size(); ct++) {
1204 std::pair<EicCadWizardCut*,bool> cut = (*cuts)[ct];
1207 static unsigned counter;
1208 char vname[128], tname[128];
1210 snprintf(vname, 128-1,
"V%06d", counter);
1211 snprintf(tname, 128-1,
"T%06d", counter++);
1213 TGeoCombiTrans *ts = cut.first->BuildRootVolume(vname, tname);
1215 if (ts) ts->RegisterYourself();
1220 cmd =
"(" + cmd +
")" + (cut.second ?
"-" :
"*") + vname + (ts ? TString(
":") + tname :
"");
1223 printf(
"%s\n", cmd.Data());
1226 static unsigned ccounter;
1229 snprintf(cname, 128-1,
"@RV@%06d", ccounter++);
1238 TGeoCompositeShape *comp =
new TGeoCompositeShape(cname, cmd.Data());
1243 geo->
GetTopVolume()->AddNode(vcomp, 0,
new TGeoCombiTrans(0, 0, 0, 0));
1244 vcomp->RegisterYourself();
1270 snprintf(rname, 1024-1,
"%s.root", bname);
1276 static unsigned ccounter;
1279 snprintf(cname, 128-1,
"@GV@%06d", ccounter++);
1284 TGeoVolume *vcomp =
new TGeoVolume(cname, comp, qconfig->
mhub()->
fSingleMedium);
1286 geo->
GetTopVolume()->AddNode(vcomp, 0,
new TGeoCombiTrans(0, 0, 0, 0));
1287 vcomp->RegisterYourself();
1310 unsigned csCounter = 0;
1311 snprintf(dname, 1024-1,
"%s.split", bname);
1315 for(
unsigned sh=0; sh<cReader.NbShapes(); sh++) {
1316 TopoDS_Shape shape = cReader.Shape(sh+1);
1318 for (TopExp_Explorer itf(shape,TopAbs_SOLID); itf.More(); itf.Next()) {
1319 STEPControl_Writer cWriter;
1321 cWriter.Transfer(itf.Current(), STEPControl_ManifoldSolidBrep);
1323 snprintf(qname, 1024-1,
"%s/part-%05d.stp", dname, csCounter);
1324 cWriter.Write(qname);
1339 const std::vector<std::pair<EicCadWizardCut*,bool> > *tried_cuts)
1352 Handle(Geom_Surface) SS = BRep_Tool::
Surface(face);
1353 if (!IsElementaryFace(face)) {
1354 cout << setw(3) << rfCounter <<
" " << SS->DynamicType() << endl;
1355 unsigned dim = 1000;
1356 double u1, u2,
v1,
v2;
1357 SS->Bounds(u1, u2, v1, v2);
1358 double du = (u2 - u1)/dim, dv = (v2 - v1)/
dim;
1360 for(
unsigned iu=0; iu<=
dim; iu++)
1361 for(
unsigned iv=0; iv<=
dim; iv++) {
1362 double u = u1 + du*iu,
v = v1 + dv*iv;
1363 gp_Pnt pt = SS->Value(u, v);