GithubHelp home page GithubHelp logo

Comments (6)

martin1cerny avatar martin1cerny commented on July 1, 2024

Hi @martin-loucka , creatimg geometry is very complex task. What you need to do is to take the representation of IfcWall and pass it to geometry engine if you want to do it this way. You will also need to consider product placement which has to be applied to the representational geometry. Also mapped items need to be transformed one or more times. All this results in a hierarchy of transformations and possibly repeated geometry representations. At the end - yes, you can do geometry intersection on these objects. I'm not sure what the engine will return for intersection between space and wall because as you said quite rightly yourself it is touching not intersecting. Or the intersection should be a 2D plane in 3D space. Have a look at XbimScene to see how transformations are used.

from xbimgeometry.

mwymwy avatar mwymwy commented on July 1, 2024

Hello.

In fact, what you really need is supposed to already exists in your Ifc files (wall areas touching an ifcSpace) as it is exactly what IfcRelSpaceBoundary are for.

I did something similar few weeks ago. Here is a piece of code that'll show you how to get geometry of boundaries of a space that are linked to a wall.

In hope it may help.

XbimGeometryEngine engine = new XbimGeometryEngine();
foreach (IfcRelSpaceBoundary rel in sp.BoundedBy.Where(r => (r.RelatedBuildingElement is IfcWall)))
{
    IfcWall w = rel.RelatedBuildingElement as IfcWall;
    IfcConnectionSurfaceGeometry geom = rel.ConnectionGeometry as IfcConnectionSurfaceGeometry;

    IfcSurfaceOrFaceSurface surface = geom.SurfaceOnRelatingElement;
    IXbimFace face = null;
    IXbimShell shell = null;
    if (surface is IfcSurfaceOfLinearExtrusion)
    {
        var res = engine.CreateShell(surface as IfcSurfaceOfLinearExtrusion);
        if(res != null) { face = res.Faces?.First; }
    }
    else if(surface is IfcCurveBoundedPlane)
    {
        face = engine.CreateFace(surface as IfcCurveBoundedPlane);
        IfcCurveBoundedPlane pl = surface as IfcCurveBoundedPlane;
        // On replace les coordonnées en dehors du repère local de la courbe pour placer le contour dans le repère de la pièce
        XbimMatrix3D transfPlane = pl.BasisSurface.Position.ToMatrix3D();
        face = face.TransformShallow(transfPlane) as IXbimFace;
    }
    else if (surface is IfcSurface)
    {
        face = engine.CreateFace(surface as IfcSurface);
    }
    else if (surface is IfcFaceSurface)
    {
        face = engine.CreateFace((surface as IfcFaceSurface).FaceSurface);
    }
    else if (surface is IfcFaceBasedSurfaceModel)
    {
        shell = engine.CreateShell((surface as IfcFaceBasedSurfaceModel).FbsmFaces.First);
    }

    if (face != null) 
    { 
        // Congrats ! you got a face between a space and a wall
    }
    else if (shell != null)
    {
        foreach (var f in shell.Faces)
        {
            // Congrats ! you got a face between a space and a wall
        }
    }
}

from xbimgeometry.

martin-loucka avatar martin-loucka commented on July 1, 2024

Thank you guys for you answers! The whole xBim team is doing a great job!

I will try to implement it now

from xbimgeometry.

martin-loucka avatar martin-loucka commented on July 1, 2024

Hello mwymwy

The problem is that we are comparing more ifcs from different sources... lets say somebody makes the walls and somebody else model the rooms (IfcSpace) so there is not the room wall link between those files..

This is the reason why I am trying to intersect the walls (IfcWall) and rooms (IfcSpace)

Best Martin

from xbimgeometry.

mwymwy avatar mwymwy commented on July 1, 2024

@martin-loucka
I get the point, indeed without any kind of relation between space and wall it is much more complicated.

It seems weird to me that Spaces may be modeled or designed outside all kind of boundary logic thing :-/

It creates the needs to implement much more heavy geometric algorithms that should not be needed in the first place as all they would do would be the exact inverse thing that was made when defining what space is between what physical limits.

That's kinda using Ifc philosophy of splitting things in different files, against the other Ifc philosophy of keeping things related to each other to answer such needs !

If you succeed at implementing what you need, I'll be really happy to give a little look to know how it's done ;)

from xbimgeometry.

SteveLockley avatar SteveLockley commented on July 1, 2024

Closing as this is an Ifc not an Xbim issue

from xbimgeometry.

Related Issues (20)

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.