3DCoat Core API
The 3DCoat API documentation.
Loading...
Searching...
No Matches
screw.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();
// init the bolt head object
boltHead countersunk;
// make the "countersunk" head with slit parameters
countersunk.head(BoltHeadType::Countersunk,HeadBaseParams(150,50)).slit(Slit(8,120,24,SlitType::Phillipse));
// compose the screw primitive with spicified parameters and add it into scene
screw().head(countersunk).length(260).diameter(50).threadDiameter(57).threadLength(200).pitch(15).details(0.2).add(volume);
return 0;
}
HeadBaseParams struct of the head data.
Definition CorePrimAPI.h:2492
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
class of the slits
Definition CorePrimAPI.h:2354
bolt head primitive
Definition CorePrimAPI.h:2731
boltHead & slit(const Slit &_s)
set the slit object.
boltHead & head(const HeadParams &_h)
set the head object.
prim & details(const float det_level)
set the detail level
void add(Volume &v)
add the prim into scene
screw primitive
Definition CorePrimAPI.h:3613
screw & pitch(const float &_p)
set the screw thread step(pitch).
screw & threadDiameter(const float &_d)
set the thread diameter.
screw & head(const boltHead &_h)
set the bolt head object.
screw & length(const float &_l)
set the screw length.
screw & diameter(const float &_d)
set the screw diameter.
screw & threadLength(const float &_l)
set the screw thread length.
static void toRoom(const char *name, bool Force=false)
switch to the room
The coat namespace used for most 3DCoat API calls except low-level internal structures.
Definition CoreAPI.h:43