Month: February 2014

Testing IFCWebViewer and BIMViewer on iPad !

Click on the picture bellow to watch the video on Youtub
BIMViewer_iPadTesting WebGL on iPad using Chrome + Jailbreak + webglenabler – iOS 7.0.4

New features:

  • Viewing of multiple models
  • Download the property set of selected object as Excel file

Work in progress:

  • Porting the rest of functionalities of the old viewer (IFCWebViewer) to BIMViewer:
    • Layers
    • select/hide by object tpye/name
    • Color customization
    • Simple sections
  • BIM Collaboration Format support
Advertisements

Script: extract and draw 2D floor plans directly from IFC models

Screenshot 2014-02-02 01.06.04

A draft copy of an IFCWebServer script to extract and draw the floor plans as SVG graphic files.

# This script extratcs the 2D plan of each floor and draw it as SVG graphic
# rooms get at moment random colors and the name of room shows as a tooltip
# It works only when the space footprint is modelled as polyline or prametric profile
use "A-PorterRoad.ifc"
IFCRELAGGREGATES.where("o.relatingObject.to_obj.class == IFCBUILDINGSTOREY","o").each { |relation|
  building_storey=relation.relatingObject.to_obj
  HTML.h2 building_storey.name.gsub("'","")
  space_svg = []
  xx=[]
  yy=[]
  relation.relatedObjects.toIfcObject.each { |k,space|
    next if space.class != IFCSPACE
    space.representation.to_obj.representations.toIfcObject.values.each { |space_geometry|
      space_geometry.items.toIfcObject.values.each { |item|
        $svg_style =" style='stroke:black;stroke-width:25;fill:" + HTML.random_color + ";opacity:0.75' "
        x=space.objectPlacement.to_obj.x
        y=space.objectPlacement.to_obj.y
        xx << x
        yy << y
        t = "transform='translate(" + x.to_s + "," + y.to_s + ") '"
        space_svg << item.svg(0.05,t).sub("</g>","<title>" + space.longName.gsub("'","") + "</title></g>")}
    }
  }
  puts "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' viewBox='" + xx.min.to_s + " " + yy.min.to_s
  puts  " " +  (xx.max-xx.min).to_s + " " + (yy.max-yy.min).to_s + "'>"
  puts space_svg.join
  puts "</svg>"
}

This script uses the following server API functions:

  • use
  • where
  • to_obj
  • toIfcObject
  • svg
  • HTML.random_color

Ruby methods:

  • puts : print something
  • Loop :  x.each { |i|  }
  • next if
  • create array: xx=[]
  • add element to the arry: xx<< x
  • join: convert an array to string