New IFC facet-based selector syntax

2

Comments

  • @c4rlosdias yes, it is not yet implemented. Would you like to try?

  • I think should be useful use the query syntax in the IfcClash Tool too.

    What do you think? Is it in the roadmap?
    Thanks for your work

  • Yes indeed it's in the roadmap - basically everywhere people should have the option to use the graphical selector from now on. Would you mind filing a bug on Github, or if you're keen, helping code it?

  • edited December 2023

    Good news thanks, i'll fill a bug (request) asap (edit: https://github.com/IfcOpenShell/IfcOpenShell/issues/4069). Help coding I think it's hard for me (basic knowledge) but if you think it's easy give me some hint and i'll try

  • Obviously i'm not doing this correctly.
    Anyone have any pointers?

  • @theoryshaw Try this: ``round({{Qto_SpaceBaseQuantities.NetFloorArea}}, 0.1)``

  • I tried that already--unfortunately get the following error.

    Python: Traceback (most recent call last):
      File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\libs\site\packages\lark\visitors.py", line 68, in _call_userfunc
        return f(children)
      File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\libs\site\packages\ifcopenshell\util\selector.py", line 198, in round
        value = Decimal(args[0] or 0.0)
    decimal.InvalidOperation: [<class 'decimal.ConversionSyntax'>]
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\bim\module\drawing\operator.py", line 75, in execute
        IfcStore.execute_ifc_operator(self, context)
      File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\bim\ifc.py", line 340, in execute_ifc_operator
        result = getattr(operator, "_execute")(context)
      File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\bim\module\drawing\operator.py", line 2198, in _execute
        core.edit_text(tool.Drawing, obj=context.active_object)
      File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\core\drawing.py", line 32, in edit_text
        drawing.update_text_value(obj)
      File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\tool\drawing.py", line 898, in update_text_value
        props.literals[i].value = cls.replace_text_literal_variables(literal.Literal, product)
      File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\tool\drawing.py", line 1397, in replace_text_literal_variables
        text = text.replace(original_command, ifcopenshell.util.selector.format(command[2:-2]))
      File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\libs\site\packages\ifcopenshell\util\selector.py", line 252, in format
        return FormatTransformer().transform(format_grammar.parse(query))
      File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\libs\site\packages\lark\visitors.py", line 105, in transform
        return self._transform_tree(tree)
      File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\libs\site\packages\lark\visitors.py", line 101, in _transform_tree
        children = list(self._transform_children(tree.children))
      File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\libs\site\packages\lark\visitors.py", line 92, in _transform_children
        yield self._transform_tree(c)
      File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\libs\site\packages\lark\visitors.py", line 101, in _transform_tree
        children = list(self._transform_children(tree.children))
      File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\libs\site\packages\lark\visitors.py", line 92, in _transform_children
        yield self._transform_tree(c)
      File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\libs\site\packages\lark\visitors.py", line 102, in _transform_tree
        return self._call_userfunc(tree, children)
      File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\libs\site\packages\lark\visitors.py", line 72, in _call_userfunc
        raise VisitError(tree.data, tree, e)
    lark.exceptions.VisitError: Error trying to process rule "round":
    
    [<class 'decimal.ConversionSyntax'>]
    
    

  • @theoryshaw I got this error because I didn't have created the Qto_SpaceBaseQuantities in the IfcSpace object yet. After I created, it worked. Maybe is something with the Object Quantity Sets? Or maybe the annotation is not assigned to the right object?
    I tested with your file by creating a new space and a new annotation and it worked.

  • edited January 10

    That's weird, it worked here. I just added the double backtricks:

  • Dang, which commit are you on?

  • edited January 10

    Nevermind... I ran Purged HDF5 Cache and it fixed it.
    Thanks, for helping!

  • I think i spoke too soon. It worked once, and then didn't again, even after the Purged HDF5 Cache step. :\

  • Sorry, i 'think' I got it. I reinstalled BB, but I 'think' maybe it was because I was trying to change the 'instance' and not the 'type'.

  • edited January 10

    Sorry, i'm still running into problems. This is a weird bug, sometimes it works, other times, not.

  • edited January 26

    Probably doing something silly, but neither of the following seem to work

    IfcFurniture, predefined_type = CHAIR
    or
    IfcFurniture, ObjectType = CHAIR
    or
    IfcFurniture, PredefinedType = CHAIR
    
  • @theoryshaw you have to use quotes so:
    IfcFurniture, PredefinedType="CHAIR"
    When i don't know exactly how to write the query, i find useful to use the UI first and after that copy the query text from the pop up menu like this:

    bruno_perdigaoJanFsteverugitheoryshawBedsonArv
  • I might be doing something wrong, but
    IfcFurniture, PredefinedType="CHAIR"
    doesn't seem to work for me.
    video: https://www.dropbox.com/scl/fi/rp9sv6qmwhardpfcvtrxx/2024-01-28_21-55-23_blenderBlenderblender.mp4?rlkey=ly9c3f09ouyamb6byqzsobg6r&dl=0

  • @theoryshaw you actually have found two bugs :-)
    1 - If you create a new search group starting from the query (like what you have done in your video), the query gets modified in a wrong way adding an equals symbol

    If you delete the equals symbol, the search works ok

    2 - In your file, there are two IfcFurniture objects, but only one has the PredefinedType = CHAIR.
    The other object hasn't the PredefinedType but the panel "object metadata" still shows the PredefinedType into the square brackets
    This is ok

    This seems wrong

    Cheers, Massimo

    theoryshawAce
  • @Moult Is quantity filtering not implemented yet? If so, I would like to try.

  • Thanks @Massimo
    That worked for selecting the non-typed based instant object.
    But, how do you select the following type-driven instance, however?

  • @bruno_perdigao said:
    @Moult Is quantity filtering not implemented yet? If so, I would like to try.

    Nevermind, I see that they are implemented. However, they don't seem to work with decimal numbers like: ifcopenshell.util.selector.filter_elements(model, "IfcColumn, Qto_ColumnBaseQuantities.Length > 2.5")

    I'm getting this error:

    umn, Qto_ColumnBaseQuantities.Length > 2.5
                                            ^
    
    Expecting: {'PLUS', 'COMMA'}
    

    Maybe it's a case to add "number" as expected value in the grammar.

  • try:
    ifcopenshell.util.selector.filter_elements(model, 'IfcColumn, Qto_ColumnBaseQuantities.Length > "2.5"')

  • @c4rlosdias Thanks, that was it. However, it's not working with the ifcopenshell installed with pip. I assume it's not updated yet.

  • you need to install ifctester

    bruno_perdigao
  • @theoryshaw i guess in this way

    Please note that it selects also the type object so, if you don't want to select also the type object, you can use this:

  • edited February 14

    Anyone know how to pull out material psets via the Spreadsheet Import/Export?

    The following doesn't work.

  • edited February 14

    Got it..Like this! :)

    MassimoAcesteverugi
Sign In or Register to comment.