From 65695eb2c080aa13c2ecd45b03a09f74f8faf692 Mon Sep 17 00:00:00 2001 From: luz paz Date: Tue, 21 Dec 2021 15:00:23 -0500 Subject: [PATCH] Cam: translate doxygen from DE/FR to EN For the purpose of making the source documentation uniform, source comments in this file were translated to english. --- src/Mod/Cam/App/SpringbackCorrection.cpp | 137 +-- src/Mod/Cam/App/UniGridApprox.cpp | 46 +- src/Mod/Cam/App/cutting_tools.cpp | 454 ++++----- src/Mod/Cam/App/cutting_tools.h | 26 +- src/Mod/Cam/App/path_simulate.cpp | 1104 +++++++++++----------- src/Mod/Cam/Gui/Cutting.cpp | 51 +- src/Mod/Cam/Gui/Cutting.h | 22 +- 7 files changed, 916 insertions(+), 924 deletions(-) diff --git a/src/Mod/Cam/App/SpringbackCorrection.cpp b/src/Mod/Cam/App/SpringbackCorrection.cpp index 6f81f3c68a..093a6657f7 100644 --- a/src/Mod/Cam/App/SpringbackCorrection.cpp +++ b/src/Mod/Cam/App/SpringbackCorrection.cpp @@ -198,7 +198,8 @@ bool SpringbackCorrection::CalcCurv() m_MeshStruct.resize(m_CadMesh.CountPoints()); MeanVec.resize(m_CadMesh.CountPoints(), 0); - // Fülle Map mit Punkten (Key) und deren, zur Basistriangulierung korrespondierenden, Indizes + // Fill the map with points (key) and their indices, which correspond + // to the basic triangulation MeshPnts = m_CadMesh.GetPoints(); MeshPntsCop = MeshPnts; MeshFacets2 = m_CadMesh.GetFacets(); @@ -214,7 +215,7 @@ bool SpringbackCorrection::CalcCurv() MeshMap.insert(inp); } - // explores all faces ------------ Hauptschleife + // explores all faces ------------ Main loop for (aExpFace.Init(m_Shape,TopAbs_FACE);aExpFace.More();aExpFace.Next()) { TopoDS_Face aFace = TopoDS::Face(aExpFace.Current()); @@ -224,7 +225,7 @@ bool SpringbackCorrection::CalcCurv() MeshPntsCopy = MeshPnts; n = MeshPnts.size(); TopLoc_Location aLocation; - // berechne normalen -> m_MeshStruct + // calculate normal -> m_MeshStruct Handle_Poly_Triangulation aTr = BRep_Tool::Triangulation(aFace,aLocation); const TColgp_Array1OfPnt& aNodes = aTr->Nodes(); // create array of node points in absolute coordinate system @@ -322,7 +323,7 @@ bool SpringbackCorrection::CalcCurv() } - // Knoten auf der EDGE die EdgeOffset-Werte zuweisen + // Assign the EdgeOffset values to the node on the EDGE // Edge -> Polygon -> Nodes Handle(Poly_PolygonOnTriangulation) polyg; @@ -355,7 +356,7 @@ bool SpringbackCorrection::CalcCurv() ++MeanVec[meshIt->second.index]; - // nehme stets den minimalen wert + // always use the minimum value if (((*edge_it).second[0])>((*meshIt).second).minCurv) ((*meshIt).second).minCurv = (*edge_it).second[0]; @@ -364,7 +365,7 @@ bool SpringbackCorrection::CalcCurv() } } - // Knoten INNERHALB eines Faces die Offset-Werte zuweisen + // Assign the offset values to the node INSIDE a face for (unsigned int k=0; ksecond.index; @@ -418,7 +419,7 @@ bool SpringbackCorrection::CalcCurv() m_MeshStruct[w].minCurv = (((*meshIt).second).minCurv); m_MeshStruct[w].maxCurv = (((*meshIt).second).maxCurv); - // Ausgabe + // output if (m_MeshStruct[w].maxCurv<10000000000) { snprintf(text,10,"%f",m_MeshStruct[w].minCurv); @@ -427,11 +428,11 @@ bool SpringbackCorrection::CalcCurv() } if (MeanVec[w] == 1) - log3d.addSinglePoint(m_MeshStruct[w].pnt,4,0,0,0); // innere punkte - > schwarz + log3d.addSinglePoint(m_MeshStruct[w].pnt,4,0,0,0); // inner points -> black else if (MeanVec[w] == 2) - log3d.addSinglePoint(m_MeshStruct[w].pnt,4,1,1,1); // edge-punkte - > weiß + log3d.addSinglePoint(m_MeshStruct[w].pnt,4,1,1,1); // edge points -> white else - log3d.addSinglePoint(m_MeshStruct[w].pnt,4,1,0,0); // eck-punkte - > rot + log3d.addSinglePoint(m_MeshStruct[w].pnt,4,1,0,0); // corner points -> red //m_MeshStruct[w].minCurv = (((*meshIt).second).minCurv)/MeanVec[w]; //m_MeshStruct[w].maxCurv = (((*meshIt).second).maxCurv)/MeanVec[w]; @@ -492,7 +493,7 @@ bool SpringbackCorrection::CalcCurv() MeshPntsCopy = MeshPnts; n = MeshPnts.size(); TopLoc_Location aLocation; - // berechne normalen -> m_MeshStruct + // calculate normal -> m_MeshStruct Handle_Poly_Triangulation aTr = BRep_Tool::Triangulation(aFace,aLocation); const TColgp_Array1OfPnt& aNodes = aTr->Nodes(); // create array of node points in absolute coordinate system @@ -562,7 +563,7 @@ bool SpringbackCorrection::Init() MeshMap.clear(); //Remove any existing Triangulation on the Shape BRepTools::Clean(m_Shape); - best_fit::Tesselate_Shape(m_Shape,m_CadMesh,(float) 0.1); // Basistriangulierung des ganzen Shapes + best_fit::Tesselate_Shape(m_Shape,m_CadMesh,(float) 0.1); // Base triangulation of the entire shape MeshCore::MeshTopoAlgorithm algo(m_CadMesh); algo.HarmonizeNormals(); @@ -774,7 +775,7 @@ MeshCore::MeshKernel SpringbackCorrection::BuildMesh(Handle_Poly_Triangulation a int SpringbackCorrection::GetBoundary(const MeshCore::MeshKernel &mesh, MeshCore::MeshPointArray &meshPnts) { // get mesh-boundary - // zweck: nur für die inneren punkte wird der curvature wert über die edge abstände berechnet + // purpose: the curvature value is only calculated for the inner points using the edge distances std::list< std::vector > BoundariesIndex; std::list< std::vector >::iterator bInd; @@ -1120,7 +1121,7 @@ std::vector SpringbackCorrection::InitFaceCheck(MeshCore::MeshKernel &mesh, if (alpha > tol) { - // markiere kritisches face + // highlight critical face mFacets[i].SetProperty(0); for (int j=0; j<3; ++j) @@ -1210,8 +1211,8 @@ std::vector SpringbackCorrection::FaceCheck(MeshCore::MeshKernel &mesh, int /* bool SpringbackCorrection::CorrectScale(double zLim) { - // VERSCHIEBUNGSVEKTOREN ... - // berechnung der skalierungsfaktoren bzgl. der Cad-Normalen + // DISPLACEMENT VECTORS... + // Calculation of the scaling factors in relation to the Cad norms int n = m_CadMesh.CountPoints(); double zLev; for (int i=0; i Basistriangulierung CAD-Mesh - // EdgeMap wird hier gefüllt + //Init(); // tessellate shape -> basic triangulation CAD mesh + // EdgeMap will be filled here Base::Vector3f nullvec(0.0,0.0,0.0); - m_dist_vec.resize(m_CadMesh.CountPoints(), nullvec); // fülle mit Nullvektoren + m_dist_vec.resize(m_CadMesh.CountPoints(), nullvec); // fill with null vectors cout << "SetFixEdges" << endl; @@ -1251,10 +1252,10 @@ bool SpringbackCorrection::Perform(int deg_Tol, bool out) if (!CalcCurv()) return false; - // berechne Krümmungswerte über Edgekrümmungen - // MeshMap wird hier gefüllt + // calculate curvature values using edge curvatures + // MeshMap is filled here - const MeshCore::MeshKernel RefMesh = m_CadMesh; // übegebe CAD-Mesh vor der Verformung + const MeshCore::MeshKernel RefMesh = m_CadMesh; // apply CAD mesh before deforming /*Base::Builder3D log; Base::Vector3f gpnt, normal; @@ -1276,7 +1277,7 @@ bool SpringbackCorrection::Perform(int deg_Tol, bool out) log.saveToFile("c:/Facenormals.iv");*/ - // speichere normalen seperat + // save normal separately m_normals.clear(); m_normals.resize(m_MeshStruct.size()); @@ -1284,13 +1285,13 @@ bool SpringbackCorrection::Perform(int deg_Tol, bool out) for (unsigned int i=0; i _ulProp = 0 + InitFaceCheck(m_CadMesh, deg_Tol+1); // critical triangles -> _ulProp = 0 MeshCore::MeshFacetArray facAr2 = m_CadMesh.GetFacets(); while (true) @@ -1435,7 +1436,7 @@ bool SpringbackCorrection::Perform(int deg_Tol, bool out) MeshCore::MeshPointArray mPoints = m_CadMesh.GetPoints(); int num = mFacets.size(); - for (int i=0; i aRegion; @@ -1450,12 +1451,12 @@ bool SpringbackCorrection::Perform(int deg_Tol, bool out) for (int i=0; i > SpringbackCorrection::RegionEval std::vector< std::pair > dists; std::vector< std::pair< unsigned long, double> > skals; - MeshCore::MeshAlgorithm algo(mesh); // übergebe mesh - algo.GetFacetBorders(RegionFacets, Borders); // speichert ränder der region in Borders + MeshCore::MeshAlgorithm algo(mesh); // pass mesh + algo.GetFacetBorders(RegionFacets, Borders); // saves edges of the region in Borders MeshCore::MeshFacetArray facets = mesh.GetFacets(); MeshCore::MeshPointArray points = mesh.GetPoints(); - // um doppelte indizes zu vermeiden push die punkte der region in eine map + // in order to avoid duplicate indices push the points of the region into a map for (unsigned int i=0; i > SpringbackCorrection::RegionEval } - // berechne distanzen der regionenpunkte zu den rändern + // calculate the distances between the region points and the edges - Base::Vector3f distVec; // speichert abstandsvektor - double distVal; // speichert maximalen abstandswert zum rand + Base::Vector3f distVec; // stores distance vector + double distVal; // stores maximum distance to the edge for (rIt = RegionMap.begin(); rIt != RegionMap.end(); ++rIt) { @@ -1807,7 +1808,7 @@ bool SpringbackCorrection::FacetRegionGrowing(MeshCore::MeshKernel &mesh, if (f_beg[*f_it]._ucFlag == MeshCore::MeshFacet::VISIT) { FacetRegion.push_back(f_beg[*f_it]); - mFacets[f_beg[*f_it]._ulProp].SetFlag(MeshCore::MeshFacet::INVALID); // markiere als schon zugewiesen + mFacets[f_beg[*f_it]._ulProp].SetFlag(MeshCore::MeshFacet::INVALID); // mark as already assigned FacetRegionGrowing(mesh, FacetRegion, mFacets); } } @@ -1877,10 +1878,10 @@ bool SpringbackCorrection::GetCurvature(TopoDS_Face aFace) GeomAPI_ProjectPointOnSurf aProjection(proPnt,geom_surface); aProjection.LowerDistanceParameters(u_par,v_par); - // Berechne Krümmung + // Calculate curvature geom_surface->D2(u_par,v_par,proPnt,D1U,D1V,D2U,D2V,D2UV); - // erste & zweite Hauptkrümmung + // first & second main curve k1 = D1U.CrossMagnitude(D2U) / D1U.Magnitude(); k2 = D1V.CrossMagnitude(D2V) / D1V.Magnitude(); @@ -1987,7 +1988,7 @@ std::vector SpringbackCorrection::MeshCurvature(const TopoDS_Face& aFace gp_Pnt2d par; gp_Pnt P; gp_Vec D1U, D1V, D2U, D2V, D2UV, nor, xvv, xuv, xuu; - double H,K; // Gaußsche- und mittlere Krümmung + double H,K; // Gaussian and average curvature std::vector aMaxCurve, aMinCurve; std::vector curv(2); @@ -1997,7 +1998,7 @@ std::vector SpringbackCorrection::MeshCurvature(const TopoDS_Face& aFace par = aUVNodes.Value(i+1); aSurface.D2(par.X(),par.Y(),P,D1U,D1V,D2U,D2V,D2UV); - //berechne Hilfsnormale + //compute auxiliary standards nor = D1U; nor.Cross(D1V); nor.Normalize(); @@ -2019,9 +2020,9 @@ std::vector SpringbackCorrection::MeshCurvature(const TopoDS_Face& aFace aMinCurve.push_back(-(H + sqrt(H*H - K))); } - - - + + + double maxCurv = 0.0; double avgCurv = 0.0; double tmp1 = 1e+10; @@ -2080,7 +2081,7 @@ std::vector SpringbackCorrection::MeshCurvature(const TopoDS_Face& aFace - //Krümmung auf Netzbasis + //Mesh-based curvature for(int i=0; i SpringbackCorrection::MeshCurvature(const TopoDS_Face& aFace bool SpringbackCorrection::MirrorMesh(std::vector error) { // Flags: 0 - not yet checked - // 1 - no correction applied, but necessary + // 1 - no correction applied, but necessary // 2 - first correction applied and still necessary // 3 - done successfully // 4 - done without success @@ -2329,7 +2330,7 @@ bool SpringbackCorrection::MirrorMesh(std::vector error) continue; } - //---------------------------- 1. Korrektur ------------------------- + //---------------------------- 1. Correction -------------------- tmp = 0; std::vector ConvComb = FillConvex(NeiLoc,NorLoc,20); @@ -2375,7 +2376,7 @@ bool SpringbackCorrection::MirrorMesh(std::vector error) MeshRef.Assign(PointArray, FacetArray); - //---------------------------- 2. Korrektur ------------------------- + //---------------------------- 2. Correction ---------------------- tmp = GlobalCorrection(NeiLoc,NorLoc,sign,ind[j]); //MeshRef.Assign(PointArray, FacetArray); @@ -2423,7 +2424,7 @@ bool SpringbackCorrection::MirrorMesh(std::vector error) mx = ver; } - //cout << "skalierung: " << mx << endl; + //cout << "scaling: " << mx << endl; //for(int i=0; i error) std::vector IndexVec,NumVec, NumVecCopy; int c, lastNum, lastInd; - // kritische punkte plus anzahl seiner kritischen nachbarn speichern + // Save critical points plus number of your critical neighbors //ind.clear(); for (unsigned int j=0; j error) } } - // normalenskalierung + // normal scaling for (unsigned int j=0; j error) log.saveToFile("c:/deformation.iv"); - // kritische punkte nach der anzahl seiner kritischen nachbarn sortieren + // Sort critical points according to the number of their critical neighbors NumVecCopy = NumVec; std::vector SortNumVec(NumVec.size(), -1); std::vector SortIndVec(NumVec.size(), -1); cout << NumVec.size() << endl; - //cout << "vor dem sortieren: "; + //cout << "before sorting: "; //for(int j=0; j error) MeshCore::MeshGeomFacet face; mesh.AddFacet(face); - // berechne hauptachsen + // calculate major axes MeshCore::MeshEigensystem pca(mesh); pca.Evaluate(); Base::Matrix4D T1 = pca.Transform(); @@ -2621,7 +2622,7 @@ bool SpringbackCorrection::MirrorMesh(std::vector error) for (unsigned int i=0; i normals = best_fit::Comp_Normals(m_Mesh); double x_max=-(1e+10),y_max=-(1e+10),z_max=-(1e+10),x_min=1e+10,y_min=1e+10,st_x,st_y; int n = normals.size(); - // führe verschiebung durch + // perform shift //for(int i=0; iyy; } - // gittergrößen bestimmung über die bounding-box + // grid size can be determined using the bounding box n_x = int((x_max - x_min)/(y_max - y_min)*sqrt((x_max - x_min)*(y_max - y_min))); n_y = int((y_max - y_min)/(x_max - x_min)*sqrt((x_max - x_min)*(y_max - y_min))); @@ -177,7 +177,7 @@ bool UniGridApprox::MeshOffset() aNormal.z = 1.0; if (!malg.NearestFacetOnRay(pnt, aNormal, aFacetGrid, projPoint, facetIndex)) { - aNormal.Scale(1,1,-1);// gridoptimiert + aNormal.Scale(1,1,-1);// grid optimized if (!malg.NearestFacetOnRay(pnt, aNormal, aFacetGrid, projPoint, facetIndex)) { aNormal.Scale(1,1,-1); @@ -288,11 +288,11 @@ bool UniGridApprox::MeshOffset() bool UniGridApprox::SurfMeshParam() { - // hier wird das in MeshOffset erzeugte gitter parametrisiert - // parametrisierung: (x,y) -> (u,v) , ( R x R ) -> ( [0,1] x [0,1] ) + // here the grid generated in MeshOffset is parameterized + // parameterization: (x,y) -> (u,v) , ( R x R ) -> ( [0,1] x [0,1] ) - int n = m_Grid.size()-1; // anzahl der zu approximierenden punkte in x-richtung - int m = m_Grid[0].size()-1; // anzahl der zu approximierenden punkte in y-richtung + int n = m_Grid.size()-1; // number of points to be approximated in x-direction + int m = m_Grid[0].size()-1; // number of points to be approximated in y-direction std::vector dist_x, dist_y; double sum,d; @@ -305,7 +305,7 @@ bool UniGridApprox::SurfMeshParam() m_uParam[n] = 1.0; m_vParam[m] = 1.0; - // berechne knotenvektor in u-richtung (entspricht x-richtung) + // calculate node vector in u-direction (corresponds to x-direction) for (int j=0; j by (1, n - 1); ublas::matrix bz (1, n - 1); - // mit null vorinitialisieren + // pre-initialize with zero for (int i=0; i upiv(n - 1); // pivotelement - atlas::lu_factor(Nu,upiv); // führt LU-Zerlegung durch + std::vector upiv(n - 1); // pivot element + atlas::lu_factor(Nu,upiv); // performs LU decomposition std::vector vpiv(m - 1); atlas::lu_factor(Nv,vpiv); @@ -527,7 +527,7 @@ bool UniGridApprox::MatComp(int u_CP, int v_CP) CPy.resize(n + 1, m + 1); CPz.resize(n + 1, m + 1); - // mit null vorinitialisieren + // pre-initialize with zero for (int i=0; i Tmp = CPz; - //glättung des kontrollpunktnetzes + //Smoothing the control point network for (int i=1; i aTempBBoxPair; aTempPair.first = MOrderIt->second; - //Jetzt durch das Face gehen und die Wires rausfiltern + //Now go through the face and filter out the wires TopExp_Explorer Explore_Face; Explore_Face.Init(MOrderIt->second,TopAbs_WIRE); //If there is no Wire -> return if (!Explore_Face.More()) return false; - //Jetzt alle Wires in die map schieben + //Now push all wires into the map for (Explore_Face.ReInit();Explore_Face.More();Explore_Face.Next()) { aTempBBoxPair.first = getWireBBox(TopoDS::Wire(Explore_Face.Current())); @@ -184,19 +184,19 @@ bool cutting_tools::fillFaceWireMap() bool cutting_tools::getShapeBB() { - //Die Cascade-Bounding Box funktioniert nicht richtig - //Es wird dort wohl ne BoundingBox um dasKontrollnetz gelegt - //Deshalb wird jetzt kurz das Shape tesseliert und dann die Bounding Box direkt ausgelesen + // The Cascade bounding box is not working properly + // There will probably be a bounding box around the control network + // Therefore, the shape is now briefly tessellated and the bounding box is then read out directly best_fit::Tesselate_Shape(m_Shape,m_CAD_Mesh,float(0.1)); Base::BoundBox3f aBoundBox = m_CAD_Mesh.GetBoundBox(); m_maxlevel = aBoundBox.MaxZ; m_minlevel = aBoundBox.MinZ; - // //Hier testen wir noch ein paar OpenMesh Funktionen + // //Here we are testing a few more OpenMesh functions // typedef OpenMesh::DefaultTraits MyTraits; // typedef OpenMesh::TriMesh_ArrayKernelT MyMesh; - //////// Mesh::Interface erbt von MyMesh , so dass das Objekt 'mesh' direkt in den OpenMesh-Funktionen genutzt werden kann + //////// Mesh::Interface inherits from MyMesh so that the 'mesh' object can be used directly in the OpenMesh functions // Mesh::Interface mesh(m_CAD_Mesh); ////// proceed with mesh, e.g. refining // MyMesh::EdgeIter e_it,e_end(mesh.edges_end()); @@ -222,7 +222,7 @@ bool cutting_tools::getShapeBB() - /* Hier ist die alte OCC BoundingBox Funktion + /* Here is the old OCC BoundingBox function Bnd_Box currentBBox; Standard_Real XMin, YMin, ZMin, XMax, YMax, ZMax; BRepBndLib::Add(m_shape, currentBBox ); @@ -263,7 +263,7 @@ bool cutting_tools::fillFaceBBoxes() } return true; } -//Hier ist die alte Version um die Bounding Box zu bestimmen +//Here is the old version to determine the bounding box // aAdaptor_Surface.Initialize(atopo_surface); // Standard_Real FirstUParameter, LastUParameter,FirstVParameter,LastVParameter; // gp_Pnt aSurfacePoint; @@ -273,8 +273,8 @@ bool cutting_tools::fillFaceBBoxes() // LastVParameter = aAdaptor_Surface.LastVParameter(); //float urange = LastUParameter - FirstUParameter; //float vrange = LastVParameter - FirstVParameter; -////Jetzt ein 10x10 Grid pro Face machen und so die BBox bestimmen -////Zunächst mal die BoundingBox auf Null setzen +////Now make a 10x10 grid per face and determine the BBox in this way +////First of all, set the bounding box to zero //Bnd_Box currentBBox; // //for(int i=0;i<10;++i) @@ -285,9 +285,9 @@ bool cutting_tools::fillFaceBBoxes() // currentBBox.Update(aSurfacePoint.X(),aSurfacePoint.Y(),aSurfacePoint.Z()); // } //} -////Jetzt noch nen Rand drumherum bauen +////Now build a border around it //currentBBox.SetGap(0.5); -////Jetzt die aktuelle BoundingBox mit dem aktuellen Face in einen vector pushen +////Now push the current bounding box with the current face into a vector //std::pair tempPair; //tempPair.first = atopo_surface; //tempPair.second = currentBBox; @@ -316,26 +316,26 @@ bool cutting_tools::initializeMeshStuff() bool cutting_tools::arrangecuts_ZLEVEL() { - //We have to fill the required maps first + // We have to fill the required maps first fillFaceWireMap(); - //Zunächst wieder checken ob CAD oder nicht + // First check again whether CAD or not if (m_cad==false) { - //Cast um die Nachkommastellen wegzuschneiden + // Cut away cast by the decimal places int cutnumber = (int)fabs((m_maxlevel-m_minlevel)/m_pitch); - //m_pitch leicht korrigieren um wirklich auf die letzte Ebene zu kommen + // Correct m_pitch slightly to really get to the last level m_pitch = fabs(m_maxlevel-m_minlevel)/cutnumber; - //Jetzt die Schnitte machen. Die höchste Ebene fällt weg, da hier noch kein Blech gedrückt wird + // Make the cuts now. The highest level is omitted, as no sheet has yet been pressed here float z_level,z_level_corrected; TopoDS_Shape aCutShape; for (int i=1;i<=cutnumber;++i) { - //Jetzt schneiden (die oberste Ebene auslassen) + //Cut now (skip the top layer) z_level = m_maxlevel-(i*m_pitch); z_level_corrected = z_level; cut(z_level,m_minlevel,aCutShape,z_level_corrected); //cut_Mesh(z_level,m_minlevel,result,z_level_corrected); - //Jetzt die resultierende Wire in einen Vector pushen + //Now push the resulting wire into a vector std::pair tempPair; tempPair.first = z_level_corrected; tempPair.second = aCutShape; @@ -343,10 +343,10 @@ bool cutting_tools::arrangecuts_ZLEVEL() } return true; } - //Wenn wir mehrere Faces haben oder eine CAD-Geometrie vorhanden ist + //If we have several faces or a CAD geometry is available else { - //Über die MachiningOrder wird jetzt die Cutting-Folge festgelegt + //The machining order is now used to determine the cutting sequence std::vector >::iterator MOrderIt; if (m_MachiningOrder.size()<2) return false; //Did not select at least two Levels //Now take two levels and perform the Cutting Stuff @@ -386,7 +386,7 @@ bool cutting_tools::arrangecuts_ZLEVEL() cut(z_level,temp_min, aCutShape,z_level_corrected); if (z_level_corrected != z_level) std::cout << "Somehow we couldn't cut" << std::endl; - //Jetzt nur das gewünschte Resultat in den vector schieben (von oben nach unten große usw.) + //Now just move the result you want into the vector (large ones from top to bottom, etc...) Edgesort aCuttingShapeSorter(aCutShape); tempPair.first = z_level_corrected; if (m_direction) @@ -425,40 +425,40 @@ bool cutting_tools::arrangecuts_ZLEVEL() //} // std::map >::iterator zl_wire_it; -// //Wir holen uns jetzt den nächsten Z-Level raus. Wir müssen was kleineres -// //wie den höchsten Wert nehmen sonst gibt er immer den höchsten Wert aus +// //We are now getting the next Z-Level out. We have to take something smaller like the highest value, +// //otherwise it will always output the highest value // zl_wire_it = m_zl_wire_combination.upper_bound(temp_max-0.1); // if (zl_wire_it->first == temp_max) // { -// cout << "Tja, es gibt wohl nur eine flache Area"; +// cout << "Well, there is probably only one flat area"; // temp_min = m_minlevel; // } -// //Wenn es mehrere flache Bereiche gibt muss ich nochmal weitermachen +// //If there are multiple flat areas, I have to go over again // else // { // temp_min = zl_wire_it->first; -// cout << "Mehrere Areas erkannt"; +// cout << "Detected multiple areas"; // } -// //Jetzt schnippeln von temp_max bis temp_min +// //Now cut from temp_max to temp_min // int cutnumber = (int)fabs((temp_max-temp_min)/m_pitch); -// //m_pitch leicht korrigieren um wirklich auf die letzte Ebene zu kommen +// //Correct m_pitch slightly to really get to the last level // m_pitch = fabs(temp_max-temp_min)/cutnumber; -// //Jetzt die Schnitte machen. Die höchste Ebene fällt weg, da hier noch kein Blech gedrückt wird +// //Now make the cuts. The highest level is omitted because no sheet is pressed here yet // float z_level,z_level_corrected; // TopoDS_Shape aCutShape; -// //Jetzt schneiden (die oberste Ebene auslassen) +// //Cut now (omit the top layer) // for (int i=1;i<=20;++i) // { // z_level = temp_max-(i*m_pitch); // z_level_corrected = z_level; // //cut_Mesh(z_level,m_minlevel,result,z_level_corrected); -// //Jetzt die resultierenden Points in den vector schieben +// //Now move the resulting points into the vector // //std::pair > > tempPair; // //tempPair.first = z_level_corrected; // //tempPair.second = result; // //m_ordered_cuts.push_back(tempPair); // cut(z_level,temp_min, aCutShape,z_level_corrected); -// //Jetzt die gefüllte Wire in den vector schieben +// //Now insert the filled wire into the vector // std::pair tempPair; // tempPair.first = z_level_corrected; // tempPair.second = aCutShape; @@ -473,7 +473,7 @@ bool cutting_tools::arrangecuts_ZLEVEL() //bool cutting_tools::checkFlatLevel() //{ -// //Falls keine CAD-Geometrie da ist, gleich wieder rausspringen +// //If there is no CAD geometry, jump straight out again // // if (m_cad==false) return false; // @@ -519,26 +519,26 @@ bool cutting_tools::arrangecuts_ZLEVEL() // gp_Vec z_normal_opposite(0,0,-1); // if (Norm_average.IsEqual(z_normal,0.01,0.01) || Norm_average.IsEqual(z_normal_opposite,0.01,0.01)) // { -// cout << "Einen flachen Bereich gefunden"; +// cout << "Found a flat area"; // std::pair >aTempPair; // aTempPair.second.clear(); // std::pair aTempBBoxPair; // -// //Z-Wert vom flachen Bereich in ein temporäres pair pushen +// //Push the Z-value from the flat area into a temporary pair // aTempPair.first = ((first.Z()+second.Z()+third.Z())/3); -// //Jetzt durch das Face gehen und die Wires rausfiltern +// //Now go through the face and filter the wires out // TopExp_Explorer Explore_Face; // Explore_Face.Init(atopo_surface,TopAbs_WIRE); // //If there is no Wire -> return // if (!Explore_Face.More()) return false; // -// //Jetzt alle Wires in die map schieben +// //Now push all wires into the map // for (Explore_Face.ReInit();Explore_Face.More();Explore_Face.Next()) // { // aTempBBoxPair.first = getWireBBox(TopoDS::Wire(Explore_Face.Current())); // aTempBBoxPair.second = TopoDS::Wire(Explore_Face.Current()); // aTempPair.second.insert(aTempBBoxPair); -// //aTempPair.first ist ja noch auf dem gleichen Z-Wert wie vorher, deswegen muss da nichts abgepasst werden +// //aTempPair.first is still at the same Z value as before, so nothing needs to be adjusted // } // m_zl_wire_combination.insert(aTempPair); // } @@ -562,21 +562,21 @@ bool cutting_tools::arrangecuts_ZLEVEL() // for (int i=1;i<=numberofpoints;++i) // { // lowestdistance=200; -// //Aktuellen Punkt holen +// //Get the current point // gp_Pnt currentPoint = aProp.Value(i); // projectPointContainer aTempContainer; -// //checken auf welches Face wir projezieren könnnen +// //check which face we can project onto // for(m_face_bb_it = m_face_bboxes.begin();m_face_bb_it!=m_face_bboxes.end();++m_face_bb_it) // { -// //Wenn der aktuelle Punkt in der BBox enthalten ist, dann machen wir mit der Projection weiter +// //If the current point is contained in the BBox, then we continue with the projection // if(checkPointinFaceBB(aProp.Value(i),m_face_bb_it->second)) // { // atopo_surface = m_face_bb_it->first; // geom_surface = BRep_Tool::Surface(atopo_surface); // GeomAPI_ProjectPointOnSurf aPPS(currentPoint,geom_surface,0.001); -// //Wenn nichts projeziert werden kann, gehts gleich weiter zum nächsten Face bzw. der nächsten BBox +// //If nothing can be projected, it goes straight to the next face or the next BBox // if (aPPS.NbPoints() == 0) continue; -// //Jetzt muss das aktuelle Face gespeichert werden, da es eventuell das face ist, welches am nächsten ist +// //Now the current face has to be saved, as it may be the face that is closest // double length = aPPS.LowerDistance(); // if(lowestdistance>length) // { @@ -588,18 +588,18 @@ bool cutting_tools::arrangecuts_ZLEVEL() // } // gp_Vec Uvec,Vvec,normalVec; // geom_surface = BRep_Tool::Surface(atopo_surface_shortest); -// //Das Face welches am nächsten ist in der temp-struct speichern +// //Save the face which is closest in the temp-struct // aTempContainer.face = atopo_surface_shortest; // geom_surface->D1(Umin,Vmin,aTempContainer.point,Uvec,Vvec); -// //Jetzt den Normalenvector auf die Fläche ausrechnen +// //Now calculate the normal vector on the surface // normalVec = Uvec; // normalVec.Cross(Vvec); // normalVec.Normalize(); -// //Jetzt ist die Normale berechnet und auch normalisiert -// //Jetzt noch checken ob die Normale auch wirklich wie alle anderen auf die gleiche Seite zeigt. -// //dazu nur checken ob der Z-Wert der Normale größer Null ist (dann im 1.und 2. Quadranten) +// //Now the normal is calculated and normalized +// //Now check if the normal is really pointing to the same side like everyone else. +// //To do this, just check whether the Z-value of the normal is greater than zero (then in the 1st and 2nd quadrant) // if(normalVec.Z()<0) normalVec.Multiply(-1.0); -// //Mal kurz den Winkel zur Grund-Ebene ausrechnen +// //Briefly calculate the angle to the ground plane // aTempContainer.normalvector = normalVec; // aContainer.push_back(aTempContainer); // @@ -610,16 +610,16 @@ bool cutting_tools::arrangecuts_ZLEVEL() TopoDS_Wire cutting_tools::ordercutShape(const TopoDS_Shape &aShape) { - //Bisher funktioniert das Ganze nur für Schnitte welche nur einmal rundherum laufen und noch nicht für Inseln + //So far, the whole thing only works for cuts that only run around once and not yet for islands TopExp_Explorer exploreShape; exploreShape.Init(aShape,TopAbs_EDGE); int k=0; - for (; exploreShape.More(); exploreShape.Next()) //erstmal schauen wieviele Edges wir haben + for (; exploreShape.More(); exploreShape.Next()) //first see how many edges we have { k++; } - //Jetzt die Edges alle in eine Wire packen (mit Add) und schauen ob ein Fehler kommt. - //Wenn ja, dann die nächste Edge. Solange bis alle Edges drin sind. + //Now pack the edges all into one wire (with Add) and see if there is an error. + //If so, then the next Edge. Until all the edges are in. if (k<1) { @@ -627,16 +627,16 @@ TopoDS_Wire cutting_tools::ordercutShape(const TopoDS_Shape &aShape) BRepBuilderAPI_MakeWire mkWire(TopoDS::Edge(exploreShape.Current())); return mkWire.Wire(); } - else //Nur wenn mehr als eine Edge vorhanden ist + else //Only when there is more than one Edge { - BRepBuilderAPI_MakeWire mkWire; //WireContainer aufbauen + BRepBuilderAPI_MakeWire mkWire; //Build the WireContainer std::vector listofedge_tmp,listofedge; std::vector::iterator it_edge; - edge_container a_edge_container; //Definiert in der stuff.h + edge_container a_edge_container; //Defined in stuff.h listofedge.clear(); listofedge_tmp.clear(); exploreShape.ReInit(); - //Edge-Liste füllen + //Fill Edge List for (; exploreShape.More(); exploreShape.Next()) { a_edge_container.edge = TopoDS::Edge(exploreShape.Current()); @@ -661,14 +661,14 @@ TopoDS_Wire cutting_tools::ordercutShape(const TopoDS_Shape &aShape) } else { - //Abstände ausrechnen + //Calculate distances double abstand1=sqrt((*it_edge).firstPoint.SquareDistance(lastpointoflastedge)); double abstand2=sqrt((*it_edge).lastPoint.SquareDistance(lastpointoflastedge)); double abstand3=sqrt((*it_edge).firstPoint.SquareDistance(firstpointoflastedge)); double abstand4=sqrt((*it_edge).lastPoint.SquareDistance(firstpointoflastedge)); if (abstand1<0.5) { - //Neue Edge erzeugen welche vom letzten Endpunkt zum aktuellen Startpunkt geht + //Create new edge which goes from the last end point to the current starting point BRepBuilderAPI_MakeEdge newedge(lastpointoflastedge,(*it_edge).firstPoint); mkWire.Add(newedge); mkWire.Add((*it_edge).edge); @@ -677,7 +677,7 @@ TopoDS_Wire cutting_tools::ordercutShape(const TopoDS_Shape &aShape) } else if (abstand2<0.5) { - //Neue Edge erzeugen welche vom letzten Endpunkt zum aktuellen Startpunkt geht + //Create new edge which goes from the last end point to the current starting point BRepBuilderAPI_MakeEdge newedge(lastpointoflastedge,(*it_edge).lastPoint); mkWire.Add(newedge); mkWire.Add((*it_edge).edge); @@ -688,7 +688,7 @@ TopoDS_Wire cutting_tools::ordercutShape(const TopoDS_Shape &aShape) else if (abstand3<0.5) { - //Neue Edge erzeugen welche vom letzten Endpunkt zum aktuellen Startpunkt geht + //Create new edge which goes from the last end point to the current starting point BRepBuilderAPI_MakeEdge newedge(firstpointoflastedge,(*it_edge).firstPoint); mkWire.Add(newedge); mkWire.Add((*it_edge).edge); @@ -697,7 +697,7 @@ TopoDS_Wire cutting_tools::ordercutShape(const TopoDS_Shape &aShape) } else if (abstand4<0.5) { - //Neue Edge erzeugen welche vom letzten Endpunkt zum aktuellen Startpunkt geht + //Create new edge which goes from the last end point to the current starting point BRepBuilderAPI_MakeEdge newedge(firstpointoflastedge,(*it_edge).lastPoint); mkWire.Add(newedge); mkWire.Add((*it_edge).edge); @@ -718,14 +718,14 @@ TopoDS_Wire cutting_tools::ordercutShape(const TopoDS_Shape &aShape) } -//bool cutting_tools::OffsetWires_Standard(float radius) //Version wo nur in X,Y-Ebene verschoben wird +//bool cutting_tools::OffsetWires_Standard(float radius) //Version where it is only shifted in the X,Y plane //{ // Base::Builder3D build; // std::ofstream outfile; // outfile.open("c:/atest.out"); // // -// //Die ordered_cuts sind ein Vector wo für jede Ebene ein Pair existiert +// //The ordered_cuts are a vector where there is a pair for every level // for(m_ordered_cuts_it = m_ordered_cuts.begin();m_ordered_cuts_it!=m_ordered_cuts.end();++m_ordered_cuts_it) // { // float current_z_level = m_ordered_cuts_it->first; @@ -739,21 +739,21 @@ TopoDS_Wire cutting_tools::ordercutShape(const TopoDS_Shape &aShape) // { // i++; // lowestdistance=200; -// //Aktuellen Punkt holen +// //Get the current point // gp_Pnt currentPoint(avector_it->x,avector_it->y,avector_it->z); // gp_Pnt nearest_Point; -// //checken auf welches Face wir projezieren könnnen +// //check which face we can project onto // for(m_face_bb_it = m_face_bboxes.begin();m_face_bb_it!=m_face_bboxes.end();++m_face_bb_it) // { -// //Wenn der aktuelle Punkt in der BBox enthalten ist, dann machen wir mit der Projection weiter +// //If the current point is in the BBox, then we continue with the projection // if(checkPointinFaceBB(currentPoint,m_face_bb_it->second)) // { // atopo_surface = m_face_bb_it->first; // geom_surface = BRep_Tool::Surface(atopo_surface); // GeomAPI_ProjectPointOnSurf aPPS(currentPoint,geom_surface,0.001); -// //Wenn nichts projeziert werden kann, gehts gleich weiter zum nächsten Face bzw. der nächsten BBox +// //If nothing can be projected, it goes straight to the next face or the next BBox // if (aPPS.NbPoints() == 0) continue; -// //Jetzt muss das aktuelle Face gespeichert werden, da es eventuell das face ist, welches am nächsten ist +// //Now the current face has to be saved, as it may be the face that is closest // double length = aPPS.LowerDistance(); // if(lowestdistance>length) // { @@ -764,9 +764,9 @@ TopoDS_Wire cutting_tools::ordercutShape(const TopoDS_Shape &aShape) // } // } // } -// //Für eine saubere Projection auf der aktuellen Ebene wird jetzt der Richtungsvector -// //aus dem projezierten Punkt und dem Ursprungspunkt gebildet -// //und dieser dann hergenommen um damit nochmal in dessen Richtung zu projezieren +// //For a clean projection on the current plane, the direction vector is now +// //formed from the projected point and the point of origin +// //and then used to project again in that direction // gp_Vec aVec(currentPoint,nearest_Point); // aVec.Normalize(); // aVec.SetZ(0.0); @@ -775,7 +775,7 @@ TopoDS_Wire cutting_tools::ordercutShape(const TopoDS_Shape &aShape) // IntCurvesFace_ShapeIntersector aFaceIntSect; // aFaceIntSect.Load(m_Shape, 0.001); // aFaceIntSect.PerformNearest(aLine,-RealLast(), +RealLast()); -// //Jetzt holen wir uns auf der Fläche den U und V Wert um dann D1 und D2 bestimmen zu können +// //Now we get the U and V value on the area so that we can then determine D1 and D2 // gp_Pnt projectedPoint,OffsetPoint; // gp_Pnt testpoint,testpoint2; // float abstand,abstand_old; @@ -799,21 +799,21 @@ TopoDS_Wire cutting_tools::ordercutShape(const TopoDS_Shape &aShape) // normalVec = Uvec; // normalVec.Cross(Vvec); // normalVec.Normalize(); -// //Jetzt ist die Surface-Normale berechnet und auch normalisiert -// //Jetzt noch checken ob die Normale auch wirklich wie alle anderen auf die gleiche Seite zeigt. -// //dazu nur checken ob der Z-Wert der Normale größer Null ist (dann im 1.und 2. Quadranten) +// //Now the surface normal is calculated and normalized +// //Now check if the normal is really pointing to the same side like everyone else. +// //To do this, just check whether the Z-value of the normal is greater than zero (then in the 1st and 2nd quadrant) // if(normalVec.Z()<0) normalVec.Multiply(-1.0); // //Jetzt die Normale auf die Radiuslänge verlängern // normalVec.Multiply(radius); -// //Jetzt die Z-Komponente auf 0 setzen +// //Now set the Z component to 0 // normalVec.SetZ(0.0); // //float abstand = currentPoint.Distance(projectedPoint); // //if(abstand>0.2) // //{cout<<"error"< finalPointscorrected; @@ -887,7 +887,7 @@ TopoDS_Wire cutting_tools::ordercutShape(const TopoDS_Shape &aShape) //bool cutting_tools::checkPointIntersection(std::vector &finalPoints) //{ -// //Hier wird gecheckt ob die Punkte wirklich alle in der richtigen Reihenfolge vorliegen +// //This is where a check is made to see whether the points are really all in the correct order // std::vector::iterator aPntIt; // double distance,distance_old; // projectPointContainer nearestPointStruct; @@ -897,25 +897,25 @@ TopoDS_Wire cutting_tools::ordercutShape(const TopoDS_Shape &aShape) // distance_old = 100; // for(int i=1;i<30;++i) // { -// //Wenn wir schon fast am Ende sind oder schon bald, dann rausspringen +// //When we're almost at the end, or soon, then jump out // if((j+i)>=finalPoints.size()) break; // // distance = (finalPoints[j+i].point).SquareDistance(finalPoints[j].point); // if(distance > MasterPointContainer; @@ -1102,9 +1102,9 @@ bool cutting_tools::OffsetWires_Standard() //Version wo nur in X,Y-Ebene verscho curveAdaptor.D0(aProp.Parameter(i),aTempPair.first); else curveAdaptor.D0(aProp.Parameter(aProp.NbPoints()-i+1),aTempPair.first); //aTempPair.first.SetZ(aTempPair.first.Z() + m_UserSettings.master_radius); - aTempPair.first.SetZ(aTempPair.first.Z() ); + aTempPair.first.SetZ(aTempPair.first.Z() ); aTempPair.second = 0.0; //Initialize of Angle - //checken ob der neue Punkt zu nahe am alten ist. Wenn ja, dann kein push_back + //check if the new point is too close to the old one. If so, then no push_back if (MasterPointContainer.size()>0 && (MasterPointContainer.rbegin()->first.SquareDistance(aTempPair.first)>(Precision::Confusion()*Precision::Confusion()))) { MasterPointContainer.push_back(aTempPair); @@ -1255,8 +1255,8 @@ bool cutting_tools::OffsetWires_Standard() //Version wo nur in X,Y-Ebene verscho double first2,last2; bool reversed = false; BRep_Tool::CurveOnSurface(aCutShapeSorter.Current(),a2DCurve,aSurface,aLoc,first2,last2); - //Jetzt noch die resultierende Surface und die Curve sauber drehen - //(vielleicht wurde ja das TopoDS_Face irgendwie gedreht oder die TopoDS_Edge) + //Now rotate the resulting surface and the curve cleanly + //(maybe the TopoDS_Face was rotated somehow or the TopoDS_Edge) if (aCutShapeSorter.Current().Orientation() == TopAbs_REVERSED) reversed = true; @@ -1277,41 +1277,41 @@ bool cutting_tools::OffsetWires_Standard() //Version wo nur in X,Y-Ebene verscho GeomAdaptor_Surface aGeom_Adaptor(aSurface); int t = aGeom_Adaptor.GetType(); aGeom_Adaptor.D1(a2dParaPoint.X(),a2dParaPoint.Y(),aSurfacePoint,Uvec,Vvec); - //Jetzt den Normalenvector auf die Fläche ausrechnen + //Now calculate the normal vector on the surface normalVec = Uvec; normalVec.Cross(Vvec); normalVec.Normalize(); - //Jetzt ist die Normale berechnet und auch normalisiert - //Jetzt noch checken ob die Normale auch wirklich auf die saubere Seite zeigt - //dazu nur checken ob der Z-Wert der Normale größer Null ist (dann im 1.und 2. Quadranten) + //Now the normal is calculated and normalized + //Now check whether the normal is really pointing to the clean side; + //just check whether the Z-value of the normal is greater than zero (then in the 1st and 2nd quadrant) if (normalVec.Z()<0) normalVec.Multiply(-1.0); - //Mal kurz den Winkel zur Grund-Ebene ausrechnen + //Briefly calculate the angle to the ground plane gp_Vec planeVec(normalVec.X(),normalVec.Y(),0.0); - //Den Winkel + //The angle PointContactPair.second = normalVec.Angle(planeVec); gp_Vec NormalVecSlave = normalVec; gp_Pnt SlavePoint; - //Jetzt die Z-Komponente auf 0 setzen + //Now set the Z component to 0 //normalVec.SetZ(0.0); normalVec.Normalize(); - //Jetzt die Normale mit folgender Formel multiplizieren für den Master + //Now multiply the normal using the following formula for the master //double multiply = m_UserSettings.master_radius*(1-sin(PointContactPair.second))/cos(PointContactPair.second); double multiply = m_UserSettings.master_radius; normalVec.Multiply(multiply); - //und hier für den Slave + //and here for the slave NormalVecSlave.Normalize(); multiply = m_UserSettings.sheet_thickness+m_UserSettings.slave_radius; NormalVecSlave.Multiply(multiply); - //Jetzt die Richtung umdrehen + //Now reverse the direction NormalVecSlave.Multiply(-1.0); - //Jetzt den OffsetPunkt berechnen + //Now calculate the offset point PointContactPair.first.SetXYZ(aSurfacePoint.XYZ()); - //PointContactPair.first.SetXYZ(aSurfacePoint.XYZ() + normalVec.XYZ()); + //PointContactPair.first.SetXYZ(aSurfacePoint.XYZ() + normalVec.XYZ()); SlavePoint.SetXYZ(aSurfacePoint.XYZ() + NormalVecSlave.XYZ()); //PointContactPair.first.SetZ(PointContactPair.first.Z() + m_UserSettings.master_radius); - //Damit wir keine Punkte bekommen die zu nahe beieinander liegen - //Den letzten hinzugefügten Punkt suchen + //So that we don't get any points that are too close together + //Find the last added point if (MasterPointContainer.size()>0 && (MasterPointContainer.rbegin()->first.SquareDistance(PointContactPair.first)>0.001)) { MasterPointContainer.push_back(PointContactPair); @@ -1343,7 +1343,7 @@ bool cutting_tools::OffsetWires_Standard() //Version wo nur in X,Y-Ebene verscho gp_Pnt SlaveOffsetPoint; wireAdaptor.D0(aProp.Parameter(i),SlaveOffsetPoint); SlaveOffsetPoint.SetZ(SlaveOffsetPoint.Z() - m_UserSettings.slave_radius - m_UserSettings.sheet_thickness); - //checken ob der neue Punkt zu nahe am alten ist. Wenn ja, dann kein push_back + //check if the new point is too close to the old one. If so, then no push_back if (SlavePointContainer.size()>0 && (SlavePointContainer.rbegin()->SquareDistance(SlaveOffsetPoint)>(0.001))) { SlavePointContainer.push_back(SlaveOffsetPoint); @@ -1474,7 +1474,7 @@ bool cutting_tools::OffsetWires_Standard() //Version wo nur in X,Y-Ebene verscho else curveAdaptor.D0(aProp.Parameter(aProp.NbPoints()-i+1),aTempPair.first); aTempPair.first.SetZ(aTempPair.first.Z() -m_UserSettings.slave_radius -m_UserSettings.sheet_thickness); aTempPair.second = 0.0; //Initialize of Angle - //checken ob der neue Punkt zu nahe am alten ist. Wenn ja, dann kein push_back + //check if the new point is too close to the old one. If so, then no push_back if (MasterPointContainer.size()>0 && (MasterPointContainer.rbegin()->first.SquareDistance(aTempPair.first)>(Precision::Confusion()*Precision::Confusion()))) { MasterPointContainer.push_back(aTempPair); @@ -1623,8 +1623,8 @@ bool cutting_tools::OffsetWires_Standard() //Version wo nur in X,Y-Ebene verscho double first2,last2; bool reversed = false; BRep_Tool::CurveOnSurface(aCutShapeSorter.Current(),a2DCurve,aSurface,aLoc,first2,last2); - //Jetzt noch die resultierende Surface und die Curve sauber drehen - //(vielleicht wurde ja das TopoDS_Face irgendwie gedreht oder die TopoDS_Edge) + //Now rotate the resulting surface and the curve cleanly + //(maybe the TopoDS_Face was somehow rotated or the TopoDS_Edge) if (aCutShapeSorter.Current().Orientation() == TopAbs_REVERSED) reversed = true; @@ -1645,39 +1645,39 @@ bool cutting_tools::OffsetWires_Standard() //Version wo nur in X,Y-Ebene verscho GeomAdaptor_Surface aGeom_Adaptor(aSurface); int t = aGeom_Adaptor.GetType(); aGeom_Adaptor.D1(a2dParaPoint.X(),a2dParaPoint.Y(),aSurfacePoint,Uvec,Vvec); - //Jetzt den Normalenvector auf die Fläche ausrechnen + //Now calculate the normal vector on the surface normalVec = Uvec; normalVec.Cross(Vvec); normalVec.Normalize(); - //Jetzt ist die Normale berechnet und auch normalisiert - //Jetzt noch checken ob die Normale auch wirklich auf die saubere Seite zeigt - //dazu nur checken ob der Z-Wert der Normale größer Null ist (dann im 1.und 2. Quadranten) + //Now the normal is calculated and normalized + //Now check whether the normal is really pointing to the clean side + //To do this, just check whether the Z-value of the normal is greater than zero (then in the 1st and 2nd quadrant) if (normalVec.Z()<0) normalVec.Multiply(-1.0); - //Mal kurz den Winkel zur Grund-Ebene ausrechnen + //Briefly calculate the angle to the ground plane gp_Vec planeVec(normalVec.X(),normalVec.Y(),0.0); - //Den Winkel + //The angle PointContactPair.second = normalVec.Angle(planeVec); gp_Vec NormalVecSlave = normalVec; gp_Pnt SlavePoint; - //Jetzt die Z-Komponente auf 0 setzen + //Now set the Z component to 0 //normalVec.SetZ(0.0); normalVec.Normalize(); - //Jetzt die Normale mit folgender Formel multiplizieren für den Master + //Now multiply the normal using the following formula for the master //double multiply = (m_UserSettings.slave_radius*(1-sin(PointContactPair.second))/cos(PointContactPair.second))+m_UserSettings.sheet_thickness; double multiply = m_UserSettings.slave_radius + m_UserSettings.sheet_thickness; //As the Master is now the Slave we have to multiply it also by -1.0 normalVec.Multiply(-multiply); - //und hier für den Slave + //and here for the slave NormalVecSlave.Normalize(); multiply = m_UserSettings.master_radius; NormalVecSlave.Multiply(multiply); - //Jetzt den OffsetPunkt berechnen + //Now calculate the offset point PointContactPair.first.SetXYZ(aSurfacePoint.XYZ() + normalVec.XYZ()); SlavePoint.SetXYZ(aSurfacePoint.XYZ() + NormalVecSlave.XYZ()); //PointContactPair.first.SetZ(PointContactPair.first.Z() - m_UserSettings.slave_radius); - //Damit wir keine Punkte bekommen die zu nahe beieinander liegen - //Den letzten hinzugefügten Punkt suchen + //So that we don't get any points that are too close together + //Find the last point added if (MasterPointContainer.size()>0 && (MasterPointContainer.rbegin()->first.SquareDistance(PointContactPair.first)>(Precision::Confusion()*Precision::Confusion()))) { MasterPointContainer.push_back(PointContactPair); @@ -1709,7 +1709,7 @@ bool cutting_tools::OffsetWires_Standard() //Version wo nur in X,Y-Ebene verscho gp_Pnt SlaveOffsetPoint; wireAdaptor.D0(aProp.Parameter(i),SlaveOffsetPoint); SlaveOffsetPoint.SetZ(SlaveOffsetPoint.Z() + m_UserSettings.master_radius); - //checken ob der neue Punkt zu nahe am alten ist. Wenn ja, dann kein push_back + //check if the new point is too close to the old one. If so, then no push_back if (SlavePointContainer.size()>0 && (SlavePointContainer.rbegin()->SquareDistance(SlaveOffsetPoint)>(0.001))) { SlavePointContainer.push_back(SlaveOffsetPoint); @@ -1864,32 +1864,32 @@ TopoDS_Shape cutting_tools::getProperCut(TopoDS_Shape& aShape) bool cutting_tools::calculateAccurateSlaveZLevel(std::vector >& OffsetPoints, double current_z_level, double &slave_z_level, double &average_sheet_thickness, double &average_angle, bool &cutpos) { - //Mittelwert von allen Normalenwinkeln und damit dann den Mittelwert der Blechdicke bilden + //Calculate the mean value of all normal angles and thus the mean value of the sheet metal thickness bool direction,area; - //Zunächst checken in welchem Bereich vom Teil wir uns aufhalten + //First of all, check in which area of the part we are if (current_z_level < m_MachiningOrder[0].first.z && current_z_level > m_MachiningOrder[1].first.z) { - //Wir sind von oben nach unten im ersten Teil + //We're in the first part from top to bottom direction = true; area = true; } else if (m_MachiningOrder.size() > 2 && current_z_level < m_MachiningOrder[1].first.z) { - //Wir sind von oben nach unten im zweiten Teil + //We're in the second part from top to bottom direction = true; area = false; } else if (m_MachiningOrder.size() > 2 && current_z_level < m_MachiningOrder[2].first.z && current_z_level > m_MachiningOrder[1].first.z) { - //Wir sind von unten nach oben im 2. Teil + //We are from the bottom up in the 2nd part direction = false; area = false; } else { - cout << "Konnte keine Zuordnung finden" << endl; + cout << "Couldn't find an assignment" << endl; } average_angle = 0.0; @@ -1936,7 +1936,7 @@ bool cutting_tools::calculateAccurateSlaveZLevel(std::vectorD1(Umin,Vmin,projectedPoint,Uvec,Vvec); // normalVec = Uvec; // normalVec.Cross(Vvec); -// normalVec.Normalize(); //Jetzt ist die Normale berechnet und auch normalisiert +// normalVec.Normalize(); //Now the normal is calculated and normalized // //zeroPoint.SetCoord(0.0,0.0,0.0); // // projPointVec.SetXYZ(projectedPoint.XYZ()); // OffsetPoint.SetXYZ((projPointVec + (normalVec*(-21))).XYZ()); -// finalOffsetPoints->SetValue(i,OffsetPoint); //Aktuellen OffsetPoint setzen +// finalOffsetPoints->SetValue(i,OffsetPoint); //Set the current offset point // } // Standard_Boolean isPeriodic = Standard_False; // GeomAPI_Interpolate aNoPeriodInterpolate(finalOffsetPoints, isPeriodic, Precision::Confusion()); @@ -2076,11 +2076,11 @@ bool cutting_tools::OffsetWires_Spiral() current_flat_level = m_ordered_cuts.begin(); SpiralHelper lastPoint; lastPoint.SurfacePoint.SetCoord(0.0,0.0,0.0); - bool slave_done= false; //Necessary if the slave is already output + boJetzt noch die Geschichte wo wir wieder nach oben fahrenol slave_done= false; //Necessary if the slave is already output bool just_started = true; // gp_Vec direction_vector(0.0,0.0,1.0),last_direction_vector(0.0,0.0,1.0);//Just to initialize them bool direction = true; //for the Robot, this tells the algo that we have to switch the direction - //Nicht beim höchsten Anfangen, da wir den nicht mit dem Master fahren wollen + //Not at the very beginning, as we don't want to drive it with the master for (m_ordered_cuts_it = m_ordered_cuts.begin()+1;m_ordered_cuts_it!=m_ordered_cuts.end();++m_ordered_cuts_it) { std::vector OffsetSpiralPoints,TempSpiralPoints; @@ -2132,8 +2132,8 @@ bool cutting_tools::OffsetWires_Spiral() double first2,last2; bool reversed = false; BRep_Tool::CurveOnSurface(aCutShapeSorter.Current(),a2DCurve,aSurface,aLoc,first2,last2); - //Jetzt noch die resultierende Surface und die Curve sauber drehen - //(vielleicht wurde ja das TopoDS_Face irgendwie gedreht oder die TopoDS_Edge) + //Now rotate the resulting surface and the curve cleanly + //(maybe the TopoDS_Face was somehow rotated or the TopoDS_Edge) if (aCutShapeSorter.Current().Orientation() == TopAbs_REVERSED) reversed = true; @@ -2160,19 +2160,19 @@ bool cutting_tools::OffsetWires_Spiral() } GeomAdaptor_Surface aGeom_Adaptor(aSurface); aGeom_Adaptor.D1(a2dParaPoint.X(),a2dParaPoint.Y(),aSurfacePoint,Uvec,Vvec); - //Jetzt den Normalenvector auf die Fläche ausrechnen + //Now calculate the normal vector on the surface normalVec = Uvec; normalVec.Cross(Vvec); normalVec.Normalize(); - //Jetzt ist die Normale berechnet und auch normalisiert - //Jetzt noch checken ob die Normale auch wirklich auf die saubere Seite zeigt - //dazu nur checken ob der Z-Wert der Normale größer Null ist (dann im 1.und 2. Quadranten) + //Now the normal is calculated and normalized + //Now check whether the normal is really pointing to the clean side + //To do this, just check whether the Z-value of the normal is greater than zero (then in the 1st and 2nd quadrant) if (normalVec.Z()<0) normalVec.Multiply(-1.0); - //Mal kurz den Winkel zur Grund-Ebene ausrechnen + //Briefly calculate the angle to the ground plane gp_Vec planeVec(normalVec.X(),normalVec.Y(),0.0); - //Den Winkel speichern + //Save the angle float angle = float(normalVec.Angle(planeVec)); aSpiralStruct.SurfaceNormal = normalVec; aSpiralStruct.SurfacePoint = aSurfacePoint; @@ -2211,7 +2211,7 @@ bool cutting_tools::OffsetWires_Spiral() { wireAdaptor.D0(aProp.Parameter(i),SlaveOffsetPoint); SlaveOffsetPoint.SetZ(SlaveOffsetPoint.Z() - m_UserSettings.sheet_thickness - m_UserSettings.slave_radius); - //checken ob der neue Punkt zu nahe am alten ist. Wenn ja, dann kein push_back + //check if the new point is too close to the old one. If so, then no push_back if (SlavePointContainer.size()>0 && (SlavePointContainer.rbegin()->SquareDistance(SlaveOffsetPoint)>(Precision::Confusion()*Precision::Confusion()))) SlavePointContainer.push_back(SlaveOffsetPoint); else if (SlavePointContainer.empty()) @@ -2448,8 +2448,8 @@ bool cutting_tools::OffsetWires_Spiral() double first2,last2; bool reversed = false; BRep_Tool::CurveOnSurface(aCutShapeSorter.Current(),a2DCurve,aSurface,aLoc,first2,last2); - //Jetzt noch die resultierende Surface und die Curve sauber drehen - //(vielleicht wurde ja das TopoDS_Face irgendwie gedreht oder die TopoDS_Edge) + //Now rotate the resulting surface and the curve cleanly + //(maybe the TopoDS_Face was somehow rotated or the TopoDS_Edge) if (aCutShapeSorter.Current().Orientation() == TopAbs_REVERSED) reversed = true; @@ -2476,19 +2476,19 @@ bool cutting_tools::OffsetWires_Spiral() } GeomAdaptor_Surface aGeom_Adaptor(aSurface); aGeom_Adaptor.D1(a2dParaPoint.X(),a2dParaPoint.Y(),aSurfacePoint,Uvec,Vvec); - //Jetzt den Normalenvector auf die Fläche ausrechnen + //Now calculate the normal vector on the surface normalVec = Uvec; normalVec.Cross(Vvec); normalVec.Normalize(); - //Jetzt ist die Normale berechnet und auch normalisiert - //Jetzt noch checken ob die Normale auch wirklich auf die saubere Seite zeigt - //dazu nur checken ob der Z-Wert der Normale größer Null ist (dann im 1.und 2. Quadranten) + //Now the normal is calculated and normalized + //Now check whether the normal is really pointing to the clean side + //To do this, just check whether the Z-value of the normal is greater than zero (then in the 1st and 2nd quadrant) if (normalVec.Z()<0) normalVec.Multiply(-1.0); - //Mal kurz den Winkel zur Grund-Ebene ausrechnen + //Briefly calculate the angle to the ground plane gp_Vec planeVec(normalVec.X(),normalVec.Y(),0.0); - //Den Winkel speichern + //Save the angle float angle = float(normalVec.Angle(planeVec)); aSpiralStruct.SurfaceNormal = normalVec; aSpiralStruct.SurfacePoint = aSurfacePoint; @@ -2527,7 +2527,7 @@ bool cutting_tools::OffsetWires_Spiral() { wireAdaptor.D0(aProp.Parameter(i),SlaveOffsetPoint); SlaveOffsetPoint.SetZ(SlaveOffsetPoint.Z() + m_UserSettings.master_radius); - //checken ob der neue Punkt zu nahe am alten ist. Wenn ja, dann kein push_back + //check if the new point is too close to the old one. If so, then no push_back if (SlavePointContainer.size()>0 && (SlavePointContainer.rbegin()->SquareDistance(SlaveOffsetPoint)>(Precision::Confusion()*Precision::Confusion()))) SlavePointContainer.push_back(SlaveOffsetPoint); else if (SlavePointContainer.empty()) @@ -2761,7 +2761,7 @@ bool cutting_tools::OffsetWires_FeatureBased() gp_Pnt lastPoint(0.0,0.0,0.0); //Initialize the first Point to the Origin current_flat_level = m_ordered_cuts.begin(); bool slave_done= false; //Necessary if the slave is already put out - //Nicht beim höchsten Anfangen, da wir den nicht mit dem Master fahren wollen + //Not at the very beginning, because we don't want to drive that with the master for (m_ordered_cuts_it = m_ordered_cuts.begin()+1;m_ordered_cuts_it!=m_ordered_cuts.end();++m_ordered_cuts_it) { std::vector > MasterPointContainer; @@ -2796,7 +2796,7 @@ bool cutting_tools::OffsetWires_FeatureBased() else curveAdaptor.D0(aProp.Parameter(aProp.NbPoints()-i+1),aTempPair.first); aTempPair.first.SetZ(aTempPair.first.Z() + m_UserSettings.master_radius); aTempPair.second = 0.0; //Initialize of Angle - //checken ob der neue Punkt zu nahe am alten ist. Wenn ja, dann kein push_back + //check if the new point is too close to the old one. If so, then no push_back if (MasterPointContainer.size()>0 && (MasterPointContainer.rbegin()->first.SquareDistance(aTempPair.first)>(Precision::Confusion()*Precision::Confusion()))) { MasterPointContainer.push_back(aTempPair); @@ -2915,8 +2915,8 @@ bool cutting_tools::OffsetWires_FeatureBased() double first2,last2; bool reversed = false; BRep_Tool::CurveOnSurface(aCutShapeSorter.Current(),a2DCurve,aSurface,aLoc,first2,last2); - //Jetzt noch die resultierende Surface und die Curve sauber drehen - //(vielleicht wurde ja das TopoDS_Face irgendwie gedreht oder die TopoDS_Edge) + //Now rotate the resulting surface and the curve cleanly + //(maybe the TopoDS_Face was somehow rotated or the TopoDS_Edge) if (aCutShapeSorter.Current().Orientation() == TopAbs_REVERSED) reversed = true; @@ -2937,31 +2937,31 @@ bool cutting_tools::OffsetWires_FeatureBased() GeomAdaptor_Surface aGeom_Adaptor(aSurface); int t = aGeom_Adaptor.GetType(); aGeom_Adaptor.D1(a2dParaPoint.X(),a2dParaPoint.Y(),aSurfacePoint,Uvec,Vvec); - //Jetzt den Normalenvector auf die Fläche ausrechnen + //Now calculate the normal vector on the surface normalVec = Uvec; normalVec.Cross(Vvec); normalVec.Normalize(); - //Jetzt ist die Normale berechnet und auch normalisiert - //Jetzt noch checken ob die Normale auch wirklich auf die saubere Seite zeigt - //dazu nur checken ob der Z-Wert der Normale größer Null ist (dann im 1.und 2. Quadranten) + //Now the normal is calculated and normalized + //Now check whether the normal is really pointing to the clean side + //To do this, just check whether the Z-value of the normal is greater than zero (then in the 1st and 2nd quadrant) if (normalVec.Z()<0) normalVec.Multiply(-1.0); - //Mal kurz den Winkel zur Grund-Ebene ausrechnen + //Briefly calculate the angle to the ground plane gp_Vec planeVec(normalVec.X(),normalVec.Y(),0.0); - //Den Winkel + //The angle PointContactPair.second = normalVec.Angle(planeVec); gp_Vec NormalVecSlave = normalVec; - //Jetzt die Z-Komponente auf 0 setzen + //Now set the Z component to 0 //normalVec.SetZ(0.0); normalVec.Normalize(); - //Jetzt die Normale mit folgender Formel multiplizieren für den Master + //Now multiply the normal using the following formula for the master //double multiply = m_UserSettings.master_radius*(1-sin(PointContactPair.second))/cos(PointContactPair.second); double multiply = m_UserSettings.master_radius; normalVec.Multiply(multiply); - //Jetzt den OffsetPunkt berechnen + //Now calculate the offset point PointContactPair.first.SetXYZ(aSurfacePoint.XYZ() + normalVec.XYZ()); - //Damit wir keine Punkte bekommen die zu nahe beieinander liegen - //Den letzten hinzugefügten Punkt suchen + //So that we don't get any points that are too close together + //Find the last point added if (MasterPointContainer.size()>0 && (MasterPointContainer.rbegin()->first.SquareDistance(PointContactPair.first)>0.001)) { MasterPointContainer.push_back(PointContactPair); @@ -3014,7 +3014,7 @@ bool cutting_tools::OffsetWires_FeatureBased() gp_Pnt SlaveOffsetPoint; wireAdaptor.D0(aProp.Parameter(i),SlaveOffsetPoint); SlaveOffsetPoint.SetZ(SlaveOffsetPoint.Z() - m_UserSettings.sheet_thickness - m_UserSettings.slave_radius); - //checken ob der neue Punkt zu nahe am alten ist. Wenn ja, dann kein push_back + //check if the new point is too close to the old one. If so, then no push_back if (SlavePointContainer.size()>0 && (SlavePointContainer.rbegin()->SquareDistance(SlaveOffsetPoint)>(Precision::Confusion()*Precision::Confusion()))) SlavePointContainer.push_back(SlaveOffsetPoint); else if (SlavePointContainer.empty()) @@ -3074,7 +3074,7 @@ bool cutting_tools::OffsetWires_FeatureBased() else curveAdaptor.D0(aProp.Parameter(aProp.NbPoints()-i+1),aTempPair.first); aTempPair.first.SetZ(aTempPair.first.Z() - m_UserSettings.slave_radius - m_UserSettings.sheet_thickness); aTempPair.second = 0.0; //Initialize of Angle - //checken ob der neue Punkt zu nahe am alten ist. Wenn ja, dann kein push_back + //check if the new point is too close to the old one. If so, then no push_back if (MasterPointContainer.size()>0 && (MasterPointContainer.rbegin()->first.SquareDistance(aTempPair.first)>(Precision::Confusion()*Precision::Confusion()))) { MasterPointContainer.push_back(aTempPair); @@ -3193,8 +3193,8 @@ bool cutting_tools::OffsetWires_FeatureBased() double first2,last2; bool reversed = false; BRep_Tool::CurveOnSurface(aCutShapeSorter.Current(),a2DCurve,aSurface,aLoc,first2,last2); - //Jetzt noch die resultierende Surface und die Curve sauber drehen - //(vielleicht wurde ja das TopoDS_Face irgendwie gedreht oder die TopoDS_Edge) + //Now rotate the resulting surface and the curve cleanly + //(maybe the TopoDS_Face was somehow rotated or the TopoDS_Edge) if (aCutShapeSorter.Current().Orientation() == TopAbs_REVERSED) reversed = true; @@ -3215,32 +3215,32 @@ bool cutting_tools::OffsetWires_FeatureBased() GeomAdaptor_Surface aGeom_Adaptor(aSurface); int t = aGeom_Adaptor.GetType(); aGeom_Adaptor.D1(a2dParaPoint.X(),a2dParaPoint.Y(),aSurfacePoint,Uvec,Vvec); - //Jetzt den Normalenvector auf die Fläche ausrechnen + //Now calculate the normal vector on the surface normalVec = Uvec; normalVec.Cross(Vvec); normalVec.Normalize(); - //Jetzt ist die Normale berechnet und auch normalisiert - //Jetzt noch checken ob die Normale auch wirklich auf die saubere Seite zeigt - //dazu nur checken ob der Z-Wert der Normale größer Null ist (dann im 1.und 2. Quadranten) + //Now the normal is calculated and normalized + //Now check whether the normal is really pointing to the clean side + //To do this, just check whether the Z-value of the normal is greater than zero (then in the 1st and 2nd quadrant) if (normalVec.Z()<0) normalVec.Multiply(-1.0); - //Mal kurz den Winkel zur Grund-Ebene ausrechnen + //Briefly calculate the angle to the ground plane gp_Vec planeVec(normalVec.X(),normalVec.Y(),0.0); - //Den Winkel + //The angle PointContactPair.second = normalVec.Angle(planeVec); gp_Vec NormalVecSlave = normalVec; - //Jetzt die Z-Komponente auf 0 setzen + //Now set the Z component to 0 //normalVec.SetZ(0.0); normalVec.Normalize(); - //Jetzt die Normale mit folgender Formel multiplizieren für den Master + //Now multiply the normal using the following formula for the master //double multiply = m_UserSettings.master_radius*(1-sin(PointContactPair.second))/cos(PointContactPair.second); double multiply = m_UserSettings.slave_radius + m_UserSettings.sheet_thickness; normalVec.Multiply(multiply); normalVec.Multiply(-1.0); //As the master is the slave - //Jetzt den OffsetPunkt berechnen + //Now calculate the offset point PointContactPair.first.SetXYZ(aSurfacePoint.XYZ() + normalVec.XYZ()); - //Damit wir keine Punkte bekommen die zu nahe beieinander liegen - //Den letzten hinzugefügten Punkt suchen + //So that we don't get any points that are too close together + //Find the last point added if (MasterPointContainer.size()>0 && (MasterPointContainer.rbegin()->first.SquareDistance(PointContactPair.first)>0.001)) { MasterPointContainer.push_back(PointContactPair); @@ -3293,7 +3293,7 @@ bool cutting_tools::OffsetWires_FeatureBased() gp_Pnt SlaveOffsetPoint; wireAdaptor.D0(aProp.Parameter(i),SlaveOffsetPoint); SlaveOffsetPoint.SetZ(SlaveOffsetPoint.Z() + m_UserSettings.master_radius); - //checken ob der neue Punkt zu nahe am alten ist. Wenn ja, dann kein push_back + //check if the new point is too close to the old one. If so, then no push_back if (SlavePointContainer.size()>0 && (SlavePointContainer.rbegin()->SquareDistance(SlaveOffsetPoint)>(Precision::Confusion()*Precision::Confusion()))) { SlavePointContainer.push_back(SlaveOffsetPoint); @@ -3346,7 +3346,7 @@ bool cutting_tools::cut_Mesh(float z_level, float min_level, std::listCutWithPlane(z_level_plane,normal,*m_CAD_Mesh_Grid,result); //std::list >::iterator it; //std::vector::iterator vector_it; - //checken ob wirklich ein Schnitt zustande gekommen ist + //check whether a cut has really been made if (result.size()==0) { cutok = false; - //Jedes Mal ein wenig mehr Abstand für die Korrektur einfügen + //Insert a little more space each time for the correction factor = factor+float(0.05); if (factor>=1) factor = float(0.95); - //Wenn wir das erste Mal eine Korrektur machen müssen gehts zunächst mal mit Minus rein + //If we have to make a correction for the first time, we start with a minus if (direction) { z_level_plane.z = (z_level-(m_pitch*factor)); @@ -3396,7 +3396,7 @@ bool cutting_tools::cut(float z_level, float min_level, TopoDS_Shape &aCutShape, gp_Pnt aPlanePnt(0,0,z_level); gp_Dir aPlaneDir(0,0,1); bool cutok; - //Die Richtung für die Korrektur wird hier festgelegt + //The direction for the correction is determined here bool correction=true; float factor = 0.0; do @@ -3408,21 +3408,21 @@ bool cutting_tools::cut(float z_level, float min_level, TopoDS_Shape &aCutShape, mkCut.Approximation (Standard_True); mkCut.ComputePCurveOn1(Standard_True); mkCut.Build(); - //Den neuen Algorithmus checken + //Check the new algorithm //Edgesort aSorter(mkCut.Shape()); //aSorter.Init(); - //Jetzt checken ob auch wirlich edges vorhanden sind + //Now check whether there really are edges TopExp_Explorer exploreShape; exploreShape.Init(mkCut.Shape(),TopAbs_EDGE); - //Wenn keine Edge vorhanden ist + //If there is no edge if (!exploreShape.More()) { cutok = false; - //Jedes Mal ein wenig mehr Abstand für die Korrektur einfügen + //Insert a little more space each time for the correction factor = factor+float(0.05); if (factor>=1) factor = float(0.95); - //Wenn wir das erste Mal eine Korrektur machen müssen gehts zunächst mal mit Minus rein + //If we have to make a correction for the first time, we start with a minus if (correction) { aPlanePnt.SetZ(z_level-(m_pitch*factor)); @@ -3438,7 +3438,7 @@ bool cutting_tools::cut(float z_level, float min_level, TopoDS_Shape &aCutShape, continue; } } - //Das Shape, welches per Referenz übergeben wird jetzt mit dem geordneten Schnitt füllen + //The shape, which is passed by reference, is now filled with the ordered section aCutShape = mkCut.Shape(); } @@ -3456,27 +3456,27 @@ bool cutting_tools::classifyShape() TopExp_Explorer Explorer; Explorer.Init(m_Shape,TopAbs_FACE); if (!Explorer.More()) return false; - //checken wieviele verschiedene Faces wir haben + //check how many different faces we have int k=0; for (; Explorer.More(); Explorer.Next()) { k++; } std::cout <<"We have " << k << "Faces" << std::endl; - //Wenn mehr als ein Face vorhanden, dann eine Membervariable setzen + //If more than one face is available, then set a member variable if (k>1) m_cad = true; return true; } -/* Hier ging das alte cut los +/* The old cut started here bool cutok=true; - //Falls wir nur ein Face haben und keine flachen Bereiche + //If we have only one face and no flat areas if (m_all_cuts.empty()) { //Schnitte über die Bounding Box bestimmen @@ -3488,14 +3488,15 @@ bool cutting_tools::classifyShape() currentBBox.Get(XMin, YMin, ZMin, XMax, YMax, ZMax); double maxlevel=Max(ZMax,ZMin); double minlevel=Min(ZMax,ZMin); - int cutnumber = fabs((maxlevel-minlevel)/m_pitch);//Cast um die Nachkommastellen wegzuschneiden - m_pitch = fabs(maxlevel-minlevel)/cutnumber;//m_pitch leicht korrigieren um wirklich auf die letzte Ebene zu kommen + int cutnumber = fabs((maxlevel-minlevel)/m_pitch); //Cut away the cast by the decimal places + m_pitch = fabs(maxlevel-minlevel)/cutnumber; //Correct m_pitch slightly to really get to the last level - //Aktuell wird die letzte Ebene bei selbst approxmierten Flächen nicht als Bahnkurve betrachtet - //Auch die erste Ebene fällt komplett weg, da unwichtig. Lediglich für die untere Maschine ist die Bahn sinnvoll falls überhaupt noch flache Bereiche vorhanden sind + //Currently, the last level of self-approximated surfaces is not considered as a path curve + //The first level is also completely omitted, since it is unimportant. + //The track is only useful for the lower machine if there are still flat areas at all for (int i=0;i InitialPlaneLevels; @@ -3537,54 +3538,55 @@ bool cutting_tools::classifyShape() std::vector::iterator temp_it; for (m_it= m_all_cuts.begin();m_itX2Max && Y1Min < Y2Min && Y1Max>Y2Max) //1 ist größer + //Now check which one is smaller + if(X1MinX2Max && Y1Min < Y2Min && Y1Max>Y2Max) //1 is greater { - if(m_it == m_all_cuts.begin())//Wenn wir auf der obersten Ebene sind.... + if(m_it == m_all_cuts.begin())//When we're at the top level... { atemp_storage.push_back(*(m_it+1)); - m_it++;//Wir überspringen damit das nächste //Damit haben wir nur noch ein Problem falls wir mehr als zwei Wires auf einer ebene haben. + m_it++;// We skip the next one + // We only have one problem if we have more than two wires on one level. } else { atemp_storage.push_back(*(m_it)); } } - //Mal schauen ob der Wert schon in der Liste vorhanden ist + //Let's see if the value is already available in the list temp_it = std::find(InitialPlaneLevels.begin(),InitialPlaneLevels.end(),(*m_it).first); if (temp_it == InitialPlaneLevels.end()) { InitialPlaneLevels.push_back((*m_it).first); } } - //Jetzt die flachen Bereiche der Höhe nach sortieren + //Now sort the flat areas according to their height std::sort(InitialPlaneLevels.begin(),InitialPlaneLevels.end(),FloatHuge); - //Die Schnitte müssen jetzt zwischen die flachen Stücke einsortiert werden + //Now the cuts have to be sorted between the flat pieces for (temp_it=InitialPlaneLevels.begin();temp_it,Face_Less > m_FaceWireMap; std::vector >::iterator m_ordered_cuts_it; - //Member zum checken ob CAD oder nicht + //Member to check whether CAD or not bool m_cad; TopoDS_Shape m_Shape; MeshCore::MeshKernel m_CAD_Mesh; @@ -216,28 +216,18 @@ private: bool m_mirrortobothsides; - //Zustellungswert + //Delivery amount float m_pitch; - //Der höchste und niedrigste Z-Wert vom Shape + //The highest and lowest z-value of the shape float m_minlevel,m_maxlevel; - //Der Radius der Werkzeuge + //The radius of the tools float m_radius,m_radius_slave; - //Blechdicke + //Sheet metal thickness float m_sheet_thickness; bool m_direction; ////If we cut from top to bottom (true) or from bottom to top (false) std::vector > m_MachiningOrder; - - - - - - - - }; #endif - - diff --git a/src/Mod/Cam/App/path_simulate.cpp b/src/Mod/Cam/App/path_simulate.cpp index 1551740810..a2cf9e683d 100644 --- a/src/Mod/Cam/App/path_simulate.cpp +++ b/src/Mod/Cam/App/path_simulate.cpp @@ -31,10 +31,10 @@ #include #include -#define curvTOL 30.0 // gibt maximalen Krümmungsradius an ab welchem eine Unterteilung der Kurve erfolgt -#define TolDist 1.0 // entspricht der Samplingschrittweite der Kurvenpunkte für den Roboter-Output +#define curvTOL 30.0 // indicates the maximum radius of curvature from which the curve is subdivided +#define TolDist 1.0 // corresponds to the sampling increment of the curve points for the robot output -/* Konstruktor mit zwei Bahnfolgen (master tool & supporting die) als Input */ +/* Constructor with two path sequences (master tool & supporting die) as input */ path_simulate::path_simulate(const std::vector &BSplineTop, const std::vector &BSplineBottom, struct CuttingToolsSettings& set) @@ -49,7 +49,7 @@ path_simulate::path_simulate(const std::vector &BSplin m_single = false; - if(m_pretension > 0) beam = true; // flag für "write_output_***" generierung + if(m_pretension > 0) beam = true; // flag for "write_output_***" generation else beam = false; //Initialize the Iterators @@ -86,7 +86,8 @@ path_simulate::path_simulate(const std::vector &BSplin /* Fill p with the starting point of the first Slave curve*/ (*m_it2)->D0((*m_it2)->FirstParameter(),p); - /* Set q to the initial-Z-level in the Simulation: -5mm - Slave-Radius-Spring-Pretensionbelow the sheet upper level which is located at Z=0 */ + // Set q to the initial-Z-level in the Simulation: + // -5mm - Slave-Radius-Spring-Pretensionbelow the sheet upper level which is located at Z=0 q.SetZ(-5.0 - set.slave_radius - m_pretension); /*Now we insert the start points for the Slave movement*/ @@ -129,8 +130,8 @@ double path_simulate::GetLength(GeomAdaptor_Curve& curve, const Standard_Real st return l1 + l2; } - - return GCPnts_AbscissaPoint::Length(curve,sParam,eParam); // genauigkeitssteuerung über parameter TOL nach eParam + // Accuracy control via parameter TOL according to eParam + return GCPnts_AbscissaPoint::Length(curve,sParam,eParam); } */ @@ -151,11 +152,11 @@ double path_simulate::FindParamAt(GeomAdaptor_Curve& curve, double dist, double } */ -/* Hier wird die absolute Geschwindigkeitsfunktion definiert und liefert die Geschwindigkeit zur Zeiteingabe . -Die Funktion gliedert sich in drei Abschnitte mit den Parametergrenzen , , , welche z.B. -mittels path_simulate::ParameterCalculation() ermittelt werden kann. -Die Start- und Endgeschwindigkeit müssen vorher in und bestimmt werden. -Die maximale Geschwindigkeit welche zwischen und erreicht werden soll, entspricht hier */ +/* The absolute speed function is defined here and provides the speed for time input . +The function is divided into three sections with the parameter limits , , , +which e.g. can be determined using path_simulate::ParameterCalculation() +The start and end speed must be determined beforehand in and +The maximum speed that is to be achieved between and corresponds here to */ double path_simulate::GetVelocity(double t) { double vel; @@ -197,8 +198,8 @@ double path_simulate::GetVelocity(double t) return vel; } -/* Diese Funktion liefert den zurückgelegten Weg zur Zeiteingabe und entspricht -dem Integral der Funktion GetVelocity(t)*/ +/* This function supplies the distance covered to enter the time and + corresponds to the integral of the GetVelocity(t) function */ double path_simulate::GetDistance(double t) { double d; @@ -258,10 +259,10 @@ double path_simulate::GetWireLength(TopoDS_Wire &aWire) } */ -/*Parameterberechnung der Geschwindigkeitsfunktion für eine gerade Strecke der Länge */ +/*Parameter calculation of the speed function for a straight line of length */ bool path_simulate::ParameterCalculation_Line(double S1) { - if (S1 == 0.0) // hier gibts nichts zu tun + if (S1 == 0.0) // there's nothing to be done here { m_T = m_t0; return true; @@ -269,17 +270,17 @@ bool path_simulate::ParameterCalculation_Line(double S1) m_a = m_amax; - m_v[0] = 0.0; // Startgeschwindigkeit wird auf Null gesetzt - m_v[1] = sqrt(m_a*S1/2.0); // Geschwindigkeit die notwendig ist damit der Weg zur Zeit erreicht wird - m_v[2] = 0.0; // Endgeschwindigkeit wird auf Null gesetzt + m_v[0] = 0.0; // Start speed is set to zero + m_v[1] = sqrt(m_a*S1/2.0); // Speed that is necessary so that the path at the time is reached + m_v[2] = 0.0; // Final speed is set to zero - while(m_v[1] > m_vmax) // maximale Geschwindigkeit darf nicht überschritten werden + while(m_v[1] > m_vmax) // maximum speed must not be exceeded { - m_a /= 2; // Versuchs erneut mit halber Beschleunigung - m_v[1] = sqrt(m_a*S1/2.0); // Geschwindigkeit die notwendig ist damit der Weg zur Zeit erreicht wird + m_a /= 2; // Retry at half acceleration + m_v[1] = sqrt(m_a*S1/2.0); // Speed that is necessary so that the path at the time is reached } - // Jetzt lassen sich die Zeitgrenzen berechnen + // Now the time limits can be calculated m_t1 = 2*m_v[1]/m_a + m_t0; m_t2 = m_t1; m_T = 2*m_t1 - m_t0; @@ -287,37 +288,37 @@ bool path_simulate::ParameterCalculation_Line(double S1) return true; } -/*Parameterberechnung der Geschwindigkeitsfunktion (definiert in path_simulate::GetVelocity()) -für einen Kurvenabschnitt der Länge . Aufruf muss stets vor der Funktion path_simulate::GetVelocity() erfolgen*/ +/* Parameter calculation of the speed function (defined in path_simulate::GetVelocity()) +for a curve section of length . The call must always be made before the path_simulate::GetVelocity() function */ bool path_simulate::ParameterCalculation_Curve(double S1) { - // Berechnung der Zeitgrenzen + // Calculating the time limits m_t1 = m_t0 + 2*(abs(m_v[1]-m_v[0]))/m_a; m_t2 = m_t1; m_T = m_t1 + 2*(abs(m_v[1]-m_v[2]))/m_a; double tmp, v_tmp; - tmp = GetDistance(m_T); // liefert den Weg zurück, der unter den gegebenen Parametereinstellungen, - // zum hoch- und runterbeschleunigen, midestens notwendig ist + tmp = GetDistance(m_T); // returns the path that, under the given parameter settings, + // to accelerate up and down, at least is necessary - if (tmp <= S1) // d.h. der Weg reicht aus + if (tmp <= S1) // i.e. the path is sufficient { - m_t2 = m_t1 + (S1 - tmp)/m_v[1]; // zwischen und wird die Kurve mit der konstanten - // Geschwindigkeit durchlaufen + m_t2 = m_t1 + (S1 - tmp)/m_v[1]; // between and the curve is traversed + // at the constant speed } - else // Weg reicht nicht aus -> Parameterkorrektur + else // Path is not sufficient -> parameter correction { - // Berechne Geschwindigkeit die mindestenns notwendig ist damit der Weg zur Zeit erreicht wird + // Calculate the speed that is at least necessary so that the path at time is reached m_v[1] = sqrt((m_a*S1 + m_v[0]*m_v[0] + m_v[2]*m_v[2])/2.0); m_t1 = m_t0 + 2*(abs(m_v[1]-m_v[0]))/m_a; m_t2 = m_t1; - - // hier wird evtl. eine Korrektur notwendig + + // a correction may be required here if(m_v[1] > m_vmax) { m_v[1] = m_vmax; - - // ab hier wieder analog zu oben + + // from here on again as above m_t1 = m_t0 + 2*(abs(m_v[1]-m_v[0]))/m_a; m_t2 = m_t1; m_T = m_t1 + 2*(abs(m_v[1]-m_v[2]))/m_a; @@ -331,12 +332,11 @@ bool path_simulate::ParameterCalculation_Curve(double S1) else { v_tmp = (m_vmax - std::min(m_v[1],m_v[2]))/2.0; - - while(tmp > S1) // hier wird die Geschwindigkeit solange in Richtung vekleinert bis - // der Weg schließlich ausreicht - { + + while(tmp > S1) // here the speed is reduced in the direction + { // until the path is sufficient m_v[1] = std::min(m_v[1],m_v[2]) + v_tmp; - + m_t1 = m_t0 + 2*(abs(m_v[1]-m_v[0]))/m_a; m_t2 = m_t1; m_T = m_t1 + 2*(abs(m_v[1]-m_v[2]))/m_a; @@ -349,12 +349,12 @@ bool path_simulate::ParameterCalculation_Curve(double S1) } } - m_T = m_t2 + 2*(abs(m_v[1]-m_v[2]))/m_a; // Endzeit lässt sich jetzt berechnen + m_T = m_t2 + 2*(abs(m_v[1]-m_v[2]))/m_a; // End time can now be calculated return true; } -/* setzt die Outputvektoren und den Beschleunigungsparameter zurück. Die Startzeit wird aktualisiert*/ +// resets the output vectors and the acceleration parameter . The start time is updated bool path_simulate::UpdateParam() { m_Output.clear(); @@ -362,66 +362,66 @@ bool path_simulate::UpdateParam() m_Output_time.clear(); m_Output_time2.clear(); - m_t0 = m_T; // Endzeit des letzten Durchlaufs wird zur neuen Startzeit + m_t0 = m_T; // The end time of the last run will become the new start time m_a = m_amax; return true; } -/* Hilfsfunktion für die Zustellung. Rückgabewert legt fest ob zuerst in z- oder in xy-Richtung zugestellt wird*/ +/* Auxiliary function for the delivery. Return value defines whether delivery is first made in the z or xy direction*/ bool path_simulate::CheckConnect() { gp_Pnt tmp; - // ab dem 2. lauf + // from the 2nd run if (m_it1 != m_BSplineTop.begin() || m_it2 != m_BSplineBottom.begin()) { m_StartPnts1.clear(); m_StartPnts2.clear(); - // Berechne neue Verbindungspunkte für die Zustellung - MASTER - + // Calculate new connecting points for the delivery - MASTER - m_it1--; - (*m_it1)->D0((*m_it1)->LastParameter(),tmp); // Speichert Endpunkt der vorigen Master-Kurve in - m_StartPnts1.push_back(tmp); // Pushe Endpunkt der vorigen Master-Kurve + (*m_it1)->D0((*m_it1)->LastParameter(),tmp); // Saves the end point of the previous Master curve in + m_StartPnts1.push_back(tmp); // Push end point of previous Master curve m_it1++; - (*m_it1)->D0((*m_it1)->FirstParameter(),tmp); // Speichert Startpunkt der vorigen Master-Kurve in - m_StartPnts1.push_back(tmp); // Pushe Startpunkt der aktuellen Master-Kurve + (*m_it1)->D0((*m_it1)->FirstParameter(),tmp); // Saves the starting point of the previous Mlave curve in + m_StartPnts1.push_back(tmp); // Push start point of the current Master curve - if (m_single == false) // Falls beidseitig gefahren wird, mache dasselbe, wie für den Slave (s.o.) + if (m_single == false) // If both sides are driven, do the same as for the slave (see above) { - // Berechne neue Verbindungspunkte für die Zustellung - SLAVE - + // Calculate new connecting points for the delivery - SLAVE - m_it2--; - (*m_it2)->D0((*m_it2)->LastParameter(),tmp); // Speichert Startpunkt der vorigen Slave-Kurve in - m_StartPnts2.push_back(tmp); // Pushe Endpunkt der vorigen Slave-Kurve + (*m_it2)->D0((*m_it2)->LastParameter(),tmp); // Saves the starting point of the previous Slave curve in + m_StartPnts2.push_back(tmp); // Push end point of previous Slave curve m_it2++; (*m_it2)->D0((*m_it2)->FirstParameter(),tmp); // Speichert Startpunkt der aktuellen Slave-Kurve in - m_StartPnts2.push_back(tmp); // Pushe Startpunkt der aktuellen Slave-Kurve + m_StartPnts2.push_back(tmp); // Push start point of the current Slave curve } } else { - return true; // Erste zustellung immer gleich (in negativer z-Richtung) + return true; // The first delivery is always the same (in the negative z-direction) } - if (m_StartPnts1[0].Z() - m_StartPnts1[1].Z() >= 0.0) return true; // Zustellung in negativer z-Richtung - else return false; // Zustellung in positiver z-Richtung + if (m_StartPnts1[0].Z() - m_StartPnts1[1].Z() >= 0.0) return true; // Infeed in the negative z-direction + else return false; // Infeed in the positive z-direction } -/* Hilfsfunktion für die Zustellung. Rückgabewert legt fest ob zuerst in z- oder in xy-Richtung zugestellt wird*/ +/* Auxiliary function for the delivery. Return value defines whether delivery is first made in the z or xy direction*/ bool path_simulate::CheckConnect(bool tool) { gp_Pnt tmp; - // ab dem 2. lauf + // from the 2nd run if (m_it1 != m_BSplineTop.begin() || m_it2 != m_BSplineBottom.begin()) { - if (m_Feat == true) // Für den Feature-Basierten Fall werden die Zustellungen von Master und Slave seperat behandelt + if (m_Feat == true) // For the feature-based case, the deliveries from Master and Slave are treated separately { if (!tool) { @@ -430,12 +430,12 @@ bool path_simulate::CheckConnect(bool tool) m_it1--; (*m_it1)->D0((*m_it1)->LastParameter(),tmp); - m_StartPnts1.push_back(tmp); // Startpunkt + m_StartPnts1.push_back(tmp); // Start point m_it1++; (*m_it1)->D0((*m_it1)->FirstParameter(),tmp); - m_StartPnts1.push_back(tmp); // Zielpunkt + m_StartPnts1.push_back(tmp); // Target point if(m_StartPnts1[0].Z() - m_StartPnts1[1].Z() >= 0.0) return true; else return false; @@ -447,55 +447,55 @@ bool path_simulate::CheckConnect(bool tool) m_it2--; (*m_it2)->D0((*m_it2)->LastParameter(),tmp); m_it2++; - m_StartPnts2.push_back(tmp); // Startpunkt + m_StartPnts2.push_back(tmp); // Start point (*m_it2)->D0((*m_it2)->FirstParameter(),tmp); - m_StartPnts2.push_back(tmp); // Zielpunkt + m_StartPnts2.push_back(tmp); // Target point if(m_StartPnts2[0].Z() - m_StartPnts2[1].Z() >= 0.0) return true; else return false; } } - // Ab hier: Berechnung der Zustellungsvektoren für die synchrone Zustellung von Master und Slave + // From here: Calculation of the infeed vectors for the synchronous infeed of Master and Slave m_StartPnts1.clear(); m_StartPnts2.clear(); - // Berechne neue Verbindungspunkte für die Zustellung - MASTER + // Calculate new connecting points for the delivery - MASTER m_it1--; (*m_it1)->D0((*m_it1)->LastParameter(),tmp); - m_StartPnts1.push_back(tmp); // Startpunkt - + m_StartPnts1.push_back(tmp); // Start point + m_it1++; - + (*m_it1)->D0((*m_it1)->FirstParameter(),tmp); - m_StartPnts1.push_back(tmp); // Zielpunkt + m_StartPnts1.push_back(tmp); // Target point if (m_single == false) { - // Berechne neue Verbindungspunkte für die Zustellung - SLAVE + // Calculate new connecting points for the delivery - SLAVE m_it2--; (*m_it2)->D0((*m_it2)->LastParameter(),tmp); - m_StartPnts2.push_back(tmp); // Startpunkt + m_StartPnts2.push_back(tmp); // Start point m_it2++; (*m_it2)->D0((*m_it2)->FirstParameter(),tmp); - m_StartPnts2.push_back(tmp); // Zielpunkt + m_StartPnts2.push_back(tmp); // Target point } } else { - return true; // erste Zustellung immer gleich + return true; // The first delivery is always the same } if (m_StartPnts1[0].Z() - m_StartPnts1[1].Z() >= 0.0) return true; else return false; } -/* Füllt die Outputvektoren für die erste Zustellung. Der Eingabeparameter legt den Ausgabetyp fest*/ +/* Fills the output vectors for the first delivery. The input parameter defines the type of output*/ bool path_simulate::ConnectPaths_xy(bool brob) { int N; @@ -508,7 +508,7 @@ bool path_simulate::ConnectPaths_xy(bool brob) gp_Pnt tmpPnt, pnt1, pnt2, p; gp_Vec vec_t(m_StartPnts1[0], m_StartPnts1[1]); - if( 1e-3 > vec_t.Magnitude()) // keine Zustellung erforderlich + if( 1e-3 > vec_t.Magnitude()) // no delivery necessary return true; if (m_single == false) @@ -516,13 +516,13 @@ bool path_simulate::ConnectPaths_xy(bool brob) gp_Vec vec_1(m_StartPnts1[0], m_StartPnts1[1]); gp_Vec vec_2(m_StartPnts2[0], m_StartPnts2[1]); - gp_Vec2d vec_11, // Speichert Master-Zustellung in XY-Richtung - vec_21; // Speichert Master-Zustellung in Z-Richtung + gp_Vec2d vec_11, // Saves Master infeed in the XY-direction + vec_21; // Saves Master infeed in the Z-direction vec_11.SetX(vec_1.X()); vec_11.SetY(vec_1.Y()); - if (m_it1 == m_BSplineTop.begin() && m_it2 == m_BSplineBottom.begin()) // erster lauf -> xy zustellung (Slave) + if (m_it1 == m_BSplineTop.begin() && m_it2 == m_BSplineBottom.begin()) // first run -> xy delivery (Slave) { vec_21.SetX(vec_2.X()); vec_21.SetY(vec_2.Y()); @@ -530,25 +530,25 @@ bool path_simulate::ConnectPaths_xy(bool brob) else { vec_21.SetX(0.0); - vec_21.SetY(vec_2.Z()); // slave zustellung in z-Richtung (ab 2.Lauf) + vec_21.SetY(vec_2.Z()); // slave delivery in the z-direction (from 2nd run) } - // Simulationsoutput + // Simulation output if (brob == false) { - // ***** MASTER ****** + // ***** MASTER ****** ParameterCalculation_Line(vec_11.Magnitude()); if (vec_11.Magnitude() != 0) vec_11.Normalize(); - N = std::max(2, int(ceil((m_T - m_t0)/m_step))); // Anzahl der zu erzeugenden Outputwerte - m_del_t = (m_T - m_t0)/N; // Zeitschrittweite + N = std::max(2, int(ceil((m_T - m_t0)/m_step))); // Number of output values to be generated + m_del_t = (m_T - m_t0)/N; // Time increment for (int i=0; i der Punkte für die Diskretisierung der Zustellungslinie berechnet + // calculate the number of the points for the discretization of the infeed line if (vec_11.Magnitude() > vec_21.Magnitude()) N = std::max(2, int(ceil(vec_21.Magnitude()/TolDist))); - else N = std::max(2, int(ceil(vec_11.Magnitude()/TolDist))); + else N = std::max(2, int(ceil(vec_11.Magnitude()/TolDist))); if (vec_11.Magnitude() == 0.0 && vec_21.Magnitude() == 0.0) N=0; if (!m_conn) con = true; - // Erster Punkt wird stets weggelassen + // The first point is always omitted if (m_it1 == m_BSplineTop.begin() && m_it2 == m_BSplineBottom.begin()) { - // Startpunkt Master + // Start point Master tmp.x = m_StartPnts1[0].X(); tmp.y = m_StartPnts1[0].Y(); tmp.z = m_StartPnts1[0].Z(); @@ -634,16 +634,16 @@ bool path_simulate::ConnectPaths_xy(bool brob) m_Output_robo1.push_back(tmp); RoboFlag_Master.push_back(0); - // Startpunkt Slave + // Start point Slave tmp.x = m_StartPnts2[0].X(); tmp.y = m_StartPnts2[0].Y(); tmp.z = m_StartPnts2[0].Z(); - + m_Output_robo2.push_back(tmp); RoboFlag_Slave.push_back(0); } - // Erzeuge Output - MASTER + // Generate Output - MASTER for (int i=1; i legt den Ausgabetyp fest*/ +/* Fills out the output vectors for the second delivery. The input parameter defines the output type*/ bool path_simulate::ConnectPaths_z(bool brob) { int N; @@ -781,12 +781,12 @@ bool path_simulate::ConnectPaths_z(bool brob) if (vec_11.Magnitude() != 0) vec_11.Normalize(); - N = std::max(2, int(ceil((m_T - m_t0)/m_step))); // Anzahl der zu erzeugenden Outputwerte - m_del_t = (m_T - m_t0)/N; // Zeitschrittweite + N = std::max(2, int(ceil((m_T - m_t0)/m_step))); // Number of output values to be generated + m_del_t = (m_T - m_t0)/N; // Time increment for (int i=0; i vec_12.Magnitude()) std::max(2, N = int(ceil(vec_12.Magnitude()/TolDist))); // Anzahl der zu erzeugenden Outputwerte - else std::max(2, N = int(ceil(vec_11.Magnitude()/TolDist))); // Anzahl der zu erzeugenden Outputwerte + if (vec_11.Magnitude() > vec_12.Magnitude()) std::max(2, N = int(ceil(vec_12.Magnitude()/TolDist))); // Number of output values to be generated + else std::max(2, N = int(ceil(vec_11.Magnitude()/TolDist))); // Number of output values to be generated if (vec_11.Magnitude() == 0.0 && vec_12.Magnitude() == 0.0) N=1; for (int i=1; i legt den Ausgabetyp fest*/ +/* Fills in the output vectors for the delivery for the feature-based case. +The input parameter defines the type of output*/ bool path_simulate::ConnectPaths_Feat(bool tool, // Tool (Master, Slave) - bool brob, // Ausgabetyp (Roboter, Simulation) - bool c_typ) // Zustellungsart (in zwei bzw. drei Schritten) + bool brob, // Output type (Robot, Simulation) + bool c_typ) // Delivery type (in two or three steps) { int N, ind; double rad, t; @@ -978,7 +977,7 @@ bool path_simulate::ConnectPaths_Feat(bool tool, // Tool (Master, Sla std::vector tmp2; double vel; - dir = CheckConnect(tool); // setze Starpunkte neu + dir = CheckConnect(tool); // set new starting points if (!tool) { @@ -991,13 +990,13 @@ bool path_simulate::ConnectPaths_Feat(bool tool, // Tool (Master, Sla rad = m_set.slave_radius; } - if (c_typ) // Zustellung in 2 Schritten + if (c_typ) // Delivery in 2 steps { ind = 2; vec_tmp[0].SetCoord(0.0, 0.0, abs(ConnPnts[1].Z()-ConnPnts[0].Z())); vec_tmp[1].SetCoord(ConnPnts[1].X()-ConnPnts[0].X(), ConnPnts[1].Y()-ConnPnts[0].Y(), 0.0); - if (dir) // tool (Master/Slave) muss runter fahren + if (dir) // tool (Master/Slave) must go down { if (!tool) { @@ -1010,7 +1009,7 @@ bool path_simulate::ConnectPaths_Feat(bool tool, // Tool (Master, Sla vec[1] = vec_tmp[1]; } } - else // tool (Master/Slave) muss hoch fahren + else // tool (Master/Slave) must go up { if (!tool) { @@ -1024,7 +1023,7 @@ bool path_simulate::ConnectPaths_Feat(bool tool, // Tool (Master, Sla } } } - else // Zustellung in 3 Schritten + else // Delivery in 3 steps { ind = 3; @@ -1032,7 +1031,7 @@ bool path_simulate::ConnectPaths_Feat(bool tool, // Tool (Master, Sla vec_tmp[1].SetCoord(ConnPnts[1].X()-ConnPnts[0].X(), ConnPnts[1].Y()-ConnPnts[0].Y(), 0.0); vec_tmp[2].SetCoord(0.0, 0.0, abs(ConnPnts[1].Z()-ConnPnts[0].Z()) + rad); - if (dir) // tool (Master/Slave) muss runter fahren + if (dir) // tool (Master/Slave) must go down { if (!tool) { @@ -1047,7 +1046,7 @@ bool path_simulate::ConnectPaths_Feat(bool tool, // Tool (Master, Sla vec[2] = vec_tmp[0]; } } - else // tool (Master/Slave) muss hoch fahren + else // tool (Master/Slave) must go up { if (!tool) { @@ -1064,11 +1063,11 @@ bool path_simulate::ConnectPaths_Feat(bool tool, // Tool (Master, Sla } } - if (brob) // Roboteroutput + if (brob) // Robot output { for (int i=0; i eine Unterteilung der Kurve vorgenommen. -Die Bereichsgrenzen werden im Rückgabevektor zurückgeliefert. Der Ausgabevektor ist leer wenn die maximale Krümmung -den Toleranzwert nicht überschreitet und somit auch keine Unterteilung notwendig ist */ +/* The curve is subdivided here, taking into account the curvature tolerance. +The range limits are returned in the return vector. The output vector is empty when the maximum curvature +does not exceed the tolerance value and therefore no subdivision is necessary */ std::vector > path_simulate::CompBounds(bool tool,std::vector knots) { - m_curMax = 0.0; // setze maximale Krümmung initial auf Null + m_curMax = 0.0; // set maximum curvature initially to zero double cr_bound = 1/curvTOL; double cr_last; gp_Vec dtmp1, dtmp2; @@ -1156,25 +1155,25 @@ std::vector > path_simulate::CompBounds(bool tool,std::vecto std::vector bounds; std::vector > CriticalBounds; - // lade aktuelle Kurve + // load current curve if (!tool) curve.Load(*m_it1); else curve.Load(*m_it2); - double fParam = curve.FirstParameter(), // Erster Kurvenparameter - lParam = curve.LastParameter(), // Letzter Kurvenparameter - period = lParam - fParam; // Länge des Parameterbereichs - + double fParam = curve.FirstParameter(), // First curve parameter + lParam = curve.LastParameter(), // Last curve parameter + period = lParam - fParam; // Length of the parameter range - int n = knots.size(); // Länge des Knotenvektors + + int n = knots.size(); // Length of the knot vector bool b = false; - // Hier erfolgt die Berechnung der maximalen Krümmung - // Die Parameter der Bereichsgrenzen an denen die Kurvenkrümmung dem Toleranzwert - // entspricht werden in den Vektor für die weitere Nachbearbeitung gefüllt + // The maximum curvature is calculated here + // The parameters of the range limits at which the curvature of the curve corresponds to the tolerance + // value corresponds to are filled into the vector for further post-processing for (int i=0; i= cr_bound && !b) { if(knots[i] >= m_boundTol && knots[i] < lParam - m_boundTol) @@ -1209,19 +1208,19 @@ std::vector > path_simulate::CompBounds(bool tool,std::vecto b = false; } - cr_last = dtmp2.Magnitude(); // Krümmung entspricht hier dem Betrag der zweiten Ableitung - - if(m_curMax < cr_last) // Speichert maximale Krümmung + cr_last = dtmp2.Magnitude(); // The curvature here corresponds to the amount of the second derivative + + if(m_curMax < cr_last) // Stores maximum curvature m_curMax = cr_last; } if(period < 2*m_boundTol || bounds.size() == 0) return CriticalBounds; - if(b) bounds.push_back(lParam - m_boundTol); // Hier muss evtl. noch die letzte Grenze eingefügt werden + if(b) bounds.push_back(lParam - m_boundTol); // The last limit may have to be added here - n = (int) bounds.size()/2; // hat stets gerade Länge - for(int i=0; i haben zusammen + n = (int) bounds.size()/2; // is always of even length + for(int i=0; i { single_bound.push_back(bounds[2*i]); @@ -1236,14 +1235,14 @@ std::vector > path_simulate::CompBounds(bool tool,std::vecto return CriticalBounds; } -/* Hier wird die Vorarbeit für die Funktion Gen_Path() geleistet. -Die Vektoren , , werden für die aktuelle Kurve gefüllt.*/ +/* This is where the preparatory work for the Gen_Path () function is done. +The vectors , , are filled for the current curve. */ bool path_simulate::CompPath(bool tool) // tool = 0 -> Master // tool = 1 -> Slave { - m_boundTol = pow(m_vmax, 2.0)/m_amax; // Toleranzbereich vor kritischen Bereichen (notwendig zum Hochbeschleunigen) + m_boundTol = pow(m_vmax, 2.0)/m_amax; // Tolerance range in front of critical areas (necessary for high acceleration) - double cur = 1.0/curvTOL, // Krümmungstoleranz für die Kurvenunterteilung + double cur = 1.0/curvTOL, // Curvature tolerance for curve division pos = 0.0, cur_tmp = 0.0; @@ -1267,27 +1266,27 @@ bool path_simulate::CompPath(bool tool) // tool = 0 -> Master double d2, velo, tetha, len, len_1; - - double t0 = m_t0; // Übergibt aktuelle Startzeit - int num = Detect_FeatCurve(tool); // Liefert Anzahl der zu fahrenden Kurven (i.d.R. num = 1) - - for(int a=0; aNbKnots(); @@ -1305,23 +1304,22 @@ bool path_simulate::CompPath(bool tool) // tool = 0 -> Master for(int i=0; iLength(); i++) knot_vec[i] = m_Knots->Value(i); - // *** Ende der Berechnung des Knotenvektors *** + // *** End of the calculation of the Knot vectors *** - std::vector > CriticalBounds = - CompBounds(tool, knot_vec); // Berechnet auf Basis der aktuellen Kurve, - // die kritischen Bereiche im Parameterraum und - // berechnet gleichzeitig die maximale Kurvenkrümmung - - m_vmid = std::min(m_vmax,sqrt(m_amax/m_curMax)); // Legt Geschwindigkeit fest mit der allen kritischen Bereiche - // abgefahren werden + std::vector > CriticalBounds = + CompBounds(tool, knot_vec); // Calculated on the basis of the current curve, + // the critical areas in the parameter space and + // simultaneously calculates the maximum curvature -Newtry: // Falls die generierten Weglängen nicht ausreichen, dann wird ein neuer Versuch mit halbem gestartet - - v[0] = 0.0; // starte jede Kurve mit v = 0 + m_vmid = std::min(m_vmax,sqrt(m_amax/m_curMax)); // Defines the speed with which all critical areas are traveled + +Newtry: // If the generated path lengths are insufficient, a new attempt is started with half the + + v[0] = 0.0; // start every curve with v = 0 int m = 0; - for (unsigned int i=0; iValue(m); @@ -1332,25 +1330,25 @@ Newtry: // Falls die generierten Weglängen nicht ausreichen, dann wird ein neue pos = m_Knots->Value(m); } - /*------------------- Gerader Bereich ---------------------*/ + /*------------------- Straight section ---------------------*/ - while(pos < CriticalBounds[i][0]) // Berechnung der maximalen Krümmung dieses geraden Bereichs + while(pos < CriticalBounds[i][0]) // Calculate the maximum curvature of this straight section { curve.D2(pos, pnt0, pnt1, pnt2); - cur_tmp = pnt2.Magnitude(); // Krümmung am aktuellen Punkt + cur_tmp = pnt2.Magnitude(); // Curvature at the current point if(d2 < cur_tmp) - d2 = cur_tmp; // Speichert maximale Krümmung dieses geraden Bereichs + d2 = cur_tmp; // Stores maximum curvature dieses geraden Bereichs m++; pos = m_Knots->Value(m); } - tetha = 0.6 + 0.25*sqrt(d2/m_curMax); // Setzt tetha-parameter -> (0.6 < tetha < 0.85) - velo = std::min(m_vmax, tetha*(sqrt(m_amax/d2))); // Setzt maximale Geschwindigkeit - m_a = m_amax - d2*velo*velo; // wenn zu groß gewählt wurde, kann evtl. negativ werden + tetha = 0.6 + 0.25*sqrt(d2/m_curMax); // Set tetha parameter -> (0.6 < tetha < 0.85) + velo = std::min(m_vmax, tetha*(sqrt(m_amax/d2))); // Sets maximum speed + m_a = m_amax - d2*velo*velo; // if was chosen too large, can possibly become negative - // Korrektur + // Correction while(m_a <= 0.0) { velo = velo/2.0; @@ -1362,19 +1360,19 @@ Newtry: // Falls die generierten Weglängen nicht ausreichen, dann wird ein neue v[1] = velo; - /*-------------- Korrektur der Geschwindigkeiten (falls der Weg zu lang) -------------*/ + /*-------------- Correction of the speeds (if the path is too long) -------------*/ - len = CriticalBounds[i][0] - m_StartParam[tool]; // Länge des i. geraden Abschnitts - len_1 = (pow(v[1] - v[0],2.0) + pow(v[1] - m_vmid,2.0))/m_a; // notwendige Länge + len = CriticalBounds[i][0] - m_StartParam[tool]; // Length of the i. straight section + len_1 = (pow(v[1] - v[0],2.0) + pow(v[1] - m_vmid,2.0))/m_a; // necessary length - if(len < pow(v[0] - m_vmid,2.0)/m_a) // für diesen Fall ist keine Korrektur möglich + if(len < pow(v[0] - m_vmid,2.0)/m_a) // no correction is possible in this case { l_vec.clear(); v_vec.clear(); a_vec.clear(); - m_StartParam[tool] = start; // setze Startparameter zurück - m_vmid = m_vmid/2; // halbiere kritische Durchlaufgeschwindigkeit + m_StartParam[tool] = start; // reset start parameters + m_vmid = m_vmid/2; // halve critical throughput speed goto Newtry; } @@ -1386,27 +1384,27 @@ Newtry: // Falls die generierten Weglängen nicht ausreichen, dann wird ein neue v[2] = m_vmid; - /*---Korrekturende---*/ + /*---Correction end---*/ - // Fülle Vektoren - l_vec.push_back(len); // Länge - v_vec.push_back(v); // Geschwindigkeiten - a_vec.push_back(m_a); // Beschleunigung - - m_StartParam[tool] += len; // setzt Startparameter neu + // Fülle Vektoren + l_vec.push_back(len); // Length + v_vec.push_back(v); // Speeds + a_vec.push_back(m_a); // Acceleration - /*------------------------ gekrümmter Bereich ------------------------*/ + m_StartParam[tool] += len; // Sets new start parameters + + /*------------------------ curved area ------------------------*/ + + len = CriticalBounds[i][1] - CriticalBounds[i][0]; // Arc length of the curved area + m_StartParam[tool] += len; // Sets new start parameters + v[0] = v[2]; // End speed becomes the start speed - len = CriticalBounds[i][1] - CriticalBounds[i][0]; // Bogenlänge des gekrümmten Bereichs - m_StartParam[tool] += len; // setzt Startparameter neu - v[0] = v[2]; // Endgeschwindigkeit wird zur Startgeschwindigkeit - l_vec.push_back(len); } d2 = 0; - - // Korrigiere aktuellen Knotenparameter + + // Correct the current knot parameter while(pos < m_StartParam[tool]) { m++; @@ -1414,30 +1412,30 @@ Newtry: // Falls die generierten Weglängen nicht ausreichen, dann wird ein neue } pos = m_Knots->Value(m); - - // Berechnung der maximalen Krümmung für den letzten Abschnitt + + // Calculation of the maximum curvature for the last section while(pos < lParam) - { + { curve.D2(pos, pnt0, pnt1, pnt2); - + Pnt1.x = pnt2.X(); Pnt1.y = pnt2.Y(); Pnt1.z = pnt2.Z(); - + if(d2 < Pnt1.Length()) d2 = Pnt1.Length(); m++; pos = m_Knots->Value(m); } - tetha = 0.6 + 0.25*sqrt(d2/m_curMax); // 0.6 < tetha < 0.85 - velo = std::min(m_vmax, tetha*(sqrt(m_amax/d2))); // vgl. oben - + tetha = 0.6 + 0.25*sqrt(d2/m_curMax); // 0.6 < tetha < 0.85 + velo = std::min(m_vmax, tetha*(sqrt(m_amax/d2))); // see above + v[1] = velo; v[2] = 0.0; - m_a = m_amax - d2*velo*velo; // wenn velo zu groß gewählt wurde, kann m_a negativ werden + m_a = m_amax - d2*velo*velo; // if velo is too large, m_a can become negative - // Korrektur + // Correction while(m_a <= 0.0) { velo = velo/2.0; @@ -1447,17 +1445,17 @@ Newtry: // Falls die generierten Weglängen nicht ausreichen, dann wird ein neue d2 = 0; - len = lParam - m_StartParam[tool] + start; // Länge des letzten geraden Abschnitts - len_1 = (pow(v[1] - v[0],2.0) + pow(v[1],2.0))/m_a; // notwendige Länge + len = lParam - m_StartParam[tool] + start; // Length of the last straight section + len_1 = (pow(v[1] - v[0],2.0) + pow(v[1],2.0))/m_a; // required length - if(len < pow(v[0],2.0)/m_a) // hier keine Korrektur möglich + if(len < pow(v[0],2.0)/m_a) // no correction possible here { l_vec.clear(); v_vec.clear(); a_vec.clear(); - m_StartParam[tool] = start; // setze Startparameter zurück - m_vmid = m_vmid/2; // halbiere kritische Durchlaufgeschwindigkeit und versuchs erneut + m_StartParam[tool] = start; // reset start parameters + m_vmid = m_vmid/2; // halve critical speed and try again goto Newtry; } @@ -1468,11 +1466,11 @@ Newtry: // Falls die generierten Weglängen nicht ausreichen, dann wird ein neue } // Fülle Vektoren - l_vec.push_back(len); // Länge - v_vec.push_back(v); // Geschwindigkeiten + l_vec.push_back(len); // Length + v_vec.push_back(v); // Speeds a_vec.push_back(m_a); // Beschleunignung - - // Fülle hier erst die Ausgabevektoren (einmal pro Kurve) + + // First fill the output vectors here (once per curve) if(tool) { m_length_sl.push_back(l_vec); @@ -1486,7 +1484,7 @@ Newtry: // Falls die generierten Weglängen nicht ausreichen, dann wird ein neue m_accel_ma.push_back(a_vec); } - // lade aktuelle kurven + // load current curves if (!tool) m_it1++; else m_it2++; @@ -1498,9 +1496,9 @@ Newtry: // Falls die generierten Weglängen nicht ausreichen, dann wird ein neue curve.Delete(); CriticalBounds.clear(); - } + } - // Setze Iterator und Startparameter wieder zurück + // Reset iterator and start parameters if (!tool) { for(int i=0; i abgelegt + // Here the numerical integration of the output vector takes place according to the + // trapezoidal rule and the resulting error vector is stored in if (tool==false) // Master { N = m_Output.size(); @@ -1544,7 +1542,7 @@ bool path_simulate::Correction(bool tool) Sum[2] += (m_Output[i][0].z + m_Output[i-1][0].z)*(m_Output_time[i] - m_Output_time[i-1]) / 2.0; } - if(m_StartPnts1[0].Distance(m_StartPnts1[1]) > 1e-3) // falls Kurve NICHT geschlossen + if(m_StartPnts1[0].Distance(m_StartPnts1[1]) > 1e-3) // if curve is NOT closed { vec.SetCoord(Sum[0],Sum[1],Sum[2]); vec.SetCoord(m_StartPnts1[1].X() - m_StartPnts1[0].X() - vec.X(), @@ -1564,7 +1562,7 @@ bool path_simulate::Correction(bool tool) Sum[2] += (m_Output2[i][0].z + m_Output2[i-1][0].z)*(m_Output_time2[i] - m_Output_time2[i-1]) / 2.0; } - if(m_StartPnts2[0].Distance(m_StartPnts2[1]) > 1e-3) // falls Kurve NICHT geschlossen + if(m_StartPnts2[0].Distance(m_StartPnts2[1]) > 1e-3) // if curve is NOT closed { vec.SetCoord(Sum[0],Sum[1],Sum[2]); vec.SetCoord(m_StartPnts2[1].X() - m_StartPnts2[0].X() - vec.X(), @@ -1575,12 +1573,12 @@ bool path_simulate::Correction(bool tool) vec.SetCoord(-Sum[0],-Sum[1],-Sum[2]); } - ParameterCalculation_Line(vec.Magnitude()); // Berechnung der Zeitgrenzen + ParameterCalculation_Line(vec.Magnitude()); // Calculating the time limits - N = (int) ceil((m_T - m_t0)/m_step); // Anzahl der zu erzeugenden Outputwerte - m_del_t = (m_T - m_t0)/N; // Zeitschrittweite + N = (int) ceil((m_T - m_t0)/m_step); // Number of output values to be generated + m_del_t = (m_T - m_t0)/N; // Time increment - if (N==1) // Nur ein Outputvektor + if (N==1) // One output vector only { m_T = m_t0 + 2e-3; @@ -1601,8 +1599,8 @@ bool path_simulate::Correction(bool tool) tmp2.push_back(tmp); - if(tool==false) m_Output.push_back(tmp2); // füllt Master-Output - else m_Output2.push_back(tmp2); // füllt Slave-Output + if(tool==false) m_Output.push_back(tmp2); // fills Master-Output + else m_Output2.push_back(tmp2); // fills Slave-Output tmp2.clear(); @@ -1630,7 +1628,7 @@ bool path_simulate::Correction(bool tool) // MASTER vel = GetVelocity(t); - // Ausgabevektor zum Zeitpunkt + // Output vector at the point in time tmp.x = vec.X()*vel; tmp.y = vec.Y()*vel; tmp.z = vec.Z()*vel; @@ -1645,14 +1643,14 @@ bool path_simulate::Correction(bool tool) } } - // Nullvektor + // Null vector tmp.x = 0.0; tmp.y = 0.0; tmp.z = 0.0; tmp2.push_back(tmp); - // Übergebe Nullvektor zur Endzeit + // Pass null vector at end time if (tool==false) { m_Output.push_back(tmp2); @@ -1666,173 +1664,173 @@ bool path_simulate::Correction(bool tool) return true; } -// Hier wird der eigentliche Output für den Simulationsprozess generiert unter der Berücksichtigung -// der in CompPath() berechneten Vektoren m_velocity, m_accel, m_length +// This is where the actual output for the simulation process is generated, taking into account +// the vectors calculated in CompPath() m_velocity, m_accel, m_length bool path_simulate::Gen_Path() { - int n,m; - double length, lam, t_start, t_ma, t_sl, t_tmp; + int n,m; + double length, lam, t_start, t_ma, t_sl, t_tmp; - t_start = m_t0; // setze Startzeit - m_StartPnts1[0] = (*m_it1)->StartPoint(); // setze Startparameter + t_start = m_t0; // Set start time + m_StartPnts1[0] = (*m_it1)->StartPoint(); // Set Start parameters if(m_single == false) { m_StartPnts2[0] = (*m_it2)->StartPoint(); -/*------------------------------ Berechne Durchlaufzeit für das Master-Tool --------------------------------*/ +/*------------------------------ Calculate lead time for the Master tool --------------------------------*/ n = m_velocity_ma.size(); - for(int i=0; i berechnet + length = m_length_sl[i][2*j]; // Length of the non-critical section + // Note: Every curve starts and ends in a non-critical section + ParameterCalculation_Curve(length);// Among other things, the end time is calculated here if(j != m-1) { - length = m_length_sl[i][2*j+1];// Länge des kritischen Abschnitts - m_T = m_T + length/m_v[2]; // Berechnet neue Endzeit (kritische Abschnitte werden mit der konstanten - // Geschwindigkeit durchlaufen) - } + length = m_length_sl[i][2*j+1];// Length of the critical section + m_T = m_T + length/m_v[2]; // Calculates new end time (critical sections are run through at + } // the constant speed ) - m_t0 = m_T; // Endzeit wird zur Startzeit + m_t0 = m_T; // End time becomes start time } } - - t_sl = m_T - t_start; // Entspricht Durchlaufzeit für den Slave - m_t0 = t_start; // Setzt Startzeit zurück - -/*----------------------- Synchronisierung von Master und Slave -----------------------------*/ -// Idee: Skaliere die Geschwindigkeiten und Beschleunigungen derjenigen Bahn mit der kürzeren Durchlaufzeit, -// so dass die Durchlaufzeiten für Master und Slave übereinstimmen + t_sl = m_T - t_start; // Corresponds to the processing time for the Slave + m_t0 = t_start; // Resets the start time - - if(t_ma <= t_sl) +/*----------------------- Synchronization of Master and Slave -----------------------------*/ + +// Idea: scale the speeds and accelerations of the path with the shorter processing time, +// so that the processing times for master and slave match + + + if(t_ma <= t_sl) { - // Ab hier: Korrektur für den Master + // From here on: Correction for the master - lam = t_ma/t_sl; // Skalierungsfaktor 0 < lam <= 1 - - // Zunächst werden alle Geschwindigkeiten runterskaliert + lam = t_ma/t_sl; // Scaling factor 0 < lam <= 1 + + // First of all, all speeds are scaled down n = m_velocity_ma.size(); for(int i=0; iFirstParameter(); // Setzt Startparameter der aktuellen Kurve + m_StartParam[0] = (*m_it1)->FirstParameter(); // Sets the start parameters of the current curve m = m_length_ma[i].size(); for(int j=0; jFirstParameter(); m = m_length_sl[i].size(); - // vgl. Master + // see Master for(int j=0; jEndPoint(); // Setzt Endpunkt, notwendig für die folgende Wegkorrektur - Correction(0); // Wegkorrektur für den Master + m_StartPnts1[1] = (*m_it1)->EndPoint(); // Sets the end point, necessary for the following path correction + Correction(0); // Path correction for the Master if(m_single == false) { m_t0 = t_tmp; - m_StartPnts2[1] = (*m_it2)->EndPoint(); // Setzt Endpunkt, notwendig für die folgende Wegkorrektur - Correction(1); // Wegkorrektur für den Slave + m_StartPnts2[1] = (*m_it2)->EndPoint(); // Sets the end point, necessary for the following path correction + Correction(1); // Path correction for the Slave } m_t0 = t_start; -/*ENDE WEG-KORREKTUR*/ +/*END PATH CORRECTION*/ m_velocity_ma.clear(); @@ -1930,11 +1928,11 @@ bool path_simulate::Gen_Path() return true; } -/* Hier werden die Simulations-Outputvektoren für die jeweiligen Kurvenabschnitte erzeugt */ -bool path_simulate::MakePathSingle(bool brob, // Beschreibt Ausgabeart (Roboter, Simulation) - double length, // Bogenlänge des betrachteten Abschnitts - bool part, // Gibt an ob wir einen kritischen Abschnitt betrachten - bool tool) // Tool (Master, Slave) +/* The simulation output vectors for the respective curve sections are generated here */ +bool path_simulate::MakePathSingle(bool brob, // Describes output type (Robot, Simulation) + double length, // Arc length of the considered section + bool part, // Specifies whether we are looking at a critical section + bool tool) // Tool (Master, Slave) { GeomAdaptor_Curve anAdaptorCurve; double firstParam, lastParam, param, period, d, velo; @@ -1946,8 +1944,8 @@ bool path_simulate::MakePathSingle(bool brob, // Beschreibt Ausgabeart (Robo firstParam = anAdaptorCurve.FirstParameter(); lastParam = anAdaptorCurve.LastParameter(); period = lastParam - firstParam; - - gp_Vec dtmp1, dtmp2; + + gp_Vec dtmp1, dtmp2; gp_Pnt tmp; Base::Vector3d tmp2; std::vector tmp3; @@ -1958,7 +1956,7 @@ bool path_simulate::MakePathSingle(bool brob, // Beschreibt Ausgabeart (Robo { N = std::max(2, (int) ceil(period / double(TolDist))); - for (int i=1; i lastParam) { @@ -2006,13 +2004,13 @@ bool path_simulate::MakePathSingle(bool brob, // Beschreibt Ausgabeart (Robo return true; } - if (part==true) m_T = m_t0 + length/m_v[2]; // kritische Bereiche werden mit konstanter Geschwindigkeit durchlaufen + if (part==true) m_T = m_t0 + length/m_v[2]; // critical areas are traversed at a constant speed else ParameterCalculation_Curve(length); N = std::max(2, (int)((m_T-m_t0)/m_step)); if (N>=100000) - N = 99999; // maximale Anzahl möglicher Outputwerte + N = 99999; // maximum number of possible output values m_del_t = (m_T-m_t0)/double(N); @@ -2024,20 +2022,20 @@ bool path_simulate::MakePathSingle(bool brob, // Beschreibt Ausgabeart (Robo //anAdaptorCurve.D0(m_StartParam[tool],tmp); //pnt2.Set(tmp.X(),tmp.Y(),tmp.Z()); - if (part == true) // kritischer Abschnitt + if (part == true) // critical section { - for (int i=0; i lastParam ){ anAdaptorCurve.D2(param - period, tmp, dtmp1, dtmp2);} else if ( param < firstParam ){ anAdaptorCurve.D2(param + period, tmp, dtmp1, dtmp2);} else { anAdaptorCurve.D2(param, tmp, dtmp1, dtmp2);} @@ -2045,7 +2043,7 @@ bool path_simulate::MakePathSingle(bool brob, // Beschreibt Ausgabeart (Robo //m_times_tmp.push_back(t); //m_velo_tmp.push_back(m_v[2]); - // Ausgabevektor zum Zeitpunkt + // Output vector at the point in time tmp2.x = dtmp1.X()*m_v[2]; tmp2.y = dtmp1.Y()*m_v[2]; tmp2.z = dtmp1.Z()*m_v[2]; @@ -2058,7 +2056,7 @@ bool path_simulate::MakePathSingle(bool brob, // Beschreibt Ausgabeart (Robo tmp3.clear(); /* - if (tool == false) // zeichnet den tatsächlichen Weg nach + if (tool == false) // traces the actual path { pnt1 = pnt2; @@ -2078,27 +2076,27 @@ bool path_simulate::MakePathSingle(bool brob, // Beschreibt Ausgabeart (Robo return true; } - // unkritischer Abschnitt + // uncritical section for (int i=0; i lastParam ){ anAdaptorCurve.D2(param - period, tmp, dtmp1, dtmp2);} else if ( param < firstParam ){ anAdaptorCurve.D2(param + period, tmp, dtmp1, dtmp2);} else { anAdaptorCurve.D2(param, tmp, dtmp1, dtmp2);} - velo = GetVelocity(t); // Berechnet die Geschwindigkeit des Tools zum Zeitpunkt - // bzgl. den Parametern m_t0, m_t1, m_t2, m_T, m_a, m_v[i], i =1,2,3 + velo = GetVelocity(t); // Calculates the speed of the tool at the point in time + // with respect to the parameters m_t0, m_t1, m_t2, m_T, m_a, m_v[i], i =1,2,3 - // Ausgabevektor zum Zeitpunkt + // Output vector at the point in time tmp2.x = dtmp1.X()*velo; tmp2.y = dtmp1.Y()*velo; tmp2.z = dtmp1.Z()*velo; @@ -2110,8 +2108,8 @@ bool path_simulate::MakePathSingle(bool brob, // Beschreibt Ausgabeart (Robo tmp3.clear(); - /* - if (tool == false) // zeichnet den tatsächlichen Weg nach + / + if (tool == false) // traces the actual path { pnt1 = pnt2; @@ -2135,7 +2133,7 @@ bool path_simulate::MakePathSingle(bool brob, // Beschreibt Ausgabeart (Robo return true; } -/* Hauptroutine zur Generierung des Roboteroutputs für den normalen beidseitigen Fall */ +/* Main routine for generating the robot output for the normal two-sided case */ bool path_simulate::MakePathRobot() { ofstream anOutputFile; @@ -2154,33 +2152,33 @@ bool path_simulate::MakePathRobot() anOutputFile2 << "none" << std::endl; } - // Outputgenerierung über alle Kurven + // Output generation across all curves for (m_it1 = m_BSplineTop.begin(); m_it1 != m_BSplineTop.end(); ++m_it1) { m_StartParam[0] = ((*m_it1)->FirstParameter()); if (m_single == false) m_StartParam[1] = ((*m_it2)->FirstParameter()); - /*------ 1.ZUSTELLUNG ------*/ - + /*------ 1.DELIVERY ------*/ + m_conn = CheckConnect(); - + if (m_conn) ConnectPaths_xy(1); else ConnectPaths_z(1); UpdateParam(); - - /*------ 2.ZUSTELLUNG ------*/ - + + /*------ 2.DELIVERY ------*/ + if (m_conn) ConnectPaths_z(1); else ConnectPaths_xy(1); UpdateParam(); - - /*------ KURVE ------*/ - MakePathSingle(1,0,0,0); // Master + /*------ CURVE ------*/ + + MakePathSingle(1,0,0,0); // Master MakePathSingle(1,0,0,1); // Slave UpdateParam(); @@ -2191,7 +2189,7 @@ bool path_simulate::MakePathRobot() int c = 1; - /*--- Schreibe Roboter-Output ---*/ + /*--- Write robot output ---*/ if (m_single==false) { @@ -2210,8 +2208,8 @@ bool path_simulate::MakePathRobot() return true; } -/* Wird nur zu Beginn der Ausschreibung in path_simulate::WriteOurputDouble() aufgerufen und passt die Ausgabevektoren -, so aneinander an, dass die Endzeiten übereinstimmen*/ +// Is only called at the beginning of the writing in path_simulate::WriteOurputDouble() +// and fits the output vectors , in such a way that the end times coincide bool path_simulate::TimeCorrection() { int N; @@ -2220,9 +2218,9 @@ bool path_simulate::TimeCorrection() vecc.push_back(vec); - if (m_single == false) // Eine Zeitkorrektur macht nur für diesen Fall auch Sinn + if (m_single == false) // A time correction makes sense only in this case { - if(m_Output_time.size() == 0 || m_Output_time2.size() == 0) // Sonderbehandlung für diesen Fall + if(m_Output_time.size() == 0 || m_Output_time2.size() == 0) // Special treatment for this case { if(m_Output_time.size() > m_Output_time2.size()) { @@ -2230,7 +2228,7 @@ bool path_simulate::TimeCorrection() N = m_Output_time2.size(); m_Output2.resize(N); - for (int i=0; i Werkzeug hat zu warten) + for (int i=0; i tool has to wait) { m_Output[i] = vecc; } @@ -2251,7 +2249,7 @@ bool path_simulate::TimeCorrection() return true; } - return true; //gibt true zurück wenn beide Outputvektoren und leer sein sollten + return true; //returns true if both output vectors and should be empty } if (m_Output_time[m_Output_time.size()-1] < m_Output_time2[m_Output_time2.size()-1]) @@ -2295,7 +2293,7 @@ bool path_simulate::TimeCorrection() m_Output2.push_back(vecc); } } - else // falls = true (d.h nur Master -> keine Zeitkorrektur erforderlich!!!) + else // if = true (i.e. only master -> no time correction required!!!) { return false; } @@ -2303,7 +2301,7 @@ bool path_simulate::TimeCorrection() return true; } -/* Hauptroutine zur Generierung des Simulationsoutputs für den feature-basierten und spiral-basierten beidseitigen Fall */ +/* Main routine for generating the simulation output for the feature-based and spiral-based two-sided case */ bool path_simulate::MakePathSimulate_Feat(const std::vector &flatAreas, bool spiral) { m_Feat = true; @@ -2330,16 +2328,16 @@ bool path_simulate::MakePathSimulate_Feat(const std::vector &flatAreas, b rad[0] = m_set.master_radius; rad[1] = - m_set.slave_radius - m_set.sheet_thickness; - c[0] = 1; // Start Index der Master Kurven - c[1] = 2001; // Start Index der Slave Kurven + c[0] = 1; // Start index of the Master curves + c[1] = 2001; // Start index of the Slave curves int i = 0; while (m_it1 != m_BSplineTop.end() && m_it2 != m_BSplineBottom.end()) { - tool = StartingTool(); // bestimmt welches tool warten muss: - // tool == true : Roboter = Slave & NC = Master - // tool == fasle : Roboter = Master & NC = Slave + tool = StartingTool(); // determines which tool must wait: + // tool == true : Robot = Slave & NC = Master + // tool == false : Robot = Master & NC = Slave if (!tool) { it_1 = &m_it1; @@ -2354,21 +2352,21 @@ bool path_simulate::MakePathSimulate_Feat(const std::vector &flatAreas, b curves_1 = &m_BSplineBottom; curves_2 = &m_BSplineTop; } - - m_StartParam[0] = ((*m_it1)->FirstParameter()); // setze neue Startparameter (in unserem Fall immer 0) - + + m_StartParam[0] = ((*m_it1)->FirstParameter()); // set new start parameters (in our case always 0) + if (m_single == false) m_StartParam[1] = ((*m_it2)->FirstParameter()); - - // die erste Zustellung vor dem Kontakt mit dem Blech wird hier seperat gehandelt + + // the first delivery before contact with the sheet metal is handled separately here if (i==0) { - /*------ ZUSTELLUNG 1 ------*/ + /*------ DELIVERY 1 ------*/ ConnectPaths_xy(0); WriteOutputDouble(anOutputFile[0],anOutputFile[1],c[0],c[1],0,beam); UpdateParam(); - /*------ ZUSTELLUNG 2 ------*/ + /*------ DELIVERY 2 ------*/ ConnectPaths_z(0); WriteOutputDouble(anOutputFile[0],anOutputFile[1],c[0],c[1],0,beam); UpdateParam(); @@ -2378,58 +2376,58 @@ bool path_simulate::MakePathSimulate_Feat(const std::vector &flatAreas, b { if (*it_1 != (*curves_1).end()-1) { - /* ------ Kurve ------*/ - CompPath(0); // Berechne Parameter für den Master - CompPath(1); // Berechne Parameter für den Slave - Gen_Path(); // Erzeuge Output für aktuelle Kurve - WriteOutputDouble(anOutputFile[0],anOutputFile[1],c[0],c[1],0,beam); // Schreibe Output + /* ------ Curve ------*/ + CompPath(0); // Calculate parameters for the Master + CompPath(1); // Calculate parameters for the Slave + Gen_Path(); // Generate output for current Curve + WriteOutputDouble(anOutputFile[0],anOutputFile[1],c[0],c[1],0,beam); // Write output UpdateParam(); - /*------ Zustellung ------*/ - (*it_1)++; // Gehe zur nächsten Kurve - ConnectPaths_Feat(tool, 0, 1); // Erzeuge Output für Zustellung - WriteOutputDouble(anOutputFile[0],anOutputFile[1],c[0],c[1],0,beam); // Schreibe Output + /*------ Delivery ------*/ + (*it_1)++; // Go to the next curve + ConnectPaths_Feat(tool, 0, 1); // Generate output for delivery + WriteOutputDouble(anOutputFile[0],anOutputFile[1],c[0],c[1],0,beam); // Write output UpdateParam(); - if (*it_1 == (*curves_1).end()-1 && *it_2 == (*curves_2).end()-1) // Letzter Schritt + if (*it_1 == (*curves_1).end()-1 && *it_2 == (*curves_2).end()-1) // last step { - /* ------ Kurve ------*/ - CompPath(0); // Berechne Parameter für den Master - CompPath(1); // Berechne Parameter für den Slave - Gen_Path(); // Erzeuge Output für aktuelle Kurve - WriteOutputDouble(anOutputFile[0],anOutputFile[1],c[0],c[1],0,beam); // Schreibe Output - UpdateParam(); + /* ------ Curve ------*/ + CompPath(0); // Calculate parameters for the Master + CompPath(1); // Calculate parameters for the Slave + Gen_Path(); // Generate output for current Curve + WriteOutputDouble(anOutputFile[0],anOutputFile[1],c[0],c[1],0,beam); // Write output + UpdateParam(); break; } - (**it_1)->D0((**it_1)->FirstParameter(),pnt0); // übergebe aktuellen Startpunkt + (**it_1)->D0((**it_1)->FirstParameter(),pnt0); // pass current starting point - - if ((pnt0.Z() > (flatAreas[i+1] + rad[tool] - 1e-1)) && // Erreicht der MASTER den nächsten ebenen - (pnt0.Z() < (flatAreas[i+1] + rad[tool] + 1e-1))) // Bereich, muss auf den SLAVE gewartet werden + + if ((pnt0.Z() > (flatAreas[i+1] + rad[tool] - 1e-1)) && // When the MASTER reaches the next level + (pnt0.Z() < (flatAreas[i+1] + rad[tool] + 1e-1))) // Area, the SLAVE must be waited for { - if(!spiral) // Bei Spiralbahnen erfolgt die Zustellung sofort - { - /* ------ Kurve ------*/ - CompPath(0); // Berechne Parameter für den Master - CompPath(1); // Berechne Parameter für den Slave - Gen_Path(); // Erzeuge Output für aktuelle Kurve - WriteOutputDouble(anOutputFile[0],anOutputFile[1],c[0],c[1],0,beam); // Schreibe Output - UpdateParam(); - } - break; + if(!spiral) // In the case of spiral tracks, delivery takes place immediately + { + /* ------ Curve ------*/ + CompPath(0); // Calculate parameters for the Master + CompPath(1); // Calculate parameters for the Slave + Gen_Path(); // Generate output for current Curve + WriteOutputDouble(anOutputFile[0],anOutputFile[1],c[0],c[1],0,beam); // Write output + UpdateParam(); + } + break; } } else { - if (*it_2 == (*curves_2).end()-1) // letzter Schritt + if (*it_2 == (*curves_2).end()-1) // last step { - /* ------ Kurve ------*/ - CompPath(0); // Berechne Parameter für den Master - CompPath(1); // Berechne Parameter für den Slave - Gen_Path(); // Erzeuge Output für aktuelle Kurve - WriteOutputDouble(anOutputFile[0],anOutputFile[1],c[0],c[1],0,beam); // Schreibe Output - UpdateParam(); + /* ------ Curve ------*/ + CompPath(0); // Calculate parameters for the Master + CompPath(1); // Calculate parameters for the Slave + Gen_Path(); // Generate output for current Curve + WriteOutputDouble(anOutputFile[0],anOutputFile[1],c[0],c[1],0,beam); // Write output + UpdateParam(); break; } else break; @@ -2439,24 +2437,24 @@ bool path_simulate::MakePathSimulate_Feat(const std::vector &flatAreas, b if (m_it1 == m_BSplineTop.end()-1 && m_it2 == m_BSplineBottom.end()-1) // Fertig !!! break; - /* ------ Zustellung ------*/ + /* ------ Delivery ------*/ if(!spiral) { - (*it_1)++; // gehe zur nächsten Kurve - ConnectPaths_Feat(tool, 0, 1); // Erzeuge Output für die Master-Zustellung + (*it_1)++; // Go to the next curve + ConnectPaths_Feat(tool, 0, 1); // Generate output for the Master-delivery } - - (*it_2)++; // gehe zur nächsten Kurve - ConnectPaths_Feat(!tool, 0, 0); // Erzeuge Output für die Slave-Zustellung - WriteOutputDouble(anOutputFile[0],anOutputFile[1],c[0],c[1],0,beam); // Schreibe Output - UpdateParam(); - - ++i; + + (*it_2)++; // Go to the next curve + ConnectPaths_Feat(!tool, 0, 0); // Generate output for the Slave-devlivery + WriteOutputDouble(anOutputFile[0],anOutputFile[1],c[0],c[1],0,beam); // Write output + UpdateParam(); + + ++i; } anOutputFile[0] << "*END" << endl; anOutputFile[1] << "*END" << endl; - anOutputFile[0].close(); + anOutputFile[0].close(); anOutputFile[1].close(); //WriteTimes(); @@ -2464,7 +2462,7 @@ bool path_simulate::MakePathSimulate_Feat(const std::vector &flatAreas, b return true; } -/* Hauptroutine zur Generierung des Roboteroutputs für den feature-basierten und spiral-basierten beidseitigen Fall */ +/* Main routine for generating the robot output for the feature-based and spiral-based two-sided case */ bool path_simulate::MakePathRobot_Feat(const std::vector &flatAreas) { m_Feat = true; @@ -2490,17 +2488,17 @@ bool path_simulate::MakePathRobot_Feat(const std::vector &flatAreas) while (m_it1 != m_BSplineTop.end() && m_it2 != m_BSplineBottom.end()) { - tool = StartingTool(); // Bestimmt welches tool warten muss + tool = StartingTool(); // Determines which tool must wait - // Setze Startparameter (in unserem Fall unnötig da immer 0) + // Set start parameter (in our case unnecessary because always 0) m_StartParam[0] = ((*m_it1)->FirstParameter()); if (m_single == false) m_StartParam[1] = ((*m_it2)->FirstParameter()); - // Erste Zustellung wird seperat gehandelt + // The first delivery is handled separately if (i==0) { - ConnectPaths_xy(1); /* 1. ZUSTELLUNG */ - ConnectPaths_z(1); /* 2. ZUSTELLUNG */ + ConnectPaths_xy(1); /* 1. Delivery */ + ConnectPaths_z(1); /* 2. Delivery */ } if (!tool) @@ -2518,10 +2516,10 @@ bool path_simulate::MakePathRobot_Feat(const std::vector &flatAreas) curves_2 = &m_BSplineTop; } - // Hauptschleife + // Main loop while (true) { - MakePathSingle(1,0,0,tool); // Bahngenerierung des kontinuierlich fahrenden tools für aktuelle kurve + MakePathSingle(1,0,0,tool); // Path generation of the continuously moving tool for the current curve // MASTER if (*it_1 != (*curves_1).end()-1) @@ -2627,8 +2625,8 @@ bool path_simulate::MakePathRobot_Feat(const std::vector &flatAreas) return true; } -// Hilfsfunktion für den Featurebasierten Teil: -// Bestimmt welches Tool wartet, während das andere läuft +// Help function for the feature-based part: +// Determines which tool waits while the other is running bool path_simulate::StartingTool() { double z0,z1; @@ -2636,7 +2634,7 @@ bool path_simulate::StartingTool() if(m_it1 != m_BSplineTop.end()-1) { - // z-Abstand zur nächsten Bahn - MASTER + // z-distance to the next path - MASTER (*m_it1)->D0((*m_it1)->FirstParameter(),pnt0); m_it1++; (*m_it1)->D0((*m_it1)->FirstParameter(),pnt1); m_it1--; @@ -2648,7 +2646,7 @@ bool path_simulate::StartingTool() if(m_it2 != m_BSplineBottom.end()-1) { - // z-Abstand zur nächsten Bahn - SLAVE + // z-distance to the next path - SLAVE (*m_it2)->D0((*m_it2)->FirstParameter(),pnt0); m_it2++; (*m_it2)->D0((*m_it2)->FirstParameter(),pnt1); m_it2--; @@ -2656,12 +2654,12 @@ bool path_simulate::StartingTool() } else z1 = 1e+3; - if(z0StartPoint(); // Startpunkt der aktuellen Master-Kurve - pt1 = (*m_it1)->EndPoint(); // Endpunkt der aktuellen Master-Kurve + pt0 = (*m_it1)->StartPoint(); // The starting point of the current master curve + pt1 = (*m_it1)->EndPoint(); // The end point of the current master curve - while(pt0.Distance(pt1) > 1e-3) // Mache weiter solange Start und Endpunkt nicht passen + while(pt0.Distance(pt1) > 1e-3) // Keep going as long as the start and end point don't match { - if(m_it1 == m_BSplineTop.end()-1) // Stoppe wenn bei der letzten Kurve angekommen + if(m_it1 == m_BSplineTop.end()-1) // Stop when you reach the last corner { for(int i=1; iStartPoint(); // Startpunkt der aktuellen Slave-Kurve - pt1 = (*m_it2)->EndPoint(); // Endpunkt der aktuellen Slave-Kurve + pt0 = (*m_it2)->StartPoint(); // The starting point of the current slave curve + pt1 = (*m_it2)->EndPoint(); // The end point of the current slave curve - while(pt0.Distance(pt1) > 1e-3) // Mache weiter solange Start und Endpunkt nicht passen + while(pt0.Distance(pt1) > 1e-3) // Keep going as long as the start and end point don't match { - if(m_it2 == m_BSplineBottom.end()-1) // Stoppe wenn bei der letzten Kurve angekommen + if(m_it2 == m_BSplineBottom.end()-1) // Stop when you reach the last corner { for(int i=1; iEndPoint(); } } - // Zurück zum Status quo + // Return to the status quo for(int i=1; iFirstParameter()); // speichert Startparameterwert der aktuellen Master-Kurve - + m_StartParam[0] = ((*m_it1)->FirstParameter()); // saves start parameter values of the current master curve + if (m_single == false) - m_StartParam[1] = ((*m_it2)->FirstParameter()); // speichert Startparameterwert der aktuellen Slave-Kurve - + m_StartParam[1] = ((*m_it2)->FirstParameter()); // saves start parameter values of the current slave curve - /*Zustellung Start*/ - m_conn = CheckConnect(); // Rückgabewert = 1 bei negativer z-Richtungszustellung - // Rückgabewert = 0 bei positiver z-Richtungszustellung - - // negative z-Richtung: 1. XY --> 2. Z - // positive z-Richtung: 1. Z --> 2. XY - + /*Delivery start*/ + + m_conn = CheckConnect(); // Return value = 1 in the case of a negative z-direction infeed + // Return value = 0 in the case of a positive z-direction feed + + // negative z-direction: 1. XY --> 2. Z + // positive z-direction: 1. Z --> 2. XY + // *** 1. *** if (m_conn) ConnectPaths_xy(0); else ConnectPaths_z(0); @@ -2771,25 +2769,25 @@ bool path_simulate::MakePathSimulate() if (m_conn) ConnectPaths_z(0); else ConnectPaths_xy(0); - // Schreibe Output + // Write output if (m_single == false) WriteOutputDouble(anOutputFile,anOutputFile2,c1,c2,0,beam); else WriteOutputSingle(anOutputFile,c1,0,0,beam); UpdateParam(); - /*Zustellung Ende* - - - /*Kurve Start*/ + /*Delivery end* - CompPath(0); // Berechnung der Parameter für den Master + + /*Curve start*/ + + CompPath(0); // Calculate the parameters for the Master if (m_single == false) - CompPath(1); // Berechnung der Parameter für den Slave + CompPath(1); // Calculate the parameters for the Slave - Gen_Path(); // Erzeugung der Outputvektoren + Gen_Path(); // Generation of the output vectors - // Schreibe Outputvektoren + // Write output vectors if (m_single == false) WriteOutputDouble(anOutputFile,anOutputFile2,c1,c2,0,beam); else WriteOutputSingle(anOutputFile,c1,0,0,beam); @@ -2798,7 +2796,7 @@ bool path_simulate::MakePathSimulate() if (m_single==false && (m_it1 != (m_BSplineTop.end()-1))) ++m_it2; - /*Kurve Ende*/ + /*Curve Ende*/ } //m_log.saveToFile("c:/Master-Path.iv"); @@ -2808,7 +2806,7 @@ bool path_simulate::MakePathSimulate() anOutputvelocity.open("output_velocity.k"); anOutputvelocity.precision(7); - for(int i=0; i<(int)m_times_tmp.size(); ++i) // Schreibe absolute Geschwindigkeitswerte aus + for(int i=0; i<(int)m_times_tmp.size(); ++i) // Write out absolute speed values anOutputvelocity << m_times_tmp[i] << ", " << m_velo_tmp[i] << endl; anOutputvelocity.close(); @@ -2828,7 +2826,7 @@ bool path_simulate::MakePathSimulate() return true; } -/* Schreibt den Output für den feature- und spiral-basierten beidseitigen Fall */ +/* Writes the output for the feature-based and spiral-based bilateral case */ bool path_simulate::WriteOutput_Feat(ofstream &anOutputFile, ofstream &anOutputFile2, int &c, bool brob) { if (m_single == false) @@ -2989,7 +2987,7 @@ bool path_simulate::WriteOutput_Feat(ofstream &anOutputFile, ofstream &anOutputF } /* -// Schreibt alle Zeitwerte der Ausgabevektoren aus +// Writes out all time values of the output vectors bool path_simulate::WriteTimes() { ofstream anOutputFile; @@ -3013,7 +3011,7 @@ bool path_simulate::WriteTimes() } */ -/* Schreibt Output für den normalen einseitigen Fall */ +/* Writes output for normal one-sided case */ bool path_simulate::WriteOutputSingle(ofstream &anOutputFile, int &c, bool brob, bool tool, bool beamfl) { std::vector< std::vector > Out_val; @@ -3024,7 +3022,7 @@ bool path_simulate::WriteOutputSingle(ofstream &anOutputFile, int &c, bool brob, int pid; - if (brob == true) // Schreibe Roboter-Output + if (brob == true) // Write robot output { std::vector Out_rob; @@ -3055,12 +3053,12 @@ bool path_simulate::WriteOutputSingle(ofstream &anOutputFile, int &c, bool brob, if (beamfl && tool) pid = ind+1; // pid: 2 - Master else pid = ind; // 3 - Slave - // 4 - Plate (x-,y-movement) + // 4 - Plate (x-,y-movement) n = Out_val.size(); if (n != Out_time.size()) - throw Base::RuntimeError("Outputlängen passen nicht zusammen"); + throw Base::RuntimeError("Output lengths do not match"); if (n>1) { @@ -3153,15 +3151,15 @@ bool path_simulate::WriteOutputSingle(ofstream &anOutputFile, int &c, bool brob, return true; } -/* Schreibt Output für den normalen beidseitigen Fall */ +/* Writes output for the normal two-sided case */ bool path_simulate::WriteOutputDouble(ofstream &anOutputFile, ofstream &anOutputFile2, int &c1, int &c2, bool brob, bool beamfl) { std::pair times; int pid1 = 2; // Master int pid2 = 3; // Slave - int pid3 = 4; // Platte + int pid3 = 4; // Plate - if (brob == false) // Simulations-Output (brob == true -> roboter-output) + if (brob == false) // Simulations-Output (brob == true -> robot output) { TimeCorrection(); @@ -3187,18 +3185,18 @@ bool path_simulate::WriteOutputDouble(ofstream &anOutputFile, ofstream &anOutput times.first = (float) m_Output_time[0]; times.second = (float) m_Output_time[n-1]; - m_PathTimes_Master.push_back(times); // fülle vektor für curve-times + m_PathTimes_Master.push_back(times); // fill in vector for curve times + + + - - - // SLAVE-X anOutputFile2 << "*BOUNDARY_PRESCRIBED_MOTION_RIGID" << std::endl; anOutputFile2 << "$# pid dof vad lcid sf vid death birth" << std::endl; anOutputFile2 << pid2 << ",1,0," << c2 << ",1.000000, ," << m_Output_time2[n2-1] << "," << m_Output_time2[0] << std::endl; - - if (beamfl) // wenn auf true, dann füge neuen part mit ein + + if (beamfl) // if true, then insert a new part { anOutputFile2 << "*BOUNDARY_PRESCRIBED_MOTION_RIGID" << std::endl; anOutputFile2 << "$# pid dof vad lcid sf vid death birth" << std::endl; @@ -3218,10 +3216,10 @@ bool path_simulate::WriteOutputDouble(ofstream &anOutputFile, ofstream &anOutput times.second = (float) m_Output_time2[n2-1]; m_PathTimes_Slave.push_back(times); - - - - + + + + // MASTER-Y anOutputFile << "*BOUNDARY_PRESCRIBED_MOTION_RIGID" << std::endl; @@ -3240,16 +3238,16 @@ bool path_simulate::WriteOutputDouble(ofstream &anOutputFile, ofstream &anOutput times.second = (float) m_Output_time[n-1]; m_PathTimes_Master.push_back(times); - - - + + + // SLAVE-Y anOutputFile2 << "*BOUNDARY_PRESCRIBED_MOTION_RIGID" << std::endl; anOutputFile2 << "$# pid dof vad lcid sf vid death birth" << std::endl; anOutputFile2 << pid2 << ",2,0," << c2+1 << ",1.000000, ," << m_Output_time2[n2-1] << "," << m_Output_time2[0] << std::endl; - if (beamfl) // wenn auf true, dann füge neuen part mit ein + if (beamfl) // if true, then insert a new part { anOutputFile2 << "*BOUNDARY_PRESCRIBED_MOTION_RIGID" << std::endl; anOutputFile2 << "$# pid dof vad lcid sf vid death birth" << std::endl; @@ -3269,10 +3267,10 @@ bool path_simulate::WriteOutputDouble(ofstream &anOutputFile, ofstream &anOutput times.second = (float) m_Output_time2[n2-1]; m_PathTimes_Slave.push_back(times); - - - - + + + + // MASTER-Z anOutputFile << "*BOUNDARY_PRESCRIBED_MOTION_RIGID" << std::endl; anOutputFile << "$# pid dof vad lcid sf vid death birth" << std::endl; @@ -3292,7 +3290,7 @@ bool path_simulate::WriteOutputDouble(ofstream &anOutputFile, ofstream &anOutput m_PathTimes_Master.push_back(times); - + // SLAVE-Z if (beamfl) @@ -3326,7 +3324,7 @@ bool path_simulate::WriteOutputDouble(ofstream &anOutputFile, ofstream &anOutput c2 += 3; } } - else // Schreibe Roboter-Output + else // Write robot output { int n1 = m_Output_robo1.size(); for (int i=0; ikill(); QMessageBox::critical(this, tr("FreeCAD CamWorkbench"), - tr("Fehler bei der Erzeugung\n"), + tr("Error in generation\n"), QMessageBox::Ok, QMessageBox::NoButton); } else if (result.contains("N o r m a l t e r m i n a t i o n")) @@ -146,14 +146,14 @@ void Cutting::on_adaptdynainput_clicked() // if (aFileInfo.size() == 0) //the file does not exist // { // QMessageBox::critical(this, tr("FreeCAD CamWorkbench"), - // tr("Fehler bei der Erzeugung vom Struct File\n"), + // tr("Error when creating the Struct file\n"), // QMessageBox::Ok, QMessageBox::NoButton); // return; // } // else // { // QMessageBox::information(this, tr("FreeCAD CamWorkbench"), - // tr("Structured-Dyna gut erzeugt\n"), + // tr("Structured Dyna generated well\n"), // QMessageBox::Ok, QMessageBox::NoButton); // } //} @@ -205,10 +205,10 @@ void Cutting::on_deviation_go_button_clicked() QString current_filename = QFileDialog::getSaveFileName(this,"Select Deviation Files","","*.txt"); m_Deviation->ImportGeometry(m_Shape, m_Mesh); m_Deviation->Compute(); - - + + m_Deviation->WriteOutput(current_filename); - + } void Cutting::on_error_accumulation_select_files_button_clicked() @@ -220,20 +220,20 @@ void Cutting::on_error_accumulation_select_files_button_clicked() "Select one or more files to open", "c:", "Deviation Files (*.txt)"); - + if (!m_dateinamen.isEmpty()) { if (!m_MergeData->Einlesen(m_dateinamen)) { QMessageBox::information(this, tr("FreeCAD CamWorkbench"), - tr("Alles i.O. Output kann erzeugt werden\n"), + tr("Everything OK. Output can be generated\n"), QMessageBox::Ok, QMessageBox::NoButton); } - - + + } error_accumulation_go_button->setEnabled(true); - + } void Cutting::on_error_accumulation_go_button_clicked() @@ -379,7 +379,7 @@ void Cutting::setFace(const TopoDS_Shape& aShape, const float x, const float y, void Cutting::on_CalculateZLevel_clicked() { - //Cutting-Klasse instanzieren + // Instantiating Cutting class if (m_CuttingAlgo == NULL) m_CuttingAlgo = new cutting_tools(m_Shape); else @@ -495,7 +495,7 @@ void Cutting::on_toolpath_calculation_go_button_clicked() if (!m_CuttingAlgo->arrangecuts_ZLEVEL()) { - std::cout << "Konnte nicht sauber schneiden" << std::endl; + std::cout << "Couldn't cut properly" << std::endl; } bool ok = true; @@ -516,12 +516,12 @@ void Cutting::on_toolpath_calculation_go_button_clicked() } catch (...) { - std::cout<<"Fehler"< m_Settings) - + switch (m_selection) { case BestFit: - + m_BestFit->Load(m_Mesh,m_Shape); m_BestFit->Perform(); @@ -704,7 +704,7 @@ void Cutting::on_best_fit_go_button_clicked() DisplayMeshOutput(m_MeshOut); //DisplayMeshOutput(m_MeshCad); - + break; @@ -733,7 +733,8 @@ best_fit_mesh2_button->setEnabled(true); break; case Approx: - /*MeshCore::MeshPointArray pnts = m_Mesh.GetPoints(); // file "kleines.stl" hat spitze über der ebene ... nicht kompatibel mit diesem Algo + // The file "Kleines.stl" has a point above the level ... not compatible with this Algo + /*MeshCore::MeshPointArray pnts = m_Mesh.GetPoints(); MeshCore::MeshFacetArray facets = m_Mesh.GetFacets(); for(int i=0; isetEnabled(true); m_Mesh.Assign(pnts,facets);*/ std::vector CtrlPnts, U_knot, V_knot; - int degU,degV; + int degU,degV; m_App = new Approximate(m_Mesh,CtrlPnts,U_knot,V_knot,degU,degV,m_Settings.error_tolerance); //m_Approx = new UniGridApprox(m_Mesh, 1); @@ -753,11 +754,11 @@ best_fit_mesh2_button->setEnabled(true); BRepBuilderAPI_MakeFace Face(m_App->aAdaptorSurface.Surface()); m_Shape = Face.Face(); - + ofstream anOutputFile; anOutputFile.open("c:/approx_log.txt"); - anOutputFile << "face zugewiesen" << endl; - + anOutputFile << "face assigned" << endl; + DisplayMeshOutput(m_App->MeshParam); DisplayShapeOutput(); break; @@ -837,7 +838,7 @@ void Cutting::DisplayCAMOutput() //std::vector::iterator an_it; //topCurves = *(anewCuttingEnv.getOutputhigh()); //botCurves = *(anewCuttingEnv.getOutputlow()); - + ofstream anoutput; ofstream anoutput2; anoutput.open("c:/topCurves.txt"); diff --git a/src/Mod/Cam/Gui/Cutting.h b/src/Mod/Cam/Gui/Cutting.h index 73a1da0218..6cb85f61b3 100644 --- a/src/Mod/Cam/Gui/Cutting.h +++ b/src/Mod/Cam/Gui/Cutting.h @@ -74,15 +74,15 @@ protected Q_SLOTS: void on_Approximate_button_clicked(); void on_best_fit_cad_button_clicked(); void on_best_fit_mesh_button_clicked(); - void on_best_fit_mesh2_button_clicked(); + void on_best_fit_mesh2_button_clicked(); void on_SelectFace_button_clicked(); void on_best_fit_go_button_clicked(); - void on_Deviation_button_clicked(); - void on_deviation_geometry1_button_clicked(); - void on_deviation_geometry2_button_clicked(); - void on_deviation_go_button_clicked(); - void on_error_accumulation_go_button_clicked(); - void on_error_accumulation_select_files_button_clicked(); + void on_Deviation_button_clicked(); + void on_deviation_geometry1_button_clicked(); + void on_deviation_geometry2_button_clicked(); + void on_deviation_go_button_clicked(); + void on_error_accumulation_go_button_clicked(); + void on_error_accumulation_select_files_button_clicked(); void selectShape(); @@ -101,13 +101,13 @@ private: private: SpringbackCorrection *m_Spring; - cutting_tools *m_CuttingAlgo; //Instanz von der cutting-klasse auf dem Heap erzeugen + cutting_tools *m_CuttingAlgo; //Generate an instance of the cutting class on the heap path_simulate *m_PathSimulate; best_fit *m_BestFit; UniGridApprox *m_Approx; - Approximate *m_App; - Deviation *m_Deviation; - MergeData *m_MergeData; + Approximate *m_App; + Deviation *m_Deviation; + MergeData *m_MergeData; CuttingToolsSettings m_Settings;