[BlenderBIM] Re-inventing the array modifier in Blender to make it suitable for copying of IFC elem

The array modifier in Blender is really useful for creating brick walls, beam system arrays, stairs etc....
However for example when I want to create a beam system array with IfcBeamType instances, it's ofcourse just copying the meshes in Blender instead of the actual IfcBeamType instances.

Is it possible with a python script to redefined the array modifier in Blender but make it IFC ready?
I can't imagine it being that hard to script, because all it would it just copy paste the IfcElementType instances and add a transformation in the X Y or Z level.....? Or am I completely underestimating this task?

Or does something similar already exist?

Screenshot of what I would like to achieve:

Comments

  • This is on the todo list. It isn't that hard, but since we are adding semantics on top of IFC, we have to decide the best way to do so. So far I'm leaning towards a dumb approach where we simply invent our own array convention and store the data in a pset. This is a simple agnostic approach that can work for any "generated" geometry.

    If you help write a function that 1) defines a clear signature of what settings an array might have (probably inspired by Blender's array modifier, but probably only support absolute offsets), 2) applies those settings to a single "parent" element (e.g. the first beam), and does the necessary copying and matrix transformations, and 3) saves the settings and the GlobalIds of the "children" elements as a dictionary, and 4) loads potentially changed settings, checks against currently tracked children and deletes/adds/moves as necessary then that would be super, super helpful. I can help polish it and integrate it to the rest of the modeling tools and create a UI for it.

    Coen
  • edited October 2022

    @Moult
    That's nice, is it true IfcMappedItem could be then used to store the data in IFC for an array?

    EDIT: I think @brunopostle also looked into this subject for the home-maker add-on?

  • @Coen in theory IfcMappedItem could be used, but I am increasingly against it, and would prefer instancing to only happen for type occurrences. It's just such an unsemantic way of sharing critical geometry data that makes native authoring hard.

    Mapped items used outside types are also perhaps one of the aspects of IFC that almost everybody goes "what why is geometry so hard and overengineered".

    Coen
  • @Coen homemaker does arrays, but with the same kind of 'dumb' approach that @Moult suggests. In IFC the number of ifcbeam elements in the file is the number of beams in the building, this is a fundamental property of the file format that has advantages and disadvantages (it makes generating a bill of quantities really easy, but makes things like repeated identical storeys hard).

    For parametric arrays, all the generated elements need to be included in the file, along with enough stashed information that will allow them to be removed and recreated whenever a parameter (eg spacing) changes.

    Coen
  • @brunopostle Do you have an example of an array in homemaker you can share with us?
    @yorik Do you guys codify arrays into IFC?
    Would be nice to align an approach, one we can perhaps suggest back to BuildingSmart?

  • @theoryshaw homemaker arrays are just multiple type instances, the spacing etc.. is defined in the style definition which is external (not recorded in the IFC). They can be regenerated with different parameters, but only when the whole building is regenerated.

  • in freecad too, arrays are just series of instanced elements. we've tried to gather them into an IfcElementAssembly, which is what we increasingly do because it's convenient, your whole structure can be manipulated as one object, but the inner components remain available. I wish there were more diverse types of assemblies than the basic generic one... The parameters of the array, though (the interval distance and orientation of the array axes) are lost. We could find a way to store them in custom properties, though

    CoenAce
  • @yorik any object can act as an aggregate, you're not limited to IfcElementAssembly.

  • @Moult said:
    @yorik any object can act as an aggregate, you're not limited to IfcElementAssembly.

    This is one of my boggles. I have aggregated a series of IFCWALL elements within a parent IFCWALL, which seems ok, especially if they are chained together. "How many walls does this building have?" is not a very interesting question, "how much wall?" is more relevant.

    But then I have a series of three columns and aggregate them within an IFCOLUMN. There are now four IFCOLUMN's in the file (but there are only three columns). This seems like a case where the aggregate should be IFCELEMENTASSEMBLY.

    Opus
  • @Moult true... I should use that more often actually.


  • Is it possible to selecte multiple items for one array?

  • @Coen said:

    Is it possible to selecte multiple items for one array?

    I don't think so. I think because of...

    CoenAce
  • The problem I see with the mapped groups / arrays is as follows: if only the parametric repetition is stored in the IFC file ("this group exists also at this location") then the actual occurrences have to be created at runtime by the application, right? It would be hard to maintain occurence data like GUID and overriden psets.
    If the occurrences are persisted in the file then the application has to take care of the replication ("keep those groups in sync").
    Both ways, if opening the file with a non full native ifc application would show a completly different project (as it already does now if you use grid placement).

    CoenAce
  • Hello. The IFC Array look great! However it seems a bit buggy when duplicating the Array Parent Object: you can edit the array on its duplication. Would be great if Shift+D duplicates the Array Parent Object + its Children Items, making it an independent Array.

    Coentheoryshaw
  • Hello, I'm back on the IFC Array tests. When I edit the Count field I have this bug:

    With: blenderbim-230116-py310-win
    Model :

  • @RaphaëlVouilloz said:
    Hello, I'm back on the IFC Array tests. When I edit the Count field I have this bug:

    With: blenderbim-230116-py310-win
    Model :

    I have the exact same bug.

  • @SigmaDimensions has helped fix this bug :) Thanks!

    Ace
  • Yes, that works, thanks! Another cool trick would be that changing the Construction Type of the parent object of the Array also updates the items. E.g. for beams

  • Hi everyone,
    Is it possible to give a rotation to the array modifier?
    In this example, I have an element that is rotated. I would like to create an array that has the same orientation and would look like this:

    But it seems that the array only works with the global coordinates, like this:

    For my use case, this is easy to do manually, but I was wondering if this is possible to implement.

  • Yes, can you help file a bug? Basically we should have a setting between local axes and global axes :)

  • Will do, thanks @Moult

  • I was playing with the code from the array modifier and I came up with two features that I found useful, I would like to know what you guys think:
    1 - Choose between "increment" and "total" for the input values:

    2 - Get 3d cursor location as input. This is useful when you want to use other object as reference:

    @Moult, if you think it's useful, I would like to work on a PR.

    CoentheoryshawAce
  • @bruno_perdigao
    This total method is nice, could there also be an option where you could set the dimension of the total length of the array? I think I already saw it quick in demo in the dropdown... Maybe you are already working on it?

    theoryshaw
  • @Coen
    Maybe it wasn't clear in my post, but the idea of the "total" option is that the value of the input is the total length of the array. In the example above, "12m" means the distance between the first and the last cube (when "total" is selected). If "increment" is select, "12m" will be the distance between each cube (which is the default behavior right now). Is that what you mean?

    theoryshaw
  • @bruno_perdigao both of those look like awesome additions! Please go for it!

    bruno_perdigaoCadGiru
  • The array function is fine. Is there any way to do something like native blender Possibly An ifc object array followed on a curve ?

Sign In or Register to comment.