diff --git a/src/Mod/TechDraw/App/DrawViewSection.cpp b/src/Mod/TechDraw/App/DrawViewSection.cpp index f3a217c9c1..d8f7a970fe 100644 --- a/src/Mod/TechDraw/App/DrawViewSection.cpp +++ b/src/Mod/TechDraw/App/DrawViewSection.cpp @@ -162,19 +162,24 @@ void DrawViewSection::onChanged(const App::Property* prop) } if (prop == &FileHatchPattern || prop == &NameGeomPattern ) { - if ((!FileHatchPattern.isEmpty()) && - (!NameGeomPattern.isEmpty())) { - std::vector specs = - DrawGeomHatch::getDecodedSpecsFromFile(FileHatchPattern.getValue(),NameGeomPattern.getValue()); - m_lineSets.clear(); - for (auto& hl: specs) { - //hl.dump("hl from section"); - LineSet ls; - ls.setPATLineSpec(hl); - m_lineSets.push_back(ls); - } - - } + std::string fileSpec = FileHatchPattern.getValue(); + Base::FileInfo fi(fileSpec); + std::string ext = fi.extension(); + if ( (ext == "pat") || + (ext == "PAT") ) { + if ((!FileHatchPattern.isEmpty()) && + (!NameGeomPattern.isEmpty())) { + std::vector specs = + DrawGeomHatch::getDecodedSpecsFromFile(FileHatchPattern.getValue(),NameGeomPattern.getValue()); + m_lineSets.clear(); + for (auto& hl: specs) { + //hl.dump("hl from section"); + LineSet ls; + ls.setPATLineSpec(hl); + m_lineSets.push_back(ls); + } + } + } } DrawView::onChanged(prop);