void IfcHierarchyHelper::setSurfaceColour(IfcSchema::IfcRepresentation* rep, 
	IfcSchema::IfcPresentationStyleAssignment* style_assignment) 
{
#ifdef USE_IFC4 
	IfcEntityList::ptr style_assignments (new IfcEntityList);
#else
	IfcSchema::IfcPresentationStyleAssignment::list::ptr style_assignments (new IfcSchema::IfcPresentationStyleAssignment::list);
#endif
	style_assignments->push(style_assignment);
	IfcSchema::IfcRepresentationItem::list::ptr items = rep->Items();
	for (IfcSchema::IfcRepresentationItem::list::it i = items->begin(); i != items->end(); ++i) {
		IfcSchema::IfcRepresentationItem* item = *i;
		IfcSchema::IfcStyledItem* styled_item = new IfcSchema::IfcStyledItem(item, style_assignments, boost::none);
		addEntity(styled_item);
	}
}
Exemple #2
0
bool IfcGeom::Kernel::convert(const IfcSchema::IfcRepresentation* l, IfcRepresentationShapeItems& shapes) {
    IfcSchema::IfcRepresentationItem::list::ptr items = l->Items();
    bool part_succes = false;
    if ( items->size() ) {
        for ( IfcSchema::IfcRepresentationItem::list::it it = items->begin(); it != items->end(); ++ it ) {
            IfcSchema::IfcRepresentationItem* representation_item = *it;
            if ( shape_type(representation_item) == ST_SHAPELIST ) {
                part_succes |= convert_shapes(*it, shapes);
            } else {
                TopoDS_Shape s;
                if (convert_shape(representation_item,s)) {
                    shapes.push_back(IfcRepresentationShapeItem(s, get_style(representation_item)));
                    part_succes |= true;
                }
            }
        }
    }
    return part_succes;
}
void IfcHierarchyHelper::clipRepresentation(IfcSchema::IfcRepresentation* rep, 
	IfcSchema::IfcAxis2Placement3D* place, bool agree) 
{
	if (rep->RepresentationIdentifier() != "Body") return;
	IfcSchema::IfcPlane* plane = new IfcSchema::IfcPlane(place);
	IfcSchema::IfcHalfSpaceSolid* half_space = new IfcSchema::IfcHalfSpaceSolid(plane, agree);
	addEntity(plane);
	addEntity(half_space);
	rep->setRepresentationType("Clipping");		
	IfcSchema::IfcRepresentationItem::list::ptr items = rep->Items();
	IfcSchema::IfcRepresentationItem::list::ptr new_items (new IfcSchema::IfcRepresentationItem::list);
	for (IfcSchema::IfcRepresentationItem::list::it i = items->begin(); i != items->end(); ++i) {
		IfcSchema::IfcRepresentationItem* item = *i;
		IfcSchema::IfcBooleanClippingResult* clip = new IfcSchema::IfcBooleanClippingResult(
			IfcSchema::IfcBooleanOperator::IfcBooleanOperator_DIFFERENCE, item, half_space);
		addEntity(clip);
		new_items->push(clip);
	}
	rep->setItems(new_items);
}