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

This example generates the bolt heads (hexa,flat,lamb)

// This example generates the bolt heads (hexa,flat,lamb)
#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("boltheads"+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(200, 60);
// set hexa parameters data in the head
h.setData(BoltHeadType::BoltHexa,hexa);
// add the hexa head in the scene
boltHead().head(h).details(0.2).add(volume);
//create the flat bot head with diameeter = 200 and height = 60
HeadBaseParams flat(200, 60);
// set flat parameters data in the head
h.setData(BoltHeadType::Countersunk,flat);
// make the "Phillipse" slit
Slit s;
s.type(SlitType::Phillipse).width(10).height(120).depth(10);
// add the hexa head in the scene
boltHead().head(h).slit(s).x(-300).details(0.2).add(volume);
// make the lamb head with length = 300 and height = 70
LambParams lamb(260, 70, 100, 30, 80, 10);
// set lamb parameters data in the head
h.setData(BoltHeadType::Lamb,lamb);
// add the hexa head in the scene
boltHead().head(h).z(300).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.
struct of the LambParams data
Definition CorePrimAPI.h:2570
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
Slit & height(const float &_h)
set the height.
Slit & type(const int &_t)
set the slit type.
Slit & depth(const float &_d)
set the depth.
Slit & width(const float &_w)
set the width.
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
prim & x(float x)
shift the primitive along the x - axis
prim & z(float z)
shift the primitive along the z - axis
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