libredwg
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libredwg] Getting Layer List - Python


From: Melvin Newman
Subject: [libredwg] Getting Layer List - Python
Date: Thu, 7 Nov 2019 22:09:21 -0700

Hello all! 

I am very new to LibreDWG and I am trying to use it to extract information out of several 3D DWG files using the Python 2.7 bindings. I have built the library and everything appears to have worked as it should.

My first task is to dump out the list of layer names. I am getting stuck at the following though:

import os
import sys
import LibreDWG as DWG

if (len(sys.argv) != 2):
        print("Usage: dwgDD.py <filename>")
        exit()

filename = sys.argv[1]
a = DWG.Dwg_Data()
error = DWG.dwg_read_file(filename,a)

layers=DWG.dwg_get_layers(a)
for x in layers:
    pass

I get the following error: 
for x in layers:
TypeError: 'SwigPyObject' object is not iterable

I have a decent amount of experience with python, but basically none with Swig. 

How would I go about iterating over the layers and getting a list of layer names? 

Thank you very much for your help!

- MN

reply via email to

[Prev in Thread] Current Thread [Next in Thread]