3DCoat Core API
The 3DCoat API documentation.
No Matches

Iterate over the sculpt tree, show the basic stats - square, volume

// Iterate over the sculpt tree, show the basic stats - square, volume
#include <CoreAPI.h>
//If you need the release build at full speed please change the Debug below to Release
//@config: Debug
class OneLine :public BaseClass {
OneLine() {
Square = Volume = 0;
OneLine(coat::SceneElement el) {
name = el.name();
Square = el.Volume().getSquare();
Volume = el.Volume().getVolume();
coat::str name;
float Square;
float Volume;
//"!identifier" means that it is readonly and it's name does not appear in UI
READONLY REG_AUTO(name, "!name");
READONLY REG_AUTO(Square, "!Square");
READONLY REG_AUTO(Volume, "!Volume");
// This is the class to represent the information about all volumes
class Stats:public BaseClass {
Stats() {
void Calculate() {
// get the sculpt root
// iterate through all sculpt objects
[&](coat::SceneElement el) -> bool {
// adding the element to ClassArray to represent in UI
if (el.isSculptObject())lines.Add(new OneLine(el));
return false;
// This is the list of volumes, ClassArray is the array of pointers to BaseClass-derived items
// ClassArray<...> may be registered with REG_AUTO(...)
// making the header, 3 columns
// "*name" means it is left-aligned text
// the lines with info, ClassArray<...> may be registered with REG_AUTO
// and will appear in the UI
int main(){
Stats stats;
// calculate the stats
return 0;
Use this class for build a class for UI or serialization. see class_reg.h for details about the class...
Definition BaseClass.h:91
The array of elements derived from the BaseClass. If you create ClassArray and register if with the R...
Definition classlist.h:340
The scene element, like sculpt object or curve.
Definition CoreAPI.h:1609
const char * name() const
get the element name
bool isSculptObject() const
Check if it is the sculpt object.
static SceneElement sculptRoot()
get the root of all sculpt objects
the rich dialog. You may customize it, show your custom parameters and custom buttons.
Definition CoreAPI.h:3388
dialog & params(BaseClass *params)
The important core feature. BaseClass allows to create the custom controls in the dialog....
dialog & ok()
add Ok button
int show()
pass the function/lambda that will be called when the button will be pressed. The button index (start...
comms::cStr str
the string that is compatible with the 3DCoat engine, see the cStr
Definition CoreAPI.h:67