ladybug-tools / honeybee-core

:honeybee: honeybee core library
https://www.ladybug.tools/honeybee-core/docs/
GNU Affero General Public License v3.0
14 stars 14 forks source link

AttributeError: module 'honeybee.writer.model' has no attribute 'idf' #471

Closed eapuertoc closed 3 years ago

eapuertoc commented 3 years ago

Hi,

I have a doubt about the writer/model module. I created in Windows a code to export DXF polylines to LB rooms. It worked great, but now I was trying to used it in Ubuntu 20.04 and found this Error:

AttributeError: module 'honeybee.writer.model' has no attribute 'idf'

I go to the model file and found a "note for developers". I understand that I have to add an "idf" method to this module, but I was comparing the same module in Windows and it's exactly the same. So, I can't understand what's the real problem.

def create_IDF_from_DXF(DXFfile, IDFname, level = 0.0, z = 3.0):
    dxf = ezdxf.readfile(DXFfile)
    msp = dxf.modelspace()
    zones = msp.query("LWPOLYLINE[layer=='M-ZONE']")
    print(len(zones))
    rooms = []
    for zone in zones:
        XYcoords = getXYCoord(zone.get_points())
        rooms.append(extrudeRoom(XYcoords, level = level, z = z, roomName = zone.dxf.handle))
        print("room " + zone.dxf.handle + " created")
    model = Model('Mymodel', rooms, tolerance = 0)
    idf_str = model.to.idf(model)
    with open(IDFname, "w") as file:
        file.write(idf_str)

AttributeError Traceback (most recent call last)

in ----> 1 create_IDF_from_DXF("prueba.dxf", "prueba.idf", 4.2, 3.2) in create_IDF_from_DXF(DXFfile, IDFname, level, z) 10 print("room " + zone.dxf.handle + " created") 11 model = Model('Mymodel', rooms, tolerance = 0) ---> 12 idf_str = model.to.idf(model) 13 with open(IDFname, "w") as file: 14 file.write(idf_str) AttributeError: module 'honeybee.writer.model' has no attribute 'idf'
mostaphaRoudsari commented 3 years ago

Hi @eapuertoc, do you have honeybee-energy installed? to.idf is added to honeybee by honeybee-energy extension.

Try pip install honeybee-energy -U which will also install honeybee-core library.

eapuertoc commented 3 years ago

Hi @mostaphaRoudsari sorry to answer so late, I had lot of work these days. I'm trying using fork libraries, so I do not installed using pip install, but in fact, I missed install honeybee-energy. Now works fine. Thank you so much.