mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-08 08:11:14 +00:00
build: update OCCT to 8.0.1 (faster STEP and Design tab, Windows STEP crash fix) (#16089)
This commit is contained in:
@@ -50,6 +50,8 @@
|
||||
#include "Font_BRepTextBuilder.hxx"
|
||||
#include "BRepPrimAPI_MakePrism.hxx"
|
||||
#include "Font_FontMgr.hxx"
|
||||
#include "NCollection_Sequence.hxx"
|
||||
#include "TCollection_HAsciiString.hxx"
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
@@ -57,7 +59,7 @@ namespace Slic3r {
|
||||
|
||||
static std::map<std::string, std::string> g_occt_fonts_maps; //map<font_name, font_path>
|
||||
|
||||
static const std::vector<Standard_CString> fonts_suffix{ "Bold", "Medium", "Heavy", "Italic", "Oblique", "Inclined", "Light", "Thin",
|
||||
static const std::vector<const char*> fonts_suffix{ "Bold", "Medium", "Heavy", "Italic", "Oblique", "Inclined", "Light", "Thin",
|
||||
"Semibold", "ExtraBold", "ExtraBold", "Semilight", "SemiLight", "ExtraLight", "Extralight", "Ultralight",
|
||||
"Condensed", "Ultra", "Extra", "Expanded", "Extended", "1", "2", "3", "4", "5", "6", "7", "8", "9", "Al Tarikh"};
|
||||
|
||||
@@ -73,7 +75,7 @@ std::vector<std::string> init_occt_fonts()
|
||||
Handle(Font_FontMgr) aFontMgr = Font_FontMgr::GetInstance();
|
||||
aFontMgr->InitFontDataBase();
|
||||
|
||||
TColStd_SequenceOfHAsciiString availFontNames;
|
||||
NCollection_Sequence<Handle(TCollection_HAsciiString)> availFontNames;
|
||||
aFontMgr->GetAvailableFontsNames(availFontNames);
|
||||
stdFontNames.reserve(availFontNames.Size());
|
||||
|
||||
@@ -122,16 +124,14 @@ std::vector<std::string> init_occt_fonts()
|
||||
|
||||
static bool TextToBRep(const char* text, const char* font, const float theTextHeight, Font_FontAspect& theFontAspect, TopoDS_Shape& theShape, double& text_width)
|
||||
{
|
||||
Standard_Integer anArgIt = 1;
|
||||
Standard_CString aName = "text_shape";
|
||||
Standard_CString aText = text;
|
||||
const char* aText = text;
|
||||
|
||||
Font_BRepFont aFont;
|
||||
//TCollection_AsciiString aFontName("Courier");
|
||||
TCollection_AsciiString aFontName(font);
|
||||
Standard_Real aTextHeight = theTextHeight;
|
||||
double aTextHeight = theTextHeight;
|
||||
Font_FontAspect aFontAspect = theFontAspect;
|
||||
Standard_Boolean anIsCompositeCurve = Standard_False;
|
||||
bool anIsCompositeCurve = false;
|
||||
gp_Ax3 aPenAx3(gp::XOY());
|
||||
gp_Dir aNormal(0.0, 0.0, 1.0);
|
||||
gp_Dir aDirection(1.0, 0.0, 0.0);
|
||||
@@ -156,10 +156,10 @@ static bool TextToBRep(const char* text, const char* font, const float theTextHe
|
||||
// get the text width
|
||||
text_width = 0;
|
||||
NCollection_String coll_str = aText;
|
||||
for (NCollection_Utf8Iter anIter = coll_str.Iterator(); *anIter != 0;) {
|
||||
const Standard_Utf32Char aCharThis = *anIter;
|
||||
const Standard_Utf32Char aCharNext = *++anIter;
|
||||
double width = aFont.AdvanceX(aCharThis, aCharNext);
|
||||
for (auto anIter = coll_str.Iterator(); *anIter != 0;) {
|
||||
const char32_t aCharThis = *anIter;
|
||||
const char32_t aCharNext = *++anIter;
|
||||
double width = aFont.AdvanceX(aCharThis, aCharNext);
|
||||
text_width += width;
|
||||
}
|
||||
|
||||
@@ -173,9 +173,9 @@ static bool Prism(const TopoDS_Shape& theBase, const float thickness, TopoDS_Sha
|
||||
if (theBase.IsNull()) return false;
|
||||
|
||||
gp_Vec V(0.f, 0.f, thickness);
|
||||
BRepPrimAPI_MakePrism* Prism = new BRepPrimAPI_MakePrism(theBase, V, Standard_False);
|
||||
BRepPrimAPI_MakePrism prism(theBase, V, false);
|
||||
|
||||
theSolid = Prism->Shape();
|
||||
theSolid = prism.Shape();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -205,10 +205,10 @@ static void MakeMesh(TopoDS_Shape& theSolid, TriangleMesh& theMesh)
|
||||
std::vector<Vec3f> points;
|
||||
points.reserve(aNbNodes);
|
||||
//BBS: count faces missing triangulation
|
||||
Standard_Integer aNbFacesNoTri = 0;
|
||||
int aNbFacesNoTri = 0;
|
||||
//BBS: fill temporary triangulation
|
||||
Standard_Integer aNodeOffset = 0;
|
||||
Standard_Integer aTriangleOffet = 0;
|
||||
int aNodeOffset = 0;
|
||||
int aTriangleOffet = 0;
|
||||
for (TopExp_Explorer anExpSF(theSolid, TopAbs_FACE); anExpSF.More(); anExpSF.Next()) {
|
||||
const TopoDS_Shape& aFace = anExpSF.Current();
|
||||
TopLoc_Location aLoc;
|
||||
@@ -219,21 +219,21 @@ static void MakeMesh(TopoDS_Shape& theSolid, TriangleMesh& theMesh)
|
||||
}
|
||||
//BBS: copy nodes
|
||||
gp_Trsf aTrsf = aLoc.Transformation();
|
||||
for (Standard_Integer aNodeIter = 1; aNodeIter <= aTriangulation->NbNodes(); ++aNodeIter) {
|
||||
for (int aNodeIter = 1; aNodeIter <= aTriangulation->NbNodes(); ++aNodeIter) {
|
||||
gp_Pnt aPnt = aTriangulation->Node(aNodeIter);
|
||||
aPnt.Transform(aTrsf);
|
||||
points.emplace_back(Vec3f(aPnt.X(), aPnt.Y(), aPnt.Z()));
|
||||
}
|
||||
//BBS: copy triangles
|
||||
const TopAbs_Orientation anOrientation = anExpSF.Current().Orientation();
|
||||
for (Standard_Integer aTriIter = 1; aTriIter <= aTriangulation->NbTriangles(); ++aTriIter) {
|
||||
for (int aTriIter = 1; aTriIter <= aTriangulation->NbTriangles(); ++aTriIter) {
|
||||
Poly_Triangle aTri = aTriangulation->Triangle(aTriIter);
|
||||
|
||||
Standard_Integer anId[3];
|
||||
int anId[3];
|
||||
aTri.Get(anId[0], anId[1], anId[2]);
|
||||
if (anOrientation == TopAbs_REVERSED) {
|
||||
//BBS: swap 1, 2.
|
||||
Standard_Integer aTmpIdx = anId[1];
|
||||
int aTmpIdx = anId[1];
|
||||
anId[1] = anId[2];
|
||||
anId[2] = aTmpIdx;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user