TBC Macros and Extensions

 View Only
Expand all | Collapse all

Creating new IFC objects in TBC

  • 1.  Creating new IFC objects in TBC

    Posted 12-22-2021 11:58
    Hi,

    I´m trying to create new IFC objects in TBC and so far I understand, it is not possible but only updating imported IFC objects and when exporting the data scheme needs to be selected and only previously imported IFC objects are exported, is this correct?

    Is there any way to create a new IFC object, no matter if a previous requirement is to import an IFC file to have a data scheme or similar?

    I´ve found several type of functions that could point in this direction to create IFC objects but not sure if this is even possible. At the moment creating IFCMesh objects which basically are at the end of the day Shell3D´s instead of anything related to IFC so a bit confused about that.

    I would appreciate any help on that.

    Thanks a lot.

    Regards,
    Fernando

    ------------------------------
    Fernando Calvo
    calvo@calvo-geospatial.com
    ------------------------------


  • 2.  RE: Creating new IFC objects in TBC

    Posted 02-09-2022 12:30
    Edited by Fernando Calvo 02-09-2022 12:31
    Hi Trimble guys (I mean Trimble employees, no not the 3rd party developers of course),

    is anyone out there checking the threads? almost 2 months later no single answer is a bit frustrating... :-(

    Thanks.

    Regards,
    Fernando

    ------------------------------
    Fernando Calvo
    calvo@calvo-geospatial.com
    ------------------------------



  • 3.  RE: Creating new IFC objects in TBC

    Posted 02-09-2022 14:57
    I can understand your frustration. It's more than 2 years now that the macro language was introduced and is advertised and sold as feature of TBC, but we still have no proper developer documentation like they provide for the Precision SDK. Those few sample macros don't cover all aspects.

    My recent macro question emails to our dealers developer, who is involved in the ANZToolbox, are unanswered. Last year was a discussion in the TBC forum why the ANZToolbox isn't for free and I thought I made a point in their favor, but that lead to a big commotion behind my back, the forum thread disappeared, they even went to our national survey manager who just shook his head (by the way I'm here with my private email address), but nobody ever talked to me personally what the big drama was. And since then this particular person plays dead man to me, my colleagues emails do get answered though. Haven't seen him here on the forum anymore either.
    That's the kind of Kindergarten we have to deal with.

    Already sorry Fernando if this thread is going to disappear as well.

    ------------------------------
    Ronny Schneider
    ------------------------------



  • 4.  RE: Creating new IFC objects in TBC

    Posted 02-09-2022 17:30

    Hi Fernando,

     

    Here's a bit of code that creates a new IFC (it's C# but the calls and types will map directly onto the python macro language).

     
    IFCMesh newShell = worldView.Add<IFCMesh>();
    Point3D[] normals = new Point3D[0];
    var newShellColor = mesh.Color;
    newShell.CreateShell(0, Guid.Empty, verticies.ToArray(), faces.ToArray(), normals, newShellColor);
    newShell.Mode = mesh.Mode;
    newShell.Name = mesh.Name;
    newShell.Description = mesh.Description;
    newShell.Color = newShellColor;

    Let me explain the parameters to the CreateShell method (to the best of my knowledge!)…

    vertices – an array of all the Point3D vertices that make up the object (no particular order)

    faces – an array of integers that describe all of the different faces that make up the IFC. It consists of the number of points for that face, followed by the list of vertex indexes, then repeat… I've only dealt with data that has sets of 3 vertices (triangles) but I assume if there are more than 3 vertices in a face then they have to be co-planar. (I'm pretty sure from memory the indices into the vertices parameter are 0 based btw).

     

    I've always just passed an empty array in for the normals argument. Perhaps this defines the inside versus outside for a each face or something… I'm not sure.

    Hope this helps!



    ------------------------------
    Dylan Towler
    dylan_towler@buildingpoint.com.au
    ------------------------------



  • 5.  RE: Creating new IFC objects in TBC

    Posted 02-10-2022 00:23
    Hi Dylan,

    thanks so much for your answer and details ! really appreciate it!

    I´m using already the IFCMesh, however it´s not creating an IFC object but a 3DMesh instead, so there is no way to assign any property to say i.e. this is a IFCwall object.


    ## create object ((container is usually worldview))
    shell = wv.Add(clr.GetClrType(IFCMesh))
    faceList = Array[int]
    ptPoint1 = Point3D(pt1.Position.X, pt1.Position.Y, pt1.Position.Z)
    ptPoint2 = Point3D(pt2.Position.X, pt2.Position.Y, pt2.Position.Z)
    ptPoint3 = Point3D(pt2.Position.X, pt2.Position.Y, pt2.Position.Z + Double(myHeight))
    ptPoint4 = Point3D(pt1.Position.X, pt1.Position.Y, pt1.Position.Z + Double(myHeight))
    vertexArray = Array[Point3D]([ptPoint1, ptPoint2, ptPoint3, ptPoint4])
    emptyArray = Array[Point3D]([])
    faceList = (4, 0, 1, 2, 3)
    shell.CreateShell(0, self.currentProject.Guid , vertexArray, faceList, emptyArray, Color.LightGray.ToArgb())

    I´m also using the empty array after struggling a lot with different things I tried.

    I´m offering the option in my Buildings plugin to the customer to create 3 different types of 3D objects: Linestring, 3D Face and/or 3D Mesh (actually an IFCMesh but has nothing to do with IFC but just a 3D mesh). The reason why offering 3 different 3D objects is because limitations i.e. in cutting plane views where Linestrings are not shown.


    Coming back to IFC objects, TBC supports IFC schema but does not allow (so far I know) to create new IFC objects inside it. Even if I import an IFC file and then create my own IFCMesh objects, and try to export them to IFC, I get a message that only the imported IFC objects can be exported, so you can simply update attributes of an IFC object but not create new ones which is what I really need.

    I´ve been checking for months the options to export myself to IFC but it´s a huge work to reinvent the wheel, when TBC already support so much of IFC and can import IFC and work with that, therefore obviuously I would like to use the current functionality inside TBC instead of creating my own IFC module.

    Please correct me if I´m wrong and there is a way to export the created IFCMeshes to IFC through any workaround or similar or there is another way to create IFC objects that can be exported to IFC through the TBC exporter.

    Thanks so much again for your support, Dylan!

    Regards,
    Fernando


    ------------------------------
    Fernando Calvo
    calvo@calvo-geospatial.com
    ------------------------------



  • 6.  RE: Creating new IFC objects in TBC

    Posted 02-10-2022 01:22
    Ahhhh I see... sorry I misinterpreted what exactly your problem is.

    This is something we have on our wish list as well! Hopefully Trimble can get onto more extensive IFC support soon.

    ------------------------------
    Dylan Towler
    dylan_towler@buildingpoint.com.au
    ------------------------------



  • 7.  RE: Creating new IFC objects in TBC

    Posted 28 days ago
    Hi,

    does anyone know if there is any improvement in v5.80 regarding IFC access from the SDK to create new IFC objects inside TBC and be able to export them later on?

    Thanks.

    Regards,
    Fernando

    ------------------------------
    Fernando Calvo
    calvo@calvo-geospatial.com
    ------------------------------



  • 8.  RE: Creating new IFC objects in TBC

    Posted 27 days ago
    That would be awesome.

    ------------------------------
    Patrick L'heureux
    ------------------------------