Scripting. Need help finding top level of tree in Surfaces

I have got stuck and could need some help to fix last problem.

My script writes out all material property vales to file.

I have now solved all parts except for the problem that i get same surface group for more than one material so i must find a way to get the unique name so that I know witch I'm looking for in the file.

In the attached image the red arrows points at the duplicate surfaces (if thats the correct name).

When i iterate through the oPropertys i can get that name by using oProperty.getOwner() to get an oOwner object and from that i can use oOwner.name to get the name at the red arrows; 

The parts marked in green I can get from oProperty.name and oProperty.getPath().

I'm however lost on how to get the part marked in yellow.

Any suggestion on how to get hold of that text?

 

DazScripting.jpg
976 x 857 - 167K

Comments

  • The reds are the Surface groups, they are unique to any given node but in your screen shot you have two nodes selected, Rocker Shoes adn Rocker Shoes(2). The greens are the property groups. The yellows are the nodes, which if you didn't have them initially you would have to get via Surface>Shape>Object>Node, I think - unfortunately DzShape and Surface are not currently in the Object reference..

  • I do have acces to oNode and dump name of it as debug info but neither oNode.name or oShape.name shows "Rocker Shoes" or "Rocker Shoes (2)".

    They shows for the oNode.name  "RNRShoes_23002" resp "RockerShoesG8_23002"

    And for oShape.name it's "RNRShoes" resp "RockerShoesG8"

    Maybe int's not the name property that has the text that is shown in the materials top level.

    Is it in any other property that it can be found?

  • Found it.

    It's the oNode.getLabel()

     

    Thanks for helping.

  • hellbornhellborn Posts: 59
    edited November 2019

    I got it to work using  Surface>Shape>Object>Node.

    I do however think that it's not the optional way as it takes long time to write out the information.

    Is it possible to go in the oposite direction from shape to surface and then on to the properties.

    I have dumped out the methods of oShape so I can see what exists and but it's not obvius to me what method to use or if at all possible?

     

     

     

    Post edited by hellborn on
  • Yes, you can get a surface list from DzShape - I have done it in the past, though I can't recall in which script to find example code.

  • Seems as I can go from oNode > oShape > oMaterial > oProperty when going in other direction.

    Only had time for a first try and not had the time to validate that what I get is what I want but it looks promising.

  • Nope.

    Something is missing.

    I'm getting oProperty from the oMaterial and at first glanse it looks god but som properties are actually a bit defferent from what it should be.

    So getting properties from oMaterials dont seem to work.

    Would really like to get it to work as code gets a lot nicer working from botom up.

  • How are they different?

  • Your question made me think that maybe I should have gotten the correct result so gave it a new try.

    Found out that I should had used label and not name.

    I have some extra properties as well.

    They might be there in the other solutions as well and dont really matter as far as I can see now.

    So I actually think it's working now. :)

     

Sign In or Register to comment.