Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
4271d5f
IfcConvert/IfcGeom: Possibility to include and exclude simultaneously…
Stinkfist0 Dec 16, 2016
2a32c69
Filtering by entity GUID and layer name w.i.p.
Stinkfist0 Feb 2, 2017
2e229c3
Implement filtering created geometry by layer assignments.
Stinkfist0 Feb 3, 2017
c9d541c
Refactoring and cleaning up geom iterator filtering.
Stinkfist0 Feb 3, 2017
8367283
Generalize IfcGeom::Iterator filtering and move make the filter speci…
Stinkfist0 Feb 7, 2017
e0f94eb
IfcConvert: change syntax of --<include|exclude>=<names|guids> to --<…
Stinkfist0 Feb 16, 2017
b48b2d5
support for IfcConvert -include=arg <Description|Tag> (for IfcElement…
Stinkfist0 Feb 16, 2017
426a27a
Refactor template class arg_filter into string_arg_filter instead, su…
Stinkfist0 Feb 17, 2017
e124f6d
Cleaning up geom filters.
Stinkfist0 Feb 20, 2017
9ca9310
IfcConvert: output regular prints to cout instead of cerr.
Stinkfist0 Feb 21, 2017
bcd4ae8
IfcConvert: minor cleanup + fix guid exclusion filter's value populat…
Stinkfist0 Feb 21, 2017
5e1be6a
Fix --exclude=arg when --traverse used also.
Stinkfist0 Feb 21, 2017
6199105
Fix --traverse --exlucde=<entities|layers> + clean up duplicate code.…
Stinkfist0 Feb 22, 2017
b53de4b
Fix errors in rebase merge.
Stinkfist0 Feb 22, 2017
a37fca8
IfcConvert: print information about the used filters.
Stinkfist0 Feb 23, 2017
0a30db2
IfcGeomIterator: use fully qualified symbol for filter_t to fix SWIT …
Stinkfist0 Feb 23, 2017
43305be
string_arg_filter: make sure the argument type is string
Stinkfist0 Feb 24, 2017
5ee2c85
IfcLogger: convenience shorthands Notice(), Warnings() and Error()
Stinkfist0 Feb 24, 2017
0244144
Doc tweaks [ci skip]
Stinkfist0 Feb 24, 2017
702e570
IfcConvert: instead of global --traverse option provide --include+ an…
Stinkfist0 Mar 1, 2017
e09a444
IfcConvert: single point for IFC file parsing and potential parsing e…
Stinkfist0 Mar 2, 2017
14ca901
TokenFunc::asStringRef: protect against null token.
Stinkfist0 Mar 2, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ Prerequisites
-------------
* Git
* CMake (2.6 or newer)
* Windows: [Visual Studio] 2008 or newer with C++ toolset (or [Visual C++ Build Tools]) or [MSYS2] + MinGW
* Windows: [Visual Studio] 2008 or newer (2017 not yet officially supported) with C++ toolset (or [Visual C++ Build Tools]) or [MSYS2] + MinGW
* *nix: GCC 4.7 or newer, or Clang (any version)

Dependencies
-------------
* [Boost](http://www.boost.org/)
* Open Cascade - *optional*, but required for building IfcGeom
([official](http://www.opencascade.org/getocc/download/loadocc/) or [community edition](https://github.com/tpaviot/oce))
* [Open Cascade](http://opencascade.org) - *optional*, but required for building IfcGeom
([official](http://www.opencascade.org/getocc/download/loadocc/), "OCCT", or [community edition](https://github.com/tpaviot/oce), "OCE")
For converting IFC representation items into BRep solids and tesselated meshes
* [ICU](http://site.icu-project.org/) - *optional*
For handling code pages and Unicode in the parser
Expand Down Expand Up @@ -58,6 +58,7 @@ Only) to deploy the headers and binaries into a single location if wanted/needed

Alternatively, one can use the utility batch file(s) to build and install the project easily from the command-line
(installing a project will build it also, if required):

> install-ifcopenshell.bat

#### Using MSYS2 + MinGW
Expand All @@ -84,12 +85,11 @@ meant to be used for a typical IfcOpenShell workspace setup.

$ sudo apt-get install git cmake gcc g++ libboost-all-dev libicu-dev

**2a)** Either use an Open CASCADE package from your operating system's software repository (see http://opencascade.org
for additional information)
**2a)** Either use an OCE package from your operating system's software repository

$ sudo apt-get install liboce-foundation-dev liboce-modeling-dev liboce-ocaf-dev liboce-visualization-dev liboce-ocaf-lite-dev

**2b)** or (if not available, or the latest code is wanted) compile Open CASCADE yourself (note that the build takes a long time):
**2b)** or (if not available, or the latest code is wanted) compile OCE yourself (note that the build takes a long time):

$ sudo apt-get install libftgl-dev libtbb2 libtbb-dev libgl1-mesa-dev libfreetype6-dev
$ git clone https://github.com/tpaviot/oce.git
Expand All @@ -99,6 +99,8 @@ for additional information)
$ make -j
$ sudo make install

**2c)** or obtain and compile OCCT from http://www.opencascade.org/getocc/download/loadocc/

**3)** For building IfcConvert with COLLADA (.dae) support (on by default), OpenCOLLADA is needed:

$ sudo apt-get install libpcre3-dev
Expand Down
1 change: 1 addition & 0 deletions src/ifcconvert/ColladaSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ void ColladaSerializer::ColladaExporter::endDocument() {
geometries.close();
for (std::vector<DeferredObject>::const_iterator it = deferreds.begin(); it != deferreds.end(); ++it) {
const std::string object_name = it->unique_id;
/// @todo redundant information using ID as both ID and Name, maybe omit Name or allow specifying what would be used as the name
scene.add(object_name, object_name, it->representation_id, it->material_references, it->matrix);
}
scene.write();
Expand Down
459 changes: 303 additions & 156 deletions src/ifcconvert/IfcConvert.cpp

Large diffs are not rendered by default.

43 changes: 8 additions & 35 deletions src/ifcconvert/XmlSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,41 +270,14 @@ ptree& descend(IfcObjectDefinition* product, ptree& tree) {
}

if (product->is(Type::IfcProduct)) {
IfcProduct* prod = product->as<IfcProduct>();
if (prod->hasRepresentation()) {
IfcEntityList::ptr r = prod->entity->file->traverse(prod->Representation());

std::map<std::string, IfcPresentationLayerAssignment*> layers;
IfcRepresentation::list::ptr representations = r->as<IfcRepresentation>();
for (IfcRepresentation::list::it it = representations->begin(); it != representations->end(); ++it) {
IfcPresentationLayerAssignment::list::ptr a = (*it)->LayerAssignments();
for (IfcPresentationLayerAssignment::list::it jt = a->begin(); jt != a->end(); ++jt) {
layers[(*jt)->Name()] = *jt;
}
}

IfcRepresentationItem::list::ptr items = r->as<IfcRepresentationItem>();
for (IfcRepresentationItem::list::it it = items->begin(); it != items->end(); ++it) {
IfcPresentationLayerAssignment::list::ptr a = (*it)->
// LayerAssignments renamed from plural to singular, LayerAssignment, so work around that
#ifdef USE_IFC4
LayerAssignment();
#else
LayerAssignments();
#endif
for (IfcPresentationLayerAssignment::list::it jt = a->begin(); jt != a->end(); ++jt) {
layers[(*jt)->Name()] = *jt;
}
}

for (std::map<std::string, IfcPresentationLayerAssignment*>::const_iterator it = layers.begin(); it != layers.end(); ++it) {
// IfcPresentationLayerAssignments don't have GUIDs (only optional Identifier) so use name as the ID.
// Note that the IfcPresentationLayerAssignment passed here doesn't really matter as as_link is true
// for the format_entity_instance() call.
ptree node;
node.put("<xmlattr>.xlink:href", "#" + it->first);
format_entity_instance(it->second, node, child, true);
}
std::map<std::string, IfcPresentationLayerAssignment*> layers = IfcGeom::Kernel::get_layers(product->as<IfcProduct>());
for (std::map<std::string, IfcPresentationLayerAssignment*>::const_iterator it = layers.begin(); it != layers.end(); ++it) {
// IfcPresentationLayerAssignments don't have GUIDs (only optional Identifier) so use name as the ID.
// Note that the IfcPresentationLayerAssignment passed here doesn't really matter as as_link is true
// for the format_entity_instance() call.
ptree node;
node.put("<xmlattr>.xlink:href", "#" + it->first);
format_entity_instance(it->second, node, child, true);
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/ifcgeom/IfcGeom.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,9 @@ class IFC_GEOM_API Kernel {

std::pair<std::string, double> initializeUnits(IfcSchema::IfcUnitAssignment*);

IfcSchema::IfcObjectDefinition* get_decomposing_entity(IfcSchema::IfcProduct*);
static IfcSchema::IfcObjectDefinition* get_decomposing_entity(IfcSchema::IfcProduct*);

static std::map<std::string, IfcSchema::IfcPresentationLayerAssignment*> get_layers(IfcSchema::IfcProduct* prod);

template <typename P>
IfcGeom::BRepElement<P>* create_brep_for_representation_and_product(
Expand Down
13 changes: 10 additions & 3 deletions src/ifcgeom/IfcGeomElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ namespace IfcGeom {
std::string _context;
std::string _unique_id;
Transformation<P> _transformation;
IfcSchema::IfcProduct* product_;
public:
int id() const { return _id; }
int parent_id() const { return _parent_id; }
Expand All @@ -89,8 +90,12 @@ namespace IfcGeom {
const std::string& context() const { return _context; }
const std::string& unique_id() const { return _unique_id; }
const Transformation<P>& transformation() const { return _transformation; }
Element(const ElementSettings& settings, int id, int parent_id, const std::string& name, const std::string& type, const std::string& guid, const std::string& context, const gp_Trsf& trsf)
IfcSchema::IfcProduct* product() const { return product_; }

Element(const ElementSettings& settings, int id, int parent_id, const std::string& name, const std::string& type,
const std::string& guid, const std::string& context, const gp_Trsf& trsf, IfcSchema::IfcProduct *product)
: _id(id), _parent_id(parent_id), _name(name), _type(type), _guid(guid), _context(context), _transformation(settings, trsf)
, product_(product)
{
std::ostringstream oss;
oss << "product-" << IfcParse::IfcGlobalId(guid).formatted();
Expand All @@ -112,8 +117,10 @@ namespace IfcGeom {
public:
const boost::shared_ptr<Representation::BRep>& geometry_pointer() const { return _geometry; }
const Representation::BRep& geometry() const { return *_geometry; }
BRepElement(int id, int parent_id, const std::string& name, const std::string& type, const std::string& guid, const std::string& context, const gp_Trsf& trsf, const boost::shared_ptr<Representation::BRep>& geometry)
: Element<P>(geometry->settings(),id,parent_id,name,type,guid,context,trsf)
BRepElement(int id, int parent_id, const std::string& name, const std::string& type, const std::string& guid,
const std::string& context, const gp_Trsf& trsf, const boost::shared_ptr<Representation::BRep>& geometry,
IfcSchema::IfcProduct* product)
: Element<P>(geometry->settings(),id,parent_id,name,type,guid,context,trsf, product)
, _geometry(geometry)
{}
private:
Expand Down
Loading