Menu

How to find orientation of Ifc elements from top and bottom?

Help
2019-06-28
2020-12-16
<< < 1 2 (Page 2 of 2)
  • Thomas Krijnen

    Thomas Krijnen - 2020-12-01

    C:\Users\Malavan-PC\AppData\Local\Programs\Python\Python38-32\python.exe

    Is not your Anaconda Python I assume. Did you properly setup anaconda and conda activate? Otherwise try running from the Anaconda Prompt.

     
    • Hamid Kiavarz

      Hamid Kiavarz - 2020-12-02

      I have re-installed the anaconda and use Anaconda python

      Result:
      C:\Users\Malavan-PC\anaconda3\python.exe
      ['C:\Users\Malavan-PC\anaconda3', 'C:\Users\Malavan-PC\anaconda3\lib\site-packages']
      C:\Users\Malavan-PC\AppData\Roaming\Python\Python38\site-packages
      PS C:\Users\Malavan-PC\OneDrive - York University\Coding>

      I remored all version of pythons on my machine and just reinstall the Anacoda. It works now. Thanks all for help and supports

       

      Last edit: Hamid Kiavarz 2020-12-02
  • Hamid Kiavarz

    Hamid Kiavarz - 2020-12-13

    Ho I can extract the area of face for a wall and the corners vertices (coordinates). Itired the following method but it is not working by OCC library :

    ifcopenshell.geom.create_shape(...).geometry.verts

    Thanks,
    Hamid

     
    • Sabih Ahmad Khan

      Hi Hamid,

      To extract the area of each face of the wall, first you will need to explore the wall shape and find each face of the wall using TopExp_Explorer. Further you can use the extracted face to find the vertex on each face.

      from OCC.Core.TopExp import TopExp_Explorer
      from OCC.Core.TopoDS import topods
      from OCC.Core.TopAbs import TopAbs_FACE, TopAbs_VERTEX
      from OCC.Core.BRep import BRep_Tool
      from OCC.Core.GProp import GProp_GProps
      from OCC.Core.BRepGProp import brepgprop_SurfaceProperties
      
      import ifcopenshell
      import ifcopenshell.geom
      
      settings = ifcopenshell.geom.settings()
      settings.set(settings.USE_PYTHON_OPENCASCADE, True)
      
      file = ifcopenshell.open("Duplex_A_20110907_optimized.ifc")
      wall = file.by_type("IfcWall")[9]
      
      wall_brep_shape = ifcopenshell.geom.create_shape(settings, wall)
      
      # Create an explorer on wall shape and find all the face on this shape
      explore_face = TopExp_Explorer(wall_brep_shape.geometry, TopAbs_FACE)
      
      while explore_face.More():
          face = topods.Face(explore_face.Current())
      
          props = GProp_GProps()
          brepgprop_SurfaceProperties(face, props)
      
          # props.Mass() provides area of face
          face_area = props.Mass()
          print(face, face_area)
      
          # Create an explorer on face and find all the vertex
          explore_vertex = TopExp_Explorer(face, TopAbs_VERTEX)
      
          while explore_vertex.More():
              vertex = topods.Vertex(explore_vertex.Current())
      
              # Coordinate of vertex on face
              vertex_point = BRep_Tool().Pnt(vertex).Coord()
              print(vertex, vertex_point)
      
              explore_vertex.Next()
      
          explore_face.Next()
      

      For more details please check:
      1. OCC.Core.TopExp.TopExp_Explorer
      2. OCC.Core.TopoDS.topods

       
<< < 1 2 (Page 2 of 2)

Log in to post a comment.