fix parsing of stl parameters from python

This commit is contained in:
Christopher Lackner 2019-10-07 12:56:12 +02:00
parent 9a3d121c47
commit b0f13a1f20
4 changed files with 70 additions and 73 deletions

View File

@ -52,7 +52,7 @@ void CreateSTLParametersFromKwargs(STLParameters& stlparam, py::dict kwargs)
stlparam.outerchartangle = py::cast<double>(kwargs.attr("pop")("outerchartangle"));
if(kwargs.contains("usesearchtree"))
stlparam.usesearchtree = py::cast<int>(kwargs.attr("pop")("usesearchtree"));
if(kwargs.contains("resthatlasfac"))
if(kwargs.contains("atlasfac"))
{
auto val = kwargs.attr("pop")("resthatlasfac");
if(val.is_none())
@ -65,9 +65,9 @@ void CreateSTLParametersFromKwargs(STLParameters& stlparam, py::dict kwargs)
}
if(kwargs.contains("atlasminh"))
stlparam.atlasminh = py::cast<double>(kwargs.attr("pop")("atlasminh"));
if(kwargs.contains("resthsurfcurvfac"))
if(kwargs.contains("surfcurvfac"))
{
auto val = kwargs.attr("pop")("resthsurfcurvfac");
auto val = kwargs.attr("pop")("surfcurvfac");
if(val.is_none())
stlparam.resthsurfcurvenable = false;
else
@ -76,9 +76,9 @@ void CreateSTLParametersFromKwargs(STLParameters& stlparam, py::dict kwargs)
stlparam.resthsurfcurvfac = py::cast<double>(val);
}
}
if(kwargs.contains("resthchartdistfac"))
if(kwargs.contains("chartdistfac"))
{
auto val = kwargs.attr("pop")("resthchartdistfac");
auto val = kwargs.attr("pop")("chartdistfac");
if(val.is_none())
stlparam.resthchartdistenable = false;
else
@ -87,9 +87,9 @@ void CreateSTLParametersFromKwargs(STLParameters& stlparam, py::dict kwargs)
stlparam.resthchartdistfac = py::cast<double>(val);
}
}
if(kwargs.contains("resthcloseedgefac"))
if(kwargs.contains("closeedgefac"))
{
auto val = kwargs.attr("pop")("resthcloseedgefac");
auto val = kwargs.attr("pop")("closeedgefac");
if(val.is_none())
stlparam.resthcloseedgeenable = false;
else
@ -98,9 +98,9 @@ void CreateSTLParametersFromKwargs(STLParameters& stlparam, py::dict kwargs)
stlparam.resthcloseedgefac = py::cast<double>(val);
}
}
if(kwargs.contains("resthedgeanglefac"))
if(kwargs.contains("edgeanglefac"))
{
auto val = kwargs.attr("pop")("resthedgeanglefac");
auto val = kwargs.attr("pop")("edgeanglefac");
if(val.is_none())
stlparam.resthedgeangleenable = false;
else
@ -109,9 +109,9 @@ void CreateSTLParametersFromKwargs(STLParameters& stlparam, py::dict kwargs)
stlparam.resthedgeanglefac = py::cast<double>(val);
}
}
if(kwargs.contains("resthsurfmeshcurvfac"))
if(kwargs.contains("surfmeshcurvfac"))
{
auto val = kwargs.attr("pop")("resthsurfmeshcurvfac");
auto val = kwargs.attr("pop")("surfmeshcurvfac");
if(val.is_none())
stlparam.resthsurfmeshcurvenable = false;
else
@ -120,9 +120,9 @@ void CreateSTLParametersFromKwargs(STLParameters& stlparam, py::dict kwargs)
stlparam.resthsurfmeshcurvfac = py::cast<double>(val);
}
}
if(kwargs.contains("resthlinelengthfac"))
if(kwargs.contains("linelengthfac"))
{
auto val = kwargs.attr("pop")("resthlinelengthfac");
auto val = kwargs.attr("pop")("linelengthfac");
if(val.is_none())
stlparam.resthlinelengthenable = false;
else

View File

@ -302,6 +302,13 @@ public:
void Print (ostream & ost) const;
};
inline ostream & operator<< (ostream & ost, const STLParameters & stlparam)
{
stlparam.Print (ost);
return ost;
}
void STLMeshing (STLGeometry & geom,
Mesh & mesh,

View File

@ -6,12 +6,10 @@ class _MeshsizeObject:
return MeshingParameters(curvaturesafety=1,
segmentsperedge=0.3,
grading=0.7,
surfcurvfac=0.25,
chartdistfac=0.8,
linelengthfac=0.2,
closeedgefac=0.5,
minedgelen=0.002,
edgeanglefac=0.25,
surfmeshcurvfac=1.,
optsteps3d=5)
@property
@ -19,12 +17,10 @@ class _MeshsizeObject:
return MeshingParameters(curvaturesafety=1.5,
segmentsperedge=0.5,
grading=0.5,
surfcurvfac=0.5,
chartdistfac=1,
linelengthfac=0.35,
closeedgefac=1,
minedgelen=0.02,
edgeanglefac=0.5,
surfmeshcurvfac=1.5,
optsteps3d=5)
@property
@ -32,12 +28,10 @@ class _MeshsizeObject:
return MeshingParameters(curvaturesafety=2,
segmentsperedge=1,
grading=0.3,
surfcurvfac=1.,
chartdistfac=1.5,
linelengthfac=0.5,
closeedgefac=2,
minedgelen=0.2,
edgeanglefac=1,
surfmeshcurvfac=2.,
optsteps3d=5)
@property
@ -45,12 +39,10 @@ class _MeshsizeObject:
return MeshingParameters(curvaturesafety=3,
segmentsperedge=2,
grading=0.2,
surfcurvfac=1.5,
chartdistfac=2,
linelengthfac=1.5,
closeedgefac=3.5,
minedgelen=1.,
edgeanglefac=1.5,
surfmeshcurvfac=3.,
optsteps3d=5)
@ -59,12 +51,10 @@ class _MeshsizeObject:
return MeshingParameters(curvaturesafety=5,
segmentsperedge=3,
grading=0.1,
surfcurvfac=3,
chartdistfac=5,
linelengthfac=3,
closeedgefac=5,
minedgelen=2.,
edgeanglefac=3.,
surfmeshcurvfac=5.,
optsteps3d=5)

View File

@ -691,39 +691,39 @@
"total_badness": 2772.6154636
},
{
"ne1d": 398,
"ne2d": 1030,
"ne3d": 1389,
"quality_histogram": "[0, 0, 0, 0, 2, 5, 18, 35, 47, 74, 111, 126, 131, 179, 189, 185, 134, 93, 46, 14]",
"total_badness": 2178.5663259
"ne1d": 298,
"ne2d": 608,
"ne3d": 770,
"quality_histogram": "[0, 0, 0, 1, 10, 9, 19, 15, 35, 46, 62, 87, 79, 89, 83, 87, 64, 45, 30, 9]",
"total_badness": 1284.6220542
},
{
"ne1d": 422,
"ne2d": 1094,
"ne3d": 1530,
"quality_histogram": "[0, 0, 0, 0, 0, 7, 14, 43, 46, 79, 94, 164, 155, 163, 212, 180, 180, 118, 61, 14]",
"total_badness": 2364.3186941
"ne1d": 370,
"ne2d": 854,
"ne3d": 1130,
"quality_histogram": "[0, 0, 0, 0, 2, 4, 17, 25, 26, 34, 64, 107, 137, 161, 156, 181, 93, 73, 42, 8]",
"total_badness": 1739.2621504
},
{
"ne1d": 456,
"ne2d": 1230,
"ne3d": 1988,
"quality_histogram": "[0, 0, 0, 0, 0, 2, 2, 5, 19, 39, 62, 112, 177, 236, 314, 304, 295, 236, 140, 45]",
"total_badness": 2747.770553
"ne1d": 516,
"ne2d": 1584,
"ne3d": 2549,
"quality_histogram": "[0, 0, 0, 0, 2, 1, 7, 19, 30, 53, 121, 174, 224, 296, 384, 362, 331, 304, 201, 40]",
"total_badness": 3600.6650263
},
{
"ne1d": 498,
"ne2d": 1396,
"ne3d": 2903,
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 3, 4, 13, 31, 64, 136, 221, 397, 484, 533, 504, 399, 114]",
"total_badness": 3701.6633824
"ne1d": 722,
"ne2d": 2888,
"ne3d": 6818,
"quality_histogram": "[0, 0, 0, 0, 0, 0, 1, 3, 12, 29, 67, 167, 379, 655, 877, 1099, 1146, 1177, 948, 258]",
"total_badness": 8742.2896959
},
{
"ne1d": 538,
"ne2d": 1670,
"ne3d": 4609,
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 14, 45, 103, 220, 448, 693, 963, 1055, 803, 257]",
"total_badness": 5628.2514122
"ne1d": 1862,
"ne2d": 19516,
"ne3d": 135482,
"quality_histogram": "[0, 0, 0, 0, 0, 1, 0, 6, 30, 145, 444, 1158, 3034, 7025, 13447, 21335, 28448, 30344, 22953, 7112]",
"total_badness": 165806.81509
}
],
"lshape3d.geo": [
@ -899,39 +899,39 @@
"total_badness": 1672.6379358
},
{
"ne1d": 146,
"ne2d": 378,
"ne3d": 629,
"quality_histogram": "[0, 0, 0, 0, 1, 4, 13, 14, 23, 44, 56, 74, 86, 82, 70, 72, 36, 38, 10, 6]",
"total_badness": 1030.3136745
"ne1d": 112,
"ne2d": 212,
"ne3d": 346,
"quality_histogram": "[0, 0, 0, 3, 8, 8, 8, 9, 19, 25, 40, 40, 35, 39, 38, 37, 17, 14, 5, 1]",
"total_badness": 629.86936176
},
{
"ne1d": 156,
"ne2d": 394,
"ne3d": 758,
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 3, 10, 24, 33, 62, 90, 103, 138, 113, 90, 60, 22, 10]",
"total_badness": 1097.0227588
"ne1d": 134,
"ne2d": 288,
"ne3d": 523,
"quality_histogram": "[0, 0, 0, 0, 0, 5, 5, 4, 14, 15, 32, 48, 68, 67, 66, 76, 44, 43, 29, 7]",
"total_badness": 790.86141744
},
{
"ne1d": 170,
"ne2d": 454,
"ne3d": 1180,
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 3, 4, 12, 16, 43, 89, 116, 178, 208, 222, 153, 99, 37]",
"total_badness": 1563.8386897
"ne1d": 194,
"ne2d": 594,
"ne3d": 1742,
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 2, 5, 9, 40, 88, 126, 192, 280, 281, 279, 241, 165, 34]",
"total_badness": 2325.4945287
},
{
"ne1d": 190,
"ne2d": 504,
"ne3d": 1516,
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 1, 6, 20, 50, 73, 141, 210, 280, 272, 238, 170, 55]",
"total_badness": 1957.4591373
"ne1d": 266,
"ne2d": 990,
"ne3d": 4103,
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 1, 2, 13, 28, 69, 162, 317, 534, 761, 831, 732, 513, 140]",
"total_badness": 5196.8765579
},
{
"ne1d": 230,
"ne2d": 698,
"ne3d": 3545,
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 2, 6, 12, 20, 44, 109, 246, 424, 580, 665, 742, 515, 180]",
"total_badness": 4425.483014
"ne1d": 674,
"ne2d": 6870,
"ne3d": 82768,
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 14, 59, 188, 513, 1613, 4088, 7976, 12954, 17553, 18871, 14413, 4526]",
"total_badness": 100797.22838
}
],
"period.geo": [