3DCoat Core API
The 3DCoat API documentation.
Loading...
Searching...
No Matches
bolt_binary.cpp

This example generates the bolt composite (bolt head + thread stud)

// This example generates the bolt composite (bolt head + thread stud)
#include <CoreAPI.h>
using namespace coat;
//@config: Debug
EXPORT
int main() {
// get to sculpt room
coat::ui::toRoom("Sculpt");
// add new volume
auto current = coat::Scene::sculptRoot().addChild("bolt"+coat::str::ToString(voxId));
auto volume = current.Volume();
// turn to surface
volume.toSurface();
//create the hexa bot head
// make the hexa head with diameeter = 200 and height = 60
HeadBaseParams hexa(100, 30);
// set hexa parameters data in the head
h.setData(BoltHeadType::BoltHexa,hexa);
// make the thread stud
threadStud().diameter(50).length(200).pitch(10).turns(15).profile(ThreadProfile::ThreadTriangle).details(0.2).add(volume);
// add the hexa head in the scene
boltHead().head(h).y(100).details(0.2).add(volume);
return 0;
}
HeadBaseParams struct of the head data.
Definition CorePrimAPI.h:2492
class HeadParams
Definition CorePrimAPI.h:2444
HeadParams & setData(int _type, void *param)
set the parameters data with specified type.
int childCount() const
returns the child elements count
SceneElement addChild(const char *name) const
add the child element of the same nature
static SceneElement sculptRoot()
get the root of all sculpt objects
bolt head primitive
Definition CorePrimAPI.h:2731
boltHead & head(const HeadParams &_h)
set the head object.
prim & details(const float det_level)
set the detail level
prim & y(float y)
shift the primitive along the y - axis
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 & 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 & diameter(const float &d)
set the diameter of the thread.
static void toRoom(const char *name)
switch to the room
The coat namespace used for most 3DCoat API calls except low-level internal structures.
Definition CoreAPI.h:43