Merge pull request #1676 from terziman/master

Bug fixes for IFC
pull/1677/head
Kim Kulling 2018-01-04 00:27:17 +01:00 committed by GitHub
commit 840416831d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -330,7 +330,11 @@ void ProcessSweptDiskSolid(const IfcSweptDiskSolid solid, TempMesh& result, Conv
const unsigned int cnt_segments = conv.settings.cylindricalTessellation; const unsigned int cnt_segments = conv.settings.cylindricalTessellation;
const IfcFloat deltaAngle = AI_MATH_TWO_PI/cnt_segments; const IfcFloat deltaAngle = AI_MATH_TWO_PI/cnt_segments;
const size_t samples = curve->EstimateSampleCount(solid.StartParam,solid.EndParam); TempMesh temp;
curve->SampleDiscrete(temp, solid.StartParam, solid.EndParam);
const std::vector<IfcVector3>& curve_points = temp.verts;
const size_t samples = curve_points.size();
result.verts.reserve(cnt_segments * samples * 4); result.verts.reserve(cnt_segments * samples * 4);
result.vertcnt.reserve((cnt_segments - 1) * samples); result.vertcnt.reserve((cnt_segments - 1) * samples);
@ -338,10 +342,6 @@ void ProcessSweptDiskSolid(const IfcSweptDiskSolid solid, TempMesh& result, Conv
std::vector<IfcVector3> points; std::vector<IfcVector3> points;
points.reserve(cnt_segments * samples); points.reserve(cnt_segments * samples);
TempMesh temp;
curve->SampleDiscrete(temp,solid.StartParam,solid.EndParam);
const std::vector<IfcVector3>& curve_points = temp.verts;
if(curve_points.empty()) { if(curve_points.empty()) {
IFCImporter::LogWarn("curve evaluation yielded no points (IfcSweptDiskSolid)"); IFCImporter::LogWarn("curve evaluation yielded no points (IfcSweptDiskSolid)");
return; return;

View File

@ -2652,6 +2652,7 @@ template <> size_t GenericFill<IfcNamedUnit>(const DB& db, const LIST& params, I
size_t base = 0; size_t base = 0;
if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to IfcNamedUnit"); } do { // convert the 'Dimensions' argument if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to IfcNamedUnit"); } do { // convert the 'Dimensions' argument
std::shared_ptr<const DataType> arg = params[base++]; std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const UNSET*>(&*arg)) break;
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcNamedUnit,2>::aux_is_derived[0]=true; break; } if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcNamedUnit,2>::aux_is_derived[0]=true; break; }
try { GenericConvert( in->Dimensions, arg, db ); break; } try { GenericConvert( in->Dimensions, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcNamedUnit to be a `IfcDimensionalExponents`")); } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcNamedUnit to be a `IfcDimensionalExponents`")); }