Giter VIP home page Giter VIP logo

ifctool's Introduction

ifctool

Command line tool for working with IFC models. It extracts IFC elements by ID or types (via web-ifc), and exports as JSON or CSV (via json2csv).

Via npx

Use NPX to run ifctool without cloning this repo. Always prefer @latest to avoid npx cacheing issues.

> npx @bldrs-ai/ifctool@latest model.ifc

or run from source:

> node src/main.js model.ifc

Usage

> npx @bldrs-ai/ifctool@latest --help
usage: ifctool <file.ifc>

options:
  --elts=id1[,id2,...]    Print the IFC elements with the given IDs
  --types=t1[,t2,...]     Print the IFC elements of the given types, case insensitive
  --deref                 Dereference complex elements (work in progress)
  --out=json|csv          Print as JSON (default) or CSV.  See https://github.com/buildingSMART/ifcJSON
    --fmt=...             Format CSV, see: https://www.npmjs.com/package/json2csv
  --omitExpressId         Omit expressID
  --omitNull              Omit fields will null values
  --log=[enum =>]         Set log level to one of: {off,error,exception,info,debug,verbose}.
                            default=info
  --version               Print the version of this tool, same as in package.json.
  --help                  Print these usage instructions.

Version: ifctool 5.0.1

# Processing

The tool uses web-ifc to extract data from the IFC.
See https://github.com/tomvandig/web-ifc


## ifcJSON

The output JSON is the result of JSON.stringify, with post-processing
to coerce web-ifc's object representation to ifcJSON.  This is a Work
in Progress.


# Examples

Print the root element of the model in JSON:

  node src/main.js model.ifc

with dereferncing and output as CSV

  node src/main.js model.ifc --deref --out=csv

with custom formatting

  node src/main.js model.ifc --types=IFCWALL,IFCWINDOW --out=csv \
    --fmt='["expressID","OverallWidth","OverallHeight"]'

e.g. with the included index.ifc:

> node src/main.js index.ifc --elts=5 --deref --omitNull
{
  "type": "ifcJSON",
  "version": "0.0.1",
  "originatingSystem": "IFC2JSON_js 3.0.2",
  "preprocessorVersion": "web-ifc 0.0.34",
  "time": "2022-06-25T15:38:56.359Z",
  "data": [
    {
      "expressID": 5,
      "type": "IFCTELECOMADDRESS",
      "Purpose": "USERDEFINED",
      "UserDefinedPurpose": "Phone",
      "TelephoneNumbers": [
        "+00 11 101 10 10"
      ],
      "WWWHomePageURL": "http://bldrs.ai"
    }
  ]
}
> node src/main.js src/testdata/IFC_2x3/7m900_tue_hello_wall_with_door.ifc --types=IFCDOOR --out=csv --deref --fmt='["OverallHeight","OverallWidth"]'
"OverallHeight","OverallWidth"
1.4,0.7000000000000001

Versions

Following semver, backwards-incompatible API changes use a new major version number.

  • 5.x: Full extract now includes PropertySets.
  • 4.x: Full extract now includes all top-level elts with globalIds. Better arg checking and error logging.
  • 3.x: JSON output now includes header section, towards ifcJSON compliance.
  • 2.x: Flag changes: no more --elt. Instead --elts and --types now support lists
  • 1.x: Let's see how web-ifc's JSON looks!

ifctool's People

Contributors

pablo-mayrgundter avatar mkeshavarzi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.