Access node name

28 views
Skip to first unread message

Patrick Janssen

unread,
Aug 16, 2015, 2:21:26 PM8/16/15
to pycollada
Hi all,

Thanks for this lib. In SketchUp, if you group entities, then in the dae xml, the node gets a 'name', something like this:

<node id="ID2" name="XXX">

I need to access this name, but I can see anything in the api to do that. e,g,

for g in mesh.geometries:
    print g.id, g.name

But g.name does not return anything...
Any suggestions?

Patrick

Jeff Terrace

unread,
Aug 16, 2015, 2:25:06 PM8/16/15
to pyco...@googlegroups.com
Indeed, we're not parsing out the name. If you want to send a patch, you could do it here:

To access manually, you can use .xmlnode.get('name')

--
You received this message because you are subscribed to the Google Groups "pycollada" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pycollada+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Patrick Janssen

unread,
Aug 16, 2015, 2:35:16 PM8/16/15
to pycollada
Hi Jeff, 

Thanks for the quick reply

>To access manually, you can use .xmlnode.get('name')

When I try this

for g in mesh.geometries:
print g.id, g.xmlnode.get('name')

it still returns None

Patrick Janssen

unread,
Aug 16, 2015, 2:47:24 PM8/16/15
to pycollada
Hi Jeff,

I think I got it now. I was iterating over the wrong things. When I iterate over the nodes in the scene, it works fine.

for n in mesh.scene.nodes[0].children:
    print n.id, n.xmlnode.get('name')

Patrick

Jeff Terrace

unread,
Aug 16, 2015, 2:50:54 PM8/16/15
to pyco...@googlegroups.com
Yep, that looks right. However, you might want to iterate over the bound primitives, not the raw scene info:

See the section on "mesh.scene.objects"
Reply all
Reply to author
Forward
0 new messages