#include <CoreAPI.h>
public:
ThreadStudPrim() {
Diameter1 = 50;
Diameter2 = 50;
Step = 10;
Turns = 10;
Length = 150;
Profile = ThreadProfile::ThreadTriangle;
Clockwise = true;
UseConus = false;
}
float Diameter1;
float Diameter2;
float Step;
float Length;
int Turns;
bool Clockwise;
bool UseConus;
SERIALIZE() {
if (UseConus) {
FSLIDER(Diameter2, "%Diameter2", 10, 100, 50, false);
FSLIDER(Diameter1, "%Diameter1", 10, 100, 50, false);
} else {
FSLIDER(Diameter2, "%Diameter", 10, 100, 50, false);
}
FSLIDER(Step, "%Step", 0.2, 20, 10, false);
SLIDER(Turns, "%Turns", 3, 20);
FSLIDER(Length,"%Length", 1, 500, 130, false);
REG_AUTO(Clockwise,"%ClockWise");
REG_AUTO(UseConus,"%UseConus");
Enumerator* E = ENUM.Get("PROFILE");
if (E->GetAmount() == 0) {
E->Add("triangle");
E->Add("trapeze");
E->Add("Rectangular");
E->Add("Round");
E->Add("Persistent");
}
REG_DROPLIST(Profile,"Profile","PROFILE");
}
void build() {
auto voxId = Scene::sculptRoot().childCount();
auto current = Scene::sculptRoot().addChild("ThreadStud"+coat::str::ToString(voxId));
auto volume = current.Volume();
volume.toSurface();
threadStud().
bodyType(UseConus?ThreadStudBodyType::StudCone:ThreadStudBodyType::StudCylinder)
}
};
EXPORT
int main() {
ui::toRoom("Sculpt");
ThreadStudPrim threadStudPrim;
threadStudPrim.ReadFromFile("data/Temp/threadStud.json");
threadStudPrim.WriteToFile("data/Temp/threadStud.json");
threadStudPrim.build();
};
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 rich dialog. You may customize it, show your custom parameters and custom buttons.
Definition CoreAPI.h:3821
dialog & params(BaseClass *params)
The important core feature. BaseClass allows to create the custom controls in the dialog....
dialog & ok()
add Ok button
dialog & cancel()
add Cancel button
int show()
Show the dialog. This is usually the last command in the chain.
dialog & caption(const char *id)
pass the caption of the dialog
prim & details(const float det_level)
set the detail level
void add(Volume &v)
add the prim into scene
thread & pitch(const float p)
set the pitch of the thread.
thread & turns(const int &n)
set the number of the thread turns.
thread & clockwise(const bool &cw)
set the clockwise flag of the thread.
thread & profile(const ThreadProfile &prf)
set the thread profile type.
thread stud primitive
Definition CorePrimAPI.h:2225
threadStud & length(const float &l)
set the stud length.
threadStud & bodyType(const ThreadStudBodyType &bt)
set the body type.
threadStud & diameterBottom(const float &d)
set the bottom diameter of the thread.
The coat namespace used for most 3DCoat API calls except low-level internal structures.
Definition CoreAPI.h:43
ThreadProfile
thread profile types
Definition CorePrimAPI.h:2089