Re: How to get ID of a DiaObject?



Dear Salu,
Thanks for your assistance.

I am trying to add a python plug-in to Dia. Following is the test scenario in the Dia python console.
obj = dia.active_display().diagram.data.selected[0]
props = obj.properties
props.keys() //this is to show all available attributes of the selected obj.

But
objId = obj.id
OR
objId = props["id"].value
Neither of above is available.

The problem is that, objId = obj.id does not exist. I need to get the DiaObject Id. How can I get it
If the id is available, I will use it to select the record where id = the DiaObject Id. Please further advise. Thanks again.

NJ.



Nycko wrote:
On Mon, Nov 23, 2009 at 1:45 PM, Nathakorn J. <nathakorn softoo co th> wrote:
  
Hello,
I am really new to Dia. And I am trying Dia 0.97 for Windows. I want to
utilize a database to store more DiaObject properties using DiaObject ID as
the primary key. Is there any possibility for me to get the id of a
DiaObject using Python?
    

The uncompressed .dia files are pure XML. with any text editor you
would see the ID of the objects inside the tag <dia:layer>. Do not use
python to day, but I'm pretty sure that if you can do. I did it with
php, I'm sure you can do it with any language that understands XML.


Salu/tty
  



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