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

This example generates the bolt composite (rim head + round thread profile)

// This example generates the bolt composite (rim head + round thread profile)
#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("boltRim"+coat::str::ToString(voxId));
auto volume = current.Volume();
// turn to surface
volume.toSurface();
// init the bolt head object
boltHead rim;
// make the "rim" head with parameters head diameter, head height, inner diameter, outer diameter
rim.head(BoltHeadType::Rim, RimParams(114,57,114,186));
// compose the bolt primitive with spicified parameters and add it into scene
bolt().head(rim).length(114).diameter(57).threadType(ThreadProfile::ThreadRound).threadLength(76).pitch(10).details(0.5).add(volume);
return 0;
}
struct of the RimParams data
Definition CorePrimAPI.h:2637
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.
bolt primitive
Definition CorePrimAPI.h:3426
bolt & pitch(const float &_p)
set the thread pitch.
bolt & head(const boltHead &_h)
set the head object.
bolt & diameter(const float &_d)
set the bolt diameter.
bolt & threadType(const int &_t)
set the screw thread profile.
bolt & length(const float &_l)
set the bolt length.
bolt & threadLength(const float &_l)
set the thread length.
prim & details(const float det_level)
set the detail level
void add(Volume &v)
add the prim into scene
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