And a follow up question... which schema is the most current 4x3 tr1 or 4x3 add1? What's the difference between tr1 and add1?
I've been away from IfcOpenShell for a while and finally have the time to get back to work on generating IFC models for bridges. Which branch should I be using? 0.6, 0.7, 0.8. A lot of my code broke when attempting to build against 0.7. That's ok because it looks like the changes are a big improvement.
Thanks for the clarification. It seems alignment->Nests() would be right because I want to know what is nested inside the alignment. Since alignment->IsNestedBy() is correct, then I'll update my brain. Very interesting about the file. I pulled it from bSI-InfraRoom/IFC-infra-unit-test on github. How do you dump the schema validation errors?
The attached file uses IfcRelNests to relate IfcAlignmentHorizontal and IfcAlignmentVertical to IfcAlignment (this format began with 4x3 rc2). When extracting data from the model, IfcAlignment->Nests() returns an empty container. Here is sample code and the file I'm trying to read. Thanks int main(int argc,char** argv) { // Redirect the output (both progress and log) to stdout Logger::SetOutput(&std::cout, &std::cout); // Parse the IFC file provided in argv[1] IfcParse::IfcFile file(argv[1]); if...
The problem was the express file. It copied to my computer as HTML. Sorry to waste your time - I didn't think to check that. I got a file from bSI and now the code generate is working. For the next step, should I take the Ifc4x3_rc3.h/cpp and other generated files, move them to the IfcParser folder, add them to the VisualStudio project and build?
Thomas - I'm trying to generate parsing code for the IFC4x3 RC3 and RC4 specification. The express_parser.py script is producing errors as shown below. I've copied the EXP file into the ...\express folder so I don't think it's an input\path issue. Any suggestions? I've verified I'm using python 3.9.0 and pyparsing is installed (import pyparsing does not generate errors) PS F:\IfcOpenShell\src\ifcopenshell-python\ifcopenshell\express> python express_parser.py IFC4x3_RC3.exp header implementation schema_class...
Thanks for the feedback. I'll update my application to use the safer code. I thought bSI had a rigorous compliance certification process. I would think it would detect problems like I came across and withhold certification.
I think I found a solution. An IfcParse::IfcInvalidTokenException gets thrown because the IFCLENGTHMEASURE token is expected but it was not provided. So, I can catch the exception and then extract the value "manually". double conversion_factor = -1; try { auto value_component = measure_with_unit->ValueComponent(); //<--- Throws exception here conversion_factor = *(value_component->as<IfcSchema::IfcLengthMeasure>()); } catch (IfcParse::IfcInvalidTokenException& e) { Argument* pArgument = measure_with_unit->get("ValueComponent");...
I found another clue that might be helpful In the attached IFC file, the IFCMEASUREWITHUNIT entry is coded as #15=IFCMEASUREWITHUNIT(3.28083333333333,#16); If I change it to #15=IFCMEASUREWITHUNIT(IFCLENGTHMEASURE(3.28083333333333),#16); the sample program runs fine and I can get the conversion factor. The file was generated from Bentley OpenRoadDesigner so I don't have any say as to how the IfcMeasureWithUnit is coded. Looking for some guidance on how to deal with this situation.
I have an IFC file that defines length with USSurveyFoot unit. When reading the unit definition an unexpected exception is thrown. The exception is thrown when calling ValueComponent() when the data argument is cast to IfcUtil::IfcBaseClass* Line 14790 Ifc4x1.cpp ::Ifc4x1::IfcValue* Ifc4x1::IfcMeasureWithUnit::ValueComponent() const { return (::Ifc4x1::IfcValue*)((IfcUtil::IfcBaseClass*)(*data_->getArgument(0))); } A simplified version of the program is provided below and the IFC file is attached....
What is the lifetime of an IFC entity? It seems there was a change. My application loads an IFC/SPF file with IfcParse::IfcFile that is created on the stack. The application holds an IfcAlignment* pointer beyond the scope of the file object. This was working fine. I did a pull from github and now the IfcAlignment object is deleted when the IfcParse::IfcFile object goes out of scope. I presume the lifetime of all entity object is now tied to the lifetime of the IfcParse::IfcFile object which creates...
I hoping there was a simple command line option. This approach is a bit involved. I was able to accomplish what I needed by changing the IfcParse project properties in visual studio and re-building. It's more direct and easier since I'm just using the parsing tool right now.
Thanks. I found the answer through a different channel. https://github.com/bSI-InfraRoom/IFC-Specification/blob/main/IFC4x3/Sections/Resource%20definition%20data%20schemas/Schemas/IfcGeometricConstraintResource/Entities/IfcAlignmentHorizontalSegment/DocEntity.xml
Is there a build setting or option to use the DLL versions of the C-runtime libraries? The default is to use the static link multithreaded version. To link IfcParse.lib to my project I need to build it using the multithreaded DLL version of the libraries. Thanks
How is curve direction supposed to be specified in IFC4x3rc2? In 4x0 Add 2 TC 1 through 4x3rc1 IfcCircurlarArcSegment2D and IfcTransitionCurveSegment2D have Boolean attributes that specified a radius is CCW. These entities have been depreciated in RC2 in favor of IfcAlignmentHorizontal segment. My guess is the algebraic sign of the radius indicates direction since the data type is IfcLengthMeasure instead of IfcPositiveLengthMeasure, however the information given in 8.7.3.5.1 is silent on the ma...
I've never done a Pull Request before so I look forward to the opportunity to learn something new. I'll get to it this week. My immediate interest is in the low lever C++ parts of IfcOpenShell. I develop a suite of bridge engineering applications (https://github.com/WSDOT/BridgeLink) and want to read and write IfcAlignment and IfcBridge data as my first IFC/BIM project. The IfcOpenShell parser is proving to be a great place to start.
I've found a couple clues that might help diagnose this problem. The crash happens every time a zero length string is written (e.g. std::string("")). If I add the following, the file writes to completion in debug builds file.header().file_name().authorization(" "); and owner_history->OwningUser()->ThePerson()->setGivenName(" "); Note the space. If I use "" instead of " ", crash when streaming the file! In a different program I'm working on, the following code works auto geometric_representation_context...
The more I think about this, it doesn't make sense to return a const object for RepresentationContext(). If the returned object where to be const, you have to copy it before it could be modified. That would change the code from auto contexts = project->RepresentationContexts(); // get the old context contexts->push(geometric_representation_context); // add the new context project->setRepresentationContexts(contexts); // set the context back into the project to const auto contexts = project->RepresentationContexts();...
Looking at the Ifc4x1.h/.cpp and other files, I see that they are generated from a python script that reads EXP files. Where is the python script? How does this process work?
I figured out my problem... I didn't add the geometric representation context to the file. Changing the related code to the following solved the problem auto local_placement = file.addLocalPlacement(); auto geometric_representation_context = new IfcSchema::IfcGeometricRepresentationContext(boost::none, boost::optional<std::string>("Model"), 3, boost::none, local_placement, nullptr); file.addEntity(geometric_representation_context); // ADD THE CONTEXT TO THE FILE!!!! auto contexts = project->RepresentationContexts();...
I made the change as you suggested but it didn't quite work. The resulting STEP code is #7=IFCPROJECT('2fzmEYKPr2AgNIvv20SVFD',$,'IFC Test Project','My first IFC project',$,$,$,(#0),#6); Which is an improvement because IfcProject now references #0 as the representation context. However, there isn't a #0 entry in the file. Somehow the IfcGeometricRepresentationContext isn't recognized. Can you help me out with that? The API is a little counter-intuitive to me. I can call project->hasRepresentationContexts()...
I'm trying to write some C++ code to generate an IFC file with alignment information. I can't seem to create an IfcGeometricRepresentationContext object and relate it to the IfcProjectObject. I've attached 3 files. IfcTest.cpp is the source code. IfcTest.ifc is the generated file. IfcTest_Success.ifc is the generated file that I've edited by hand to add the IfcGeometricRepresentationContext. If I drop IfcTest.ifc into OpenIFCViewer I get an error that the Data context could not be obtained. The IfcTest_Success.ifc...
I downloaded and built code from the version 0.6 branch. In IfcSpfHeader::write, when calling os << file_name().to_String(true), the call gets to IfcEntityInstanceData::toString and crashes after calling ss << attributes_[i].toString(upper) when i = 6. Here is a copy/paste from VisualStudio call stack window: IfcOpenHouse.exe!std::Debug_message(const wchar_t * message, const wchar_t * file, unsigned int line) Line 17 C++ IfcOpenHouse.exe!std::_String_const_iterator<std::_string_val<std::_simple_types<wchar_t>...
Using Visual Studio 2015, x64, I open the IfcOpenShell.sln solution file, set IfcOpenHouse or IfcAdvancedHouse as the Start Up project, and F5 to start debugging. The program crashes with a "string iterator not dereferencable" error. This occurs in the call stack for the stream insertion operation on line 523 of IfcOpenHouse.cpp and line 140 of IfcAdvancedHouse.cpp. Any ideas as to what the problem may be?
I'm very new to IFC and IfcOpenShell. I'm trying to learn how to use IfcOS by creating a program with minimum amount of instructions, with the goal of adding IfcAlignment and IfcBridge data in the future. This is the program I've created but is crashes while writing to the ofstream. Any assistance to get this newbie on the right track is greatly appreciated. #include "stdafx.h" #include "../../IfcOpenShell/_installed-vs2015-x64/include/ifcparse/Ifc4x1.h" #include "../../IfcOpenShell/_installed-vs2015-x64/include/ifcparse/IfcHierarchyHelper.h"...