diff --git a/src/Mod/Path/Gui/DlgSettingsPathColor.cpp b/src/Mod/Path/Gui/DlgSettingsPathColor.cpp index 7e301ee59..c9b583858 100644 --- a/src/Mod/Path/Gui/DlgSettingsPathColor.cpp +++ b/src/Mod/Path/Gui/DlgSettingsPathColor.cpp @@ -33,8 +33,8 @@ using namespace PathGui; /* TRANSLATOR PathGui::DlgSettingsPathColor */ /** - * Constructs a DlgSettingsObjectColor which is a child of 'parent', with the - * name 'name' and widget flags set to 'f' + * Constructs a DlgSettingsObjectColor which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' */ DlgSettingsPathColor::DlgSettingsPathColor(QWidget* parent) : PreferencePage(parent) @@ -42,7 +42,7 @@ DlgSettingsPathColor::DlgSettingsPathColor(QWidget* parent) this->setupUi(this); } -/** +/** * Destroys the object and frees any allocated resources */ DlgSettingsPathColor::~DlgSettingsPathColor() @@ -58,6 +58,7 @@ void DlgSettingsPathColor::saveSettings() DefaultPathLineWidth->onSave(); DefaultPathMarkerColor->onSave(); DefaultExtentsColor->onSave(); + DefaultProbePathColor->onSave(); } void DlgSettingsPathColor::loadSettings() @@ -68,6 +69,7 @@ void DlgSettingsPathColor::loadSettings() DefaultPathLineWidth->onRestore(); DefaultPathMarkerColor->onRestore(); DefaultExtentsColor->onRestore(); + DefaultProbePathColor->onRestore(); } /** diff --git a/src/Mod/Path/Gui/DlgSettingsPathColor.ui b/src/Mod/Path/Gui/DlgSettingsPathColor.ui index 226a6d57d..faffa6ff8 100644 --- a/src/Mod/Path/Gui/DlgSettingsPathColor.ui +++ b/src/Mod/Path/Gui/DlgSettingsPathColor.ui @@ -6,192 +6,225 @@ 0 0 - 359 - 282 + 297 + 281 Path colors - - + + Default Path colors - - - - - - - - 182 - 0 - - - - Default normal path color - - - - - - - The default color for new shapes - - - - 0 - 170 - 0 - - - - DefaultNormalPathColor - - - Mod/Path - - - - - - - - 182 - 0 - - - - Default pathline width - - - - - - - The default line thickness for new shapes - - - px - - - 9 - - - 1 - - - DefaultPathLineWidth - - - Mod/Path - - - - - - - - 182 - 0 - - - - Default path marker color - - - - - - - The default line color for new shapes - - - - 85 - 255 - 0 - - - - DefaultPathMarkerColor - - - Mod/Path - - - - - - - - 182 - 0 - - - - Rapid path color - - - - - - - The default line color for new shapes - - - - 170 - 0 - 0 - - - - DefaultRapidPathColor - - - Mod/Path - - - - - - - Machine extents color - - - - - - - DefaultExtentsColor - - - Mod/Path - - - - - - - - - Qt::Horizontal - - + + + + - 28 - 20 + 182 + 0 - + + Default normal path color + + + + + + + The default color for new shapes + + + + 0 + 170 + 0 + + + + DefaultNormalPathColor + + + Mod/Path + + + + + + + + 182 + 0 + + + + Default pathline width + + + + + + + The default line thickness for new shapes + + + px + + + 9 + + + 1 + + + DefaultPathLineWidth + + + Mod/Path + + + + + + + + 182 + 0 + + + + Default path marker color + + + + + + + The default line color for new shapes + + + + 85 + 255 + 0 + + + + DefaultPathMarkerColor + + + Mod/Path + + + + + + + + 182 + 0 + + + + Rapid path color + + + + + + + The default line color for new shapes + + + + 170 + 0 + 0 + + + + DefaultRapidPathColor + + + Mod/Path + + + + + + + + 182 + 0 + + + + Probe Path color + + + + + + + The default line color for new shapes + + + + 255 + 255 + 5 + + + + DefaultProbePathColor + + + Mod/Path + + + + + + + Machine extents color + + + + + + + DefaultExtentsColor + + + Mod/Path + + + DefaultRapidPathColor_2 + label_8 + label_8 + DefaultProbePathColor - + + + + Qt::Horizontal + + + + 7 + 220 + + + + + Qt::Vertical diff --git a/src/Mod/Path/Gui/ViewProviderPath.cpp b/src/Mod/Path/Gui/ViewProviderPath.cpp index 38348eb47..e2c4322f8 100644 --- a/src/Mod/Path/Gui/ViewProviderPath.cpp +++ b/src/Mod/Path/Gui/ViewProviderPath.cpp @@ -83,14 +83,14 @@ ViewProviderPath::ViewProviderPath() ADD_PROPERTY_TYPE(LineWidth,(lwidth),"Path",App::Prop_None,"The line width of this path"); ADD_PROPERTY_TYPE(ShowFirstRapid,(true),"Path",App::Prop_None,"Turns the display of the first rapid move on/off"); ADD_PROPERTY_TYPE(ShowNodes,(false),"Path",App::Prop_None,"Turns the display of nodes on/off"); - + pcPathRoot = new Gui::SoFCSelection(); pcPathRoot->style = Gui::SoFCSelection::EMISSIVE; pcPathRoot->highlightMode = Gui::SoFCSelection::AUTO; pcPathRoot->selectionMode = Gui::SoFCSelection::SEL_ON; pcPathRoot->ref(); - + pcTransform = new SoTransform(); pcTransform->ref(); @@ -99,7 +99,7 @@ ViewProviderPath::ViewProviderPath() pcMarkerCoords = new SoCoordinate3(); pcMarkerCoords->ref(); - + pcDrawStyle = new SoDrawStyle(); pcDrawStyle->ref(); pcDrawStyle->style = SoDrawStyle::LINES; @@ -108,17 +108,17 @@ ViewProviderPath::ViewProviderPath() pcLines = new PartGui::SoBrepEdgeSet(); pcLines->ref(); pcLines->coordIndex.setNum(0); - + pcLineColor = new SoMaterial; pcLineColor->ref(); - + pcMatBind = new SoMaterialBinding; pcMatBind->ref(); pcMatBind->value = SoMaterialBinding::OVERALL; pcMarkerColor = new SoBaseColor; pcMarkerColor->ref(); - + NormalColor.touch(); MarkerColor.touch(); } @@ -186,12 +186,16 @@ void ViewProviderPath::onChanged(const App::Property* prop) pcDrawStyle->lineWidth = LineWidth.getValue(); } else if (prop == &NormalColor) { if (colorindex.size() > 0) { - const App::Color& c = NormalColor.getValue(); + const App::Color& c = NormalColor.getValue(); ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Path"); unsigned long rcol = hGrp->GetUnsigned("DefaultRapidPathColor",2852126975UL); // dark red (170,0,0) float rr,rg,rb; rr = ((rcol >> 24) & 0xff) / 255.0; rg = ((rcol >> 16) & 0xff) / 255.0; rb = ((rcol >> 8) & 0xff) / 255.0; - + + unsigned long pcol = hGrp->GetUnsigned("DefaultProbePathColor",4293591295UL); // yellow (255,255,5) + float pr,pg,pb; + pr = ((pcol >> 24) & 0xff) / 255.0; pg = ((pcol >> 16) & 0xff) / 255.0; pb = ((pcol >> 8) & 0xff) / 255.0; + pcMatBind->value = SoMaterialBinding::PER_PART; // resizing and writing the color vector: pcLineColor->diffuseColor.setNum(colorindex.size()); @@ -199,8 +203,10 @@ void ViewProviderPath::onChanged(const App::Property* prop) for(unsigned int i=0;idiffuseColor.finishEditing(); } @@ -220,14 +226,14 @@ void ViewProviderPath::updateData(const App::Property* prop) Path::Feature* pcPathObj = static_cast(pcObject); if (prop == &pcPathObj->Path) { - + const Toolpath &tp = pcPathObj->Path.getValue(); if(tp.getSize()==0) { pcLineCoords->point.deleteValues(0); pcMarkerCoords->point.deleteValues(0); return; } - + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Part"); float deviation = hGrp->GetFloat("MeshDeviation",0.2); std::vector points; @@ -237,7 +243,7 @@ void ViewProviderPath::updateData(const App::Property* prop) bool absolute = true; bool absolutecenter = false; bool first = true; - + for (unsigned int i = 0; i < tp.getSize(); i++) { Path::Command cmd = tp.getCommand(i); std::string name = cmd.Name; @@ -250,7 +256,7 @@ void ViewProviderPath::updateData(const App::Property* prop) next.y = last.y; if (!cmd.has("Z")) next.z = last.z; - + if ( (name == "G0") || (name == "G00") || (name == "G1") || (name == "G01") ) { // straight line if ( (!first) || (ShowFirstRapid.getValue() == true) || (name == "G1") || (name == "G01") ) { @@ -273,12 +279,12 @@ void ViewProviderPath::updateData(const App::Property* prop) markers.push_back(last); // startpoint of path } first = false; - + } else if ( (name == "G2") || (name == "G02") || (name == "G3") || (name == "G03") ) { // arc Base::Vector3d norm; Base::Vector3d center; - + if ( (name == "G2") || (name == "G02") ) norm.Set(0,0,-1); else @@ -321,23 +327,23 @@ void ViewProviderPath::updateData(const App::Property* prop) } last = next; colorindex.push_back(1); - + } else if (name == "G90") { // absolute mode absolute = true; - + } else if (name == "G91") { // relative mode absolute = false; - + } else if (name == "G90.1") { // absolute mode absolutecenter = true; - + } else if (name == "G91.1") { // relative mode absolutecenter = false; - + } else if ((name=="G81")||(name=="G82")||(name=="G83")||(name=="G84")||(name=="G85")||(name=="G86")||(name=="G89")){ // drill,tap,bore double r = 0; @@ -373,9 +379,19 @@ void ViewProviderPath::updateData(const App::Property* prop) if (ShowNodes.getValue() == true) markers.push_back(p2); colorindex.push_back(0); - } - } - + + } else if ((name=="G38.2")||(name=="38.3")||(name=="G38.4")||(name=="G38.5")){ + // Straight probe + Base::Vector3d p1(next.x,next.y,last.z); + points.push_back(p1); + colorindex.push_back(0); + points.push_back(next); + colorindex.push_back(2); + Base::Vector3d p3(next.x,next.y,last.z); + points.push_back(p3); + colorindex.push_back(0); + }} + if (!points.empty()) { pcLineCoords->point.deleteValues(0); pcLineCoords->point.setNum(points.size()); @@ -387,20 +403,20 @@ void ViewProviderPath::updateData(const App::Property* prop) int* segs = &ei[0]; pcLines->coordIndex.setNum(points.size()); pcLines->coordIndex.setValues(0,points.size(),(const int32_t*)segs); - + pcMarkerCoords->point.deleteValues(0); - + pcMarkerCoords->point.setNum(markers.size()); for(unsigned int i=0;ipoint.set1Value(i,markers[i].x,markers[i].y,markers[i].z); - + // update the coloring after we changed the color vector NormalColor.touch(); recomputeBoundingBox(); } - + } else if ( prop == &pcPathObj->Placement) { - + Base::Placement pl = *(&pcPathObj->Placement.getValue()); Base::Vector3d pos = pl.getPosition(); double q1, q2, q3, q4;