GithubHelp home page GithubHelp logo

ebrahimraeyat / freecad-blenderbim Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yorikvanhavre/freecad-nativeifc

0.0 1.0 0.0 93 KB

A FreeCAD implementation of BlenderBIM (provisory name, might change!)

License: GNU General Public License v3.0

Python 100.00%

freecad-blenderbim's Introduction

BlenderBIM addon for FreeCAD

This is a preliminary stub to integrate BlenderBIM into FreeCAD. The final goal is to offer in FreeCAD the same level of functionality found in BlenderBIM, mainly the native handling of IFC files, which means the data manipulation in FreeCAD is affecting directly the IFC model.

Roadmap

1. Get a working concept up

  • Write an importer that allows an initial import of an IFC file into FreeCAD
  • Write a custom parametric FreeCAD object that represents an IFC document in the FreeCAD tree
  • Do an initial geometry import
  • Write a custom parametric FreeCAD object that represents in IFC product in the FreeCAD tree
  • Reveal the document structure in the FreeCAD tree
  • Add a shape caching system
  • Allow an object shape to be built automatically from its children
  • Allow to expand a document (reveal its children)

2. Allow basic editing

  • Allow different import strategies (full model, only building structure...)
  • Allow different storage strategies (the shape is transient or not, coin representation only, etc..)
  • Allow to change a parameter of an object
  • Write a hook system that allows FreeCAD to save the IFC document
  • Test what happens when opening a bb file in vanilla FreeCAD

Installation & Usage

Auto install

The advantage of this approach is the ability to update FreeCAD-BlenderBIM workbench via the addon manager.

  • Open the Addon Manager preferences via EditPreferencesAddon ManagerCustom Repositories
  • Add https://github.com/yorikvanhavre/FreeCAD-BlenderBIM to Custom Repositories list. In the Branch section indicate the main branch. Press OK.
  • Start the ToolsAddon Manager which will automatically find FreeCAD-BlenderBIM addon in the workbench list.
  • Install FreeCAD-BlenderBIM addon
  • Restart FreeCAD
    Result: FreeCAD-BlenderBIM IFC importer should be available in open/insert file dialogs

Manual install

  • Navigate to your FreeCAD Mods folder (~/.local/share/FreeCAD/Mods)
  • Clone this repo there: git clone https://github.com/yorikvanhavre/FreeCAD-BlenderBIM.git
  • Restart FreeCAD
    Result: FreeCAD-BlenderBIM IFC importer should be available in open/insert file dialogs

To test

  • Run FreeCAD
  • FileOpen or FileInsert, select an IFC file
  • Select the BlenderBIM importer (bb_import)
  • A FreeCAD document is created
  • An object is created representing the IFC root document + project

Notes

Documentation

Code examples

Initial import + getting the main file structure

import ifcopenshell
f = ifcopenshell.open("IfcOpenHouse.ifc")
p = f.by_type("IfcProject")[0]
# get descendents (site, building, and everything inside)
d = ifcopenshell.util.element.get_decomposition(p)

Using the geometry iterator

import multicore
settings = ifcopenshell.geom.settings()
settings.set(settings.DISABLE_TRIANGULATION, True)
settings.set(settings.USE_BREP_DATA,True)
settings.set(settings.SEW_SHELLS,True)
settings.set(settings.USE_WORLD_COORDS,True)
settings.set(settings.APPLY_LAYERSETS,True)
shapes = []
cores = multiprocessing.cpu_count()-2
iterator = ifcopenshell.geom.iterator(settings, ifcfile, cores, include=entitieslist)
iterator.initialize()
while True:
    item = iterator.get()
    if item:
        ifcproduct = ifcfile.by_id(item.guid)
        brep = item.geometry.brep_data
        shape = Part.Shape()
        shape.importBrepFromString(brep, False)
        shape.scale(1000.0) # IfcOpenShell outputs in meters
        shapes.append(shape)
    if not iterator.next():
        break
compound = Part.makeCompound(shapes)

schependomlaan.ifc of 47Mb imports in 23s

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.