ifcquery / ifcplusplus

IfcPlusPlus is an open source C++ class model, as well as a reader and writer for IFC files in STEP format. Features: Easy and efficient memory management using smart pointers. Parallel reader for very fast parsing on multi-core CPU's. Additionally, there's a simple IFC viewer application, using Qt and OpenSceneGraph. It can be used as starting point for all kinds of applications around the open building model standard IFC.
http://www.ifcquery.com
MIT License
588 stars 211 forks source link

Incorrect STEP line for IFCCURVESTYLE(2X3) #60

Open alas2 opened 6 years ago

alas2 commented 6 years ago

In the code below, if ModelOrDraughting is nullptr then should not be exported at all not even $. For instance, for IFC2X3 it doesn't have this value.

void IfcCurveStyle::getStepLine( std::stringstream& stream ) const { stream << "#" << m_id << "= IFCCURVESTYLE" << "("; if( m_Name ) { m_Name->getStepParameter( stream ); } else { stream << "*"; } stream << ","; if( m_CurveFont ) { m_CurveFont->getStepParameter( stream, true ); } else { stream << "$" ; } stream << ","; if( m_CurveWidth ) { m_CurveWidth->getStepParameter( stream, true ); } else { stream << "$" ; } stream << ","; if( m_CurveColour ) { m_CurveColour->getStepParameter( stream, true ); } else { stream << "$" ; } **//////////////////////////// stream << ","; if( m_ModelOrDraughting ) { m_ModelOrDraughting->getStepParameter( stream ); } else { stream << "$"; } stream << ");";

/// Change to

if( m_ModelOrDraughting ) {stream << ","; m_ModelOrDraughting->getStepParameter( stream ); } 

////////////////////**

}

ifcquery commented 6 years ago

The attribute ModelOrDraughting was introduced in IFC4. The IFC version implemented in IFC++ is IFC4, so it is correct to write the attribute. If you want to export in older IFC versions, you need the IFC classes in that version. You can use this tool for that: https://github.com/ifcquery/Express2SourceConverter