Merge branch 'master' into better_fbx_material_import

pull/1704/head
Kim Kulling 2018-01-14 22:04:20 +01:00 committed by GitHub
commit c07069821d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 24872 additions and 730 deletions

View File

@ -43,7 +43,7 @@ __Importers__:
- AMJ
- ASE
- ASK
- B3D;
- B3D
- BLEND (Blender)
- BVH
- COB

View File

@ -457,24 +457,23 @@ ADD_ASSIMP_IMPORTER( BLEND
)
ADD_ASSIMP_IMPORTER( IFC
IFCLoader.cpp
IFCLoader.h
IFCReaderGen1.cpp
IFCReaderGen2.cpp
IFCReaderGen.h
IFCUtil.h
IFCUtil.cpp
IFCGeometry.cpp
IFCMaterial.cpp
IFCProfile.cpp
IFCCurve.cpp
IFCBoolean.cpp
IFCOpenings.cpp
STEPFile.h
STEPFileReader.h
STEPFileReader.cpp
STEPFileEncoding.cpp
STEPFileEncoding.h
Importer/IFC/IFCLoader.cpp
Importer/IFC/IFCLoader.h
Importer/IFC/IFCReaderGen1_2x3.cpp
Importer/IFC/IFCReaderGen2_2x3.cpp
Importer/IFC/IFCReaderGen_2x3.h
Importer/IFC/IFCUtil.h
Importer/IFC/IFCUtil.cpp
Importer/IFC/IFCGeometry.cpp
Importer/IFC/IFCMaterial.cpp
Importer/IFC/IFCProfile.cpp
Importer/IFC/IFCCurve.cpp
Importer/IFC/IFCBoolean.cpp
Importer/IFC/IFCOpenings.cpp
Importer/IFC/STEPFileReader.h
Importer/IFC/STEPFileReader.cpp
Importer/IFC/STEPFileEncoding.cpp
Importer/IFC/STEPFileEncoding.h
)
if (ASSIMP_BUILD_IFC_IMPORTER)
if (MSVC)
@ -697,6 +696,7 @@ ADD_ASSIMP_IMPORTER( MMD
)
SET( Step_SRCS
STEPFile.h
StepExporter.h
StepExporter.cpp
)

View File

@ -42,17 +42,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @brief Implements a subset of Ifc boolean operations
*/
#ifndef ASSIMP_BUILD_NO_IFC_IMPORTER
#include "IFCUtil.h"
#include "PolyTools.h"
#include "ProcessHelper.h"
#include "code/Importer/IFC/IFCUtil.h"
#include "code/PolyTools.h"
#include "code/ProcessHelper.h"
#include <assimp/Defines.h>
#include <iterator>
#include <tuple>
namespace Assimp {
namespace IFC {
@ -61,7 +59,7 @@ namespace Assimp {
// The function then generates a hit only if the end is beyond a certain margin in that direction, filtering out
// "very close to plane" ghost hits as long as start and end stay directly on or within the given plane side.
bool IntersectSegmentPlane(const IfcVector3& p,const IfcVector3& n, const IfcVector3& e0,
const IfcVector3& e1, bool assumeStartOnWhiteSide, IfcVector3& out)
const IfcVector3& e1, bool assumeStartOnWhiteSide, IfcVector3& out)
{
const IfcVector3 pdelta = e0 - p, seg = e1 - e0;
const IfcFloat dotOne = n*seg, dotTwo = -(n*pdelta);
@ -131,20 +129,20 @@ void WritePolygon(std::vector<IfcVector3>& resultpoly, TempMesh& result)
if( resultpoly.size() > 2 )
{
result.verts.insert(result.verts.end(), resultpoly.begin(), resultpoly.end());
result.vertcnt.push_back(static_cast<unsigned int>(resultpoly.size()));
result.mVerts.insert(result.mVerts.end(), resultpoly.begin(), resultpoly.end());
result.mVertcnt.push_back(static_cast<unsigned int>(resultpoly.size()));
}
}
// ------------------------------------------------------------------------------------------------
void ProcessBooleanHalfSpaceDifference(const IfcHalfSpaceSolid* hs, TempMesh& result,
void ProcessBooleanHalfSpaceDifference(const Schema_2x3::IfcHalfSpaceSolid* hs, TempMesh& result,
const TempMesh& first_operand,
ConversionData& /*conv*/)
{
ai_assert(hs != NULL);
const IfcPlane* const plane = hs->BaseSurface->ToPtr<IfcPlane>();
const Schema_2x3::IfcPlane* const plane = hs->BaseSurface->ToPtr<Schema_2x3::IfcPlane>();
if(!plane) {
IFCImporter::LogError("expected IfcPlane as base surface for the IfcHalfSpaceSolid");
return;
@ -162,14 +160,14 @@ void ProcessBooleanHalfSpaceDifference(const IfcHalfSpaceSolid* hs, TempMesh& re
}
// clip the current contents of `meshout` against the plane we obtained from the second operand
const std::vector<IfcVector3>& in = first_operand.verts;
std::vector<IfcVector3>& outvert = result.verts;
const std::vector<IfcVector3>& in = first_operand.mVerts;
std::vector<IfcVector3>& outvert = result.mVerts;
std::vector<unsigned int>::const_iterator begin = first_operand.vertcnt.begin(),
end = first_operand.vertcnt.end(), iit;
std::vector<unsigned int>::const_iterator begin = first_operand.mVertcnt.begin(),
end = first_operand.mVertcnt.end(), iit;
outvert.reserve(in.size());
result.vertcnt.reserve(first_operand.vertcnt.size());
result.mVertcnt.reserve(first_operand.mVertcnt.size());
unsigned int vidx = 0;
for(iit = begin; iit != end; vidx += *iit++) {
@ -229,10 +227,10 @@ void ProcessBooleanHalfSpaceDifference(const IfcHalfSpaceSolid* hs, TempMesh& re
--newcount;
}
if(newcount > 2) {
result.vertcnt.push_back(newcount);
result.mVertcnt.push_back(newcount);
}
else while(newcount-->0) {
result.verts.pop_back();
result.mVerts.pop_back();
}
}
@ -386,13 +384,13 @@ bool PointInPoly(const IfcVector3& p, const std::vector<IfcVector3>& boundary)
// ------------------------------------------------------------------------------------------------
void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBoundedHalfSpace* hs, TempMesh& result,
void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const Schema_2x3::IfcPolygonalBoundedHalfSpace* hs, TempMesh& result,
const TempMesh& first_operand,
ConversionData& conv)
{
ai_assert(hs != NULL);
const IfcPlane* const plane = hs->BaseSurface->ToPtr<IfcPlane>();
const Schema_2x3::IfcPlane* const plane = hs->BaseSurface->ToPtr<Schema_2x3::IfcPlane>();
if(!plane) {
IFCImporter::LogError("expected IfcPlane as base surface for the IfcHalfSpaceSolid");
return;
@ -419,7 +417,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
}
// determine winding order by calculating the normal.
IfcVector3 profileNormal = TempMesh::ComputePolygonNormal(profile->verts.data(), profile->verts.size());
IfcVector3 profileNormal = TempMesh::ComputePolygonNormal(profile->mVerts.data(), profile->mVerts.size());
IfcMatrix4 proj_inv;
ConvertAxisPlacement(proj_inv,hs->Position);
@ -430,16 +428,16 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
proj.Inverse();
// clip the current contents of `meshout` against the plane we obtained from the second operand
const std::vector<IfcVector3>& in = first_operand.verts;
std::vector<IfcVector3>& outvert = result.verts;
std::vector<unsigned int>& outvertcnt = result.vertcnt;
const std::vector<IfcVector3>& in = first_operand.mVerts;
std::vector<IfcVector3>& outvert = result.mVerts;
std::vector<unsigned int>& outvertcnt = result.mVertcnt;
outvert.reserve(in.size());
outvertcnt.reserve(first_operand.vertcnt.size());
outvertcnt.reserve(first_operand.mVertcnt.size());
unsigned int vidx = 0;
std::vector<unsigned int>::const_iterator begin = first_operand.vertcnt.begin();
std::vector<unsigned int>::const_iterator end = first_operand.vertcnt.end();
std::vector<unsigned int>::const_iterator begin = first_operand.mVertcnt.begin();
std::vector<unsigned int>::const_iterator end = first_operand.mVertcnt.end();
std::vector<unsigned int>::const_iterator iit;
for( iit = begin; iit != end; vidx += *iit++ )
{
@ -510,7 +508,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
{
// poly edge index, intersection point, edge index in boundary poly
std::vector<std::tuple<size_t, IfcVector3, size_t> > intersections;
bool startedInside = PointInPoly(proj * blackside.front(), profile->verts);
bool startedInside = PointInPoly(proj * blackside.front(), profile->mVerts);
bool isCurrentlyInside = startedInside;
std::vector<std::pair<size_t, IfcVector3> > intersected_boundary;
@ -521,7 +519,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
const IfcVector3 e1 = proj * blackside[(a + 1) % blackside.size()];
intersected_boundary.clear();
IntersectsBoundaryProfile(e0, e1, profile->verts, isCurrentlyInside, intersected_boundary);
IntersectsBoundaryProfile(e0, e1, profile->mVerts, isCurrentlyInside, intersected_boundary);
// sort the hits by distance from e0 to get the correct in/out/in sequence. Manually :-( I miss you, C++11.
if( intersected_boundary.size() > 1 )
{
@ -634,17 +632,17 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
// generate segments along the boundary polygon that lie in the poly's plane until we hit another intersection
IfcVector3 startingPoint = proj * std::get<1>(nextintsec);
size_t currentBoundaryEdgeIdx = (std::get<2>(nextintsec) + (marchBackwardsOnBoundary ? 1 : 0)) % profile->verts.size();
size_t currentBoundaryEdgeIdx = (std::get<2>(nextintsec) + (marchBackwardsOnBoundary ? 1 : 0)) % profile->mVerts.size();
size_t nextIntsecIdx = SIZE_MAX;
while( nextIntsecIdx == SIZE_MAX )
{
IfcFloat t = 1e10;
size_t nextBoundaryEdgeIdx = marchBackwardsOnBoundary ? (currentBoundaryEdgeIdx + profile->verts.size() - 1) : currentBoundaryEdgeIdx + 1;
nextBoundaryEdgeIdx %= profile->verts.size();
size_t nextBoundaryEdgeIdx = marchBackwardsOnBoundary ? (currentBoundaryEdgeIdx + profile->mVerts.size() - 1) : currentBoundaryEdgeIdx + 1;
nextBoundaryEdgeIdx %= profile->mVerts.size();
// vertices of the current boundary segments
IfcVector3 currBoundaryPoint = profile->verts[currentBoundaryEdgeIdx];
IfcVector3 nextBoundaryPoint = profile->verts[nextBoundaryEdgeIdx];
IfcVector3 currBoundaryPoint = profile->mVerts[currentBoundaryEdgeIdx];
IfcVector3 nextBoundaryPoint = profile->mVerts[nextBoundaryEdgeIdx];
// project the two onto the polygon
if( std::abs(polyNormal.z) > 1e-5 )
{
@ -693,7 +691,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
}
// quick endless loop check
if( resultpoly.size() > blackside.size() + profile->verts.size() )
if( resultpoly.size() > blackside.size() + profile->mVerts.size() )
{
IFCImporter::LogError("Encountered endless loop while clipping polygon against poly-bounded half space.");
break;
@ -718,7 +716,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
}
// ------------------------------------------------------------------------------------------------
void ProcessBooleanExtrudedAreaSolidDifference(const IfcExtrudedAreaSolid* as, TempMesh& result,
void ProcessBooleanExtrudedAreaSolidDifference(const Schema_2x3::IfcExtrudedAreaSolid* as, TempMesh& result,
const TempMesh& first_operand,
ConversionData& conv)
{
@ -738,12 +736,12 @@ void ProcessBooleanExtrudedAreaSolidDifference(const IfcExtrudedAreaSolid* as, T
TempMesh temp;
std::vector<IfcVector3>::const_iterator vit = first_operand.verts.begin();
for(unsigned int pcount : first_operand.vertcnt) {
std::vector<IfcVector3>::const_iterator vit = first_operand.mVerts.begin();
for(unsigned int pcount : first_operand.mVertcnt) {
temp.Clear();
temp.verts.insert(temp.verts.end(), vit, vit + pcount);
temp.vertcnt.push_back(pcount);
temp.mVerts.insert(temp.mVerts.end(), vit, vit + pcount);
temp.mVertcnt.push_back(pcount);
// The algorithms used to generate mesh geometry sometimes
// spit out lines or other degenerates which must be
@ -767,11 +765,11 @@ void ProcessBooleanExtrudedAreaSolidDifference(const IfcExtrudedAreaSolid* as, T
}
// ------------------------------------------------------------------------------------------------
void ProcessBoolean(const IfcBooleanResult& boolean, TempMesh& result, ConversionData& conv)
void ProcessBoolean(const Schema_2x3::IfcBooleanResult& boolean, TempMesh& result, ConversionData& conv)
{
// supported CSG operations:
// DIFFERENCE
if(const IfcBooleanResult* const clip = boolean.ToPtr<IfcBooleanResult>()) {
if(const Schema_2x3::IfcBooleanResult* const clip = boolean.ToPtr<Schema_2x3::IfcBooleanResult>()) {
if(clip->Operator != "DIFFERENCE") {
IFCImporter::LogWarn("encountered unsupported boolean operator: " + (std::string)clip->Operator);
return;
@ -786,18 +784,18 @@ void ProcessBoolean(const IfcBooleanResult& boolean, TempMesh& result, Conversio
// IfcExtrudedAreaSolid -- reduce to an instance of the quadrify() algorithm
const IfcHalfSpaceSolid* const hs = clip->SecondOperand->ResolveSelectPtr<IfcHalfSpaceSolid>(conv.db);
const IfcExtrudedAreaSolid* const as = clip->SecondOperand->ResolveSelectPtr<IfcExtrudedAreaSolid>(conv.db);
const Schema_2x3::IfcHalfSpaceSolid* const hs = clip->SecondOperand->ResolveSelectPtr<Schema_2x3::IfcHalfSpaceSolid>(conv.db);
const Schema_2x3::IfcExtrudedAreaSolid* const as = clip->SecondOperand->ResolveSelectPtr<Schema_2x3::IfcExtrudedAreaSolid>(conv.db);
if(!hs && !as) {
IFCImporter::LogError("expected IfcHalfSpaceSolid or IfcExtrudedAreaSolid as second clipping operand");
return;
}
TempMesh first_operand;
if(const IfcBooleanResult* const op0 = clip->FirstOperand->ResolveSelectPtr<IfcBooleanResult>(conv.db)) {
if(const Schema_2x3::IfcBooleanResult* const op0 = clip->FirstOperand->ResolveSelectPtr<Schema_2x3::IfcBooleanResult>(conv.db)) {
ProcessBoolean(*op0,first_operand,conv);
}
else if (const IfcSweptAreaSolid* const swept = clip->FirstOperand->ResolveSelectPtr<IfcSweptAreaSolid>(conv.db)) {
else if (const Schema_2x3::IfcSweptAreaSolid* const swept = clip->FirstOperand->ResolveSelectPtr<Schema_2x3::IfcSweptAreaSolid>(conv.db)) {
ProcessSweptAreaSolid(*swept,first_operand,conv);
}
else {
@ -807,7 +805,7 @@ void ProcessBoolean(const IfcBooleanResult& boolean, TempMesh& result, Conversio
if(hs) {
const IfcPolygonalBoundedHalfSpace* const hs_bounded = clip->SecondOperand->ResolveSelectPtr<IfcPolygonalBoundedHalfSpace>(conv.db);
const Schema_2x3::IfcPolygonalBoundedHalfSpace* const hs_bounded = clip->SecondOperand->ResolveSelectPtr<Schema_2x3::IfcPolygonalBoundedHalfSpace>(conv.db);
if (hs_bounded) {
ProcessPolygonalBoundedBooleanHalfSpaceDifference(hs_bounded, result, first_operand, conv);
}

View File

@ -57,7 +57,7 @@ namespace {
class Conic : public Curve {
public:
// --------------------------------------------------
Conic(const IfcConic& entity, ConversionData& conv)
Conic(const Schema_2x3::IfcConic& entity, ConversionData& conv)
: Curve(entity,conv) {
IfcMatrix4 trafo;
ConvertAxisPlacement(trafo,*entity.Position,conv);
@ -103,7 +103,7 @@ protected:
class Circle : public Conic {
public:
// --------------------------------------------------
Circle(const IfcCircle& entity, ConversionData& conv)
Circle(const Schema_2x3::IfcCircle& entity, ConversionData& conv)
: Conic(entity,conv)
, entity(entity)
{
@ -117,17 +117,16 @@ public:
}
private:
const IfcCircle& entity;
const Schema_2x3::IfcCircle& entity;
};
// --------------------------------------------------------------------------------
// Ellipse
// --------------------------------------------------------------------------------
class Ellipse : public Conic {
public:
// --------------------------------------------------
Ellipse(const IfcEllipse& entity, ConversionData& conv)
Ellipse(const Schema_2x3::IfcEllipse& entity, ConversionData& conv)
: Conic(entity,conv)
, entity(entity) {
// empty
@ -141,7 +140,7 @@ public:
}
private:
const IfcEllipse& entity;
const Schema_2x3::IfcEllipse& entity;
};
// --------------------------------------------------------------------------------
@ -150,7 +149,7 @@ private:
class Line : public Curve {
public:
// --------------------------------------------------
Line(const IfcLine& entity, ConversionData& conv)
Line(const Schema_2x3::IfcLine& entity, ConversionData& conv)
: Curve(entity,conv) {
ConvertCartesianPoint(p,entity.Pnt);
ConvertVector(v,entity.Dir);
@ -181,12 +180,12 @@ public:
ai_assert( InRange( b ) );
if (a == b) {
out.verts.push_back(Eval(a));
out.mVerts.push_back(Eval(a));
return;
}
out.verts.reserve(out.verts.size()+2);
out.verts.push_back(Eval(a));
out.verts.push_back(Eval(b));
out.mVerts.reserve(out.mVerts.size()+2);
out.mVerts.push_back(Eval(a));
out.mVerts.push_back(Eval(b));
}
// --------------------------------------------------
@ -208,11 +207,11 @@ class CompositeCurve : public BoundedCurve {
public:
// --------------------------------------------------
CompositeCurve(const IfcCompositeCurve& entity, ConversionData& conv)
CompositeCurve(const Schema_2x3::IfcCompositeCurve& entity, ConversionData& conv)
: BoundedCurve(entity,conv)
, total() {
curves.reserve(entity.Segments.size());
for(const IfcCompositeCurveSegment& curveSegment :entity.Segments) {
for(const Schema_2x3::IfcCompositeCurveSegment& curveSegment :entity.Segments) {
// according to the specification, this must be a bounded curve
std::shared_ptr< Curve > cv(Curve::Convert(curveSegment.ParentCurve,conv));
std::shared_ptr< BoundedCurve > bc = std::dynamic_pointer_cast<BoundedCurve>(cv);
@ -282,14 +281,14 @@ public:
ai_assert( InRange( b ) );
const size_t cnt = EstimateSampleCount(a,b);
out.verts.reserve(out.verts.size() + cnt);
out.mVerts.reserve(out.mVerts.size() + cnt);
for(const CurveEntry& entry : curves) {
const size_t cnt = out.verts.size();
const size_t cnt = out.mVerts.size();
entry.first->SampleDiscrete(out);
if (!entry.second && cnt != out.verts.size()) {
std::reverse(out.verts.begin()+cnt,out.verts.end());
if (!entry.second && cnt != out.mVerts.size()) {
std::reverse(out.mVerts.begin()+cnt,out.mVerts.end());
}
}
}
@ -310,7 +309,7 @@ private:
class TrimmedCurve : public BoundedCurve {
public:
// --------------------------------------------------
TrimmedCurve(const IfcTrimmedCurve& entity, ConversionData& conv)
TrimmedCurve(const Schema_2x3::IfcTrimmedCurve& entity, ConversionData& conv)
: BoundedCurve(entity,conv)
{
base = std::shared_ptr<const Curve>(Curve::Convert(entity.BasisCurve,conv));
@ -325,12 +324,12 @@ public:
bool have_param = false, have_point = false;
IfcVector3 point;
for(const Entry sel :entity.Trim1) {
if (const EXPRESS::REAL* const r = sel->ToPtr<EXPRESS::REAL>()) {
if (const ::Assimp::STEP::EXPRESS::REAL* const r = sel->ToPtr<::Assimp::STEP::EXPRESS::REAL>()) {
range.first = *r;
have_param = true;
break;
}
else if (const IfcCartesianPoint* const r = sel->ResolveSelectPtr<IfcCartesianPoint>(conv.db)) {
else if (const Schema_2x3::IfcCartesianPoint* const r = sel->ResolveSelectPtr<Schema_2x3::IfcCartesianPoint>(conv.db)) {
ConvertCartesianPoint(point,*r);
have_point = true;
}
@ -342,12 +341,12 @@ public:
}
have_param = false, have_point = false;
for(const Entry sel :entity.Trim2) {
if (const EXPRESS::REAL* const r = sel->ToPtr<EXPRESS::REAL>()) {
if (const ::Assimp::STEP::EXPRESS::REAL* const r = sel->ToPtr<::Assimp::STEP::EXPRESS::REAL>()) {
range.second = *r;
have_param = true;
break;
}
else if (const IfcCartesianPoint* const r = sel->ResolveSelectPtr<IfcCartesianPoint>(conv.db)) {
else if (const Schema_2x3::IfcCartesianPoint* const r = sel->ResolveSelectPtr<Schema_2x3::IfcCartesianPoint>(conv.db)) {
ConvertCartesianPoint(point,*r);
have_point = true;
}
@ -420,13 +419,13 @@ private:
class PolyLine : public BoundedCurve {
public:
// --------------------------------------------------
PolyLine(const IfcPolyline& entity, ConversionData& conv)
PolyLine(const Schema_2x3::IfcPolyline& entity, ConversionData& conv)
: BoundedCurve(entity,conv)
{
points.reserve(entity.Points.size());
IfcVector3 t;
for(const IfcCartesianPoint& cp : entity.Points) {
for(const Schema_2x3::IfcCartesianPoint& cp : entity.Points) {
ConvertCartesianPoint(t,cp);
points.push_back(t);
}
@ -463,29 +462,29 @@ private:
} // anon
// ------------------------------------------------------------------------------------------------
Curve* Curve::Convert(const IFC::IfcCurve& curve,ConversionData& conv) {
if(curve.ToPtr<IfcBoundedCurve>()) {
if(const IfcPolyline* c = curve.ToPtr<IfcPolyline>()) {
Curve* Curve::Convert(const IFC::Schema_2x3::IfcCurve& curve,ConversionData& conv) {
if(curve.ToPtr<Schema_2x3::IfcBoundedCurve>()) {
if(const Schema_2x3::IfcPolyline* c = curve.ToPtr<Schema_2x3::IfcPolyline>()) {
return new PolyLine(*c,conv);
}
if(const IfcTrimmedCurve* c = curve.ToPtr<IfcTrimmedCurve>()) {
if(const Schema_2x3::IfcTrimmedCurve* c = curve.ToPtr<Schema_2x3::IfcTrimmedCurve>()) {
return new TrimmedCurve(*c,conv);
}
if(const IfcCompositeCurve* c = curve.ToPtr<IfcCompositeCurve>()) {
if(const Schema_2x3::IfcCompositeCurve* c = curve.ToPtr<Schema_2x3::IfcCompositeCurve>()) {
return new CompositeCurve(*c,conv);
}
}
if(curve.ToPtr<IfcConic>()) {
if(const IfcCircle* c = curve.ToPtr<IfcCircle>()) {
if(curve.ToPtr<Schema_2x3::IfcConic>()) {
if(const Schema_2x3::IfcCircle* c = curve.ToPtr<Schema_2x3::IfcCircle>()) {
return new Circle(*c,conv);
}
if(const IfcEllipse* c = curve.ToPtr<IfcEllipse>()) {
if(const Schema_2x3::IfcEllipse* c = curve.ToPtr<Schema_2x3::IfcEllipse>()) {
return new Ellipse(*c,conv);
}
}
if(const IfcLine* c = curve.ToPtr<IfcLine>()) {
if(const Schema_2x3::IfcLine* c = curve.ToPtr<Schema_2x3::IfcLine>()) {
return new Line(*c,conv);
}
@ -589,11 +588,11 @@ void Curve::SampleDiscrete(TempMesh& out,IfcFloat a, IfcFloat b) const {
ai_assert( InRange( b ) );
const size_t cnt = std::max(static_cast<size_t>(0),EstimateSampleCount(a,b));
out.verts.reserve( out.verts.size() + cnt + 1);
out.mVerts.reserve( out.mVerts.size() + cnt + 1);
IfcFloat p = a, delta = (b-a)/cnt;
for(size_t i = 0; i <= cnt; ++i, p += delta) {
out.verts.push_back(Eval(p));
out.mVerts.push_back(Eval(p));
}
}

View File

@ -46,8 +46,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_IFC_IMPORTER
#include "IFCUtil.h"
#include "PolyTools.h"
#include "ProcessHelper.h"
#include "code/PolyTools.h"
#include "code/ProcessHelper.h"
#include "../contrib/poly2tri/poly2tri/poly2tri.h"
#include "../contrib/clipper/clipper.hpp"
@ -59,27 +59,27 @@ namespace Assimp {
namespace IFC {
// ------------------------------------------------------------------------------------------------
bool ProcessPolyloop(const IfcPolyLoop& loop, TempMesh& meshout, ConversionData& /*conv*/)
bool ProcessPolyloop(const Schema_2x3::IfcPolyLoop& loop, TempMesh& meshout, ConversionData& /*conv*/)
{
size_t cnt = 0;
for(const IfcCartesianPoint& c : loop.Polygon) {
for(const Schema_2x3::IfcCartesianPoint& c : loop.Polygon) {
IfcVector3 tmp;
ConvertCartesianPoint(tmp,c);
meshout.verts.push_back(tmp);
meshout.mVerts.push_back(tmp);
++cnt;
}
meshout.vertcnt.push_back(static_cast<unsigned int>(cnt));
meshout.mVertcnt.push_back(static_cast<unsigned int>(cnt));
// zero- or one- vertex polyloops simply ignored
if (meshout.vertcnt.back() > 1) {
if (meshout.mVertcnt.back() > 1) {
return true;
}
if (meshout.vertcnt.back()==1) {
meshout.vertcnt.pop_back();
meshout.verts.pop_back();
if (meshout.mVertcnt.back()==1) {
meshout.mVertcnt.pop_back();
meshout.mVerts.pop_back();
}
return false;
}
@ -88,19 +88,19 @@ bool ProcessPolyloop(const IfcPolyLoop& loop, TempMesh& meshout, ConversionData&
void ProcessPolygonBoundaries(TempMesh& result, const TempMesh& inmesh, size_t master_bounds = (size_t)-1)
{
// handle all trivial cases
if(inmesh.vertcnt.empty()) {
if(inmesh.mVertcnt.empty()) {
return;
}
if(inmesh.vertcnt.size() == 1) {
if(inmesh.mVertcnt.size() == 1) {
result.Append(inmesh);
return;
}
ai_assert(std::count(inmesh.vertcnt.begin(), inmesh.vertcnt.end(), 0) == 0);
ai_assert(std::count(inmesh.mVertcnt.begin(), inmesh.mVertcnt.end(), 0) == 0);
typedef std::vector<unsigned int>::const_iterator face_iter;
face_iter begin = inmesh.vertcnt.begin(), end = inmesh.vertcnt.end(), iit;
face_iter begin = inmesh.mVertcnt.begin(), end = inmesh.mVertcnt.end(), iit;
std::vector<unsigned int>::const_iterator outer_polygon_it = end;
// major task here: given a list of nested polygon boundaries (one of which
@ -119,7 +119,7 @@ void ProcessPolygonBoundaries(TempMesh& result, const TempMesh& inmesh, size_t m
// shall be of the type IfcFaceOuterBound'
IfcFloat area_outer_polygon = 1e-10f;
if (master_bounds != (size_t)-1) {
ai_assert(master_bounds < inmesh.vertcnt.size());
ai_assert(master_bounds < inmesh.mVertcnt.size());
outer_polygon_it = begin + master_bounds;
}
else {
@ -146,9 +146,9 @@ void ProcessPolygonBoundaries(TempMesh& result, const TempMesh& inmesh, size_t m
// this is the plane onto which the quadrulate algorithm will
// project the entire mesh.
std::vector<TempOpening> fake_openings;
fake_openings.reserve(inmesh.vertcnt.size()-1);
fake_openings.reserve(inmesh.mVertcnt.size()-1);
std::vector<IfcVector3>::const_iterator vit = inmesh.verts.begin(), outer_vit;
std::vector<IfcVector3>::const_iterator vit = inmesh.mVerts.begin(), outer_vit;
for(iit = begin; iit != end; vit += *iit++) {
if (iit == outer_polygon_it) {
@ -171,32 +171,32 @@ void ProcessPolygonBoundaries(TempMesh& result, const TempMesh& inmesh, size_t m
opening.solid = NULL;
opening.profileMesh = std::make_shared<TempMesh>();
opening.profileMesh->verts.reserve(*iit);
opening.profileMesh->vertcnt.push_back(*iit);
opening.profileMesh->mVerts.reserve(*iit);
opening.profileMesh->mVertcnt.push_back(*iit);
std::copy(vit, vit + *iit, std::back_inserter(opening.profileMesh->verts));
std::copy(vit, vit + *iit, std::back_inserter(opening.profileMesh->mVerts));
}
// fill a mesh with ONLY the main polygon
TempMesh temp;
temp.verts.reserve(outer_polygon_size);
temp.vertcnt.push_back(static_cast<unsigned int>(outer_polygon_size));
temp.mVerts.reserve(outer_polygon_size);
temp.mVertcnt.push_back(static_cast<unsigned int>(outer_polygon_size));
std::copy(outer_vit, outer_vit+outer_polygon_size,
std::back_inserter(temp.verts));
std::back_inserter(temp.mVerts));
GenerateOpenings(fake_openings, normals, temp, false, false);
result.Append(temp);
}
// ------------------------------------------------------------------------------------------------
void ProcessConnectedFaceSet(const IfcConnectedFaceSet& fset, TempMesh& result, ConversionData& conv)
void ProcessConnectedFaceSet(const Schema_2x3::IfcConnectedFaceSet& fset, TempMesh& result, ConversionData& conv)
{
for(const IfcFace& face : fset.CfsFaces) {
for(const Schema_2x3::IfcFace& face : fset.CfsFaces) {
// size_t ob = -1, cnt = 0;
TempMesh meshout;
for(const IfcFaceBound& bound : face.Bounds) {
for(const Schema_2x3::IfcFaceBound& bound : face.Bounds) {
if(const IfcPolyLoop* const polyloop = bound.Bound->ToPtr<IfcPolyLoop>()) {
if(const Schema_2x3::IfcPolyLoop* const polyloop = bound.Bound->ToPtr<Schema_2x3::IfcPolyLoop>()) {
if(ProcessPolyloop(*polyloop, meshout,conv)) {
// The outer boundary is better determined by checking which
@ -230,12 +230,12 @@ void ProcessConnectedFaceSet(const IfcConnectedFaceSet& fset, TempMesh& result,
}
// ------------------------------------------------------------------------------------------------
void ProcessRevolvedAreaSolid(const IfcRevolvedAreaSolid& solid, TempMesh& result, ConversionData& conv)
void ProcessRevolvedAreaSolid(const Schema_2x3::IfcRevolvedAreaSolid& solid, TempMesh& result, ConversionData& conv)
{
TempMesh meshout;
// first read the profile description
if(!ProcessProfile(*solid.SweptArea,meshout,conv) || meshout.verts.size()<=1) {
if(!ProcessProfile(*solid.SweptArea,meshout,conv) || meshout.mVerts.size()<=1) {
return;
}
@ -246,7 +246,7 @@ void ProcessRevolvedAreaSolid(const IfcRevolvedAreaSolid& solid, TempMesh& resul
IfcMatrix4::Translation(pos,tb0);
IfcMatrix4::Translation(-pos,tb1);
const std::vector<IfcVector3>& in = meshout.verts;
const std::vector<IfcVector3>& in = meshout.mVerts;
const size_t size=in.size();
bool has_area = solid.SweptArea->ProfileType == "AREA" && size>2;
@ -263,14 +263,14 @@ void ProcessRevolvedAreaSolid(const IfcRevolvedAreaSolid& solid, TempMesh& resul
has_area = has_area && std::fabs(max_angle) < AI_MATH_TWO_PI_F*0.99;
result.verts.reserve(size*((cnt_segments+1)*4+(has_area?2:0)));
result.vertcnt.reserve(size*cnt_segments+2);
result.mVerts.reserve(size*((cnt_segments+1)*4+(has_area?2:0)));
result.mVertcnt.reserve(size*cnt_segments+2);
IfcMatrix4 rot;
rot = tb0 * IfcMatrix4::Rotation(delta,axis,rot) * tb1;
size_t base = 0;
std::vector<IfcVector3>& out = result.verts;
std::vector<IfcVector3>& out = result.mVerts;
// dummy data to simplify later processing
for(size_t i = 0; i < size; ++i) {
@ -281,7 +281,7 @@ void ProcessRevolvedAreaSolid(const IfcRevolvedAreaSolid& solid, TempMesh& resul
for(size_t i = 0; i < size; ++i) {
const size_t next = (i+1)%size;
result.vertcnt.push_back(4);
result.mVertcnt.push_back(4);
const IfcVector3 base_0 = out[base+i*4+3],base_1 = out[base+next*4+3];
out.push_back(base_0);
@ -305,8 +305,8 @@ void ProcessRevolvedAreaSolid(const IfcRevolvedAreaSolid& solid, TempMesh& resul
for(size_t i = 0; i < size; ++i ) {
out.push_back(out[i*4]);
}
result.vertcnt.push_back(static_cast<unsigned int>(size));
result.vertcnt.push_back(static_cast<unsigned int>(size));
result.mVertcnt.push_back(static_cast<unsigned int>(size));
result.mVertcnt.push_back(static_cast<unsigned int>(size));
}
IfcMatrix4 trafo;
@ -316,10 +316,8 @@ void ProcessRevolvedAreaSolid(const IfcRevolvedAreaSolid& solid, TempMesh& resul
IFCImporter::LogDebug("generate mesh procedurally by radial extrusion (IfcRevolvedAreaSolid)");
}
// ------------------------------------------------------------------------------------------------
void ProcessSweptDiskSolid(const IfcSweptDiskSolid solid, TempMesh& result, ConversionData& conv)
void ProcessSweptDiskSolid(const Schema_2x3::IfcSweptDiskSolid solid, TempMesh& result, ConversionData& conv)
{
const Curve* const curve = Curve::Convert(*solid.Directrix, conv);
if(!curve) {
@ -332,12 +330,12 @@ void ProcessSweptDiskSolid(const IfcSweptDiskSolid solid, TempMesh& result, Conv
TempMesh temp;
curve->SampleDiscrete(temp, solid.StartParam, solid.EndParam);
const std::vector<IfcVector3>& curve_points = temp.verts;
const std::vector<IfcVector3>& curve_points = temp.mVerts;
const size_t samples = curve_points.size();
result.verts.reserve(cnt_segments * samples * 4);
result.vertcnt.reserve((cnt_segments - 1) * samples);
result.mVerts.reserve(cnt_segments * samples * 4);
result.mVertcnt.reserve((cnt_segments - 1) * samples);
std::vector<IfcVector3> points;
points.reserve(cnt_segments * samples);
@ -434,22 +432,22 @@ void ProcessSweptDiskSolid(const IfcSweptDiskSolid solid, TempMesh& result, Conv
for (unsigned int seg = 0; seg < cnt_segments; ++seg) {
result.verts.push_back(points[ i * cnt_segments + (seg % cnt_segments)]);
result.verts.push_back(points[ i * cnt_segments + (seg + 1) % cnt_segments]);
result.verts.push_back(points[ (i+1) * cnt_segments + ((seg + 1 + best_pair_offset) % cnt_segments)]);
result.verts.push_back(points[ (i+1) * cnt_segments + ((seg + best_pair_offset) % cnt_segments)]);
result.mVerts.push_back(points[ i * cnt_segments + (seg % cnt_segments)]);
result.mVerts.push_back(points[ i * cnt_segments + (seg + 1) % cnt_segments]);
result.mVerts.push_back(points[ (i+1) * cnt_segments + ((seg + 1 + best_pair_offset) % cnt_segments)]);
result.mVerts.push_back(points[ (i+1) * cnt_segments + ((seg + best_pair_offset) % cnt_segments)]);
IfcVector3& v1 = *(result.verts.end()-1);
IfcVector3& v2 = *(result.verts.end()-2);
IfcVector3& v3 = *(result.verts.end()-3);
IfcVector3& v4 = *(result.verts.end()-4);
IfcVector3& v1 = *(result.mVerts.end()-1);
IfcVector3& v2 = *(result.mVerts.end()-2);
IfcVector3& v3 = *(result.mVerts.end()-3);
IfcVector3& v4 = *(result.mVerts.end()-4);
if (((v4-v3) ^ (v4-v1)) * (v4 - curve_points[i]) < 0.0f) {
std::swap(v4, v1);
std::swap(v3, v2);
}
result.vertcnt.push_back(4);
result.mVertcnt.push_back(4);
}
}
@ -459,14 +457,15 @@ void ProcessSweptDiskSolid(const IfcSweptDiskSolid solid, TempMesh& result, Conv
// ------------------------------------------------------------------------------------------------
IfcMatrix3 DerivePlaneCoordinateSpace(const TempMesh& curmesh, bool& ok, IfcVector3& norOut)
{
const std::vector<IfcVector3>& out = curmesh.verts;
const std::vector<IfcVector3>& out = curmesh.mVerts;
IfcMatrix3 m;
ok = true;
// The input "mesh" must be a single polygon
const size_t s = out.size();
assert(curmesh.vertcnt.size() == 1 && curmesh.vertcnt.back() == s);
ai_assert( curmesh.mVertcnt.size() == 1 );
ai_assert( curmesh.mVertcnt.back() == s);
const IfcVector3 any_point = out[s-1];
IfcVector3 nor;
@ -477,9 +476,10 @@ IfcMatrix3 DerivePlaneCoordinateSpace(const TempMesh& curmesh, bool& ok, IfcVect
// axis for the 2D coordinate space on the polygon plane, exploiting the
// fact that the input polygon is nearly always a quad.
bool done = false;
size_t i, j;
for (i = 0; !done && i < s-2; done || ++i) {
for (j = i+1; j < s-1; ++j) {
size_t idx( 0 );
for (size_t i = 0; !done && i < s-2; done || ++i) {
idx = i;
for (size_t j = i+1; j < s-1; ++j) {
nor = -((out[i]-any_point)^(out[j]-any_point));
if(std::fabs(nor.Length()) > 1e-8f) {
done = true;
@ -496,7 +496,7 @@ IfcMatrix3 DerivePlaneCoordinateSpace(const TempMesh& curmesh, bool& ok, IfcVect
nor.Normalize();
norOut = nor;
IfcVector3 r = (out[i]-any_point);
IfcVector3 r = (out[idx]-any_point);
r.Normalize();
//if(d) {
@ -524,12 +524,12 @@ IfcMatrix3 DerivePlaneCoordinateSpace(const TempMesh& curmesh, bool& ok, IfcVect
}
// Extrudes the given polygon along the direction, converts it into an opening or applies all openings as necessary.
void ProcessExtrudedArea(const IfcExtrudedAreaSolid& solid, const TempMesh& curve,
void ProcessExtrudedArea(const Schema_2x3::IfcExtrudedAreaSolid& solid, const TempMesh& curve,
const IfcVector3& extrusionDir, TempMesh& result, ConversionData &conv, bool collect_openings)
{
// Outline: 'curve' is now a list of vertex points forming the underlying profile, extrude along the given axis,
// forming new triangles.
const bool has_area = solid.SweptArea->ProfileType == "AREA" && curve.verts.size() > 2;
const bool has_area = solid.SweptArea->ProfileType == "AREA" && curve.mVerts.size() > 2;
if( solid.Depth < 1e-6 ) {
if( has_area ) {
result.Append(curve);
@ -537,9 +537,9 @@ void ProcessExtrudedArea(const IfcExtrudedAreaSolid& solid, const TempMesh& curv
return;
}
result.verts.reserve(curve.verts.size()*(has_area ? 4 : 2));
result.vertcnt.reserve(curve.verts.size() + 2);
std::vector<IfcVector3> in = curve.verts;
result.mVerts.reserve(curve.mVerts.size()*(has_area ? 4 : 2));
result.mVertcnt.reserve(curve.mVerts.size() + 2);
std::vector<IfcVector3> in = curve.mVerts;
// First step: transform all vertices into the target coordinate space
IfcMatrix4 trafo;
@ -582,24 +582,24 @@ void ProcessExtrudedArea(const IfcExtrudedAreaSolid& solid, const TempMesh& curv
for(TempOpening& t : *conv.apply_openings) {
TempMesh& bounds = *t.profileMesh.get();
if( bounds.verts.size() <= 2 ) {
if( bounds.mVerts.size() <= 2 ) {
nors.push_back(IfcVector3());
continue;
}
nors.push_back(((bounds.verts[2] - bounds.verts[0]) ^ (bounds.verts[1] - bounds.verts[0])).Normalize());
nors.push_back(((bounds.mVerts[2] - bounds.mVerts[0]) ^ (bounds.mVerts[1] - bounds.mVerts[0])).Normalize());
}
}
TempMesh temp;
TempMesh& curmesh = openings ? temp : result;
std::vector<IfcVector3>& out = curmesh.verts;
std::vector<IfcVector3>& out = curmesh.mVerts;
size_t sides_with_openings = 0;
for( size_t i = 0; i < in.size(); ++i ) {
const size_t next = (i + 1) % in.size();
curmesh.vertcnt.push_back(4);
curmesh.mVertcnt.push_back(4);
out.push_back(in[i]);
out.push_back(in[next]);
@ -638,7 +638,7 @@ void ProcessExtrudedArea(const IfcExtrudedAreaSolid& solid, const TempMesh& curv
out.push_back(in[i]);
}
curmesh.vertcnt.push_back(static_cast<unsigned int>(in.size()));
curmesh.mVertcnt.push_back(static_cast<unsigned int>(in.size()));
if( openings && in.size() > 2 ) {
if( GenerateOpenings(*conv.apply_openings, nors, temp, true, true, dir) ) {
++sides_with_v_openings;
@ -664,8 +664,8 @@ void ProcessExtrudedArea(const IfcExtrudedAreaSolid& solid, const TempMesh& curv
profile->Swap(result);
std::shared_ptr<TempMesh> profile2D = std::shared_ptr<TempMesh>(new TempMesh());
profile2D->verts.insert(profile2D->verts.end(), in.begin(), in.end());
profile2D->vertcnt.push_back(static_cast<unsigned int>(in.size()));
profile2D->mVerts.insert(profile2D->mVerts.end(), in.begin(), in.end());
profile2D->mVertcnt.push_back(static_cast<unsigned int>(in.size()));
conv.collect_openings->push_back(TempOpening(&solid, dir, profile, profile2D));
ai_assert(result.IsEmpty());
@ -673,13 +673,13 @@ void ProcessExtrudedArea(const IfcExtrudedAreaSolid& solid, const TempMesh& curv
}
// ------------------------------------------------------------------------------------------------
void ProcessExtrudedAreaSolid(const IfcExtrudedAreaSolid& solid, TempMesh& result,
void ProcessExtrudedAreaSolid(const Schema_2x3::IfcExtrudedAreaSolid& solid, TempMesh& result,
ConversionData& conv, bool collect_openings)
{
TempMesh meshout;
// First read the profile description.
if(!ProcessProfile(*solid.SweptArea,meshout,conv) || meshout.verts.size()<=1) {
if(!ProcessProfile(*solid.SweptArea,meshout,conv) || meshout.mVerts.size()<=1) {
return;
}
@ -691,13 +691,13 @@ void ProcessExtrudedAreaSolid(const IfcExtrudedAreaSolid& solid, TempMesh& resul
// and there's still so many corner cases uncovered - we really need a generic solution to all of this hole carving.
std::vector<TempOpening> fisherPriceMyFirstOpenings;
std::vector<TempOpening>* oldApplyOpenings = conv.apply_openings;
if( const IfcArbitraryProfileDefWithVoids* const cprofile = solid.SweptArea->ToPtr<IfcArbitraryProfileDefWithVoids>() ) {
if( const Schema_2x3::IfcArbitraryProfileDefWithVoids* const cprofile = solid.SweptArea->ToPtr<Schema_2x3::IfcArbitraryProfileDefWithVoids>() ) {
if( !cprofile->InnerCurves.empty() ) {
// read all inner curves and extrude them to form proper openings.
std::vector<TempOpening>* oldCollectOpenings = conv.collect_openings;
conv.collect_openings = &fisherPriceMyFirstOpenings;
for(const IfcCurve* curve : cprofile->InnerCurves) {
for (const Schema_2x3::IfcCurve* curve : cprofile->InnerCurves) {
TempMesh curveMesh, tempMesh;
ProcessCurve(*curve, curveMesh, conv);
ProcessExtrudedArea(solid, curveMesh, dir, tempMesh, conv, true);
@ -713,13 +713,13 @@ void ProcessExtrudedAreaSolid(const IfcExtrudedAreaSolid& solid, TempMesh& resul
}
// ------------------------------------------------------------------------------------------------
void ProcessSweptAreaSolid(const IfcSweptAreaSolid& swept, TempMesh& meshout,
void ProcessSweptAreaSolid(const Schema_2x3::IfcSweptAreaSolid& swept, TempMesh& meshout,
ConversionData& conv)
{
if(const IfcExtrudedAreaSolid* const solid = swept.ToPtr<IfcExtrudedAreaSolid>()) {
if(const Schema_2x3::IfcExtrudedAreaSolid* const solid = swept.ToPtr<Schema_2x3::IfcExtrudedAreaSolid>()) {
ProcessExtrudedAreaSolid(*solid,meshout,conv, !!conv.collect_openings);
}
else if(const IfcRevolvedAreaSolid* const rev = swept.ToPtr<IfcRevolvedAreaSolid>()) {
else if(const Schema_2x3::IfcRevolvedAreaSolid* const rev = swept.ToPtr<Schema_2x3::IfcRevolvedAreaSolid>()) {
ProcessRevolvedAreaSolid(*rev,meshout,conv);
}
else {
@ -728,16 +728,16 @@ void ProcessSweptAreaSolid(const IfcSweptAreaSolid& swept, TempMesh& meshout,
}
// ------------------------------------------------------------------------------------------------
bool ProcessGeometricItem(const IfcRepresentationItem& geo, unsigned int matid, std::vector<unsigned int>& mesh_indices,
bool ProcessGeometricItem(const Schema_2x3::IfcRepresentationItem& geo, unsigned int matid, std::vector<unsigned int>& mesh_indices,
ConversionData& conv)
{
bool fix_orientation = false;
std::shared_ptr< TempMesh > meshtmp = std::make_shared<TempMesh>();
if(const IfcShellBasedSurfaceModel* shellmod = geo.ToPtr<IfcShellBasedSurfaceModel>()) {
for(std::shared_ptr<const IfcShell> shell :shellmod->SbsmBoundary) {
if(const Schema_2x3::IfcShellBasedSurfaceModel* shellmod = geo.ToPtr<Schema_2x3::IfcShellBasedSurfaceModel>()) {
for(std::shared_ptr<const Schema_2x3::IfcShell> shell :shellmod->SbsmBoundary) {
try {
const EXPRESS::ENTITY& e = shell->To<ENTITY>();
const IfcConnectedFaceSet& fs = conv.db.MustGetObject(e).To<IfcConnectedFaceSet>();
const ::Assimp::STEP::EXPRESS::ENTITY& e = shell->To<::Assimp::STEP::EXPRESS::ENTITY>();
const Schema_2x3::IfcConnectedFaceSet& fs = conv.db.MustGetObject(e).To<Schema_2x3::IfcConnectedFaceSet>();
ProcessConnectedFaceSet(fs,*meshtmp.get(),conv);
}
@ -747,30 +747,30 @@ bool ProcessGeometricItem(const IfcRepresentationItem& geo, unsigned int matid,
}
fix_orientation = true;
}
else if(const IfcConnectedFaceSet* fset = geo.ToPtr<IfcConnectedFaceSet>()) {
else if(const Schema_2x3::IfcConnectedFaceSet* fset = geo.ToPtr<Schema_2x3::IfcConnectedFaceSet>()) {
ProcessConnectedFaceSet(*fset,*meshtmp.get(),conv);
fix_orientation = true;
}
else if(const IfcSweptAreaSolid* swept = geo.ToPtr<IfcSweptAreaSolid>()) {
else if(const Schema_2x3::IfcSweptAreaSolid* swept = geo.ToPtr<Schema_2x3::IfcSweptAreaSolid>()) {
ProcessSweptAreaSolid(*swept,*meshtmp.get(),conv);
}
else if(const IfcSweptDiskSolid* disk = geo.ToPtr<IfcSweptDiskSolid>()) {
else if(const Schema_2x3::IfcSweptDiskSolid* disk = geo.ToPtr<Schema_2x3::IfcSweptDiskSolid>()) {
ProcessSweptDiskSolid(*disk,*meshtmp.get(),conv);
}
else if(const IfcManifoldSolidBrep* brep = geo.ToPtr<IfcManifoldSolidBrep>()) {
else if(const Schema_2x3::IfcManifoldSolidBrep* brep = geo.ToPtr<Schema_2x3::IfcManifoldSolidBrep>()) {
ProcessConnectedFaceSet(brep->Outer,*meshtmp.get(),conv);
fix_orientation = true;
}
else if(const IfcFaceBasedSurfaceModel* surf = geo.ToPtr<IfcFaceBasedSurfaceModel>()) {
for(const IfcConnectedFaceSet& fc : surf->FbsmFaces) {
else if(const Schema_2x3::IfcFaceBasedSurfaceModel* surf = geo.ToPtr<Schema_2x3::IfcFaceBasedSurfaceModel>()) {
for(const Schema_2x3::IfcConnectedFaceSet& fc : surf->FbsmFaces) {
ProcessConnectedFaceSet(fc,*meshtmp.get(),conv);
}
fix_orientation = true;
}
else if(const IfcBooleanResult* boolean = geo.ToPtr<IfcBooleanResult>()) {
else if(const Schema_2x3::IfcBooleanResult* boolean = geo.ToPtr<Schema_2x3::IfcBooleanResult>()) {
ProcessBoolean(*boolean,*meshtmp.get(),conv);
}
else if(geo.ToPtr<IfcBoundingBox>()) {
else if(geo.ToPtr<Schema_2x3::IfcBoundingBox>()) {
// silently skip over bounding boxes
return false;
}
@ -788,7 +788,7 @@ bool ProcessGeometricItem(const IfcRepresentationItem& geo, unsigned int matid,
// which returns an empty mesh.
if(conv.collect_openings) {
if (!meshtmp->IsEmpty()) {
conv.collect_openings->push_back(TempOpening(geo.ToPtr<IfcSolidModel>(),
conv.collect_openings->push_back(TempOpening(geo.ToPtr<Schema_2x3::IfcSolidModel>(),
IfcVector3(0,0,0),
meshtmp,
std::shared_ptr<TempMesh>()));
@ -837,7 +837,7 @@ void AssignAddedMeshes(std::vector<unsigned int>& mesh_indices,aiNode* nd,
}
// ------------------------------------------------------------------------------------------------
bool TryQueryMeshCache(const IfcRepresentationItem& item,
bool TryQueryMeshCache(const Schema_2x3::IfcRepresentationItem& item,
std::vector<unsigned int>& mesh_indices, unsigned int mat_index,
ConversionData& conv)
{
@ -851,7 +851,7 @@ bool TryQueryMeshCache(const IfcRepresentationItem& item,
}
// ------------------------------------------------------------------------------------------------
void PopulateMeshCache(const IfcRepresentationItem& item,
void PopulateMeshCache(const Schema_2x3::IfcRepresentationItem& item,
const std::vector<unsigned int>& mesh_indices, unsigned int mat_index,
ConversionData& conv)
{
@ -860,7 +860,7 @@ void PopulateMeshCache(const IfcRepresentationItem& item,
}
// ------------------------------------------------------------------------------------------------
bool ProcessRepresentationItem(const IfcRepresentationItem& item, unsigned int matid,
bool ProcessRepresentationItem(const Schema_2x3::IfcRepresentationItem& item, unsigned int matid,
std::vector<unsigned int>& mesh_indices,
ConversionData& conv)
{

View File

@ -59,7 +59,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "IFCUtil.h"
#include "MemoryIOWrapper.h"
#include "code/MemoryIOWrapper.h"
#include <assimp/scene.h>
#include <assimp/Importer.hpp>
#include <assimp/importerdesc.h>
@ -99,7 +99,7 @@ void SetUnits(ConversionData& conv);
void SetCoordinateSpace(ConversionData& conv);
void ProcessSpatialStructures(ConversionData& conv);
void MakeTreeRelative(ConversionData& conv);
void ConvertUnit(const EXPRESS::DataType& dt,ConversionData& conv);
void ConvertUnit(const ::Assimp::STEP::EXPRESS::DataType& dt,ConversionData& conv);
} // anon
@ -152,7 +152,6 @@ const aiImporterDesc* IFCImporter::GetInfo () const
return &desc;
}
// ------------------------------------------------------------------------------------------------
// Setup configuration properties for the loader
void IFCImporter::SetupProperties(const Importer* pImp)
@ -167,8 +166,7 @@ void IFCImporter::SetupProperties(const Importer* pImp)
// ------------------------------------------------------------------------------------------------
// Imports the given file into the given scene structure.
void IFCImporter::InternReadFile( const std::string& pFile,
aiScene* pScene, IOSystem* pIOHandler)
void IFCImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler)
{
std::shared_ptr<IOStream> stream(pIOHandler->Open(pFile));
if (!stream) {
@ -253,8 +251,8 @@ void IFCImporter::InternReadFile( const std::string& pFile,
}
// obtain a copy of the machine-generated IFC scheme
EXPRESS::ConversionSchema schema;
GetSchema(schema);
::Assimp::STEP::EXPRESS::ConversionSchema schema;
Schema_2x3::GetSchema(schema);
// tell the reader which entity types to track with special care
static const char* const types_to_track[] = {
@ -273,7 +271,7 @@ void IFCImporter::InternReadFile( const std::string& pFile,
ThrowException("missing IfcProject entity");
}
ConversionData conv(*db,proj->To<IfcProject>(),pScene,settings);
ConversionData conv(*db,proj->To<Schema_2x3::IfcProject>(),pScene,settings);
SetUnits(conv);
SetCoordinateSpace(conv);
ProcessSpatialStructures(conv);
@ -323,10 +321,9 @@ namespace {
// ------------------------------------------------------------------------------------------------
void ConvertUnit(const IfcNamedUnit& unit,ConversionData& conv)
void ConvertUnit(const Schema_2x3::IfcNamedUnit& unit,ConversionData& conv)
{
if(const IfcSIUnit* const si = unit.ToPtr<IfcSIUnit>()) {
if(const Schema_2x3::IfcSIUnit* const si = unit.ToPtr<Schema_2x3::IfcSIUnit>()) {
if(si->UnitType == "LENGTHUNIT") {
conv.len_scale = si->Prefix ? ConvertSIPrefix(si->Prefix) : 1.f;
IFCImporter::LogDebug("got units used for lengths");
@ -337,11 +334,10 @@ void ConvertUnit(const IfcNamedUnit& unit,ConversionData& conv)
}
}
}
else if(const IfcConversionBasedUnit* const convu = unit.ToPtr<IfcConversionBasedUnit>()) {
else if(const Schema_2x3::IfcConversionBasedUnit* const convu = unit.ToPtr<Schema_2x3::IfcConversionBasedUnit>()) {
if(convu->UnitType == "PLANEANGLEUNIT") {
try {
conv.angle_scale = convu->ConversionFactor->ValueComponent->To<EXPRESS::REAL>();
conv.angle_scale = convu->ConversionFactor->ValueComponent->To<::Assimp::STEP::EXPRESS::REAL>();
ConvertUnit(*convu->ConversionFactor->UnitComponent,conv);
IFCImporter::LogDebug("got units used for angles");
}
@ -353,12 +349,12 @@ void ConvertUnit(const IfcNamedUnit& unit,ConversionData& conv)
}
// ------------------------------------------------------------------------------------------------
void ConvertUnit(const EXPRESS::DataType& dt,ConversionData& conv)
void ConvertUnit(const ::Assimp::STEP::EXPRESS::DataType& dt,ConversionData& conv)
{
try {
const EXPRESS::ENTITY& e = dt.To<ENTITY>();
const ::Assimp::STEP::EXPRESS::ENTITY& e = dt.To<::Assimp::STEP::EXPRESS::ENTITY>();
const IfcNamedUnit& unit = e.ResolveSelect<IfcNamedUnit>(conv.db);
const Schema_2x3::IfcNamedUnit& unit = e.ResolveSelect<Schema_2x3::IfcNamedUnit>(conv.db);
if(unit.UnitType != "LENGTHUNIT" && unit.UnitType != "PLANEANGLEUNIT") {
return;
}
@ -384,8 +380,8 @@ void SetUnits(ConversionData& conv)
// ------------------------------------------------------------------------------------------------
void SetCoordinateSpace(ConversionData& conv)
{
const IfcRepresentationContext* fav = NULL;
for(const IfcRepresentationContext& v : conv.proj.RepresentationContexts) {
const Schema_2x3::IfcRepresentationContext* fav = NULL;
for(const Schema_2x3::IfcRepresentationContext& v : conv.proj.RepresentationContexts) {
fav = &v;
// Model should be the most suitable type of context, hence ignore the others
if (v.ContextType && v.ContextType.Get() == "Model") {
@ -393,7 +389,7 @@ void SetCoordinateSpace(ConversionData& conv)
}
}
if (fav) {
if(const IfcGeometricRepresentationContext* const geo = fav->ToPtr<IfcGeometricRepresentationContext>()) {
if(const Schema_2x3::IfcGeometricRepresentationContext* const geo = fav->ToPtr<Schema_2x3::IfcGeometricRepresentationContext>()) {
ConvertAxisPlacement(conv.wcs, *geo->WorldCoordinateSystem, conv);
IFCImporter::LogDebug("got world coordinate system");
}
@ -402,9 +398,9 @@ void SetCoordinateSpace(ConversionData& conv)
// ------------------------------------------------------------------------------------------------
void ResolveObjectPlacement(aiMatrix4x4& m, const IfcObjectPlacement& place, ConversionData& conv)
void ResolveObjectPlacement(aiMatrix4x4& m, const Schema_2x3::IfcObjectPlacement& place, ConversionData& conv)
{
if (const IfcLocalPlacement* const local = place.ToPtr<IfcLocalPlacement>()){
if (const Schema_2x3::IfcLocalPlacement* const local = place.ToPtr<Schema_2x3::IfcLocalPlacement>()){
IfcMatrix4 tmp;
ConvertAxisPlacement(tmp, *local->RelativePlacement, conv);
@ -422,9 +418,9 @@ void ResolveObjectPlacement(aiMatrix4x4& m, const IfcObjectPlacement& place, Con
}
// ------------------------------------------------------------------------------------------------
bool ProcessMappedItem(const IfcMappedItem& mapped, aiNode* nd_src, std::vector< aiNode* >& subnodes_src, unsigned int matid, ConversionData& conv)
bool ProcessMappedItem(const Schema_2x3::IfcMappedItem& mapped, aiNode* nd_src, std::vector< aiNode* >& subnodes_src, unsigned int matid, ConversionData& conv)
{
// insert a custom node here, the cartesian transform operator is simply a conventional transformation matrix
// insert a custom node here, the carthesian transform operator is simply a conventional transformation matrix
std::unique_ptr<aiNode> nd(new aiNode());
nd->mName.Set("IfcMappedItem");
@ -448,10 +444,10 @@ bool ProcessMappedItem(const IfcMappedItem& mapped, aiNode* nd_src, std::vector<
}
unsigned int localmatid = ProcessMaterials(mapped.GetID(),matid,conv,false);
const IfcRepresentation& repr = mapped.MappingSource->MappedRepresentation;
const Schema_2x3::IfcRepresentation& repr = mapped.MappingSource->MappedRepresentation;
bool got = false;
for(const IfcRepresentationItem& item : repr.Items) {
for(const Schema_2x3::IfcRepresentationItem& item : repr.Items) {
if(!ProcessRepresentationItem(item,localmatid,meshes,conv)) {
IFCImporter::LogWarn("skipping mapped entity of type " + item.GetClassName() + ", no representations could be generated");
}
@ -483,8 +479,7 @@ bool ProcessMappedItem(const IfcMappedItem& mapped, aiNode* nd_src, std::vector<
// ------------------------------------------------------------------------------------------------
struct RateRepresentationPredicate {
int Rate(const IfcRepresentation* r) const {
int Rate(const Schema_2x3::IfcRepresentation* r) const {
// the smaller, the better
if (! r->RepresentationIdentifier) {
@ -497,7 +492,7 @@ struct RateRepresentationPredicate {
if (name == "MappedRepresentation") {
if (!r->Items.empty()) {
// take the first item and base our choice on it
const IfcMappedItem* const m = r->Items.front()->ToPtr<IfcMappedItem>();
const Schema_2x3::IfcMappedItem* const m = r->Items.front()->ToPtr<Schema_2x3::IfcMappedItem>();
if (m) {
return Rate(m->MappingSource->MappedRepresentation);
}
@ -509,8 +504,6 @@ struct RateRepresentationPredicate {
}
int Rate(const std::string& r) const {
if (r == "SolidModel") {
return -3;
}
@ -541,13 +534,13 @@ struct RateRepresentationPredicate {
return 0;
}
bool operator() (const IfcRepresentation* a, const IfcRepresentation* b) const {
bool operator() (const Schema_2x3::IfcRepresentation* a, const Schema_2x3::IfcRepresentation* b) const {
return Rate(a) < Rate(b);
}
};
// ------------------------------------------------------------------------------------------------
void ProcessProductRepresentation(const IfcProduct& el, aiNode* nd, std::vector< aiNode* >& subnodes, ConversionData& conv)
void ProcessProductRepresentation(const Schema_2x3::IfcProduct& el, aiNode* nd, std::vector< aiNode* >& subnodes, ConversionData& conv)
{
if(!el.Representation) {
return;
@ -562,14 +555,14 @@ void ProcessProductRepresentation(const IfcProduct& el, aiNode* nd, std::vector<
// representation is relatively generic and allows the concrete implementations
// for the different representation types to make some sensible choices what
// to load and what not to load.
const STEP::ListOf< STEP::Lazy< IfcRepresentation >, 1, 0 >& src = el.Representation.Get()->Representations;
std::vector<const IfcRepresentation*> repr_ordered(src.size());
const STEP::ListOf< STEP::Lazy< Schema_2x3::IfcRepresentation >, 1, 0 >& src = el.Representation.Get()->Representations;
std::vector<const Schema_2x3::IfcRepresentation*> repr_ordered(src.size());
std::copy(src.begin(),src.end(),repr_ordered.begin());
std::sort(repr_ordered.begin(),repr_ordered.end(),RateRepresentationPredicate());
for(const IfcRepresentation* repr : repr_ordered) {
for(const Schema_2x3::IfcRepresentation* repr : repr_ordered) {
bool res = false;
for(const IfcRepresentationItem& item : repr->Items) {
if(const IfcMappedItem* const geo = item.ToPtr<IfcMappedItem>()) {
for(const Schema_2x3::IfcRepresentationItem& item : repr->Items) {
if(const Schema_2x3::IfcMappedItem* const geo = item.ToPtr<Schema_2x3::IfcMappedItem>()) {
res = ProcessMappedItem(*geo,nd,subnodes,matid,conv) || res;
}
else {
@ -587,25 +580,25 @@ void ProcessProductRepresentation(const IfcProduct& el, aiNode* nd, std::vector<
typedef std::map<std::string, std::string> Metadata;
// ------------------------------------------------------------------------------------------------
void ProcessMetadata(const ListOf< Lazy< IfcProperty >, 1, 0 >& set, ConversionData& conv, Metadata& properties,
void ProcessMetadata(const Schema_2x3::ListOf< Schema_2x3::Lazy< Schema_2x3::IfcProperty >, 1, 0 >& set, ConversionData& conv, Metadata& properties,
const std::string& prefix = "",
unsigned int nest = 0)
{
for(const IfcProperty& property : set) {
for(const Schema_2x3::IfcProperty& property : set) {
const std::string& key = prefix.length() > 0 ? (prefix + "." + property.Name) : property.Name;
if (const IfcPropertySingleValue* const singleValue = property.ToPtr<IfcPropertySingleValue>()) {
if (const Schema_2x3::IfcPropertySingleValue* const singleValue = property.ToPtr<Schema_2x3::IfcPropertySingleValue>()) {
if (singleValue->NominalValue) {
if (const EXPRESS::STRING* str = singleValue->NominalValue.Get()->ToPtr<EXPRESS::STRING>()) {
if (const ::Assimp::STEP::EXPRESS::STRING* str = singleValue->NominalValue.Get()->ToPtr<::Assimp::STEP::EXPRESS::STRING>()) {
std::string value = static_cast<std::string>(*str);
properties[key]=value;
}
else if (const EXPRESS::REAL* val = singleValue->NominalValue.Get()->ToPtr<EXPRESS::REAL>()) {
else if (const ::Assimp::STEP::EXPRESS::REAL* val = singleValue->NominalValue.Get()->ToPtr<::Assimp::STEP::EXPRESS::REAL>()) {
float value = static_cast<float>(*val);
std::stringstream s;
s << value;
properties[key]=s.str();
}
else if (const EXPRESS::INTEGER* val = singleValue->NominalValue.Get()->ToPtr<EXPRESS::INTEGER>()) {
else if (const ::Assimp::STEP::EXPRESS::INTEGER* val = singleValue->NominalValue.Get()->ToPtr<::Assimp::STEP::EXPRESS::INTEGER>()) {
int64_t value = static_cast<int64_t>(*val);
std::stringstream s;
s << value;
@ -613,21 +606,21 @@ void ProcessMetadata(const ListOf< Lazy< IfcProperty >, 1, 0 >& set, ConversionD
}
}
}
else if (const IfcPropertyListValue* const listValue = property.ToPtr<IfcPropertyListValue>()) {
else if (const Schema_2x3::IfcPropertyListValue* const listValue = property.ToPtr<Schema_2x3::IfcPropertyListValue>()) {
std::stringstream ss;
ss << "[";
unsigned index=0;
for(const IfcValue::Out& v : listValue->ListValues) {
for(const Schema_2x3::IfcValue::Out& v : listValue->ListValues) {
if (!v) continue;
if (const EXPRESS::STRING* str = v->ToPtr<EXPRESS::STRING>()) {
if (const ::Assimp::STEP::EXPRESS::STRING* str = v->ToPtr<::Assimp::STEP::EXPRESS::STRING>()) {
std::string value = static_cast<std::string>(*str);
ss << "'" << value << "'";
}
else if (const EXPRESS::REAL* val = v->ToPtr<EXPRESS::REAL>()) {
else if (const ::Assimp::STEP::EXPRESS::REAL* val = v->ToPtr<::Assimp::STEP::EXPRESS::REAL>()) {
float value = static_cast<float>(*val);
ss << value;
}
else if (const EXPRESS::INTEGER* val = v->ToPtr<EXPRESS::INTEGER>()) {
else if (const ::Assimp::STEP::EXPRESS::INTEGER* val = v->ToPtr<::Assimp::STEP::EXPRESS::INTEGER>()) {
int64_t value = static_cast<int64_t>(*val);
ss << value;
}
@ -639,7 +632,7 @@ void ProcessMetadata(const ListOf< Lazy< IfcProperty >, 1, 0 >& set, ConversionD
ss << "]";
properties[key]=ss.str();
}
else if (const IfcComplexProperty* const complexProp = property.ToPtr<IfcComplexProperty>()) {
else if (const Schema_2x3::IfcComplexProperty* const complexProp = property.ToPtr<Schema_2x3::IfcComplexProperty>()) {
if(nest > 2) { // mostly arbitrary limit to prevent stack overflow vulnerabilities
IFCImporter::LogError("maximum nesting level for IfcComplexProperty reached, skipping this property.");
}
@ -657,29 +650,29 @@ void ProcessMetadata(const ListOf< Lazy< IfcProperty >, 1, 0 >& set, ConversionD
// ------------------------------------------------------------------------------------------------
void ProcessMetadata(uint64_t relDefinesByPropertiesID, ConversionData& conv, Metadata& properties)
{
if (const IfcRelDefinesByProperties* const pset = conv.db.GetObject(relDefinesByPropertiesID)->ToPtr<IfcRelDefinesByProperties>()) {
if (const IfcPropertySet* const set = conv.db.GetObject(pset->RelatingPropertyDefinition->GetID())->ToPtr<IfcPropertySet>()) {
if (const Schema_2x3::IfcRelDefinesByProperties* const pset = conv.db.GetObject(relDefinesByPropertiesID)->ToPtr<Schema_2x3::IfcRelDefinesByProperties>()) {
if (const Schema_2x3::IfcPropertySet* const set = conv.db.GetObject(pset->RelatingPropertyDefinition->GetID())->ToPtr<Schema_2x3::IfcPropertySet>()) {
ProcessMetadata(set->HasProperties, conv, properties);
}
}
}
// ------------------------------------------------------------------------------------------------
aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, ConversionData& conv, std::vector<TempOpening>* collect_openings = NULL)
aiNode* ProcessSpatialStructure(aiNode* parent, const Schema_2x3::IfcProduct& el, ConversionData& conv, std::vector<TempOpening>* collect_openings = NULL)
{
const STEP::DB::RefMap& refs = conv.db.GetRefs();
// skip over space and annotation nodes - usually, these have no meaning in Assimp's context
bool skipGeometry = false;
if(conv.settings.skipSpaceRepresentations) {
if(el.ToPtr<IfcSpace>()) {
if(el.ToPtr<Schema_2x3::IfcSpace>()) {
IFCImporter::LogDebug("skipping IfcSpace entity due to importer settings");
skipGeometry = true;
}
}
if(conv.settings.skipAnnotations) {
if(el.ToPtr<IfcAnnotation>()) {
if(el.ToPtr<Schema_2x3::IfcAnnotation>()) {
IFCImporter::LogDebug("skipping IfcAnnotation entity due to importer settings");
return NULL;
}
@ -745,12 +738,12 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
const STEP::LazyObject& obj = conv.db.MustGetObject((*range2.first).second);
// handle regularly-contained elements
if(const IfcRelContainedInSpatialStructure* const cont = obj->ToPtr<IfcRelContainedInSpatialStructure>()) {
if(const Schema_2x3::IfcRelContainedInSpatialStructure* const cont = obj->ToPtr<Schema_2x3::IfcRelContainedInSpatialStructure>()) {
if(cont->RelatingStructure->GetID() != el.GetID()) {
continue;
}
for(const IfcProduct& pro : cont->RelatedElements) {
if(pro.ToPtr<IfcOpeningElement>()) {
for(const Schema_2x3::IfcProduct& pro : cont->RelatedElements) {
if(pro.ToPtr<Schema_2x3::IfcOpeningElement>()) {
// IfcOpeningElement is handled below. Sadly we can't use it here as is:
// The docs say that opening elements are USUALLY attached to building storey,
// but we want them for the building elements to which they belong.
@ -764,9 +757,9 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
}
}
// handle openings, which we collect in a list rather than adding them to the node graph
else if(const IfcRelVoidsElement* const fills = obj->ToPtr<IfcRelVoidsElement>()) {
else if(const Schema_2x3::IfcRelVoidsElement* const fills = obj->ToPtr<Schema_2x3::IfcRelVoidsElement>()) {
if(fills->RelatingBuildingElement->GetID() == el.GetID()) {
const IfcFeatureElementSubtraction& open = fills->RelatedOpeningElement;
const Schema_2x3::IfcFeatureElementSubtraction& open = fills->RelatedOpeningElement;
// move opening elements to a separate node since they are semantically different than elements that are just 'contained'
std::unique_ptr<aiNode> nd_aggr(new aiNode());
@ -808,7 +801,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
if (conv.already_processed.find((*range.first).second) != conv.already_processed.end()) {
continue;
}
if(const IfcRelAggregates* const aggr = conv.db.GetObject((*range.first).second)->ToPtr<IfcRelAggregates>()) {
if(const Schema_2x3::IfcRelAggregates* const aggr = conv.db.GetObject((*range.first).second)->ToPtr<Schema_2x3::IfcRelAggregates>()) {
if(aggr->RelatingObject->GetID() != el.GetID()) {
continue;
}
@ -821,8 +814,8 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
nd_aggr->mTransformation = nd->mTransformation;
nd_aggr->mChildren = new aiNode*[aggr->RelatedObjects.size()]();
for(const IfcObjectDefinition& def : aggr->RelatedObjects) {
if(const IfcProduct* const prod = def.ToPtr<IfcProduct>()) {
for(const Schema_2x3::IfcObjectDefinition& def : aggr->RelatedObjects) {
if(const Schema_2x3::IfcProduct* const prod = def.ToPtr<Schema_2x3::IfcProduct>()) {
aiNode* const ndnew = ProcessSpatialStructure(nd_aggr.get(),*prod,conv,NULL);
if(ndnew) {
@ -889,7 +882,7 @@ void ProcessSpatialStructures(ConversionData& conv)
std::vector<aiNode*> nodes;
for(const STEP::LazyObject* lz : *range) {
const IfcSpatialStructureElement* const prod = lz->ToPtr<IfcSpatialStructureElement>();
const Schema_2x3::IfcSpatialStructureElement* const prod = lz->ToPtr<Schema_2x3::IfcSpatialStructureElement>();
if(!prod) {
continue;
}
@ -899,9 +892,9 @@ void ProcessSpatialStructures(ConversionData& conv)
const STEP::DB::RefMap& refs = conv.db.GetRefs();
STEP::DB::RefMapRange ref_range = refs.equal_range(conv.proj.GetID());
for(; ref_range.first != ref_range.second; ++ref_range.first) {
if(const IfcRelAggregates* const aggr = conv.db.GetObject((*ref_range.first).second)->ToPtr<IfcRelAggregates>()) {
if(const Schema_2x3::IfcRelAggregates* const aggr = conv.db.GetObject((*ref_range.first).second)->ToPtr<Schema_2x3::IfcRelAggregates>()) {
for(const IfcObjectDefinition& def : aggr->RelatedObjects) {
for(const Schema_2x3::IfcObjectDefinition& def : aggr->RelatedObjects) {
// comparing pointer values is not sufficient, we would need to cast them to the same type first
// as there is multiple inheritance in the game.
if (def.GetID() == prod->GetID()) {
@ -910,7 +903,6 @@ void ProcessSpatialStructures(ConversionData& conv)
nodes.push_back(ProcessSpatialStructure(NULL, *prod, conv, NULL));
}
}
}
}
}
@ -920,7 +912,7 @@ void ProcessSpatialStructures(ConversionData& conv)
if (nb_nodes == 0) {
IFCImporter::LogWarn("failed to determine primary site element, taking all the IfcSite");
for (const STEP::LazyObject* lz : *range) {
const IfcSpatialStructureElement* const prod = lz->ToPtr<IfcSpatialStructureElement>();
const Schema_2x3::IfcSpatialStructureElement* const prod = lz->ToPtr<Schema_2x3::IfcSpatialStructureElement>();
if (!prod) {
continue;
}

View File

@ -45,8 +45,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef INCLUDED_AI_IFC_LOADER_H
#define INCLUDED_AI_IFC_LOADER_H
#include "BaseImporter.h"
#include "LogAux.h"
#include "code/BaseImporter.h"
#include "code/LogAux.h"
namespace Assimp {

View File

@ -68,20 +68,20 @@ static int ConvertShadingMode(const std::string& name) {
}
// ------------------------------------------------------------------------------------------------
static void FillMaterial(aiMaterial* mat,const IFC::IfcSurfaceStyle* surf,ConversionData& conv) {
static void FillMaterial(aiMaterial* mat,const IFC::Schema_2x3::IfcSurfaceStyle* surf,ConversionData& conv) {
aiString name;
name.Set((surf->Name? surf->Name.Get() : "IfcSurfaceStyle_Unnamed"));
mat->AddProperty(&name,AI_MATKEY_NAME);
// now see which kinds of surface information are present
for(std::shared_ptr< const IFC::IfcSurfaceStyleElementSelect > sel2 : surf->Styles) {
if (const IFC::IfcSurfaceStyleShading* shade = sel2->ResolveSelectPtr<IFC::IfcSurfaceStyleShading>(conv.db)) {
for(std::shared_ptr< const IFC::Schema_2x3::IfcSurfaceStyleElementSelect > sel2 : surf->Styles) {
if (const IFC::Schema_2x3::IfcSurfaceStyleShading* shade = sel2->ResolveSelectPtr<IFC::Schema_2x3::IfcSurfaceStyleShading>(conv.db)) {
aiColor4D col_base,col;
ConvertColor(col_base, shade->SurfaceColour);
mat->AddProperty(&col_base,1, AI_MATKEY_COLOR_DIFFUSE);
if (const IFC::IfcSurfaceStyleRendering* ren = shade->ToPtr<IFC::IfcSurfaceStyleRendering>()) {
if (const IFC::Schema_2x3::IfcSurfaceStyleRendering* ren = shade->ToPtr<IFC::Schema_2x3::IfcSurfaceStyleRendering>()) {
if (ren->Transparency) {
const float t = 1.f-static_cast<float>(ren->Transparency.Get());
@ -112,7 +112,7 @@ static void FillMaterial(aiMaterial* mat,const IFC::IfcSurfaceStyle* surf,Conver
mat->AddProperty(&shading,1, AI_MATKEY_SHADING_MODEL);
if (ren->SpecularHighlight) {
if(const EXPRESS::REAL* rt = ren->SpecularHighlight.Get()->ToPtr<EXPRESS::REAL>()) {
if(const ::Assimp::STEP::EXPRESS::REAL* rt = ren->SpecularHighlight.Get()->ToPtr<::Assimp::STEP::EXPRESS::REAL>()) {
// at this point we don't distinguish between the two distinct ways of
// specifying highlight intensities. leave this to the user.
const float e = static_cast<float>(*rt);
@ -123,23 +123,19 @@ static void FillMaterial(aiMaterial* mat,const IFC::IfcSurfaceStyle* surf,Conver
}
}
}
} /*
else if (const IFC::IfcSurfaceStyleWithTextures* tex = sel2->ResolveSelectPtr<IFC::IfcSurfaceStyleWithTextures>(conv.db)) {
// XXX
} */
}
}
}
// ------------------------------------------------------------------------------------------------
unsigned int ProcessMaterials(uint64_t id, unsigned int prevMatId, ConversionData& conv, bool forceDefaultMat) {
STEP::DB::RefMapRange range = conv.db.GetRefs().equal_range(id);
for(;range.first != range.second; ++range.first) {
if(const IFC::IfcStyledItem* const styled = conv.db.GetObject((*range.first).second)->ToPtr<IFC::IfcStyledItem>()) {
for(const IFC::IfcPresentationStyleAssignment& as : styled->Styles) {
for(std::shared_ptr<const IFC::IfcPresentationStyleSelect> sel : as.Styles) {
if(const IFC::Schema_2x3::IfcStyledItem* const styled = conv.db.GetObject((*range.first).second)->ToPtr<IFC::Schema_2x3::IfcStyledItem>()) {
for(const IFC::Schema_2x3::IfcPresentationStyleAssignment& as : styled->Styles) {
for(std::shared_ptr<const IFC::Schema_2x3::IfcPresentationStyleSelect> sel : as.Styles) {
if( const IFC::IfcSurfaceStyle* const surf = sel->ResolveSelectPtr<IFC::IfcSurfaceStyle>(conv.db) ) {
if( const IFC::Schema_2x3::IfcSurfaceStyle* const surf = sel->ResolveSelectPtr<IFC::Schema_2x3::IfcSurfaceStyle>(conv.db) ) {
// try to satisfy from cache
ConversionData::MaterialCache::iterator mit = conv.cached_materials.find(surf);
if( mit != conv.cached_materials.end() )

View File

@ -46,8 +46,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_IFC_IMPORTER
#include "IFCUtil.h"
#include "PolyTools.h"
#include "ProcessHelper.h"
#include "code/PolyTools.h"
#include "code/ProcessHelper.h"
#include "../contrib/poly2tri/poly2tri/poly2tri.h"
#include "../contrib/clipper/clipper.hpp"
@ -323,7 +323,7 @@ void InsertWindowContours(const ContourVector& contours,
if (hit) {
if (last_hit != (size_t)-1) {
const size_t old = curmesh.verts.size();
const size_t old = curmesh.mVerts.size();
size_t cnt = last_hit > n ? size-(last_hit-n) : n-last_hit;
for(size_t a = last_hit, e = 0; e <= cnt; a=(a+1)%size, ++e) {
// hack: this is to fix cases where opening contours are self-intersecting.
@ -335,7 +335,7 @@ void InsertWindowContours(const ContourVector& contours,
if ((contour[a] - edge).SquareLength() > diag*diag*0.7) {
continue;
}
curmesh.verts.push_back(IfcVector3(contour[a].x, contour[a].y, 0.0f));
curmesh.mVerts.push_back(IfcVector3(contour[a].x, contour[a].y, 0.0f));
}
if (edge != contour[last_hit]) {
@ -356,16 +356,16 @@ void InsertWindowContours(const ContourVector& contours,
corner.y = bb.second.y;
}
curmesh.verts.push_back(IfcVector3(corner.x, corner.y, 0.0f));
curmesh.mVerts.push_back(IfcVector3(corner.x, corner.y, 0.0f));
}
else if (cnt == 1) {
// avoid degenerate polygons (also known as lines or points)
curmesh.verts.erase(curmesh.verts.begin()+old,curmesh.verts.end());
curmesh.mVerts.erase(curmesh.mVerts.begin()+old,curmesh.mVerts.end());
}
if (const size_t d = curmesh.verts.size()-old) {
curmesh.vertcnt.push_back(static_cast<unsigned int>(d));
std::reverse(curmesh.verts.rbegin(),curmesh.verts.rbegin()+d);
if (const size_t d = curmesh.mVerts.size()-old) {
curmesh.mVertcnt.push_back(static_cast<unsigned int>(d));
std::reverse(curmesh.mVerts.rbegin(),curmesh.mVerts.rbegin()+d);
}
if (n == very_first_hit) {
break;
@ -504,8 +504,8 @@ void CleanupOuterContour(const std::vector<IfcVector2>& contour_flat, TempMesh&
std::vector<IfcVector3> vold;
std::vector<unsigned int> iold;
vold.reserve(curmesh.verts.size());
iold.reserve(curmesh.vertcnt.size());
vold.reserve(curmesh.mVerts.size());
iold.reserve(curmesh.mVertcnt.size());
// Fix the outer contour using polyclipper
try {
@ -530,9 +530,9 @@ void CleanupOuterContour(const std::vector<IfcVector2>& contour_flat, TempMesh&
subject.reserve(4);
size_t index = 0;
size_t countdown = 0;
for(const IfcVector3& pip : curmesh.verts) {
for(const IfcVector3& pip : curmesh.mVerts) {
if (!countdown) {
countdown = curmesh.vertcnt[index++];
countdown = curmesh.mVertcnt[index++];
if (!countdown) {
continue;
}
@ -572,8 +572,8 @@ void CleanupOuterContour(const std::vector<IfcVector2>& contour_flat, TempMesh&
}
// swap data arrays
std::swap(vold,curmesh.verts);
std::swap(iold,curmesh.vertcnt);
std::swap(vold,curmesh.mVerts);
std::swap(iold,curmesh.mVertcnt);
}
typedef std::vector<TempOpening*> OpeningRefs;
@ -898,14 +898,14 @@ size_t CloseWindows(ContourVector& contours,
SkipList::const_iterator skipbegin = (*it).skiplist.begin();
curmesh.verts.reserve(curmesh.verts.size() + (*it).contour.size() * 4);
curmesh.vertcnt.reserve(curmesh.vertcnt.size() + (*it).contour.size());
curmesh.mVerts.reserve(curmesh.mVerts.size() + (*it).contour.size() * 4);
curmesh.mVertcnt.reserve(curmesh.mVertcnt.size() + (*it).contour.size());
bool reverseCountourFaces = false;
// compare base poly normal and contour normal to detect if we need to reverse the face winding
if(curmesh.vertcnt.size() > 0) {
IfcVector3 basePolyNormal = TempMesh::ComputePolygonNormal(curmesh.verts.data(), curmesh.vertcnt.front());
if(curmesh.mVertcnt.size() > 0) {
IfcVector3 basePolyNormal = TempMesh::ComputePolygonNormal(curmesh.mVerts.data(), curmesh.mVertcnt.front());
std::vector<IfcVector3> worldSpaceContourVtx(it->contour.size());
@ -954,14 +954,14 @@ size_t CloseWindows(ContourVector& contours,
}
if (drop_this_edge) {
curmesh.verts.pop_back();
curmesh.verts.pop_back();
curmesh.mVerts.pop_back();
curmesh.mVerts.pop_back();
}
else {
curmesh.verts.push_back(((cit == cbegin) != reverseCountourFaces) ? world_point : bestv);
curmesh.verts.push_back(((cit == cbegin) != reverseCountourFaces) ? bestv : world_point);
curmesh.mVerts.push_back(((cit == cbegin) != reverseCountourFaces) ? world_point : bestv);
curmesh.mVerts.push_back(((cit == cbegin) != reverseCountourFaces) ? bestv : world_point);
curmesh.vertcnt.push_back(4);
curmesh.mVertcnt.push_back(4);
++closed;
}
@ -971,8 +971,8 @@ size_t CloseWindows(ContourVector& contours,
continue;
}
curmesh.verts.push_back(reverseCountourFaces ? bestv : world_point);
curmesh.verts.push_back(reverseCountourFaces ? world_point : bestv);
curmesh.mVerts.push_back(reverseCountourFaces ? bestv : world_point);
curmesh.mVerts.push_back(reverseCountourFaces ? world_point : bestv);
if (cit == cend - 1) {
drop_this_edge = *skipit;
@ -981,13 +981,13 @@ size_t CloseWindows(ContourVector& contours,
// a border edge that needs to be dropped.
if (drop_this_edge) {
--closed;
curmesh.vertcnt.pop_back();
curmesh.verts.pop_back();
curmesh.verts.pop_back();
curmesh.mVertcnt.pop_back();
curmesh.mVerts.pop_back();
curmesh.mVerts.pop_back();
}
else {
curmesh.verts.push_back(reverseCountourFaces ? start0 : start1);
curmesh.verts.push_back(reverseCountourFaces ? start1 : start0);
curmesh.mVerts.push_back(reverseCountourFaces ? start0 : start1);
curmesh.mVerts.push_back(reverseCountourFaces ? start1 : start0);
}
}
}
@ -1029,10 +1029,10 @@ void Quadrify(const std::vector< BoundingBox >& bbs, TempMesh& curmesh)
QuadrifyPart(IfcVector2(),one_vec,field,bbs,quads);
ai_assert(!(quads.size() % 4));
curmesh.vertcnt.resize(quads.size()/4,4);
curmesh.verts.reserve(quads.size());
curmesh.mVertcnt.resize(quads.size()/4,4);
curmesh.mVerts.reserve(quads.size());
for(const IfcVector2& v2 : quads) {
curmesh.verts.push_back(IfcVector3(v2.x, v2.y, static_cast<IfcFloat>(0.0)));
curmesh.mVerts.push_back(IfcVector3(v2.x, v2.y, static_cast<IfcFloat>(0.0)));
}
}
@ -1053,7 +1053,7 @@ void Quadrify(const ContourVector& contours, TempMesh& curmesh)
IfcMatrix4 ProjectOntoPlane(std::vector<IfcVector2>& out_contour, const TempMesh& in_mesh,
bool &ok, IfcVector3& nor_out)
{
const std::vector<IfcVector3>& in_verts = in_mesh.verts;
const std::vector<IfcVector3>& in_verts = in_mesh.mVerts;
ok = true;
IfcMatrix4 m = IfcMatrix4(DerivePlaneCoordinateSpace(in_mesh, ok, nor_out));
@ -1200,8 +1200,8 @@ bool GenerateOpenings(std::vector<TempOpening>& openings,
}
}
}
std::vector<IfcVector3> profile_verts = profile_data->verts;
std::vector<unsigned int> profile_vertcnts = profile_data->vertcnt;
std::vector<IfcVector3> profile_verts = profile_data->mVerts;
std::vector<unsigned int> profile_vertcnts = profile_data->mVertcnt;
if(profile_verts.size() <= 2) {
continue;
}
@ -1421,7 +1421,7 @@ bool GenerateOpenings(std::vector<TempOpening>& openings,
CleanupOuterContour(contour_flat, curmesh);
// Undo the projection and get back to world (or local object) space
for(IfcVector3& v3 : curmesh.verts) {
for(IfcVector3& v3 : curmesh.mVerts) {
v3 = minv * v3;
}
@ -1438,7 +1438,7 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
TempMesh& curmesh)
{
IFCImporter::LogWarn("forced to use poly2tri fallback method to generate wall openings");
std::vector<IfcVector3>& out = curmesh.verts;
std::vector<IfcVector3>& out = curmesh.mVerts;
bool result = false;
@ -1513,14 +1513,14 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
continue;
}
const std::vector<IfcVector3>& va = t.profileMesh->verts;
const std::vector<IfcVector3>& va = t.profileMesh->mVerts;
if(va.size() <= 2) {
continue;
}
std::vector<IfcVector2> contour;
for(const IfcVector3& xx : t.profileMesh->verts) {
for(const IfcVector3& xx : t.profileMesh->mVerts) {
IfcVector3 vv = m * xx, vv_extr = m * (xx + t.extrusionDir);
const bool is_extruded_side = std::fabs(vv.z - coord) > std::fabs(vv_extr.z - coord);
@ -1603,8 +1603,8 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
std::vector<IfcVector3> old_verts;
std::vector<unsigned int> old_vertcnt;
old_verts.swap(curmesh.verts);
old_vertcnt.swap(curmesh.vertcnt);
old_verts.swap(curmesh.mVerts);
old_vertcnt.swap(curmesh.mVertcnt);
std::vector< std::vector<p2t::Point*> > contours;
for(ClipperLib::ExPolygon& clip : clipped) {
@ -1669,9 +1669,9 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
ai_assert(v.x <= 1.0 && v.x >= 0.0 && v.y <= 1.0 && v.y >= 0.0);
const IfcVector3 v3 = minv * IfcVector3(vmin.x + v.x * vmax.x, vmin.y + v.y * vmax.y,coord) ;
curmesh.verts.push_back(v3);
curmesh.mVerts.push_back(v3);
}
curmesh.vertcnt.push_back(3);
curmesh.mVertcnt.push_back(3);
}
result = true;
@ -1679,8 +1679,8 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
if (!result) {
// revert -- it's a shame, but better than nothing
curmesh.verts.insert(curmesh.verts.end(),old_verts.begin(), old_verts.end());
curmesh.vertcnt.insert(curmesh.vertcnt.end(),old_vertcnt.begin(), old_vertcnt.end());
curmesh.mVerts.insert(curmesh.mVerts.end(),old_verts.begin(), old_verts.end());
curmesh.mVertcnt.insert(curmesh.mVertcnt.end(),old_vertcnt.begin(), old_vertcnt.end());
IFCImporter::LogError("Ifc: revert, could not generate openings for this wall");
}

View File

@ -43,28 +43,27 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @brief Read profile and curves entities from IFC files
*/
#ifndef ASSIMP_BUILD_NO_IFC_IMPORTER
#include "IFCUtil.h"
namespace Assimp {
namespace IFC {
namespace IFC {
// ------------------------------------------------------------------------------------------------
void ProcessPolyLine(const IfcPolyline& def, TempMesh& meshout, ConversionData& /*conv*/)
void ProcessPolyLine(const Schema_2x3::IfcPolyline& def, TempMesh& meshout, ConversionData& /*conv*/)
{
// this won't produce a valid mesh, it just spits out a list of vertices
IfcVector3 t;
for(const IfcCartesianPoint& cp : def.Points) {
for(const Schema_2x3::IfcCartesianPoint& cp : def.Points) {
ConvertCartesianPoint(t,cp);
meshout.verts.push_back(t);
meshout.mVerts.push_back(t);
}
meshout.vertcnt.push_back(static_cast<unsigned int>(meshout.verts.size()));
meshout.mVertcnt.push_back(static_cast<unsigned int>(meshout.mVerts.size()));
}
// ------------------------------------------------------------------------------------------------
bool ProcessCurve(const IfcCurve& curve, TempMesh& meshout, ConversionData& conv)
bool ProcessCurve(const Schema_2x3::IfcCurve& curve, TempMesh& meshout, ConversionData& conv)
{
std::unique_ptr<const Curve> cv(Curve::Convert(curve,conv));
if (!cv) {
@ -78,10 +77,10 @@ bool ProcessCurve(const IfcCurve& curve, TempMesh& meshout, ConversionData& con
bc->SampleDiscrete(meshout);
}
catch(const CurveError& cv) {
IFCImporter::LogError(cv.s+ " (error occurred while processing curve)");
IFCImporter::LogError(cv.mStr + " (error occurred while processing curve)");
return false;
}
meshout.vertcnt.push_back(static_cast<unsigned int>(meshout.verts.size()));
meshout.mVertcnt.push_back(static_cast<unsigned int>(meshout.mVerts.size()));
return true;
}
@ -90,66 +89,66 @@ bool ProcessCurve(const IfcCurve& curve, TempMesh& meshout, ConversionData& con
}
// ------------------------------------------------------------------------------------------------
void ProcessClosedProfile(const IfcArbitraryClosedProfileDef& def, TempMesh& meshout, ConversionData& conv)
void ProcessClosedProfile(const Schema_2x3::IfcArbitraryClosedProfileDef& def, TempMesh& meshout, ConversionData& conv)
{
ProcessCurve(def.OuterCurve,meshout,conv);
}
// ------------------------------------------------------------------------------------------------
void ProcessOpenProfile(const IfcArbitraryOpenProfileDef& def, TempMesh& meshout, ConversionData& conv)
void ProcessOpenProfile(const Schema_2x3::IfcArbitraryOpenProfileDef& def, TempMesh& meshout, ConversionData& conv)
{
ProcessCurve(def.Curve,meshout,conv);
}
// ------------------------------------------------------------------------------------------------
void ProcessParametrizedProfile(const IfcParameterizedProfileDef& def, TempMesh& meshout, ConversionData& conv)
void ProcessParametrizedProfile(const Schema_2x3::IfcParameterizedProfileDef& def, TempMesh& meshout, ConversionData& conv)
{
if(const IfcRectangleProfileDef* const cprofile = def.ToPtr<IfcRectangleProfileDef>()) {
if(const Schema_2x3::IfcRectangleProfileDef* const cprofile = def.ToPtr<Schema_2x3::IfcRectangleProfileDef>()) {
const IfcFloat x = cprofile->XDim*0.5f, y = cprofile->YDim*0.5f;
meshout.verts.reserve(meshout.verts.size()+4);
meshout.verts.push_back( IfcVector3( x, y, 0.f ));
meshout.verts.push_back( IfcVector3(-x, y, 0.f ));
meshout.verts.push_back( IfcVector3(-x,-y, 0.f ));
meshout.verts.push_back( IfcVector3( x,-y, 0.f ));
meshout.vertcnt.push_back(4);
meshout.mVerts.reserve(meshout.mVerts.size()+4);
meshout.mVerts.push_back( IfcVector3( x, y, 0.f ));
meshout.mVerts.push_back( IfcVector3(-x, y, 0.f ));
meshout.mVerts.push_back( IfcVector3(-x,-y, 0.f ));
meshout.mVerts.push_back( IfcVector3( x,-y, 0.f ));
meshout.mVertcnt.push_back(4);
}
else if( const IfcCircleProfileDef* const circle = def.ToPtr<IfcCircleProfileDef>()) {
if(def.ToPtr<IfcCircleHollowProfileDef>()) {
else if( const Schema_2x3::IfcCircleProfileDef* const circle = def.ToPtr<Schema_2x3::IfcCircleProfileDef>()) {
if(def.ToPtr<Schema_2x3::IfcCircleHollowProfileDef>()) {
// TODO
}
const size_t segments = conv.settings.cylindricalTessellation;
const IfcFloat delta = AI_MATH_TWO_PI_F/segments, radius = circle->Radius;
meshout.verts.reserve(segments);
meshout.mVerts.reserve(segments);
IfcFloat angle = 0.f;
for(size_t i = 0; i < segments; ++i, angle += delta) {
meshout.verts.push_back( IfcVector3( std::cos(angle)*radius, std::sin(angle)*radius, 0.f ));
meshout.mVerts.push_back( IfcVector3( std::cos(angle)*radius, std::sin(angle)*radius, 0.f ));
}
meshout.vertcnt.push_back(static_cast<unsigned int>(segments));
meshout.mVertcnt.push_back(static_cast<unsigned int>(segments));
}
else if( const IfcIShapeProfileDef* const ishape = def.ToPtr<IfcIShapeProfileDef>()) {
else if( const Schema_2x3::IfcIShapeProfileDef* const ishape = def.ToPtr<Schema_2x3::IfcIShapeProfileDef>()) {
// construct simplified IBeam shape
const IfcFloat offset = (ishape->OverallWidth - ishape->WebThickness) / 2;
const IfcFloat inner_height = ishape->OverallDepth - ishape->FlangeThickness * 2;
meshout.verts.reserve(12);
meshout.verts.push_back(IfcVector3(0,0,0));
meshout.verts.push_back(IfcVector3(0,ishape->FlangeThickness,0));
meshout.verts.push_back(IfcVector3(offset,ishape->FlangeThickness,0));
meshout.verts.push_back(IfcVector3(offset,ishape->FlangeThickness + inner_height,0));
meshout.verts.push_back(IfcVector3(0,ishape->FlangeThickness + inner_height,0));
meshout.verts.push_back(IfcVector3(0,ishape->OverallDepth,0));
meshout.verts.push_back(IfcVector3(ishape->OverallWidth,ishape->OverallDepth,0));
meshout.verts.push_back(IfcVector3(ishape->OverallWidth,ishape->FlangeThickness + inner_height,0));
meshout.verts.push_back(IfcVector3(offset+ishape->WebThickness,ishape->FlangeThickness + inner_height,0));
meshout.verts.push_back(IfcVector3(offset+ishape->WebThickness,ishape->FlangeThickness,0));
meshout.verts.push_back(IfcVector3(ishape->OverallWidth,ishape->FlangeThickness,0));
meshout.verts.push_back(IfcVector3(ishape->OverallWidth,0,0));
meshout.mVerts.reserve(12);
meshout.mVerts.push_back(IfcVector3(0,0,0));
meshout.mVerts.push_back(IfcVector3(0,ishape->FlangeThickness,0));
meshout.mVerts.push_back(IfcVector3(offset,ishape->FlangeThickness,0));
meshout.mVerts.push_back(IfcVector3(offset,ishape->FlangeThickness + inner_height,0));
meshout.mVerts.push_back(IfcVector3(0,ishape->FlangeThickness + inner_height,0));
meshout.mVerts.push_back(IfcVector3(0,ishape->OverallDepth,0));
meshout.mVerts.push_back(IfcVector3(ishape->OverallWidth,ishape->OverallDepth,0));
meshout.mVerts.push_back(IfcVector3(ishape->OverallWidth,ishape->FlangeThickness + inner_height,0));
meshout.mVerts.push_back(IfcVector3(offset+ishape->WebThickness,ishape->FlangeThickness + inner_height,0));
meshout.mVerts.push_back(IfcVector3(offset+ishape->WebThickness,ishape->FlangeThickness,0));
meshout.mVerts.push_back(IfcVector3(ishape->OverallWidth,ishape->FlangeThickness,0));
meshout.mVerts.push_back(IfcVector3(ishape->OverallWidth,0,0));
meshout.vertcnt.push_back(12);
meshout.mVertcnt.push_back(12);
}
else {
IFCImporter::LogWarn("skipping unknown IfcParameterizedProfileDef entity, type is " + def.GetClassName());
@ -162,15 +161,15 @@ void ProcessParametrizedProfile(const IfcParameterizedProfileDef& def, TempMesh&
}
// ------------------------------------------------------------------------------------------------
bool ProcessProfile(const IfcProfileDef& prof, TempMesh& meshout, ConversionData& conv)
bool ProcessProfile(const Schema_2x3::IfcProfileDef& prof, TempMesh& meshout, ConversionData& conv)
{
if(const IfcArbitraryClosedProfileDef* const cprofile = prof.ToPtr<IfcArbitraryClosedProfileDef>()) {
if(const Schema_2x3::IfcArbitraryClosedProfileDef* const cprofile = prof.ToPtr<Schema_2x3::IfcArbitraryClosedProfileDef>()) {
ProcessClosedProfile(*cprofile,meshout,conv);
}
else if(const IfcArbitraryOpenProfileDef* const copen = prof.ToPtr<IfcArbitraryOpenProfileDef>()) {
else if(const Schema_2x3::IfcArbitraryOpenProfileDef* const copen = prof.ToPtr<Schema_2x3::IfcArbitraryOpenProfileDef>()) {
ProcessOpenProfile(*copen,meshout,conv);
}
else if(const IfcParameterizedProfileDef* const cparam = prof.ToPtr<IfcParameterizedProfileDef>()) {
else if(const Schema_2x3::IfcParameterizedProfileDef* const cparam = prof.ToPtr<Schema_2x3::IfcParameterizedProfileDef>()) {
ProcessParametrizedProfile(*cparam,meshout,conv);
}
else {
@ -178,7 +177,7 @@ bool ProcessProfile(const IfcProfileDef& prof, TempMesh& meshout, ConversionData
return false;
}
meshout.RemoveAdjacentDuplicates();
if (!meshout.vertcnt.size() || meshout.vertcnt.front() <= 1) {
if (!meshout.mVertcnt.size() || meshout.mVertcnt.front() <= 1) {
return false;
}
return true;
@ -187,4 +186,4 @@ bool ProcessProfile(const IfcProfileDef& prof, TempMesh& meshout, ConversionData
} // ! IFC
} // ! Assimp
#endif
#endif // ASSIMP_BUILD_NO_IFC_IMPORTER

View File

@ -43,15 +43,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//#include "AssimpPCH.h"
#ifndef ASSIMP_BUILD_NO_IFC_IMPORTER
#include "IFCReaderGen.h"
#include "IFCReaderGen_2x3.h"
namespace Assimp {
using namespace IFC;
using namespace ::Assimp::IFC;
using namespace ::Assimp::IFC::Schema_2x3;
namespace {
typedef EXPRESS::ConversionSchema::SchemaEntry SchemaEntry;
const SchemaEntry schema_raw[] = {
static const SchemaEntry schema_raw_2x3[] = {
SchemaEntry("ifcstairtypeenum",NULL )
, SchemaEntry("ifcspacetypeenum",NULL )
, SchemaEntry("ifcwalltypeenum",NULL )
@ -1037,9 +1039,8 @@ namespace {
}
// -----------------------------------------------------------------------------------------------------------
void IFC::GetSchema(EXPRESS::ConversionSchema& out)
{
out = EXPRESS::ConversionSchema(schema_raw);
void IFC::Schema_2x3::GetSchema(EXPRESS::ConversionSchema& out) {
out = EXPRESS::ConversionSchema(schema_raw_2x3);
}
namespace STEP {
@ -1050,34 +1051,32 @@ template <> size_t GenericFill<NotImplemented>(const STEP::DB& /*db*/, const LIS
return 0;
}
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<IfcRoot>(const DB& db, const LIST& params, IfcRoot* in)
{
size_t base = 0;
if (params.GetSize() < 4) { throw STEP::TypeError("expected 4 arguments to IfcRoot"); } do { // convert the 'GlobalId' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcRoot,4>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcRoot,4>::aux_is_derived[0]=true; break; }
try { GenericConvert( in->GlobalId, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcRoot to be a `IfcGloballyUniqueId`")); }
} while(0);
do { // convert the 'OwnerHistory' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcRoot,4>::aux_is_derived[1]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcRoot,4>::aux_is_derived[1]=true; break; }
try { GenericConvert( in->OwnerHistory, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcRoot to be a `IfcOwnerHistory`")); }
} while(0);
do { // convert the 'Name' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcRoot,4>::aux_is_derived[2]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcRoot,4>::aux_is_derived[2]=true; break; }
if (dynamic_cast<const UNSET*>(&*arg)) break;
try { GenericConvert( in->Name, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcRoot to be a `IfcLabel`")); }
} while(0);
do { // convert the 'Description' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcRoot,4>::aux_is_derived[3]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcRoot,4>::aux_is_derived[3]=true; break; }
if (dynamic_cast<const UNSET*>(&*arg)) break;
try { GenericConvert( in->Description, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 3 to IfcRoot to be a `IfcText`")); }
@ -1145,27 +1144,27 @@ template <> size_t GenericFill<IfcRepresentation>(const DB& db, const LIST& para
size_t base = 0;
if (params.GetSize() < 4) { throw STEP::TypeError("expected 4 arguments to IfcRepresentation"); } do { // convert the 'ContextOfItems' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcRepresentation,4>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcRepresentation,4>::aux_is_derived[0]=true; break; }
try { GenericConvert( in->ContextOfItems, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcRepresentation to be a `IfcRepresentationContext`")); }
} while(0);
do { // convert the 'RepresentationIdentifier' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcRepresentation,4>::aux_is_derived[1]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcRepresentation,4>::aux_is_derived[1]=true; break; }
if (dynamic_cast<const UNSET*>(&*arg)) break;
try { GenericConvert( in->RepresentationIdentifier, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcRepresentation to be a `IfcLabel`")); }
} while(0);
do { // convert the 'RepresentationType' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcRepresentation,4>::aux_is_derived[2]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcRepresentation,4>::aux_is_derived[2]=true; break; }
if (dynamic_cast<const UNSET*>(&*arg)) break;
try { GenericConvert( in->RepresentationType, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcRepresentation to be a `IfcLabel`")); }
} while(0);
do { // convert the 'Items' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcRepresentation,4>::aux_is_derived[3]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcRepresentation,4>::aux_is_derived[3]=true; break; }
try { GenericConvert( in->Items, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 3 to IfcRepresentation to be a `SET [1:?] OF IfcRepresentationItem`")); }
} while(0);
@ -1231,7 +1230,7 @@ template <> size_t GenericFill<IfcObject>(const DB& db, const LIST& params, IfcO
size_t base = GenericFill(db,params,static_cast<IfcObjectDefinition*>(in));
if (params.GetSize() < 5) { throw STEP::TypeError("expected 5 arguments to IfcObject"); } do { // convert the 'ObjectType' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcObject,1>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcObject,1>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const UNSET*>(&*arg)) break;
try { GenericConvert( in->ObjectType, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 4 to IfcObject to be a `IfcLabel`")); }
@ -1284,21 +1283,21 @@ template <> size_t GenericFill<IfcProductRepresentation>(const DB& db, const LIS
size_t base = 0;
if (params.GetSize() < 3) { throw STEP::TypeError("expected 3 arguments to IfcProductRepresentation"); } do { // convert the 'Name' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcProductRepresentation,3>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcProductRepresentation,3>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const UNSET*>(&*arg)) break;
try { GenericConvert( in->Name, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcProductRepresentation to be a `IfcLabel`")); }
} while(0);
do { // convert the 'Description' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcProductRepresentation,3>::aux_is_derived[1]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcProductRepresentation,3>::aux_is_derived[1]=true; break; }
if (dynamic_cast<const UNSET*>(&*arg)) break;
try { GenericConvert( in->Description, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcProductRepresentation to be a `IfcText`")); }
} while(0);
do { // convert the 'Representations' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcProductRepresentation,3>::aux_is_derived[2]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcProductRepresentation,3>::aux_is_derived[2]=true; break; }
try { GenericConvert( in->Representations, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcProductRepresentation to be a `LIST [1:?] OF IfcRepresentation`")); }
} while(0);
@ -1310,14 +1309,14 @@ template <> size_t GenericFill<IfcProduct>(const DB& db, const LIST& params, Ifc
size_t base = GenericFill(db,params,static_cast<IfcObject*>(in));
if (params.GetSize() < 7) { throw STEP::TypeError("expected 7 arguments to IfcProduct"); } do { // convert the 'ObjectPlacement' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcProduct,2>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcProduct,2>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const UNSET*>(&*arg)) break;
try { GenericConvert( in->ObjectPlacement, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 5 to IfcProduct to be a `IfcObjectPlacement`")); }
} while(0);
do { // convert the 'Representation' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcProduct,2>::aux_is_derived[1]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcProduct,2>::aux_is_derived[1]=true; break; }
if (dynamic_cast<const UNSET*>(&*arg)) break;
try { GenericConvert( in->Representation, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 6 to IfcProduct to be a `IfcProductRepresentation`")); }
@ -1330,7 +1329,7 @@ template <> size_t GenericFill<IfcElement>(const DB& db, const LIST& params, Ifc
size_t base = GenericFill(db,params,static_cast<IfcProduct*>(in));
if (params.GetSize() < 8) { throw STEP::TypeError("expected 8 arguments to IfcElement"); } do { // convert the 'Tag' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcElement,1>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcElement,1>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const UNSET*>(&*arg)) break;
try { GenericConvert( in->Tag, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 7 to IfcElement to be a `IfcIdentifier`")); }
@ -1369,13 +1368,13 @@ template <> size_t GenericFill<IfcCompositeCurve>(const DB& db, const LIST& para
size_t base = GenericFill(db,params,static_cast<IfcBoundedCurve*>(in));
if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to IfcCompositeCurve"); } do { // convert the 'Segments' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcCompositeCurve,2>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcCompositeCurve,2>::aux_is_derived[0]=true; break; }
try { GenericConvert( in->Segments, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcCompositeCurve to be a `LIST [1:?] OF IfcCompositeCurveSegment`")); }
} while(0);
do { // convert the 'SelfIntersect' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcCompositeCurve,2>::aux_is_derived[1]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcCompositeCurve,2>::aux_is_derived[1]=true; break; }
try { GenericConvert( in->SelfIntersect, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcCompositeCurve to be a `LOGICAL`")); }
} while(0);
@ -1394,27 +1393,27 @@ template <> size_t GenericFill<IfcCartesianTransformationOperator>(const DB& db,
size_t base = GenericFill(db,params,static_cast<IfcGeometricRepresentationItem*>(in));
if (params.GetSize() < 4) { throw STEP::TypeError("expected 4 arguments to IfcCartesianTransformationOperator"); } do { // convert the 'Axis1' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcCartesianTransformationOperator,4>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcCartesianTransformationOperator,4>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const UNSET*>(&*arg)) break;
try { GenericConvert( in->Axis1, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcCartesianTransformationOperator to be a `IfcDirection`")); }
} while(0);
do { // convert the 'Axis2' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcCartesianTransformationOperator,4>::aux_is_derived[1]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcCartesianTransformationOperator,4>::aux_is_derived[1]=true; break; }
if (dynamic_cast<const UNSET*>(&*arg)) break;
try { GenericConvert( in->Axis2, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcCartesianTransformationOperator to be a `IfcDirection`")); }
} while(0);
do { // convert the 'LocalOrigin' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcCartesianTransformationOperator,4>::aux_is_derived[2]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcCartesianTransformationOperator,4>::aux_is_derived[2]=true; break; }
try { GenericConvert( in->LocalOrigin, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcCartesianTransformationOperator to be a `IfcCartesianPoint`")); }
} while(0);
do { // convert the 'Scale' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcCartesianTransformationOperator,4>::aux_is_derived[3]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcCartesianTransformationOperator,4>::aux_is_derived[3]=true; break; }
if (dynamic_cast<const UNSET*>(&*arg)) break;
try { GenericConvert( in->Scale, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 3 to IfcCartesianTransformationOperator to be a `REAL`")); }
@ -1427,7 +1426,7 @@ template <> size_t GenericFill<IfcCartesianTransformationOperator3D>(const DB& d
size_t base = GenericFill(db,params,static_cast<IfcCartesianTransformationOperator*>(in));
if (params.GetSize() < 5) { throw STEP::TypeError("expected 5 arguments to IfcCartesianTransformationOperator3D"); } do { // convert the 'Axis3' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcCartesianTransformationOperator3D,1>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcCartesianTransformationOperator3D,1>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const UNSET*>(&*arg)) break;
try { GenericConvert( in->Axis3, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 4 to IfcCartesianTransformationOperator3D to be a `IfcDirection`")); }
@ -1440,13 +1439,13 @@ template <> size_t GenericFill<IfcProperty>(const DB& db, const LIST& params, If
size_t base = 0;
if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to IfcProperty"); } do { // convert the 'Name' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcProperty,2>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcProperty,2>::aux_is_derived[0]=true; break; }
try { GenericConvert( in->Name, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcProperty to be a `IfcIdentifier`")); }
} while(0);
do { // convert the 'Description' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcProperty,2>::aux_is_derived[1]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcProperty,2>::aux_is_derived[1]=true; break; }
if (dynamic_cast<const UNSET*>(&*arg)) break;
try { GenericConvert( in->Description, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcProperty to be a `IfcText`")); }
@ -1492,7 +1491,7 @@ template <> size_t GenericFill<IfcElementarySurface>(const DB& db, const LIST& p
size_t base = GenericFill(db,params,static_cast<IfcSurface*>(in));
if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to IfcElementarySurface"); } do { // convert the 'Position' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcElementarySurface,1>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcElementarySurface,1>::aux_is_derived[0]=true; break; }
try { GenericConvert( in->Position, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcElementarySurface to be a `IfcAxis2Placement3D`")); }
} while(0);
@ -1510,19 +1509,19 @@ template <> size_t GenericFill<IfcBooleanResult>(const DB& db, const LIST& param
size_t base = GenericFill(db,params,static_cast<IfcGeometricRepresentationItem*>(in));
if (params.GetSize() < 3) { throw STEP::TypeError("expected 3 arguments to IfcBooleanResult"); } do { // convert the 'Operator' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcBooleanResult,3>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcBooleanResult,3>::aux_is_derived[0]=true; break; }
try { GenericConvert( in->Operator, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcBooleanResult to be a `IfcBooleanOperator`")); }
} while(0);
do { // convert the 'FirstOperand' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcBooleanResult,3>::aux_is_derived[1]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcBooleanResult,3>::aux_is_derived[1]=true; break; }
try { GenericConvert( in->FirstOperand, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcBooleanResult to be a `IfcBooleanOperand`")); }
} while(0);
do { // convert the 'SecondOperand' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcBooleanResult,3>::aux_is_derived[2]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcBooleanResult,3>::aux_is_derived[2]=true; break; }
try { GenericConvert( in->SecondOperand, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcBooleanResult to be a `IfcBooleanOperand`")); }
} while(0);
@ -1546,7 +1545,7 @@ template <> size_t GenericFill<IfcManifoldSolidBrep>(const DB& db, const LIST& p
size_t base = GenericFill(db,params,static_cast<IfcSolidModel*>(in));
if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to IfcManifoldSolidBrep"); } do { // convert the 'Outer' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcManifoldSolidBrep,1>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcManifoldSolidBrep,1>::aux_is_derived[0]=true; break; }
try { GenericConvert( in->Outer, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcManifoldSolidBrep to be a `IfcClosedShell`")); }
} while(0);
@ -1779,13 +1778,13 @@ template <> size_t GenericFill<IfcProfileDef>(const DB& db, const LIST& params,
size_t base = 0;
if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to IfcProfileDef"); } do { // convert the 'ProfileType' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcProfileDef,2>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcProfileDef,2>::aux_is_derived[0]=true; break; }
try { GenericConvert( in->ProfileType, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcProfileDef to be a `IfcProfileTypeEnum`")); }
} while(0);
do { // convert the 'ProfileName' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcProfileDef,2>::aux_is_derived[1]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcProfileDef,2>::aux_is_derived[1]=true; break; }
if (dynamic_cast<const UNSET*>(&*arg)) break;
try { GenericConvert( in->ProfileName, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcProfileDef to be a `IfcLabel`")); }
@ -1798,7 +1797,7 @@ template <> size_t GenericFill<IfcParameterizedProfileDef>(const DB& db, const L
size_t base = GenericFill(db,params,static_cast<IfcProfileDef*>(in));
if (params.GetSize() < 3) { throw STEP::TypeError("expected 3 arguments to IfcParameterizedProfileDef"); } do { // convert the 'Position' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcParameterizedProfileDef,1>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcParameterizedProfileDef,1>::aux_is_derived[0]=true; break; }
try { GenericConvert( in->Position, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcParameterizedProfileDef to be a `IfcAxis2Placement2D`")); }
} while(0);
@ -1905,7 +1904,7 @@ template <> size_t GenericFill<IfcCircleProfileDef>(const DB& db, const LIST& pa
size_t base = GenericFill(db,params,static_cast<IfcParameterizedProfileDef*>(in));
if (params.GetSize() < 4) { throw STEP::TypeError("expected 4 arguments to IfcCircleProfileDef"); } do { // convert the 'Radius' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcCircleProfileDef,1>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcCircleProfileDef,1>::aux_is_derived[0]=true; break; }
try { GenericConvert( in->Radius, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 3 to IfcCircleProfileDef to be a `IfcPositiveLengthMeasure`")); }
} while(0);
@ -1928,7 +1927,7 @@ template <> size_t GenericFill<IfcPlacement>(const DB& db, const LIST& params, I
size_t base = GenericFill(db,params,static_cast<IfcGeometricRepresentationItem*>(in));
if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to IfcPlacement"); } do { // convert the 'Location' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcPlacement,1>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcPlacement,1>::aux_is_derived[0]=true; break; }
try { GenericConvert( in->Location, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcPlacement to be a `IfcCartesianPoint`")); }
} while(0);
@ -1958,7 +1957,7 @@ template <> size_t GenericFill<IfcPresentationStyle>(const DB& db, const LIST& p
size_t base = 0;
if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to IfcPresentationStyle"); } do { // convert the 'Name' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcPresentationStyle,1>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcPresentationStyle,1>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const UNSET*>(&*arg)) break;
try { GenericConvert( in->Name, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcPresentationStyle to be a `IfcLabel`")); }
@ -1999,13 +1998,13 @@ template <> size_t GenericFill<IfcRectangleProfileDef>(const DB& db, const LIST&
size_t base = GenericFill(db,params,static_cast<IfcParameterizedProfileDef*>(in));
if (params.GetSize() < 5) { throw STEP::TypeError("expected 5 arguments to IfcRectangleProfileDef"); } do { // convert the 'XDim' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcRectangleProfileDef,2>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcRectangleProfileDef,2>::aux_is_derived[0]=true; break; }
try { GenericConvert( in->XDim, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 3 to IfcRectangleProfileDef to be a `IfcPositiveLengthMeasure`")); }
} while(0);
do { // convert the 'YDim' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcRectangleProfileDef,2>::aux_is_derived[1]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcRectangleProfileDef,2>::aux_is_derived[1]=true; break; }
try { GenericConvert( in->YDim, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 4 to IfcRectangleProfileDef to be a `IfcPositiveLengthMeasure`")); }
} while(0);
@ -2118,13 +2117,13 @@ template <> size_t GenericFill<IfcSweptAreaSolid>(const DB& db, const LIST& para
size_t base = GenericFill(db,params,static_cast<IfcSolidModel*>(in));
if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to IfcSweptAreaSolid"); } do { // convert the 'SweptArea' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcSweptAreaSolid,2>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcSweptAreaSolid,2>::aux_is_derived[0]=true; break; }
try { GenericConvert( in->SweptArea, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcSweptAreaSolid to be a `IfcProfileDef`")); }
} while(0);
do { // convert the 'Position' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcSweptAreaSolid,2>::aux_is_derived[1]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcSweptAreaSolid,2>::aux_is_derived[1]=true; break; }
try { GenericConvert( in->Position, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcSweptAreaSolid to be a `IfcAxis2Placement3D`")); }
} while(0);
@ -2198,13 +2197,13 @@ template <> size_t GenericFill<IfcHalfSpaceSolid>(const DB& db, const LIST& para
size_t base = GenericFill(db,params,static_cast<IfcGeometricRepresentationItem*>(in));
if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to IfcHalfSpaceSolid"); } do { // convert the 'BaseSurface' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcHalfSpaceSolid,2>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcHalfSpaceSolid,2>::aux_is_derived[0]=true; break; }
try { GenericConvert( in->BaseSurface, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcHalfSpaceSolid to be a `IfcSurface`")); }
} while(0);
do { // convert the 'AgreementFlag' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcHalfSpaceSolid,2>::aux_is_derived[1]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcHalfSpaceSolid,2>::aux_is_derived[1]=true; break; }
try { GenericConvert( in->AgreementFlag, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcHalfSpaceSolid to be a `BOOLEAN`")); }
} while(0);
@ -2354,7 +2353,7 @@ template <> size_t GenericFill<IfcRelDefines>(const DB& db, const LIST& params,
size_t base = GenericFill(db,params,static_cast<IfcRelationship*>(in));
if (params.GetSize() < 5) { throw STEP::TypeError("expected 5 arguments to IfcRelDefines"); } do { // convert the 'RelatedObjects' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcRelDefines,1>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcRelDefines,1>::aux_is_derived[0]=true; break; }
try { GenericConvert( in->RelatedObjects, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 4 to IfcRelDefines to be a `SET [1:?] OF IfcObject`")); }
} while(0);
@ -2366,7 +2365,7 @@ template <> size_t GenericFill<IfcRelDefinesByProperties>(const DB& db, const LI
size_t base = GenericFill(db,params,static_cast<IfcRelDefines*>(in));
if (params.GetSize() < 6) { throw STEP::TypeError("expected 6 arguments to IfcRelDefinesByProperties"); } do { // convert the 'RelatingPropertyDefinition' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcRelDefinesByProperties,1>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcRelDefinesByProperties,1>::aux_is_derived[0]=true; break; }
try { GenericConvert( in->RelatingPropertyDefinition, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 5 to IfcRelDefinesByProperties to be a `IfcPropertySetDefinition`")); }
} while(0);
@ -2399,7 +2398,7 @@ template <> size_t GenericFill<IfcArbitraryOpenProfileDef>(const DB& db, const L
size_t base = GenericFill(db,params,static_cast<IfcProfileDef*>(in));
if (params.GetSize() < 3) { throw STEP::TypeError("expected 3 arguments to IfcArbitraryOpenProfileDef"); } do { // convert the 'Curve' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcArbitraryOpenProfileDef,1>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcArbitraryOpenProfileDef,1>::aux_is_derived[0]=true; break; }
try { GenericConvert( in->Curve, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcArbitraryOpenProfileDef to be a `IfcBoundedCurve`")); }
} while(0);
@ -2565,13 +2564,13 @@ template <> size_t GenericFill<IfcRelDecomposes>(const DB& db, const LIST& param
size_t base = GenericFill(db,params,static_cast<IfcRelationship*>(in));
if (params.GetSize() < 6) { throw STEP::TypeError("expected 6 arguments to IfcRelDecomposes"); } do { // convert the 'RelatingObject' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcRelDecomposes,2>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcRelDecomposes,2>::aux_is_derived[0]=true; break; }
try { GenericConvert( in->RelatingObject, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 4 to IfcRelDecomposes to be a `IfcObjectDefinition`")); }
} while(0);
do { // convert the 'RelatedObjects' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcRelDecomposes,2>::aux_is_derived[1]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcRelDecomposes,2>::aux_is_derived[1]=true; break; }
try { GenericConvert( in->RelatedObjects, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 5 to IfcRelDecomposes to be a `SET [1:?] OF IfcObjectDefinition`")); }
} while(0);
@ -2653,13 +2652,13 @@ template <> size_t GenericFill<IfcNamedUnit>(const DB& db, const LIST& params, I
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++];
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::Schema_2x3::IfcNamedUnit,2>::aux_is_derived[0]=true; 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`")); }
} while(0);
do { // convert the 'UnitType' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcNamedUnit,2>::aux_is_derived[1]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcNamedUnit,2>::aux_is_derived[1]=true; break; }
try { GenericConvert( in->UnitType, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcNamedUnit to be a `IfcUnitEnum`")); }
} while(0);
@ -2713,14 +2712,14 @@ template <> size_t GenericFill<IfcSpatialStructureElement>(const DB& db, const L
size_t base = GenericFill(db,params,static_cast<IfcProduct*>(in));
if (params.GetSize() < 9) { throw STEP::TypeError("expected 9 arguments to IfcSpatialStructureElement"); } do { // convert the 'LongName' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcSpatialStructureElement,2>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcSpatialStructureElement,2>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const UNSET*>(&*arg)) break;
try { GenericConvert( in->LongName, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 7 to IfcSpatialStructureElement to be a `IfcLabel`")); }
} while(0);
do { // convert the 'CompositionType' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcSpatialStructureElement,2>::aux_is_derived[1]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcSpatialStructureElement,2>::aux_is_derived[1]=true; break; }
try { GenericConvert( in->CompositionType, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 8 to IfcSpatialStructureElement to be a `IfcElementCompositionEnum`")); }
} while(0);
@ -2756,7 +2755,7 @@ template <> size_t GenericFill<IfcConnectedFaceSet>(const DB& db, const LIST& pa
size_t base = GenericFill(db,params,static_cast<IfcTopologicalRepresentationItem*>(in));
if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to IfcConnectedFaceSet"); } do { // convert the 'CfsFaces' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcConnectedFaceSet,1>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcConnectedFaceSet,1>::aux_is_derived[0]=true; break; }
try { GenericConvert( in->CfsFaces, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcConnectedFaceSet to be a `SET [1:?] OF IfcFace`")); }
} while(0);
@ -2782,7 +2781,7 @@ template <> size_t GenericFill<IfcConic>(const DB& db, const LIST& params, IfcCo
size_t base = GenericFill(db,params,static_cast<IfcCurve*>(in));
if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to IfcConic"); } do { // convert the 'Position' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcConic,1>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcConic,1>::aux_is_derived[0]=true; break; }
try { GenericConvert( in->Position, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcConic to be a `IfcAxis2Placement`")); }
} while(0);
@ -2829,31 +2828,31 @@ template <> size_t GenericFill<IfcIShapeProfileDef>(const DB& db, const LIST& pa
size_t base = GenericFill(db,params,static_cast<IfcParameterizedProfileDef*>(in));
if (params.GetSize() < 8) { throw STEP::TypeError("expected 8 arguments to IfcIShapeProfileDef"); } do { // convert the 'OverallWidth' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcIShapeProfileDef,5>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcIShapeProfileDef,5>::aux_is_derived[0]=true; break; }
try { GenericConvert( in->OverallWidth, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 3 to IfcIShapeProfileDef to be a `IfcPositiveLengthMeasure`")); }
} while(0);
do { // convert the 'OverallDepth' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcIShapeProfileDef,5>::aux_is_derived[1]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcIShapeProfileDef,5>::aux_is_derived[1]=true; break; }
try { GenericConvert( in->OverallDepth, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 4 to IfcIShapeProfileDef to be a `IfcPositiveLengthMeasure`")); }
} while(0);
do { // convert the 'WebThickness' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcIShapeProfileDef,5>::aux_is_derived[2]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcIShapeProfileDef,5>::aux_is_derived[2]=true; break; }
try { GenericConvert( in->WebThickness, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 5 to IfcIShapeProfileDef to be a `IfcPositiveLengthMeasure`")); }
} while(0);
do { // convert the 'FlangeThickness' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcIShapeProfileDef,5>::aux_is_derived[3]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcIShapeProfileDef,5>::aux_is_derived[3]=true; break; }
try { GenericConvert( in->FlangeThickness, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 6 to IfcIShapeProfileDef to be a `IfcPositiveLengthMeasure`")); }
} while(0);
do { // convert the 'FilletRadius' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcIShapeProfileDef,5>::aux_is_derived[4]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcIShapeProfileDef,5>::aux_is_derived[4]=true; break; }
if (dynamic_cast<const UNSET*>(&*arg)) break;
try { GenericConvert( in->FilletRadius, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 7 to IfcIShapeProfileDef to be a `IfcPositiveLengthMeasure`")); }
@ -2978,20 +2977,20 @@ template <> size_t GenericFill<IfcStyledItem>(const DB& db, const LIST& params,
size_t base = GenericFill(db,params,static_cast<IfcRepresentationItem*>(in));
if (params.GetSize() < 3) { throw STEP::TypeError("expected 3 arguments to IfcStyledItem"); } do { // convert the 'Item' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcStyledItem,3>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcStyledItem,3>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const UNSET*>(&*arg)) break;
try { GenericConvert( in->Item, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcStyledItem to be a `IfcRepresentationItem`")); }
} while(0);
do { // convert the 'Styles' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcStyledItem,3>::aux_is_derived[1]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcStyledItem,3>::aux_is_derived[1]=true; break; }
try { GenericConvert( in->Styles, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcStyledItem to be a `SET [1:?] OF IfcPresentationStyleAssignment`")); }
} while(0);
do { // convert the 'Name' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcStyledItem,3>::aux_is_derived[2]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcStyledItem,3>::aux_is_derived[2]=true; break; }
if (dynamic_cast<const UNSET*>(&*arg)) break;
try { GenericConvert( in->Name, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcStyledItem to be a `IfcLabel`")); }
@ -3018,7 +3017,7 @@ template <> size_t GenericFill<IfcArbitraryClosedProfileDef>(const DB& db, const
size_t base = GenericFill(db,params,static_cast<IfcProfileDef*>(in));
if (params.GetSize() < 3) { throw STEP::TypeError("expected 3 arguments to IfcArbitraryClosedProfileDef"); } do { // convert the 'OuterCurve' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcArbitraryClosedProfileDef,1>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcArbitraryClosedProfileDef,1>::aux_is_derived[0]=true; break; }
try { GenericConvert( in->OuterCurve, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcArbitraryClosedProfileDef to be a `IfcCurve`")); }
} while(0);
@ -3106,7 +3105,7 @@ template <> size_t GenericFill<IfcSurfaceStyleShading>(const DB& db, const LIST&
size_t base = 0;
if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to IfcSurfaceStyleShading"); } do { // convert the 'SurfaceColour' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcSurfaceStyleShading,1>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcSurfaceStyleShading,1>::aux_is_derived[0]=true; break; }
try { GenericConvert( in->SurfaceColour, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcSurfaceStyleShading to be a `IfcColourRgb`")); }
} while(0);

View File

@ -41,10 +41,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//#include "AssimpPCH.h"
#ifndef ASSIMP_BUILD_NO_IFC_IMPORTER
#include "IFCReaderGen.h"
#include "IFCReaderGen_2x3.h"
namespace Assimp {
using namespace IFC;
using namespace ::Assimp::IFC::Schema_2x3;
namespace STEP {
@ -111,7 +112,7 @@ template <> size_t GenericFill<IfcFace>(const DB& db, const LIST& params, IfcFac
size_t base = GenericFill(db,params,static_cast<IfcTopologicalRepresentationItem*>(in));
if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to IfcFace"); } do { // convert the 'Bounds' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcFace,1>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcFace,1>::aux_is_derived[0]=true; break; }
try { GenericConvert( in->Bounds, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcFace to be a `SET [1:?] OF IfcFaceBound`")); }
} while(0);
@ -165,7 +166,7 @@ template <> size_t GenericFill<IfcColourSpecification>(const DB& db, const LIST&
size_t base = 0;
if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to IfcColourSpecification"); } do { // convert the 'Name' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcColourSpecification,1>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcColourSpecification,1>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const UNSET*>(&*arg)) break;
try { GenericConvert( in->Name, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcColourSpecification to be a `IfcLabel`")); }
@ -405,31 +406,31 @@ template <> size_t GenericFill<IfcBSplineCurve>(const DB& db, const LIST& params
size_t base = GenericFill(db,params,static_cast<IfcBoundedCurve*>(in));
if (params.GetSize() < 5) { throw STEP::TypeError("expected 5 arguments to IfcBSplineCurve"); } do { // convert the 'Degree' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcBSplineCurve,5>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcBSplineCurve,5>::aux_is_derived[0]=true; break; }
try { GenericConvert( in->Degree, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcBSplineCurve to be a `INTEGER`")); }
} while(0);
do { // convert the 'ControlPointsList' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcBSplineCurve,5>::aux_is_derived[1]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcBSplineCurve,5>::aux_is_derived[1]=true; break; }
try { GenericConvert( in->ControlPointsList, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcBSplineCurve to be a `LIST [2:?] OF IfcCartesianPoint`")); }
} while(0);
do { // convert the 'CurveForm' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcBSplineCurve,5>::aux_is_derived[2]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcBSplineCurve,5>::aux_is_derived[2]=true; break; }
try { GenericConvert( in->CurveForm, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcBSplineCurve to be a `IfcBSplineCurveForm`")); }
} while(0);
do { // convert the 'ClosedCurve' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcBSplineCurve,5>::aux_is_derived[3]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcBSplineCurve,5>::aux_is_derived[3]=true; break; }
try { GenericConvert( in->ClosedCurve, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 3 to IfcBSplineCurve to be a `LOGICAL`")); }
} while(0);
do { // convert the 'SelfIntersect' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcBSplineCurve,5>::aux_is_derived[4]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcBSplineCurve,5>::aux_is_derived[4]=true; break; }
try { GenericConvert( in->SelfIntersect, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 4 to IfcBSplineCurve to be a `LOGICAL`")); }
} while(0);
@ -708,14 +709,14 @@ template <> size_t GenericFill<IfcRepresentationContext>(const DB& db, const LIS
size_t base = 0;
if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to IfcRepresentationContext"); } do { // convert the 'ContextIdentifier' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcRepresentationContext,2>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcRepresentationContext,2>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const UNSET*>(&*arg)) break;
try { GenericConvert( in->ContextIdentifier, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcRepresentationContext to be a `IfcLabel`")); }
} while(0);
do { // convert the 'ContextType' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcRepresentationContext,2>::aux_is_derived[1]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcRepresentationContext,2>::aux_is_derived[1]=true; break; }
if (dynamic_cast<const UNSET*>(&*arg)) break;
try { GenericConvert( in->ContextType, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcRepresentationContext to be a `IfcLabel`")); }
@ -728,26 +729,26 @@ template <> size_t GenericFill<IfcGeometricRepresentationContext>(const DB& db,
size_t base = GenericFill(db,params,static_cast<IfcRepresentationContext*>(in));
if (params.GetSize() < 6) { throw STEP::TypeError("expected 6 arguments to IfcGeometricRepresentationContext"); } do { // convert the 'CoordinateSpaceDimension' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcGeometricRepresentationContext,4>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcGeometricRepresentationContext,4>::aux_is_derived[0]=true; break; }
try { GenericConvert( in->CoordinateSpaceDimension, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcGeometricRepresentationContext to be a `IfcDimensionCount`")); }
} while(0);
do { // convert the 'Precision' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcGeometricRepresentationContext,4>::aux_is_derived[1]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcGeometricRepresentationContext,4>::aux_is_derived[1]=true; break; }
if (dynamic_cast<const UNSET*>(&*arg)) break;
try { GenericConvert( in->Precision, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 3 to IfcGeometricRepresentationContext to be a `REAL`")); }
} while(0);
do { // convert the 'WorldCoordinateSystem' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcGeometricRepresentationContext,4>::aux_is_derived[2]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcGeometricRepresentationContext,4>::aux_is_derived[2]=true; break; }
try { GenericConvert( in->WorldCoordinateSystem, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 4 to IfcGeometricRepresentationContext to be a `IfcAxis2Placement`")); }
} while(0);
do { // convert the 'TrueNorth' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcGeometricRepresentationContext,4>::aux_is_derived[3]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcGeometricRepresentationContext,4>::aux_is_derived[3]=true; break; }
if (dynamic_cast<const UNSET*>(&*arg)) break;
try { GenericConvert( in->TrueNorth, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 5 to IfcGeometricRepresentationContext to be a `IfcDirection`")); }
@ -1165,13 +1166,13 @@ template <> size_t GenericFill<IfcFaceBound>(const DB& db, const LIST& params, I
size_t base = GenericFill(db,params,static_cast<IfcTopologicalRepresentationItem*>(in));
if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to IfcFaceBound"); } do { // convert the 'Bound' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcFaceBound,2>::aux_is_derived[0]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcFaceBound,2>::aux_is_derived[0]=true; break; }
try { GenericConvert( in->Bound, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcFaceBound to be a `IfcLoop`")); }
} while(0);
do { // convert the 'Orientation' argument
std::shared_ptr<const DataType> arg = params[base++];
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcFaceBound,2>::aux_is_derived[1]=true; break; }
if (dynamic_cast<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::Schema_2x3::IfcFaceBound,2>::aux_is_derived[1]=true; break; }
try { GenericConvert( in->Orientation, arg, db ); break; }
catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcFaceBound to be a `BOOLEAN`")); }
} while(0);

View File

@ -43,10 +43,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef INCLUDED_IFC_READER_GEN_H
#define INCLUDED_IFC_READER_GEN_H
#include "STEPFile.h"
#include "code/STEPFile.h"
namespace Assimp {
namespace IFC {
namespace Schema_2x3 {
using namespace STEP;
using namespace STEP::EXPRESS;
@ -3912,15 +3914,16 @@ namespace IFC {
};
void GetSchema(EXPRESS::ConversionSchema& out);
} //! Schema_2x3
} //! IFC
namespace STEP {
// ******************************************************************************
// Converter stubs
// ******************************************************************************
#define DECL_CONV_STUB(type) template <> size_t GenericFill<IFC::type>(const STEP::DB& db, const EXPRESS::LIST& params, IFC::type* in)
#define DECL_CONV_STUB(type) template <> size_t GenericFill<IFC::Schema_2x3::type>(const STEP::DB& db, const EXPRESS::LIST& params, IFC::Schema_2x3::type* in)
DECL_CONV_STUB(IfcRepresentationItem);
DECL_CONV_STUB(IfcGeometricRepresentationItem);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -47,9 +47,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_IFC_IMPORTER
#include "IFCUtil.h"
#include "PolyTools.h"
#include "ProcessHelper.h"
#include "code/Importer/IFC/IFCUtil.h"
#include "code/PolyTools.h"
#include "code/ProcessHelper.h"
#include <assimp/Defines.h>
namespace Assimp {
@ -70,31 +70,31 @@ void TempOpening::Transform(const IfcMatrix4& mat)
// ------------------------------------------------------------------------------------------------
aiMesh* TempMesh::ToMesh()
{
ai_assert(verts.size() == std::accumulate(vertcnt.begin(),vertcnt.end(),size_t(0)));
ai_assert(mVerts.size() == std::accumulate(mVertcnt.begin(),mVertcnt.end(),size_t(0)));
if (verts.empty()) {
if (mVerts.empty()) {
return NULL;
}
std::unique_ptr<aiMesh> mesh(new aiMesh());
// copy vertices
mesh->mNumVertices = static_cast<unsigned int>(verts.size());
mesh->mNumVertices = static_cast<unsigned int>(mVerts.size());
mesh->mVertices = new aiVector3D[mesh->mNumVertices];
std::copy(verts.begin(),verts.end(),mesh->mVertices);
std::copy(mVerts.begin(),mVerts.end(),mesh->mVertices);
// and build up faces
mesh->mNumFaces = static_cast<unsigned int>(vertcnt.size());
mesh->mNumFaces = static_cast<unsigned int>(mVertcnt.size());
mesh->mFaces = new aiFace[mesh->mNumFaces];
for(unsigned int i = 0,n=0, acc = 0; i < mesh->mNumFaces; ++n) {
aiFace& f = mesh->mFaces[i];
if (!vertcnt[n]) {
if (!mVertcnt[n]) {
--mesh->mNumFaces;
continue;
}
f.mNumIndices = vertcnt[n];
f.mNumIndices = mVertcnt[n];
f.mIndices = new unsigned int[f.mNumIndices];
for(unsigned int a = 0; a < f.mNumIndices; ++a) {
f.mIndices[a] = acc++;
@ -109,14 +109,14 @@ aiMesh* TempMesh::ToMesh()
// ------------------------------------------------------------------------------------------------
void TempMesh::Clear()
{
verts.clear();
vertcnt.clear();
mVerts.clear();
mVertcnt.clear();
}
// ------------------------------------------------------------------------------------------------
void TempMesh::Transform(const IfcMatrix4& mat)
{
for(IfcVector3& v : verts) {
for(IfcVector3& v : mVerts) {
v *= mat;
}
}
@ -124,14 +124,14 @@ void TempMesh::Transform(const IfcMatrix4& mat)
// ------------------------------------------------------------------------------
IfcVector3 TempMesh::Center() const
{
return (verts.size() == 0) ? IfcVector3(0.0f, 0.0f, 0.0f) : (std::accumulate(verts.begin(),verts.end(),IfcVector3()) / static_cast<IfcFloat>(verts.size()));
return (mVerts.size() == 0) ? IfcVector3(0.0f, 0.0f, 0.0f) : (std::accumulate(mVerts.begin(),mVerts.end(),IfcVector3()) / static_cast<IfcFloat>(mVerts.size()));
}
// ------------------------------------------------------------------------------------------------
void TempMesh::Append(const TempMesh& other)
{
verts.insert(verts.end(),other.verts.begin(),other.verts.end());
vertcnt.insert(vertcnt.end(),other.vertcnt.begin(),other.vertcnt.end());
mVerts.insert(mVerts.end(),other.mVerts.begin(),other.mVerts.end());
mVertcnt.insert(mVertcnt.end(),other.mVertcnt.begin(),other.mVertcnt.end());
}
// ------------------------------------------------------------------------------------------------
@ -147,13 +147,13 @@ void TempMesh::RemoveDegenerates()
bool drop = false;
size_t inor = 0;
std::vector<IfcVector3>::iterator vit = verts.begin();
for (std::vector<unsigned int>::iterator it = vertcnt.begin(); it != vertcnt.end(); ++inor) {
std::vector<IfcVector3>::iterator vit = mVerts.begin();
for (std::vector<unsigned int>::iterator it = mVertcnt.begin(); it != mVertcnt.end(); ++inor) {
const unsigned int pcount = *it;
if (normals[inor].SquareLength() < 1e-10f) {
it = vertcnt.erase(it);
vit = verts.erase(vit, vit + pcount);
it = mVertcnt.erase(it);
vit = mVerts.erase(vit, vit + pcount);
drop = true;
continue;
@ -191,24 +191,24 @@ void TempMesh::ComputePolygonNormals(std::vector<IfcVector3>& normals,
size_t ofs) const
{
size_t max_vcount = 0;
std::vector<unsigned int>::const_iterator begin = vertcnt.begin()+ofs, end = vertcnt.end(), iit;
std::vector<unsigned int>::const_iterator begin = mVertcnt.begin()+ofs, end = mVertcnt.end(), iit;
for(iit = begin; iit != end; ++iit) {
max_vcount = std::max(max_vcount,static_cast<size_t>(*iit));
}
std::vector<IfcFloat> temp((max_vcount+2)*4);
normals.reserve( normals.size() + vertcnt.size()-ofs );
normals.reserve( normals.size() + mVertcnt.size()-ofs );
// `NewellNormal()` currently has a relatively strange interface and need to
// re-structure things a bit to meet them.
size_t vidx = std::accumulate(vertcnt.begin(),begin,0);
size_t vidx = std::accumulate(mVertcnt.begin(),begin,0);
for(iit = begin; iit != end; vidx += *iit++) {
if (!*iit) {
normals.push_back(IfcVector3());
continue;
}
for(size_t vofs = 0, cnt = 0; vofs < *iit; ++vofs) {
const IfcVector3& v = verts[vidx+vofs];
const IfcVector3& v = mVerts[vidx+vofs];
temp[cnt++] = v.x;
temp[cnt++] = v.y;
temp[cnt++] = v.z;
@ -233,7 +233,7 @@ void TempMesh::ComputePolygonNormals(std::vector<IfcVector3>& normals,
// Compute the normal of the last polygon in the given mesh
IfcVector3 TempMesh::ComputeLastPolygonNormal(bool normalize) const
{
return ComputePolygonNormal(&verts[verts.size() - vertcnt.back()], vertcnt.back(), normalize);
return ComputePolygonNormal(&mVerts[mVerts.size() - mVertcnt.back()], mVertcnt.back(), normalize);
}
struct CompareVector
@ -258,27 +258,27 @@ void TempMesh::FixupFaceOrientation()
const IfcVector3 vavg = Center();
// create a list of start indices for all faces to allow random access to faces
std::vector<size_t> faceStartIndices(vertcnt.size());
for( size_t i = 0, a = 0; a < vertcnt.size(); i += vertcnt[a], ++a )
std::vector<size_t> faceStartIndices(mVertcnt.size());
for( size_t i = 0, a = 0; a < mVertcnt.size(); i += mVertcnt[a], ++a )
faceStartIndices[a] = i;
// list all faces on a vertex
std::map<IfcVector3, std::vector<size_t>, CompareVector> facesByVertex;
for( size_t a = 0; a < vertcnt.size(); ++a )
for( size_t a = 0; a < mVertcnt.size(); ++a )
{
for( size_t b = 0; b < vertcnt[a]; ++b )
facesByVertex[verts[faceStartIndices[a] + b]].push_back(a);
for( size_t b = 0; b < mVertcnt[a]; ++b )
facesByVertex[mVerts[faceStartIndices[a] + b]].push_back(a);
}
// determine neighbourhood for all polys
std::vector<size_t> neighbour(verts.size(), SIZE_MAX);
std::vector<size_t> neighbour(mVerts.size(), SIZE_MAX);
std::vector<size_t> tempIntersect(10);
for( size_t a = 0; a < vertcnt.size(); ++a )
for( size_t a = 0; a < mVertcnt.size(); ++a )
{
for( size_t b = 0; b < vertcnt[a]; ++b )
for( size_t b = 0; b < mVertcnt[a]; ++b )
{
size_t ib = faceStartIndices[a] + b, nib = faceStartIndices[a] + (b + 1) % vertcnt[a];
const std::vector<size_t>& facesOnB = facesByVertex[verts[ib]];
const std::vector<size_t>& facesOnNB = facesByVertex[verts[nib]];
size_t ib = faceStartIndices[a] + b, nib = faceStartIndices[a] + (b + 1) % mVertcnt[a];
const std::vector<size_t>& facesOnB = facesByVertex[mVerts[ib]];
const std::vector<size_t>& facesOnNB = facesByVertex[mVerts[nib]];
// there should be exactly one or two faces which appear in both lists. Our face and the other side
std::vector<size_t>::iterator sectstart = tempIntersect.begin();
std::vector<size_t>::iterator sectend = std::set_intersection(
@ -295,33 +295,33 @@ void TempMesh::FixupFaceOrientation()
// now we're getting started. We take the face which is the farthest away from the center. This face is most probably
// facing outwards. So we reverse this face to point outwards in relation to the center. Then we adapt neighbouring
// faces to have the same winding until all faces have been tested.
std::vector<bool> faceDone(vertcnt.size(), false);
std::vector<bool> faceDone(mVertcnt.size(), false);
while( std::count(faceDone.begin(), faceDone.end(), false) != 0 )
{
// find the farthest of the remaining faces
size_t farthestIndex = SIZE_MAX;
IfcFloat farthestDistance = -1.0;
for( size_t a = 0; a < vertcnt.size(); ++a )
for( size_t a = 0; a < mVertcnt.size(); ++a )
{
if( faceDone[a] )
continue;
IfcVector3 faceCenter = std::accumulate(verts.begin() + faceStartIndices[a],
verts.begin() + faceStartIndices[a] + vertcnt[a], IfcVector3(0.0)) / IfcFloat(vertcnt[a]);
IfcVector3 faceCenter = std::accumulate(mVerts.begin() + faceStartIndices[a],
mVerts.begin() + faceStartIndices[a] + mVertcnt[a], IfcVector3(0.0)) / IfcFloat(mVertcnt[a]);
IfcFloat dst = (faceCenter - vavg).SquareLength();
if( dst > farthestDistance ) { farthestDistance = dst; farthestIndex = a; }
}
// calculate its normal and reverse the poly if its facing towards the mesh center
IfcVector3 farthestNormal = ComputePolygonNormal(verts.data() + faceStartIndices[farthestIndex], vertcnt[farthestIndex]);
IfcVector3 farthestCenter = std::accumulate(verts.begin() + faceStartIndices[farthestIndex],
verts.begin() + faceStartIndices[farthestIndex] + vertcnt[farthestIndex], IfcVector3(0.0))
/ IfcFloat(vertcnt[farthestIndex]);
IfcVector3 farthestNormal = ComputePolygonNormal(mVerts.data() + faceStartIndices[farthestIndex], mVertcnt[farthestIndex]);
IfcVector3 farthestCenter = std::accumulate(mVerts.begin() + faceStartIndices[farthestIndex],
mVerts.begin() + faceStartIndices[farthestIndex] + mVertcnt[farthestIndex], IfcVector3(0.0))
/ IfcFloat(mVertcnt[farthestIndex]);
// We accapt a bit of negative orientation without reversing. In case of doubt, prefer the orientation given in
// the file.
if( (farthestNormal * (farthestCenter - vavg).Normalize()) < -0.4 )
{
size_t fsi = faceStartIndices[farthestIndex], fvc = vertcnt[farthestIndex];
std::reverse(verts.begin() + fsi, verts.begin() + fsi + fvc);
size_t fsi = faceStartIndices[farthestIndex], fvc = mVertcnt[farthestIndex];
std::reverse(mVerts.begin() + fsi, mVerts.begin() + fsi + fvc);
std::reverse(neighbour.begin() + fsi, neighbour.begin() + fsi + fvc);
// because of the neighbour index belonging to the edge starting with the point at the same index, we need to
// cycle the neighbours through to match the edges again.
@ -339,7 +339,7 @@ void TempMesh::FixupFaceOrientation()
while( !todo.empty() )
{
size_t tdf = todo.back();
size_t vsi = faceStartIndices[tdf], vc = vertcnt[tdf];
size_t vsi = faceStartIndices[tdf], vc = mVertcnt[tdf];
todo.pop_back();
// check its neighbours
@ -350,19 +350,19 @@ void TempMesh::FixupFaceOrientation()
if( nbi == SIZE_MAX || faceDone[nbi] )
continue;
const IfcVector3& vp = verts[vsi + a];
size_t nbvsi = faceStartIndices[nbi], nbvc = vertcnt[nbi];
std::vector<IfcVector3>::iterator it = std::find_if(verts.begin() + nbvsi, verts.begin() + nbvsi + nbvc, FindVector(vp));
ai_assert(it != verts.begin() + nbvsi + nbvc);
size_t nb_vidx = std::distance(verts.begin() + nbvsi, it);
const IfcVector3& vp = mVerts[vsi + a];
size_t nbvsi = faceStartIndices[nbi], nbvc = mVertcnt[nbi];
std::vector<IfcVector3>::iterator it = std::find_if(mVerts.begin() + nbvsi, mVerts.begin() + nbvsi + nbvc, FindVector(vp));
ai_assert(it != mVerts.begin() + nbvsi + nbvc);
size_t nb_vidx = std::distance(mVerts.begin() + nbvsi, it);
// two faces winded in the same direction should have a crossed edge, where one face has p0->p1 and the other
// has p1'->p0'. If the next point on the neighbouring face is also the next on the current face, we need
// to reverse the neighbour
nb_vidx = (nb_vidx + 1) % nbvc;
size_t oursideidx = (a + 1) % vc;
if( FuzzyVectorCompare(1e-6)(verts[vsi + oursideidx], verts[nbvsi + nb_vidx]) )
if( FuzzyVectorCompare(1e-6)(mVerts[vsi + oursideidx], mVerts[nbvsi + nb_vidx]) )
{
std::reverse(verts.begin() + nbvsi, verts.begin() + nbvsi + nbvc);
std::reverse(mVerts.begin() + nbvsi, mVerts.begin() + nbvsi + nbvc);
std::reverse(neighbour.begin() + nbvsi, neighbour.begin() + nbvsi + nbvc);
for( size_t a = 0; a < nbvc - 1; ++a )
std::swap(neighbour[nbvsi + a], neighbour[nbvsi + a + 1]);
@ -379,12 +379,10 @@ void TempMesh::FixupFaceOrientation()
}
// ------------------------------------------------------------------------------------------------
void TempMesh::RemoveAdjacentDuplicates()
{
void TempMesh::RemoveAdjacentDuplicates() {
bool drop = false;
std::vector<IfcVector3>::iterator base = verts.begin();
for(unsigned int& cnt : vertcnt) {
std::vector<IfcVector3>::iterator base = mVerts.begin();
for(unsigned int& cnt : mVertcnt) {
if (cnt < 2){
base += cnt;
continue;
@ -425,13 +423,13 @@ void TempMesh::RemoveAdjacentDuplicates()
std::vector<IfcVector3>::iterator end = base+cnt, e = std::unique( base, end, fz );
if (e != end) {
cnt -= static_cast<unsigned int>(std::distance(e, end));
verts.erase(e,end);
mVerts.erase(e,end);
drop = true;
}
// check front and back vertices for this polygon
if (cnt > 1 && fz(*base,*(base+cnt-1))) {
verts.erase(base+ --cnt);
mVerts.erase(base+ --cnt);
drop = true;
}
@ -447,12 +445,12 @@ void TempMesh::RemoveAdjacentDuplicates()
// ------------------------------------------------------------------------------------------------
void TempMesh::Swap(TempMesh& other)
{
vertcnt.swap(other.vertcnt);
verts.swap(other.verts);
mVertcnt.swap(other.mVertcnt);
mVerts.swap(other.mVerts);
}
// ------------------------------------------------------------------------------------------------
bool IsTrue(const EXPRESS::BOOLEAN& in)
bool IsTrue(const ::Assimp::STEP::EXPRESS::BOOLEAN& in)
{
return (std::string)in == "TRUE" || (std::string)in == "T";
}
@ -515,7 +513,7 @@ IfcFloat ConvertSIPrefix(const std::string& prefix)
}
// ------------------------------------------------------------------------------------------------
void ConvertColor(aiColor4D& out, const IfcColourRgb& in)
void ConvertColor(aiColor4D& out, const Schema_2x3::IfcColourRgb& in)
{
out.r = static_cast<float>( in.Red );
out.g = static_cast<float>( in.Green );
@ -524,9 +522,9 @@ void ConvertColor(aiColor4D& out, const IfcColourRgb& in)
}
// ------------------------------------------------------------------------------------------------
void ConvertColor(aiColor4D& out, const IfcColourOrFactor& in,ConversionData& conv,const aiColor4D* base)
void ConvertColor(aiColor4D& out, const Schema_2x3::IfcColourOrFactor& in,ConversionData& conv,const aiColor4D* base)
{
if (const EXPRESS::REAL* const r = in.ToPtr<EXPRESS::REAL>()) {
if (const ::Assimp::STEP::EXPRESS::REAL* const r = in.ToPtr<::Assimp::STEP::EXPRESS::REAL>()) {
out.r = out.g = out.b = static_cast<float>(*r);
if(base) {
out.r *= static_cast<float>( base->r );
@ -536,7 +534,7 @@ void ConvertColor(aiColor4D& out, const IfcColourOrFactor& in,ConversionData& co
}
else out.a = 1.0;
}
else if (const IfcColourRgb* const rgb = in.ResolveSelectPtr<IfcColourRgb>(conv.db)) {
else if (const Schema_2x3::IfcColourRgb* const rgb = in.ResolveSelectPtr<Schema_2x3::IfcColourRgb>(conv.db)) {
ConvertColor(out,*rgb);
}
else {
@ -545,7 +543,7 @@ void ConvertColor(aiColor4D& out, const IfcColourOrFactor& in,ConversionData& co
}
// ------------------------------------------------------------------------------------------------
void ConvertCartesianPoint(IfcVector3& out, const IfcCartesianPoint& in)
void ConvertCartesianPoint(IfcVector3& out, const Schema_2x3::IfcCartesianPoint& in)
{
out = IfcVector3();
for(size_t i = 0; i < in.Coordinates.size(); ++i) {
@ -554,14 +552,14 @@ void ConvertCartesianPoint(IfcVector3& out, const IfcCartesianPoint& in)
}
// ------------------------------------------------------------------------------------------------
void ConvertVector(IfcVector3& out, const IfcVector& in)
void ConvertVector(IfcVector3& out, const Schema_2x3::IfcVector& in)
{
ConvertDirection(out,in.Orientation);
out *= in.Magnitude;
}
// ------------------------------------------------------------------------------------------------
void ConvertDirection(IfcVector3& out, const IfcDirection& in)
void ConvertDirection(IfcVector3& out, const Schema_2x3::IfcDirection& in)
{
out = IfcVector3();
for(size_t i = 0; i < in.DirectionRatios.size(); ++i) {
@ -592,7 +590,7 @@ void AssignMatrixAxes(IfcMatrix4& out, const IfcVector3& x, const IfcVector3& y,
}
// ------------------------------------------------------------------------------------------------
void ConvertAxisPlacement(IfcMatrix4& out, const IfcAxis2Placement3D& in)
void ConvertAxisPlacement(IfcMatrix4& out, const Schema_2x3::IfcAxis2Placement3D& in)
{
IfcVector3 loc;
ConvertCartesianPoint(loc,in.Location);
@ -617,7 +615,7 @@ void ConvertAxisPlacement(IfcMatrix4& out, const IfcAxis2Placement3D& in)
}
// ------------------------------------------------------------------------------------------------
void ConvertAxisPlacement(IfcMatrix4& out, const IfcAxis2Placement2D& in)
void ConvertAxisPlacement(IfcMatrix4& out, const Schema_2x3::IfcAxis2Placement2D& in)
{
IfcVector3 loc;
ConvertCartesianPoint(loc,in.Location);
@ -634,7 +632,7 @@ void ConvertAxisPlacement(IfcMatrix4& out, const IfcAxis2Placement2D& in)
}
// ------------------------------------------------------------------------------------------------
void ConvertAxisPlacement(IfcVector3& axis, IfcVector3& pos, const IfcAxis1Placement& in)
void ConvertAxisPlacement(IfcVector3& axis, IfcVector3& pos, const Schema_2x3::IfcAxis1Placement& in)
{
ConvertCartesianPoint(pos,in.Location);
if (in.Axis) {
@ -646,12 +644,12 @@ void ConvertAxisPlacement(IfcVector3& axis, IfcVector3& pos, const IfcAxis1Place
}
// ------------------------------------------------------------------------------------------------
void ConvertAxisPlacement(IfcMatrix4& out, const IfcAxis2Placement& in, ConversionData& conv)
void ConvertAxisPlacement(IfcMatrix4& out, const Schema_2x3::IfcAxis2Placement& in, ConversionData& conv)
{
if(const IfcAxis2Placement3D* pl3 = in.ResolveSelectPtr<IfcAxis2Placement3D>(conv.db)) {
if(const Schema_2x3::IfcAxis2Placement3D* pl3 = in.ResolveSelectPtr<Schema_2x3::IfcAxis2Placement3D>(conv.db)) {
ConvertAxisPlacement(out,*pl3);
}
else if(const IfcAxis2Placement2D* pl2 = in.ResolveSelectPtr<IfcAxis2Placement2D>(conv.db)) {
else if(const Schema_2x3::IfcAxis2Placement2D* pl2 = in.ResolveSelectPtr<Schema_2x3::IfcAxis2Placement2D>(conv.db)) {
ConvertAxisPlacement(out,*pl2);
}
else {
@ -660,7 +658,7 @@ void ConvertAxisPlacement(IfcMatrix4& out, const IfcAxis2Placement& in, Conversi
}
// ------------------------------------------------------------------------------------------------
void ConvertTransformOperator(IfcMatrix4& out, const IfcCartesianTransformationOperator& op)
void ConvertTransformOperator(IfcMatrix4& out, const Schema_2x3::IfcCartesianTransformationOperator& op)
{
IfcVector3 loc;
ConvertCartesianPoint(loc,op.LocalOrigin);
@ -672,7 +670,7 @@ void ConvertTransformOperator(IfcMatrix4& out, const IfcCartesianTransformationO
if (op.Axis2) {
ConvertDirection(y,*op.Axis2.Get());
}
if (const IfcCartesianTransformationOperator3D* op2 = op.ToPtr<IfcCartesianTransformationOperator3D>()) {
if (const Schema_2x3::IfcCartesianTransformationOperator3D* op2 = op.ToPtr<Schema_2x3::IfcCartesianTransformationOperator3D>()) {
if(op2->Axis3) {
ConvertDirection(z,*op2->Axis3.Get());
}
@ -684,7 +682,7 @@ void ConvertTransformOperator(IfcMatrix4& out, const IfcCartesianTransformationO
IfcVector3 vscale;
if (const IfcCartesianTransformationOperator3DnonUniform* nuni = op.ToPtr<IfcCartesianTransformationOperator3DnonUniform>()) {
if (const Schema_2x3::IfcCartesianTransformationOperator3DnonUniform* nuni = op.ToPtr<Schema_2x3::IfcCartesianTransformationOperator3DnonUniform>()) {
vscale.x = nuni->Scale?op.Scale.Get():1.f;
vscale.y = nuni->Scale2?nuni->Scale2.Get():1.f;
vscale.z = nuni->Scale3?nuni->Scale3.Get():1.f;

View File

@ -46,9 +46,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef INCLUDED_IFCUTIL_H
#define INCLUDED_IFCUTIL_H
#include "IFCReaderGen.h"
#include "IFCReaderGen_2x3.h"
#include "IFCLoader.h"
#include "STEPFile.h"
#include "code/STEPFile.h"
#include <assimp/mesh.h>
#include <assimp/material.h>
@ -71,8 +71,7 @@ namespace IFC {
// Helper for std::for_each to delete all heap-allocated items in a container
// ------------------------------------------------------------------------------------------------
template<typename T>
struct delete_fun
{
struct delete_fun {
void operator()(T* del) {
delete del;
}
@ -83,10 +82,9 @@ struct delete_fun
// ------------------------------------------------------------------------------------------------
// Helper used during mesh construction. Aids at creating aiMesh'es out of relatively few polygons.
// ------------------------------------------------------------------------------------------------
struct TempMesh
{
std::vector<IfcVector3> verts;
std::vector<unsigned int> vertcnt;
struct TempMesh {
std::vector<IfcVector3> mVerts;
std::vector<unsigned int> mVertcnt;
// utilities
aiMesh* ToMesh();
@ -94,30 +92,28 @@ struct TempMesh
void Transform(const IfcMatrix4& mat);
IfcVector3 Center() const;
void Append(const TempMesh& other);
bool IsEmpty() const {
return verts.empty() && vertcnt.empty();
}
bool IsEmpty() const;
void RemoveAdjacentDuplicates();
void RemoveDegenerates();
void FixupFaceOrientation();
static IfcVector3 ComputePolygonNormal(const IfcVector3* vtcs, size_t cnt, bool normalize = true);
IfcVector3 ComputeLastPolygonNormal(bool normalize = true) const;
void ComputePolygonNormals(std::vector<IfcVector3>& normals, bool normalize = true, size_t ofs = 0) const;
void Swap(TempMesh& other);
};
inline
bool TempMesh::IsEmpty() const {
return mVerts.empty() && mVertcnt.empty();
}
// ------------------------------------------------------------------------------------------------
// Temporary representation of an opening in a wall or a floor
// ------------------------------------------------------------------------------------------------
struct TempOpening
{
const IFC::IfcSolidModel* solid;
const IFC::Schema_2x3::IfcSolidModel *solid;
IfcVector3 extrusionDir;
std::shared_ptr<TempMesh> profileMesh;
@ -139,7 +135,7 @@ struct TempOpening
}
// ------------------------------------------------------------------------------
TempOpening(const IFC::IfcSolidModel* solid,IfcVector3 extrusionDir,
TempOpening(const IFC::Schema_2x3::IfcSolidModel* solid,IfcVector3 extrusionDir,
std::shared_ptr<TempMesh> profileMesh,
std::shared_ptr<TempMesh> profileMesh2D)
: solid(solid)
@ -174,7 +170,7 @@ struct TempOpening
// ------------------------------------------------------------------------------------------------
struct ConversionData
{
ConversionData(const STEP::DB& db, const IFC::IfcProject& proj, aiScene* out,const IFCImporter::Settings& settings)
ConversionData(const STEP::DB& db, const IFC::Schema_2x3::IfcProject& proj, aiScene* out,const IFCImporter::Settings& settings)
: len_scale(1.0)
, angle_scale(-1.0)
, db(db)
@ -194,7 +190,7 @@ struct ConversionData
bool plane_angle_in_radians;
const STEP::DB& db;
const IFC::IfcProject& proj;
const IFC::Schema_2x3::IfcProject& proj;
aiScene* out;
IfcMatrix4 wcs;
@ -202,16 +198,16 @@ struct ConversionData
std::vector<aiMaterial*> materials;
struct MeshCacheIndex {
const IFC::IfcRepresentationItem* item; unsigned int matindex;
const IFC::Schema_2x3::IfcRepresentationItem* item; unsigned int matindex;
MeshCacheIndex() : item(NULL), matindex(0) { }
MeshCacheIndex(const IFC::IfcRepresentationItem* i, unsigned int mi) : item(i), matindex(mi) { }
MeshCacheIndex(const IFC::Schema_2x3::IfcRepresentationItem* i, unsigned int mi) : item(i), matindex(mi) { }
bool operator == (const MeshCacheIndex& o) const { return item == o.item && matindex == o.matindex; }
bool operator < (const MeshCacheIndex& o) const { return item < o.item || (item == o.item && matindex < o.matindex); }
};
typedef std::map<MeshCacheIndex, std::vector<unsigned int> > MeshCache;
MeshCache cached_meshes;
typedef std::map<const IFC::IfcSurfaceStyle*, unsigned int> MaterialCache;
typedef std::map<const IFC::Schema_2x3::IfcSurfaceStyle*, unsigned int> MaterialCache;
MaterialCache cached_materials;
const IFCImporter::Settings& settings;
@ -260,50 +256,50 @@ struct XYSorter {
// conversion routines for common IFC entities, implemented in IFCUtil.cpp
void ConvertColor(aiColor4D& out, const IfcColourRgb& in);
void ConvertColor(aiColor4D& out, const IfcColourOrFactor& in,ConversionData& conv,const aiColor4D* base);
void ConvertCartesianPoint(IfcVector3& out, const IfcCartesianPoint& in);
void ConvertDirection(IfcVector3& out, const IfcDirection& in);
void ConvertVector(IfcVector3& out, const IfcVector& in);
void ConvertColor(aiColor4D& out, const Schema_2x3::IfcColourRgb& in);
void ConvertColor(aiColor4D& out, const Schema_2x3::IfcColourOrFactor& in,ConversionData& conv,const aiColor4D* base);
void ConvertCartesianPoint(IfcVector3& out, const Schema_2x3::IfcCartesianPoint& in);
void ConvertDirection(IfcVector3& out, const Schema_2x3::IfcDirection& in);
void ConvertVector(IfcVector3& out, const Schema_2x3::IfcVector& in);
void AssignMatrixAxes(IfcMatrix4& out, const IfcVector3& x, const IfcVector3& y, const IfcVector3& z);
void ConvertAxisPlacement(IfcMatrix4& out, const IfcAxis2Placement3D& in);
void ConvertAxisPlacement(IfcMatrix4& out, const IfcAxis2Placement2D& in);
void ConvertAxisPlacement(IfcVector3& axis, IfcVector3& pos, const IFC::IfcAxis1Placement& in);
void ConvertAxisPlacement(IfcMatrix4& out, const IfcAxis2Placement& in, ConversionData& conv);
void ConvertTransformOperator(IfcMatrix4& out, const IfcCartesianTransformationOperator& op);
bool IsTrue(const EXPRESS::BOOLEAN& in);
void ConvertAxisPlacement(IfcMatrix4& out, const Schema_2x3::IfcAxis2Placement3D& in);
void ConvertAxisPlacement(IfcMatrix4& out, const Schema_2x3::IfcAxis2Placement2D& in);
void ConvertAxisPlacement(IfcVector3& axis, IfcVector3& pos, const IFC::Schema_2x3::IfcAxis1Placement& in);
void ConvertAxisPlacement(IfcMatrix4& out, const Schema_2x3::IfcAxis2Placement& in, ConversionData& conv);
void ConvertTransformOperator(IfcMatrix4& out, const Schema_2x3::IfcCartesianTransformationOperator& op);
bool IsTrue(const Assimp::STEP::EXPRESS::BOOLEAN& in);
IfcFloat ConvertSIPrefix(const std::string& prefix);
// IFCProfile.cpp
bool ProcessProfile(const IfcProfileDef& prof, TempMesh& meshout, ConversionData& conv);
bool ProcessCurve(const IfcCurve& curve, TempMesh& meshout, ConversionData& conv);
bool ProcessProfile(const Schema_2x3::IfcProfileDef& prof, TempMesh& meshout, ConversionData& conv);
bool ProcessCurve(const Schema_2x3::IfcCurve& curve, TempMesh& meshout, ConversionData& conv);
// IFCMaterial.cpp
unsigned int ProcessMaterials(uint64_t id, unsigned int prevMatId, ConversionData& conv, bool forceDefaultMat);
// IFCGeometry.cpp
IfcMatrix3 DerivePlaneCoordinateSpace(const TempMesh& curmesh, bool& ok, IfcVector3& norOut);
bool ProcessRepresentationItem(const IfcRepresentationItem& item, unsigned int matid, std::vector<unsigned int>& mesh_indices, ConversionData& conv);
bool ProcessRepresentationItem(const Schema_2x3::IfcRepresentationItem& item, unsigned int matid, std::vector<unsigned int>& mesh_indices, ConversionData& conv);
void AssignAddedMeshes(std::vector<unsigned int>& mesh_indices,aiNode* nd,ConversionData& /*conv*/);
void ProcessSweptAreaSolid(const IfcSweptAreaSolid& swept, TempMesh& meshout,
void ProcessSweptAreaSolid(const Schema_2x3::IfcSweptAreaSolid& swept, TempMesh& meshout,
ConversionData& conv);
void ProcessExtrudedAreaSolid(const IfcExtrudedAreaSolid& solid, TempMesh& result,
void ProcessExtrudedAreaSolid(const Schema_2x3::IfcExtrudedAreaSolid& solid, TempMesh& result,
ConversionData& conv, bool collect_openings);
// IFCBoolean.cpp
void ProcessBoolean(const IfcBooleanResult& boolean, TempMesh& result, ConversionData& conv);
void ProcessBooleanHalfSpaceDifference(const IfcHalfSpaceSolid* hs, TempMesh& result,
void ProcessBoolean(const Schema_2x3::IfcBooleanResult& boolean, TempMesh& result, ConversionData& conv);
void ProcessBooleanHalfSpaceDifference(const Schema_2x3::IfcHalfSpaceSolid* hs, TempMesh& result,
const TempMesh& first_operand,
ConversionData& conv);
void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBoundedHalfSpace* hs, TempMesh& result,
void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const Schema_2x3::IfcPolygonalBoundedHalfSpace* hs, TempMesh& result,
const TempMesh& first_operand,
ConversionData& conv);
void ProcessBooleanExtrudedAreaSolidDifference(const IfcExtrudedAreaSolid* as, TempMesh& result,
void ProcessBooleanExtrudedAreaSolidDifference(const Schema_2x3::IfcExtrudedAreaSolid* as, TempMesh& result,
const TempMesh& first_operand,
ConversionData& conv);
@ -324,38 +320,31 @@ bool GenerateOpenings(std::vector<TempOpening>& openings,
// ------------------------------------------------------------------------------------------------
// Custom exception for use by members of the Curve class
// ------------------------------------------------------------------------------------------------
class CurveError
{
class CurveError {
public:
CurveError(const std::string& s)
: s(s)
{
: mStr(s) {
// empty
}
std::string s;
std::string mStr;
};
// ------------------------------------------------------------------------------------------------
// Temporary representation for an arbitrary sub-class of IfcCurve. Used to sample the curves
// to obtain a list of line segments.
// ------------------------------------------------------------------------------------------------
class Curve
{
class Curve {
protected:
Curve(const IfcCurve& base_entity, ConversionData& conv)
: base_entity(base_entity)
, conv(conv)
{}
Curve(const Schema_2x3::IfcCurve& base_entity, ConversionData& conv)
: base_entity(base_entity)
, conv(conv) {
// empty
}
public:
typedef std::pair<IfcFloat, IfcFloat> ParamRange;
public:
virtual ~Curve() {}
@ -386,14 +375,10 @@ public:
// check if a particular parameter value lies within the well-defined range
bool InRange(IfcFloat) const;
#endif
public:
static Curve* Convert(const IFC::IfcCurve&,ConversionData& conv);
static Curve* Convert(const IFC::Schema_2x3::IfcCurve&,ConversionData& conv);
protected:
const IfcCurve& base_entity;
const Schema_2x3::IfcCurve& base_entity;
ConversionData& conv;
};
@ -402,11 +387,9 @@ protected:
// A BoundedCurve always holds the invariant that GetParametricRange()
// never returns infinite values.
// --------------------------------------------------------------------------------
class BoundedCurve : public Curve
{
class BoundedCurve : public Curve {
public:
BoundedCurve(const IfcBoundedCurve& entity, ConversionData& conv)
BoundedCurve(const Schema_2x3::IfcBoundedCurve& entity, ConversionData& conv)
: Curve(entity,conv)
{}
@ -422,7 +405,7 @@ public:
};
// IfcProfile.cpp
bool ProcessCurve(const IfcCurve& curve, TempMesh& meshout, ConversionData& conv);
bool ProcessCurve(const Schema_2x3::IfcCurve& curve, TempMesh& meshout, ConversionData& conv);
}
}

View File

@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @brief STEP character handling, string un-escaping
*/
#include "STEPFileEncoding.h"
#include "fast_atof.h"
#include "code/fast_atof.h"
#include <contrib/utf8cpp/source/utf8.h>
#include <memory>

View File

@ -46,8 +46,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "STEPFileReader.h"
#include "STEPFileEncoding.h"
#include "TinyFormatter.h"
#include "fast_atof.h"
#include "code/TinyFormatter.h"
#include "code/fast_atof.h"
#include <memory>

View File

@ -42,7 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef INCLUDED_AI_STEPFILEREADER_H
#define INCLUDED_AI_STEPFILEREADER_H
#include "STEPFile.h"
#include "code/STEPFile.h"
namespace Assimp {
namespace STEP {

View File

@ -169,7 +169,7 @@ corresponding preprocessor flag to selectively disable formats.
# include "NDOLoader.h"
#endif
#ifndef ASSIMP_BUILD_NO_IFC_IMPORTER
# include "IFCLoader.h"
# include "Importer/IFC/IFCLoader.h"
#endif
#ifndef ASSIMP_BUILD_NO_XGL_IMPORTER
# include "XGLLoader.h"

View File

@ -51,12 +51,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace Assimp {
template <class TDeriving>
class LogFunctions
{
template<class TDeriving>
class LogFunctions {
public:
// ------------------------------------------------------------------------------------------------
static void ThrowException(const std::string& msg)
{

View File

@ -364,17 +364,16 @@ namespace STEP {
// -------------------------------------------------------------------------------
class ConversionSchema
{
public:
struct SchemaEntry {
SchemaEntry(const char* name,ConvertObjectProc func)
: name(name)
, func(func)
{}
SchemaEntry( const char *name, ConvertObjectProc func )
: mName( name )
, mFunc(func) {
// empty
}
const char* name;
ConvertObjectProc func;
const char* mName;
ConvertObjectProc mFunc;
};
typedef std::map<std::string,ConvertObjectProc> ConverterMap;
@ -410,7 +409,7 @@ namespace STEP {
const ConversionSchema& operator=( const SchemaEntry (& schemas)[N]) {
for(size_t i = 0; i < N; ++i ) {
const SchemaEntry& schema = schemas[i];
converters[schema.name] = schema.func;
converters[schema.mName] = schema.mFunc;
}
return *this;
}

View File

@ -584,7 +584,7 @@ namespace glTF2 {
if (bodyBuffer->byteLength > 0) {
rapidjson::Value glbBodyBuffer;
glbBodyBuffer.SetObject();
glbBodyBuffer.AddMember("byteLength", bodyBuffer->byteLength, mAl);
glbBodyBuffer.AddMember("byteLength", static_cast<uint64_t>(bodyBuffer->byteLength), mAl);
mDoc["buffers"].PushBack(glbBodyBuffer, mAl);
}

137
doc/dox.h
View File

@ -561,17 +561,27 @@ The output UV coordinate system has its origin in the lower-left corner:
@endcode
Use the #aiProcess_FlipUVs flag to get UV coordinates with the upper-left corner als origin.
All matrices in the library are row-major. That means that the matrices are stored row by row in memory,
which is similar to the OpenGL matrix layout. A typical 4x4 matrix including a translational part looks like this:
A typical 4x4 matrix including a translational part looks like this:
@code
X1 Y1 Z1 T1
X2 Y2 Z2 T2
X3 Y3 Z3 T3
0 0 0 1
0 0 0 1
@endcode
with (X1, X2, X3) being the X base vector, (Y1, Y2, Y3) being the Y base vector, (Z1, Z2, Z3)
being the Z base vector and (T1, T2, T3) being the translation part. If you want to use these matrices
in DirectX functions, you have to transpose them.
with <tt>(X1, X2, X3)</tt> being the local X base vector, <tt>(Y1, Y2, Y3)</tt> being the local
Y base vector, <tt>(Z1, Z2, Z3)</tt> being the local Z base vector and <tt>(T1, T2, T3)</tt> being the
offset of the local origin (the translational part).
All matrices in the library use row-major storage order. That means that the matrix elements are
stored row-by-row, i.e. they end up like this in memory:
<tt>[X1, Y1, Z1, T1, X2, Y2, Z2, T2, X3, Y3, Z3, T3, 0, 0, 0, 1]</tt>.
Note that this is neither the OpenGL format nor the DirectX format, because both of them specify the
matrix layout such that the translational part occupies three consecutive addresses in memory (so those
matrices end with <tt>[..., T1, T2, T3, 1]</tt>), whereas the translation in an Assimp matrix is found at
the offsets 3, 7 and 11 (spread across the matrix). You can transpose an Assimp matrix to end up with
the format that OpenGL and DirectX mandate. To be very precise: The transposition has nothing
to do with a left-handed or right-handed coordinate system but 'converts' between row-major and
column-major storage format.
<hr>
@ -803,188 +813,203 @@ All material key constants start with 'AI_MATKEY' (it's an ugly macro for histor
<th>Name</th>
<th>Data Type</th>
<th>Default Value</th>
<th>Meaning</th>
<th>Notes</th>
<th>Meaning</th>
<th>Notes</th>
</tr>
<tr>
<td><tt>NAME</tt></td>
<td>aiString</td>
<td>n/a</td>
<td>The name of the material, if available. </td>
<td>Ignored by <tt>aiProcess_RemoveRedundantMaterials</tt>. Materials are considered equal even if their names are different.</td>
<td>The name of the material, if available. </td>
<td>Ignored by <tt>aiProcess_RemoveRedundantMaterials</tt>. Materials are considered equal even if their names are different.</td>
</tr>
<tr>
<td><tt>COLOR_DIFFUSE</tt></td>
<td>aiColor3D</td>
<td>black (0,0,0)</td>
<td>Diffuse color of the material. This is typically scaled by the amount of incoming diffuse light (e.g. using gouraud shading) </td>
<td>---</td>
<td>Diffuse color of the material. This is typically scaled by the amount of incoming diffuse light (e.g. using gouraud shading) </td>
<td>---</td>
</tr>
<tr>
<td><tt>COLOR_SPECULAR</tt></td>
<td>aiColor3D</td>
<td>black (0,0,0)</td>
<td>Specular color of the material. This is typically scaled by the amount of incoming specular light (e.g. using phong shading) </td>
<td>---</td>
<td>Specular color of the material. This is typically scaled by the amount of incoming specular light (e.g. using phong shading) </td>
<td>---</td>
</tr>
<tr>
<td><tt>COLOR_AMBIENT</tt></td>
<td>aiColor3D</td>
<td>black (0,0,0)</td>
<td>Ambient color of the material. This is typically scaled by the amount of ambient light </td>
<td>---</td>
<td>Ambient color of the material. This is typically scaled by the amount of ambient light </td>
<td>---</td>
</tr>
<tr>
<td><tt>COLOR_EMISSIVE</tt></td>
<td>aiColor3D</td>
<td>black (0,0,0)</td>
<td>Emissive color of the material. This is the amount of light emitted by the object. In real time applications it will usually not affect surrounding objects, but raytracing applications may wish to treat emissive objects as light sources. </td>
<td>---</tt></td>
<td>Emissive color of the material. This is the amount of light emitted by the object. In real time applications it will usually not affect surrounding objects, but raytracing applications may wish to treat emissive objects as light sources. </td>
<td>---</td>
</tr>
<tr>
<td><tt>COLOR_TRANSPARENT</tt></td>
<td>aiColor3D</td>
<td>black (0,0,0)</td>
<td>Defines the transparent color of the material, this is the color to be multiplied with the color of
translucent light to construct the final 'destination color' for a particular position in the screen buffer. T </td>
<td>---</tt></td>
<td>Defines the transparent color of the material, this is the color to be multiplied with the color of translucent light to construct the final 'destination color' for a particular position in the screen buffer.</td>
<td>---</td>
</tr>
<tr>
<td><tt>COLOR_REFLECTIVE</tt></td>
<td>aiColor3D</td>
<td>black (0,0,0)</td>
<td>Defines the reflective color of the material. This is typically scaled by the amount of incoming light from the direction of mirror reflection. Usually combined with an enviroment lightmap of some kind for real-time applications.</td>
<td>---</td>
</tr>
<tr>
<td><tt>REFLECTIVITY</tt></td>
<td>float</td>
<td>0.0</td>
<td>Scales the reflective color of the material.</td>
<td>---</td>
</tr>
<tr>
<td><tt>WIREFRAME</tt></td>
<td>int</td>
<td>false</td>
<td>Specifies whether wireframe rendering must be turned on for the material. 0 for false, !0 for true. </td>
<td>---</tt></td>
<td>Specifies whether wireframe rendering must be turned on for the material. 0 for false, !0 for true. </td>
<td>---</td>
</tr>
<tr>
<td><tt>TWOSIDED</tt></td>
<td>int</td>
<td>false</td>
<td>Specifies whether meshes using this material must be rendered without backface culling. 0 for false, !0 for true. </td>
<td>Some importers set this property if they don't know whether the output face oder is right. As long as it is not set, you may safely enable backface culling.</tt></td>
<td>Specifies whether meshes using this material must be rendered without backface culling. 0 for false, !0 for true. </td>
<td>Some importers set this property if they don't know whether the output face oder is right. As long as it is not set, you may safely enable backface culling.</tt></td>
</tr>
<tr>
<td><tt>SHADING_MODEL</tt></td>
<td>int</td>
<td>gouraud</td>
<td>One of the #aiShadingMode enumerated values. Defines the library shading model to use for (real time) rendering to approximate the original look of the material as closely as possible. </td>
<td>The presence of this key might indicate a more complex material. If absent, assume phong shading only if a specular exponent is given.</tt></td>
<td>One of the #aiShadingMode enumerated values. Defines the library shading model to use for (real time) rendering to approximate the original look of the material as closely as possible. </td>
<td>The presence of this key might indicate a more complex material. If absent, assume phong shading only if a specular exponent is given.</tt></td>
</tr>
<tr>
<td><tt>BLEND_FUNC</tt></td>
<td>int</td>
<td>false</td>
<td>One of the #aiBlendMode enumerated values. Defines how the final color value in the screen buffer is computed from the given color at that position and the newly computed color from the material. Simply said, alpha blending settings.</td>
<td>-</td>
<td>One of the #aiBlendMode enumerated values. Defines how the final color value in the screen buffer is computed from the given color at that position and the newly computed color from the material. Simply said, alpha blending settings.</td>
<td>-</td>
</tr>
<tr>
<td><tt>OPACITY</tt></td>
<td>float</td>
<td>1.0</td>
<td>Defines the opacity of the material in a range between 0..1.</td>
<td>Use this value to decide whether you have to activate alpha blending for rendering. <tt>OPACITY</tt> != 1 usually also implies TWOSIDED=1 to avoid cull artifacts.</td>
<td>Defines the opacity of the material in a range between 0..1.</td>
<td>Use this value to decide whether you have to activate alpha blending for rendering. <tt>OPACITY</tt> != 1 usually also implies TWOSIDED=1 to avoid cull artifacts.</td>
</tr>
<tr>
<td><tt>SHININESS</tt></td>
<td>float</td>
<td>0.f</td>
<td>Defines the shininess of a phong-shaded material. This is actually the exponent of the phong specular equation</td>
<td><tt>SHININESS</tt>=0 is equivalent to <tt>SHADING_MODEL</tt>=<tt>aiShadingMode_Gouraud</tt>.</td>
<td>Defines the shininess of a phong-shaded material. This is actually the exponent of the phong specular equation</td>
<td><tt>SHININESS</tt>=0 is equivalent to <tt>SHADING_MODEL</tt>=<tt>aiShadingMode_Gouraud</tt>.</td>
</tr>
<tr>
<td><tt>SHININESS_STRENGTH</tt></td>
<td>float</td>
<td>1.0</td>
<td>Scales the specular color of the material.</td>
<td>This value is kept separate from the specular color by most modelers, and so do we.</td>
<td>Scales the specular color of the material.</td>
<td>This value is kept separate from the specular color by most modelers, and so do we.</td>
</tr>
<tr>
<td><tt>REFRACTI</tt></td>
<td>float</td>
<td>1.0</td>
<td>Defines the Index Of Refraction for the material. That's not supported by most file formats.</td>
<td>Might be of interest for raytracing.</td>
<td>Defines the Index Of Refraction for the material. That's not supported by most file formats.</td>
<td>Might be of interest for raytracing.</td>
</tr>
<tr>
<td><tt>TEXTURE(t,n)</tt></td>
<td>aiString</td>
<td>n/a</td>
<td>Defines the path of the n'th texture on the stack 't', where 'n' is any value >= 0 and 't' is one of the #aiTextureType enumerated values. Either a filepath or `*<index>`, where `<index>` is the index of an embedded texture in aiScene::mTextures.</td>
<td>See the 'Textures' section above.</td>
<td>Defines the path of the n'th texture on the stack 't', where 'n' is any value >= 0 and 't' is one of the #aiTextureType enumerated values. Either a filepath or `*<index>`, where `<index>` is the index of an embedded texture in aiScene::mTextures.</td>
<td>See the 'Textures' section above.</td>
</tr>
<tr>
<td><tt>TEXBLEND(t,n)</tt></td>
<td>float</td>
<td>n/a</td>
<td>Defines the strength the n'th texture on the stack 't'. All color components (rgb) are multiplied with this factor *before* any further processing is done.</td>
<td>-</td>
<td>Defines the strength the n'th texture on the stack 't'. All color components (rgb) are multiplied with this factor *before* any further processing is done.</td>
<td>-</td>
</tr>
<tr>
<td><tt>TEXOP(t,n)</tt></td>
<td>int</td>
<td>n/a</td>
<td>One of the #aiTextureOp enumerated values. Defines the arithmetic operation to be used to combine the n'th texture on the stack 't' with the n-1'th. <tt>TEXOP(t,0)</tt> refers to the blend operation between the base color for this stack (e.g. <tt>COLOR_DIFFUSE</tt> for the diffuse stack) and the first texture.</td>
<td>-</td>
<td>One of the #aiTextureOp enumerated values. Defines the arithmetic operation to be used to combine the n'th texture on the stack 't' with the n-1'th. <tt>TEXOP(t,0)</tt> refers to the blend operation between the base color for this stack (e.g. <tt>COLOR_DIFFUSE</tt> for the diffuse stack) and the first texture.</td>
<td>-</td>
</tr>
<tr>
<td><tt>MAPPING(t,n)</tt></td>
<td>int</td>
<td>n/a</td>
<td>Defines how the input mapping coordinates for sampling the n'th texture on the stack 't' are computed. Usually explicit UV coordinates are provided, but some model file formats might also be using basic shapes, such as spheres or cylinders, to project textures onto meshes.</td>
<td>See the 'Textures' section below. #aiProcess_GenUVCoords can be used to let Assimp compute proper UV coordinates from projective mappings.</td>
<td>Defines how the input mapping coordinates for sampling the n'th texture on the stack 't' are computed. Usually explicit UV coordinates are provided, but some model file formats might also be using basic shapes, such as spheres or cylinders, to project textures onto meshes.</td>
<td>See the 'Textures' section below. #aiProcess_GenUVCoords can be used to let Assimp compute proper UV coordinates from projective mappings.</td>
</tr>
<tr>
<td><tt>UVWSRC(t,n)</tt></td>
<td>int</td>
<td>n/a</td>
<td>Defines the UV channel to be used as input mapping coordinates for sampling the n'th texture on the stack 't'. All meshes assigned to this material share the same UV channel setup</td>
<td>Presence of this key implies <tt>MAPPING(t,n)</tt> to be #aiTextureMapping_UV. See @ref uvwsrc for more details. </td>
<td>Defines the UV channel to be used as input mapping coordinates for sampling the n'th texture on the stack 't'. All meshes assigned to this material share the same UV channel setup</td>
<td>Presence of this key implies <tt>MAPPING(t,n)</tt> to be #aiTextureMapping_UV. See @ref uvwsrc for more details. </td>
</tr>
<tr>
<td><tt>MAPPINGMODE_U(t,n)</tt></td>
<td>int</td>
<td>n/a</td>
<td>Any of the #aiTextureMapMode enumerated values. Defines the texture wrapping mode on the x axis for sampling the n'th texture on the stack 't'. 'Wrapping' occurs whenever UVs lie outside the 0..1 range. </td>
<td>-</td>
<td>Any of the #aiTextureMapMode enumerated values. Defines the texture wrapping mode on the x axis for sampling the n'th texture on the stack 't'. 'Wrapping' occurs whenever UVs lie outside the 0..1 range. </td>
<td>-</td>
</tr>
<tr>
<td><tt>MAPPINGMODE_V(t,n)</tt></td>
<td>int</td>
<td>n/a</td>
<td>Wrap mode on the v axis. See <tt>MAPPINGMODE_U</tt>. </td>
<td>-</td>
<td>Wrap mode on the v axis. See <tt>MAPPINGMODE_U</tt>. </td>
<td>-</td>
</tr>
<tr>
<td><tt>TEXMAP_AXIS(t,n)</tt></td>
<td>aiVector3D</td>
<td>n/a</td>
<td></tt> Defines the base axis to to compute the mapping coordinates for the n'th texture on the stack 't' from. This is not required for UV-mapped textures. For instance, if <tt>MAPPING(t,n)</tt> is #aiTextureMapping_SPHERE, U and V would map to longitude and latitude of a sphere around the given axis. The axis is given in local mesh space.</td>
<td>-</td>
<td></tt> Defines the base axis to to compute the mapping coordinates for the n'th texture on the stack 't' from. This is not required for UV-mapped textures. For instance, if <tt>MAPPING(t,n)</tt> is #aiTextureMapping_SPHERE, U and V would map to longitude and latitude of a sphere around the given axis. The axis is given in local mesh space.</td>
<td>-</td>
</tr>
<tr>
<td><tt>TEXFLAGS(t,n)</tt></td>
<td>int</td>
<td>n/a</td>
<td></tt> Defines miscellaneous flag for the n'th texture on the stack 't'. This is a bitwise combination of the #aiTextureFlags enumerated values.</td>
<td>-</td>
<td></tt> Defines miscellaneous flag for the n'th texture on the stack 't'. This is a bitwise combination of the #aiTextureFlags enumerated values.</td>
<td>-</td>
</tr>
</table>
@ -1075,7 +1100,7 @@ for all textures
assign channel specified in uvwsrc
else
assign channels in ascending order for all texture stacks,
i.e. diffuse1 gets channel 1, opacity0 gets channel 0.
i.e. diffuse1 gets channel 1, opacity0 gets channel 0.
@endverbatim

View File

@ -0,0 +1,96 @@
#!/usr/bin/env python
# -*- Coding: UTF-8 -*-
# ---------------------------------------------------------------------------
# Open Asset Import Library (ASSIMP)
# ---------------------------------------------------------------------------
#
# Copyright (c) 2006-2010, ASSIMP Development Team
#
# All rights reserved.
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
# conditions are met:
#
# * Redistributions of source code must retain the above
# copyright notice, this list of conditions and the
# following disclaimer.
#
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the
# following disclaimer in the documentation and/or other
# materials provided with the distribution.
#
# * Neither the name of the ASSIMP team, nor the names of its
# contributors may be used to endorse or promote products
# derived from this software without specific prior
# written permission of the ASSIMP Development Team.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ---------------------------------------------------------------------------
"""Update PyAssimp's texture type constants C/C++ headers.
This script is meant to be executed in the source tree, directly from
port/PyAssimp/gen
"""
import os
import re
REenumTextureType = re.compile(r''
r'enum\saiTextureType' # enum aiTextureType
r'[^{]*?\{' # {
r'(?P<code>.*?)' # code
r'\};' # };
, re.IGNORECASE + re.DOTALL + re.MULTILINE)
# Replace comments
RErpcom = re.compile(r''
r'\s*(/\*+\s|\*+/|\B\*\s?|///?!?)' # /**
r'(?P<line>.*?)' # * line
, re.IGNORECASE + re.DOTALL)
# Remove trailing commas
RErmtrailcom = re.compile(r',$', re.IGNORECASE + re.DOTALL)
# Remove #ifdef __cplusplus
RErmifdef = re.compile(r''
r'#ifndef SWIG' # #ifndef SWIG
r'(?P<code>.*)' # code
r'#endif(\s*//\s*!?\s*SWIG)*' # #endif
, re.IGNORECASE + re.DOTALL)
path = '../../../include/assimp'
files = os.listdir (path)
enumText = ''
for fileName in files:
if fileName.endswith('.h'):
text = open(os.path.join(path, fileName)).read()
for enum in REenumTextureType.findall(text):
enumText = enum
text = ''
for line in enumText.split('\n'):
line = line.lstrip().rstrip()
line = RErmtrailcom.sub('', line)
text += RErpcom.sub('# \g<line>', line) + '\n'
text = RErmifdef.sub('', text)
file = open('material.py', 'w')
file.write(text)
file.close()
print("Generation done. You can now review the file 'material.py' and merge it.")

View File

@ -1,89 +1,89 @@
## <hr>Dummy value.
# Dummy value.
#
# No texture, but the value to be used as 'texture semantic'
# (#aiMaterialProperty::mSemantic) for all material properties
# *not* related to textures.
# No texture, but the value to be used as 'texture semantic'
# (#aiMaterialProperty::mSemantic) for all material properties
# # not* related to textures.
#
aiTextureType_NONE = 0x0
## <hr>The texture is combined with the result of the diffuse
# lighting equation.
# The texture is combined with the result of the diffuse
# lighting equation.
#
aiTextureType_DIFFUSE = 0x1
## <hr>The texture is combined with the result of the specular
# lighting equation.
# The texture is combined with the result of the specular
# lighting equation.
#
aiTextureType_SPECULAR = 0x2
## <hr>The texture is combined with the result of the ambient
# lighting equation.
# The texture is combined with the result of the ambient
# lighting equation.
#
aiTextureType_AMBIENT = 0x3
## <hr>The texture is added to the result of the lighting
# calculation. It isn't influenced by incoming light.
# The texture is added to the result of the lighting
# calculation. It isn't influenced by incoming light.
#
aiTextureType_EMISSIVE = 0x4
## <hr>The texture is a height map.
# The texture is a height map.
#
# By convention, higher gray-scale values stand for
# higher elevations from the base height.
# By convention, higher gray-scale values stand for
# higher elevations from the base height.
#
aiTextureType_HEIGHT = 0x5
## <hr>The texture is a (tangent space) normal-map.
# The texture is a (tangent space) normal-map.
#
# Again, there are several conventions for tangent-space
# normal maps. Assimp does (intentionally) not
# distinguish here.
# Again, there are several conventions for tangent-space
# normal maps. Assimp does (intentionally) not
# distinguish here.
#
aiTextureType_NORMALS = 0x6
## <hr>The texture defines the glossiness of the material.
# The texture defines the glossiness of the material.
#
# The glossiness is in fact the exponent of the specular
# (phong) lighting equation. Usually there is a conversion
# function defined to map the linear color values in the
# texture to a suitable exponent. Have fun.
# The glossiness is in fact the exponent of the specular
# (phong) lighting equation. Usually there is a conversion
# function defined to map the linear color values in the
# texture to a suitable exponent. Have fun.
#
aiTextureType_SHININESS = 0x7
## <hr>The texture defines per-pixel opacity.
# The texture defines per-pixel opacity.
#
# Usually 'white' means opaque and 'black' means
# 'transparency'. Or quite the opposite. Have fun.
# Usually 'white' means opaque and 'black' means
# 'transparency'. Or quite the opposite. Have fun.
#
aiTextureType_OPACITY = 0x8
## <hr>Displacement texture
# Displacement texture
#
# The exact purpose and format is application-dependent.
# Higher color values stand for higher vertex displacements.
# The exact purpose and format is application-dependent.
# Higher color values stand for higher vertex displacements.
#
aiTextureType_DISPLACEMENT = 0x9
## <hr>Lightmap texture (aka Ambient Occlusion)
# Lightmap texture (aka Ambient Occlusion)
#
# Both 'Lightmaps' and dedicated 'ambient occlusion maps' are
# covered by this material property. The texture contains a
# scaling value for the final color value of a pixel. Its
# intensity is not affected by incoming light.
# Both 'Lightmaps' and dedicated 'ambient occlusion maps' are
# covered by this material property. The texture contains a
# scaling value for the final color value of a pixel. Its
# intensity is not affected by incoming light.
#
aiTextureType_LIGHTMAP = 0xA
## <hr>Reflection texture
# Reflection texture
#
#Contains the color of a perfect mirror reflection.
#Rarely used, almost never for real-time applications.
# Contains the color of a perfect mirror reflection.
# Rarely used, almost never for real-time applications.
#
aiTextureType_REFLECTION = 0xB
## <hr>Unknown texture
# Unknown texture
#
# A texture reference that does not match any of the definitions
# above is considered to be 'unknown'. It is still imported
# but is excluded from any further postprocessing.
# A texture reference that does not match any of the definitions
# above is considered to be 'unknown'. It is still imported
# but is excluded from any further postprocessing.
#
aiTextureType_UNKNOWN = 0xC

View File

@ -94,8 +94,9 @@ class Type:
self.enums = enums
def read(filename,silent=False):
def read(filename, silent=False):
schema = Schema()
print( "Try to read EXPRESS schema file" + filename)
with open(filename,'rt') as inp:
contents = inp.read()
types = re.findall(re_match_type,contents)

File diff suppressed because it is too large Load Diff