ahh ... found it ... it's so easy ... I have no idea why I just not tried what I do in Python all time. Probably the need of the quotes confused me at all.
# works great :-)
from ifcopenshell.util import selector
query = "IfcWall, FBJ_Properties.HB_Std_Gewerk=Betonarbeiten"
len(ifcopenshell.util.selector.filter_elements(ifcfile, query))
query = "IfcWall, FBJ_Properties.HB_Std_Gewerk=Mauerarbeiten"
len(ifcopenshell.util.selector.filter_elements(ifcfile, query))
but use the ! does not seam to work with properties ...
# works not ...
query = "IfcWall, ! FBJ_Properties.HB_Std_Gewerk=Betonarbeiten"
len(ifcopenshell.util.selector.filter_elements(ifcfile, query))
Error ...
>>> query = "IfcWall, ! FBJ_Properties.HB_Std_Gewerk=Betonarbeiten"
>>> len(ifcopenshell.util.selector.filter_elements(ifcfile, query))
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\0_BHA_privat\progr\FreeCAD\FreeCAD_0.21.xxxxx\bin\lib\site-packages\ifcopenshell\util\selector.py", line 311, in filter_elements
transformer.transform(filter_elements_grammar.parse(query))
File "C:\0_BHA_privat\progr\FreeCAD\FreeCAD_0.21.xxxxx\bin\lib\site-packages\lark\lark.py", line 645, in parse
return self.parser.parse(text, start=start, on_error=on_error)
File "C:\0_BHA_privat\progr\FreeCAD\FreeCAD_0.21.xxxxx\bin\lib\site-packages\lark\parser_frontends.py", line 96, in parse
return self.parser.parse(stream, chosen_start, **kw)
File "C:\0_BHA_privat\progr\FreeCAD\FreeCAD_0.21.xxxxx\bin\lib\site-packages\lark\parsers\earley.py", line 266, in parse
to_scan = self._parse(lexer, columns, to_scan, start_symbol)
File "C:\0_BHA_privat\progr\FreeCAD\FreeCAD_0.21.xxxxx\bin\lib\site-packages\lark\parsers\xearley.py", line 146, in _parse
to_scan = scan(i, to_scan)
File "C:\0_BHA_privat\progr\FreeCAD\FreeCAD_0.21.xxxxx\bin\lib\site-packages\lark\parsers\xearley.py", line 119, in scan
raise UnexpectedCharacters(stream, i, text_line, text_column, {item.expect.name for item in to_scan},
lark.exceptions.UnexpectedCharacters: No terminal matches 'F' in the current parser context, at line 1 col 12
IfcWall, ! FBJ_Properties.HB_Std_Gewerk=Betonarbeit
^
Expected one of:
* __ANON_0
* __ANON_3
>>>
Just got the model seen in the screen from an landscape architect. 180 MB but probably 95% data volumes are trees which I do not need at all ... Let BBIM help myself to get something to easily work with ...
First idea:
Open the file in BBIM and delete the trees works fine, but takes two hours on my machanine. But BBIM did not crash :-) But there must be a better way ... Actually there is ...
Second idea, use the filter and IfcPatch
Start by finding the correct filter by python ...
Since it seams to work fine, use IfcPatch tool from BBIM Gui with the query from above: IfcBuildingElement, Name!=/^Platane/, Name!=/^Bush/, Name!=/^Willow/, Name!=/^Black_Maple/, Name!=/^Nordmann/, Name!=/^Elm_Tree/, Name!=/^Chestnut_Tree/
takes just 10 minutes all together and results in a ifc of around 11.4 MB ... :-) More than 10 times faster than open the file in BBBIM Gui, deleting the elems and save the file and much more robust.
I got a ifc from a landscape architekt of 180 MB containing probably 95 % data in trees which I do not need at all. The idea was to use BBIM to create a new ifc without the trees. Means filter all element except all the trees ... This was what I came up with ...
In BBGui run IFCPatch by the use of the filter from above and get a ifc file of 11.4 MB ... :-) IfcBuildingElement, Name!=/^Platane/, Name!=/^Bush/, Name!=/^Willow/, Name!=/^Black_Maple/, Name!=/^Nordmann/, Name!=/^Elm_Tree/, Name!=/^Chestnut_Tree/
"material" filters Materials, "Name" filters by Name ...
What do I need to filter Layer ? I tried "Layer" and "layer" but both did not return something reasonable ...
from IFC ... #113754=IFCPRESENTATIONLAYERASSIGNMENT('115 Liftanlagen.002',$,(#25008,#25402,#25403,#25404,#25405,#25406,#25407),$);
another one ...
A property name does have a Space inside. I am not able to filterfor this property values ... Nothing of this works? BTW (False is really a String in this IFC ... bang ... )
"material" filters Materials, "Name" filters by Name ...
What do I need to filter Layer ? I tried "Layer" and "layer" but both did not return something reasonable ...
from IFC ... #113754=IFCPRESENTATIONLAYERASSIGNMENT('115 Liftanlagen.002',$,(#25008,#25402,#25403,#25404,#25405,#25406,#25407),$);
Comments
That explains a lot.
#97=IFCQUANTITYLENGTH('Dicke',$,$,0.28);
Than I need to ask the question different.
ahh ... found it ... it's so easy ... I have no idea why I just not tried what I do in Python all time. Probably the need of the quotes confused me at all.
next filter problem ...
file from this post https://community.osarch.org/discussion/comment/20854/#Comment_20854
but use the
!
does not seam to work with properties ...Error ...
once again ... just use Python relational operator ...
sometimes it needs a post to solve the problem myself, I have no idea why , sorry for the noise ...
@bernd it's far from noise, it's a really helpful guide for people like me trying to learn and understand. More, please.
Just got the model seen in the screen from an landscape architect. 180 MB but probably 95% data volumes are trees which I do not need at all ... Let BBIM help myself to get something to easily work with ...
First idea:
Open the file in BBIM and delete the trees works fine, but takes two hours on my machanine. But BBIM did not crash :-) But there must be a better way ... Actually there is ...
Second idea, use the filter and IfcPatch
Start by finding the correct filter by python ...
results in:
Since it seams to work fine, use IfcPatch tool from BBIM Gui with the query from above:
IfcBuildingElement, Name!=/^Platane/, Name!=/^Bush/, Name!=/^Willow/, Name!=/^Black_Maple/, Name!=/^Nordmann/, Name!=/^Elm_Tree/, Name!=/^Chestnut_Tree/
takes just 10 minutes all together and results in a ifc of around 11.4 MB ... :-) More than 10 times faster than open the file in BBBIM Gui, deleting the elems and save the file and much more robust.
I got a ifc from a landscape architekt of 180 MB containing probably 95 % data in trees which I do not need at all. The idea was to use BBIM to create a new ifc without the trees. Means filter all element except all the trees ... This was what I came up with ...
In BBGui run IFCPatch by the use of the filter from above and get a ifc file of 11.4 MB ... :-)
IfcBuildingElement, Name!=/^Platane/, Name!=/^Bush/, Name!=/^Willow/, Name!=/^Black_Maple/, Name!=/^Nordmann/, Name!=/^Elm_Tree/, Name!=/^Chestnut_Tree/
found a even simpler way to filter. It works inside one regex ...
results in:
next problem to solve ...
"material" filters Materials, "Name" filters by Name ...
What do I need to filter Layer ? I tried "Layer" and "layer" but both did not return something reasonable ...
from IFC ...
#113754=IFCPRESENTATIONLAYERASSIGNMENT('115 Liftanlagen.002',$,(#25008,#25402,#25403,#25404,#25405,#25406,#25407),$);
another one ...
A property name does have a Space inside. I am not able to filterfor this property values ... Nothing of this works? BTW (False is really a String in this IFC ... bang ... )
gives an Error in all three cases ...
from IFC ...
#2833771=IFCPROPERTYSINGLEVALUE('Tragendes Bauteil',$,IFCLABEL('FALSE'),$);
solved one of the two problems ...
it has to be
query = 'IfcWall, Allreal."Tragendes Bauteil"=/^FALSE/'
noone out here a idea if it is not implemented or if I do some mistake ...
Maybe...


thanks, I meant to add yours to my query examples but, what is a practical use of layer in Bonsai? the same as in DWG? cheers
Yes, as i understand it, it's kinda like that. I don't use it, however.
Good evening. How do I exclude IfcAnnotation[GRID] from my drawings when I create them. All efforts are not yielding results.
Thank you.
Exclude:
IfcAnnotation, ObjectType = GRID
Thank you very much.