Every Face Groups Into Surface Groups
AscendedJoy
Posts: 44
Hello, I'd like to receive some help as I'm not familiar with DAZ's scripting system and Documentation page is bit complicated to understand
I'm trying to make a script that creates Surface Group from every Face Group exists within an object.
However, I couldn't find proper API reference that refers to either of those group...
If anybody is able to help that'll be great.. Thanks!
Comments
You may want to look at the old DS3 scripting docs, the geometry sections of the current documentation were taken down a while back - not sure if it was because of updates being needed or to hide the work being done on dForce/strand hair - and haven't vcome back but I think you may be able to get started with the samples, the old docs, and if need be a bit of member discovery.
The Scripting Samples are also a good source of info, e.g. for your case try http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/geometry/geometry_triangulate/start
I have not tested this extract from the above Sample, but I expect it will do something like you want (after some modifiactions):
Hello Praxis, this is such a great resource! I'll try to build something with code your provided. It doesn't work as is, but surely seems promising place to start from
Thank you!
You are welcome.
You need to download the Sample .dsa code file at http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/geometry/geometry_triangulate/start and modify it to suit your situation. For example, in the code I posted, getRootNode() and getFacetMeshForNode() are not built-in functions of DAZ Script - they are utility routines in the Sample .dsa script.
Enjoy!...
Hi Praxis, I slightly modified the script to have it running (as it was giving me an error). now it seems script is up and running, but although script IDE claims it has created Material groups, I cannot see them in neither Geometry Editor or Surface Editor. Am I doing something wrong here? (I gotta be xD ;; )
Oops... After creating each new Surface, you need to add the relevant Faces to it - I left out that code.
I'll post an update soon, after I've tested a few things...
OK...
This runs OK, and at the end it lists the newly-created Surfaces,
BUT: Those new Surfaces don't appear in the Surfaces Editor or the Geometry Editor.
I'm out of ideas on this one... maybe someone else can help?
Hello Praxis, I also tried coding on my own; Borrowed first few lines from your code..
Following code shows very interesting result;
When I run this script, I don't see a faces on my viewport - when I try "Show All Polygons", DazStudio crashes. So something weird has happened to the polygons with code above
Also, I made DazStudio to print vertex IDs with getMaterialGroup - result shows same vertices appear on multiple MaterialGroup.
Or to be more precise; group A gets added to group B, group B gets added to group C, and etc..
And like your example, mine doesn't show the list either. I'm pretty sure we're missing something ... : /
Update: After de-commenting DeselctAllFacets, now I don't see duplicated vertices in Surface Group. However, they still don't appear in the list T_T
After some experimentation using both your method (via Selections) and my method (via setting individual facet Index #s), I have occasionally got it to behave as desired - BUT not reliably or repeatedly: Sometimes it works, and sometimes not.
I suspect the problem is that (probably - I assume so) each Facet must at all times belong to a Surface ("MaterialGroup"), and so you need to remove each Facet Index from its current Surface (e.g. "default") before adding it to the new Surface. But I'm just guessing.
Hopefully someome who knows will step in here...