Editing IfcOpenShell code examples
From Wiki.OSArch
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 10: | Line 10: | ||
import ifcopenshell | import ifcopenshell | ||
ifc = ifcopenshell.open('/path/to/your/file.ifc') | ifc = ifcopenshell.open('/path/to/your/file.ifc') | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 240: | Line 232: | ||
iterator = ifcopenshell.geom.iterator(settings, ifc_file, multiprocessing.cpu_count()) | iterator = ifcopenshell.geom.iterator(settings, ifc_file, multiprocessing.cpu_count()) | ||
if iterator.initialize(): | if iterator.initialize(): | ||
− | while | + | while iterator.next(): |
shape = iterator.get() | shape = iterator.get() | ||
element = ifc_file.by_guid(shape.guid) | element = ifc_file.by_guid(shape.guid) | ||
Line 251: | Line 243: | ||
grouped_verts = [[verts[i], verts[i + 1], verts[i + 2]] for i in range(0, len(verts), 3)] | grouped_verts = [[verts[i], verts[i + 1], verts[i + 2]] for i in range(0, len(verts), 3)] | ||
grouped_faces = [[faces[i], faces[i + 1], faces[i + 2]] for i in range(0, len(faces), 3)] | grouped_faces = [[faces[i], faces[i + 1], faces[i + 2]] for i in range(0, len(faces), 3)] | ||
− | |||
− | |||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
=IFC Query Syntax= | =IFC Query Syntax= | ||
Line 326: | Line 313: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
=Exploring IFC schema= | =Exploring IFC schema= | ||
Line 387: | Line 364: | ||
<entity IfcFlowSegment> | <entity IfcFlowSegment> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Get subtypes : | Get subtypes : | ||
Line 413: | Line 374: | ||
<entity IfcPipeSegment>) | <entity IfcPipeSegment>) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
=Property and quantity sets (Pset and Qto)= | =Property and quantity sets (Pset and Qto)= | ||
Line 473: | Line 433: | ||
python -m ifcopenshell.validate some_file.ifc | python -m ifcopenshell.validate some_file.ifc | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
==Inside a script== | ==Inside a script== | ||
It looks similar to command line way but you need to provide a logger (standard logger or json_logger as below). | It looks similar to command line way but you need to provide a logger (standard logger or json_logger as below). |