3DCoat Core API
The 3DCoat API documentation.
Loading...
Searching...
No Matches
CorePrimAPI.h
1#pragma once
2
3#include "CoreAPI.h"
4
5#define to_scast_obj(T,obj) static_cast<T*>(obj)
6
7#pragma pack(push, 1)
8
9namespace coat {
10 using namespace comms;
11 typedef One2DCurve curve2d;
15 class APICALL prim {
16 public:
30 prim& name(const char* s);
34 str name() const;
39 void add(Volume& v);
44 void subtract(Volume& v);
49 void intersect(Volume& v);
55 void merge(Volume& v, const BoolOpType op);
66 prim& color(DWORD CL);
67
76 prim& color(float r, float g, float b, float a);
77
85 prim& color(float r, float g, float b);
86
93 prim& color(const char* colorid);
94
100 prim& gloss(float value);
101
107 prim& roughness(float value);
108
114 prim& metal(float value);
115
122 prim& opacity(float value);
127 prim& details(const float det_level);
132 float details();
138 prim& transform(const mat4& t);
149 prim& scale(float scale);
155 prim& scale(const vec3& v);
160 vec3 scale() const;
166 prim& translate(const vec3& _pos);
179 prim& translate(float x, float y, float z);
185 prim& x(float x);
191 prim& y(float y);
197 prim& z(float z);
203 prim& auto_divide(float average_div);
209 prim& step_divide(float step);
215 prim& fillet(float radius);
220 static void debug_on(bool isOn=true);
224 static void debug_clear();
229 static void push_transform(const mat4& t);
235 static void push_translate(const vec3& d);
241 static void push_scale(float scale);
247 static void push_scale(const vec3& s);
253 static void push_details(float details_modulator);
258 static void reset_transform();
263 template <typename T>
264 T& Obj() { return to_cast_this<T>(); }
269 template <typename T>
270 bool isAs() { return dynamic_cast<const T*>(this) != NULL; }
275 virtual float fillet_relative();
276 protected:
281 template<class T>
282 T& to_cast_this() { return *static_cast<T*>(this); }
287 virtual cMeshContainer* create_mesh() { return nullptr; }
293 void merge_debug(Volume& vol, Mesh& mesh);
294 prim* _this;
295private:
296
297 int _nx;
298 int _ny;
299 int _nz;
300
301 float _average_div;
302 float _step_div;
303
304 mat4 _transform;
305 float _details;
306 str _name;
307
308 static mat4 _ovTransform;
309 static float _ovDetails;
310 static bool _prmDebug;
311 static SceneElement _seDebug;
312
313 DWORD _Color;
314
315 float _fillet;
319 virtual void average_devide() { ; }
325 float filletRadiusRelative(float rmax);
326
327 friend class box;
328 friend class sphere;
329 friend class ellipse;
330 friend class cylinder;
331 friend class cone;
332 friend class tube;
333 friend class gear;
334 friend class ngon;
335 friend class capsule;
336 friend class torus;
337 friend class spiral;
338
339 template <typename T> T& _src(T* s) {
340 auto* t = dynamic_cast<T*>(_this);
341 if (t)return *t;
342 return *s;
343 }
344 };
348 class APICALL box : public prim {
349 public:
363 box(float sizeX, float sizeY, float sizeZ);
369 box(const vec3& size);
375 box(const vec3& pos, const vec3& size);
382 box(const vec3& pos, const vec3& size, float fillet);
388 box& axis(const vec3& directionX);
395 box& axis(const vec3& directionX, const vec3& directionY);
403 box& axis(const vec3& directionX, const vec3& directionY, const vec3& directionZ);
431 box& divide(int nx, int ny, int nz);
437 box& size(const vec3& _size);
445 box& size(float x, float y, float z);
450 vec3 size() const;
455 virtual float fillet_relative();
456 protected:
460 void init();
465 virtual cMeshContainer* create_mesh();
466 private:
467 vec3 _axisx;
468 vec3 _axisy;
469 vec3 _axisz;
470 vec3 _side;
474 virtual void average_devide();
475 friend class torus;
476 };
480 class APICALL torus :public box {
481 public:
491 torus(const float& ringRadius, const float& crossSectionRadius);
498 torus(const vec3& pos, const float& ringRadius, const float& crossSectionRadius);
504 torus& slices(const int& _slices);
509 int slices() const;
515 torus& rings(const int& _rings);
520 int rings() const;
526 torus& radius(const float& r);
531 float radius()const;
537 torus& section_radius(const float& section_r);
542 float section_radius() const;
548 torus& diameter(const float& d);
553 float diameter()const;
559 torus& section_diameter(const float& section_d);
564 float section_diameter() const;
570 torus& sector_on(const bool& _switch);
575 bool sector_on() const;
581 torus& slices_angle(const float& angle);
586 float slices_angle() const;
592 torus& rings_angle(const float& angle);
597 float rings_angle() const;
598
599 protected:
604 virtual cMeshContainer* create_mesh();
605 private:
606 float _ringRadius;
607 float _crossSectionRadius;
608 float _slicesAngle;
609 float _ringsAngle;
610 bool _isSector;
611
615 virtual void average_devide();
616 };
620 class APICALL sphere : public prim {
621 public:
627 DIV_TRIANGLE = 0,
629 DIV_MERIDIAN = 1,
631 DIV_CUBE = 2
632 };
641 sphere(float radius);
647 sphere(const vec3& pos, float radius);
653 sphere& radius(const float& r);
658 float radius() const;
664 sphere& diameter(const float& d);
669 float diameter() const;
675 sphere& sub_division(const int subdiv);
680 int sub_division() const;
697 sphere& rings(const int& _rings);
702 int rings() const;
708 sphere& slices(const int& _slices);
713 int slices() const;
719 sphere& sector_on(const bool& _switch);
724 bool sector_on() const;
730 sphere& slice_from(const float& angle);
735 float slice_from() const;
741 sphere& slice_to(const float& angle);
746 float slice_to() const;
752 sphere& ring_from(const float& angle);
757 float ring_from() const;
763 sphere& ring_to(const float& angle);
768 float ring_to() const;
769
770 protected:
775 virtual cMeshContainer* create_mesh();
781 virtual void density_subdiv(int& slices, int& rings);
782 private:
783 float _radius;
784 int _subdiv;
785 rect _sector;
786 bool _bsector;
787 DivisionMode _divmode;
791 virtual void average_devide();
792 friend class ellipse;
793 };
797 class APICALL ellipse : public sphere {
798 public:
810 ellipse(const vec3& pos, float rx, float ry, float rz);
816 ellipse(const vec3& pos, const vec3& size);
821 ellipse(const vec3& size);
829 ellipse& axis(const vec3& directionX, const vec3& directionY = vec3::AxisY, const vec3& directionZ = vec3::AxisZ);
840 ellipse& size(const vec3& _size);
845 vec3 size() const;
846
847 protected:
851 void init();
856 virtual cMeshContainer* create_mesh();
862 virtual void density_subdiv(int& slices, int& rings);
863 private:
864 vec3 _axisx;
865 vec3 _axisy;
866 vec3 _axisz;
867 vec3 _side;
871 virtual void average_devide();
872 };
876 class APICALL cylinder : public prim {
877 public:
889 cylinder(const float& height, const float& radiusTop, const float& radiusBottom, const float& fillet=0.0);
898 cylinder(const vec3& posTop, const vec3& posBottom, const float& radiusTop, const float& radiusBottom, const float& fillet=0.0);
926 cylinder& radiusTop(const float& r);
931 float radiusTop() const;
937 cylinder& radiusBottom(const float& r);
942 float radiusBottom() const;
948 cylinder& radius(const float& r);
953 float radius() const;
959 cylinder& diameterTop(const float& d);
964 float diameterTop() const;
970 cylinder& diameterBottom(const float& r);
975 float diameterBottom() const;
981 cylinder& diameter(const float& d);
986 float diameter() const;
992 cylinder& height(const float& _height);
997 float height() const;
1003 cylinder& sectorAngle(const float& angle);
1008 float sectorAngle() const;
1014 cylinder& topCapScale(const float& scale);
1019 float topCapScale() const;
1025 cylinder& bottomCapScale(const float& scale);
1030 float bottomCapScale() const;
1036 cylinder& slices(const int& nslices);
1041 int slices() const;
1047 cylinder& rings(const int& nrings);
1052 int rings() const;
1058 cylinder& caps(const int& ncaps);
1063 int caps() const;
1068 virtual float fillet_relative();
1069 protected:
1074 virtual cMeshContainer* create_mesh();
1080 cMeshContainer* getCylinderPrim(bool iscone = false);
1086 private:
1087 vec3 _positionTop;
1088 vec3 _positionBottom;
1089 float _radiusTop;
1090 float _radiusBottom;
1091 float _sectorAngle;
1092 float _topCapScale;
1093 float _bottomCapScale;
1097 virtual void average_devide();
1098 friend class cone;
1099 friend class capsule;
1100 friend class ngon;
1101 friend class tube;
1102 };
1106 class APICALL cone : public cylinder {
1107 public:
1118 cone(const float& height, const float& radiusBottom, const float& fillet = 0.0);
1126 cone(const vec3& posTop, const vec3& posBottom, const float& radiusBottom, const float& fillet = 0.0);
1132 cone& radius(const float& r);
1137 float radius() const;
1143 cone& diameter(const float& d);
1148 float diameter() const;
1153 float fillet_relative() override;
1154 protected:
1159 virtual cMeshContainer* create_mesh();
1160 private:
1164 virtual void average_devide();
1165 };
1169 class APICALL tube : public cylinder {
1170 public:
1181 tube(const float& height, const float& radiusTop, const float& radiusBottom);
1189 tube(const float& height, const float& radiusTop, const float& radiusBottom, const float& fillet);
1198 tube(const float& height, const float& radiusTop, const float& radiusBottom, const float& relativeHoleRadius, const float& fillet);
1207 tube(const vec3& posTop, const vec3& posBottom, const float& radiusTop, const float& radiusBottom, const float& relativeHoleRadius);
1217 tube(const vec3& posTop, const vec3& posBottom, const float& radiusTop, const float& radiusBottom, const float& relativeHoleRadius, const float& fillet);
1223 tube& relativeHoleRadius(const float& r);
1228 float relativeHoleRadius() const;
1234 tube& thickness(const float& w);
1239 float thickness() const;
1244 float fillet_relative() override;
1245 protected:
1250 virtual cMeshContainer* create_mesh();
1251 private:
1252 float _relativeHoleRadius;
1253 float _thickness;
1257 virtual void average_devide();
1258 };
1262 class APICALL gear : public tube {
1263 public:
1274 gear(const float& height, const float& radiusTop, const float& radiusBottom);
1284 gear(const float& height, const float& radiusTop, const float& radiusBottom, float depth, float sharpness = 0.5, const int& order = 16);
1294 gear(const vec3& posTop, const vec3& posBottom, const float& radiusTop, const float& radiusBottom, float depth = 0.1, float sharpness = 0.5, const int& order = 16);
1300 gear& depth(const float& __depth);
1305 float depth() const;
1311 gear& sharpness(const float& sharp);
1316 float sharpness() const;
1322 gear& order(const int& nteeth);
1327 int order() const;
1328 protected:
1333 virtual cMeshContainer* create_mesh();
1334 private:
1335 float _depth;
1336 float _sharpness;
1337 int _order;
1341 virtual void average_devide();
1342 friend class ngon;
1343 };
1347 class APICALL ngon : public gear {
1348 public:
1360 ngon(const float& height, const float& radiusTop, const float& radiusBottom, const int& order);
1369 ngon(const float& height, const float& radiusTop, const float& radiusBottom, const float& fillet, const int& order);
1378 ngon(const vec3& posTop, const vec3& posBottom, const float& radiusTop, const float& radiusBottom, const int& order);
1383 virtual float fillet_relative();
1384 protected:
1389 virtual cMeshContainer* create_mesh();
1390 };
1394 class APICALL capsule :public cylinder {
1395 public:
1406 capsule(const float& height, const float& radiusTop, const float& radiusBottom);
1414 capsule(const vec3& posTop, const vec3& posBottom, const float& radiusTop, const float& radiusBottom);
1415 protected:
1420 virtual cMeshContainer* create_mesh();
1421 private:
1425 virtual void average_devide();
1426 };
1427
1431 enum class SpiralProfile {
1433 CIRCLE = 0,
1435 RECTANGLE = 1
1436 };
1437
1441 class APICALL spiral:public prim {
1442 public:
1454 spiral(const float& out_radius, const float& in_radius, const float& _sstep, const float& nturns);
1460 spiral& radius(const float& r);
1465 float radius() const;
1471 spiral& profile_radius(const float& r);
1476 float profile_radius() const;
1482 spiral& diameter(const float& d);
1487 float diameter() const;
1493 spiral& profile_diameter(const float& d);
1498 float profile_diameter() const;
1504 spiral& turns(const int nturns);
1509 int turns() const;
1515 spiral& step(const float& vstep);
1520 float step() const;
1533 spiral& profile_rect(const float width, const float height);
1539 spiral& clock_wise(const bool& clockWise);
1544 bool clock_wise() const;
1549 float profile_height() const;
1554 float profile_width() const;
1560 spiral& slices(const int& nslices);
1565 int slices() const;
1571 spiral& rings(const int& nrings);
1576 int rings() const;
1582 spiral& caps(const int& ncaps);
1587 int caps() const;
1588 protected:
1593 virtual cMeshContainer* create_mesh();
1594 private:
1595 int _turns;
1596 float _step;
1597 float _radius;
1598 float _profile_radius;
1599 float _profile_width;
1600 float _profile_height;
1601 bool _clock_wise;
1602 SpiralProfile _profile_type;
1606 virtual void average_devide();
1607 };
1608
1613 Regular = 0,
1614 Italic = 1 << 0,
1615 Underline = 1 << 1,
1616 StrikeThrough = 1 << 2
1617 };
1618
1619 enum FontWeight {
1620 Dont = 0,
1621 Thin = 100,
1622 ExtraLight = 200,
1623 Light = 300,
1624 Normal = 400,
1625 Medium = 500,
1626 DemiBold = 600,
1627 Bold = 700,
1628 ExtraBold = 800,
1629 Black = 900
1630 };
1631
1635 class APICALL FontInfo {
1636 public:
1637 int size;
1638 int weight;
1639 int style;
1640 std::string fname;
1641 };
1642
1643 class APICALL Font {
1644 public:
1645
1654 Font(const FontInfo& _finfo);
1659 Font(const char* _fname);
1665 Font(const char* _fname, const int& _st);
1671 Font& size(const int& _size);
1676 int size() const;
1682 Font& weight(const int& weight);
1687 int weight() const;
1693 Font& style(const int st);
1698 int style() const;
1704 Font& name(const char* _fname);
1709 const char* name() const;
1713 void select();
1714 private:
1718 void init();
1722 void save(void);
1727 FontInfo& info() { return _finfo; }
1728 const FontInfo& info() const { return _finfo; }
1729 FontInfo _finfo;
1730 };
1731
1735 class APICALL text :public prim {
1736 public:
1745 text(const char* s);
1750 text& string(const char* s);
1755 str string() const;
1761 text& font(const Font& f);
1766 Font font() const;
1772 text& width(const float& w);
1777 float width() const;
1783 text& depth(const float& d);
1788 float depth() const;
1794 text& bendRadius(const float& radius);
1799 float bendRadius() const;
1805 text& extraRotation(const float& rotation);
1810 float extraRotation() const;
1816 text& invertBending(const bool& _binvert);
1821 float invertBending() const;
1822 protected:
1827 virtual cMeshContainer* create_mesh();
1832 void update_mesh(cMeshContainer* mc);
1833 private:
1834 str _string;
1835 Font _font;
1836 vec2 _size;
1837 float _rotation;
1838 float _bendRadius;
1839 bool _invertBending;
1843 void init();
1844 };
1848 class APICALL lathe :public box {
1849 bool untouched;
1850 public:
1855 regular=0,
1856 bspline=1,
1857 sharp=2,
1858 locked=3,
1859 vertical=4,
1860 horizontal=5
1861 };
1865 enum Type {
1866 cylinder=0,
1867 rectangle=1
1868 };
1894 lathe& add_point(const vec2& point, int st);
1899 curve2d* profile() const;
1908 protected:
1913 virtual cMeshContainer* create_mesh();
1914 private:
1915 Type _type;
1916 curve2d* _profile;
1920 void init();
1921 };
1922
1926 class APICALL image :public text {
1927 public:
1931 struct ParamInfo {
1932 str topTexture;
1933 str topBumpTexture;
1934 str bottomTexture;
1935 str bottomBumpTexture;
1936 str strencilTexture;
1937 str bottomStrencilTexture;
1938 float basicThickness;
1939 float bumpThickness;
1940 float taperAngle;
1941 float topBottomWeight;
1942 float sizeInScene;
1943 };
1953 image& topTexture(const char* _texture);
1964 image& topBumpTexture(const char* _texture);
1975 image& bottomTexture(const char* _texture);
1986 image& bottomBumpTexture(const char* _texture);
1997 image& strencilTexture(const char* _texture);
2008 image& bottomStrencilTexture(const char* _texture);
2019 image& basicThickness(const float& _thickness);
2024 float basicThickness() const;
2030 image& bumpThickness(const float& _thickness);
2035 float bumpThickness() const;
2041 image& taperAngle(const float& _angle);
2046 float taperAngle() const;
2052 image& topBottomWeight(const float& weight);
2057 float topBottomWeight() const;
2063 image& sizeInScene(const float& _size);
2068 float sizeInScene() const;
2069
2070 protected:
2075 virtual cMeshContainer* create_mesh();
2076 private:
2077 ParamInfo _paramInfo;
2082 ParamInfo& paramInfo() { return _paramInfo; }
2083 const ParamInfo& paramInfo() const { return _paramInfo; }
2084 };
2085
2090 ThreadNone = -1,
2091 ThreadTriangle = 0,
2092 ThreadTrapeze = 1,
2093 ThreadRectangular = 2,
2094 ThreadRound = 3,
2095 ThreadPersistent = 4
2096 };
2097
2101 class APICALL thread :public prim {
2102 public:
2112 thread& diameter(const float d);
2117 float diameter() const;
2123 thread& pitch(const float p);
2128 float pitch() const;
2134 thread& stub(const float& l);
2139 float stub() const;
2145 thread& height(const float& h);
2150 float height() const;
2156 thread& turns(const int& n);
2161 int turns() const;
2167 thread& clockwise(const bool& cw);
2172 bool clockwise() const;
2178 thread& close(const bool& b);
2183 bool close() const;
2195
2196 protected:
2201 virtual cMeshContainer* create_mesh();
2202 private:
2203 ThreadProfile _profile;
2204 float _diameter;
2205 float _pitch;
2206 float _stub;
2207 float _height;
2208 bool _close;
2209 bool _clockwise;
2210 int _turns;
2211 friend class threadStud;
2212 };
2213
2218 StudCylinder = 0,
2219 StudCone = 1
2220 };
2221
2225 class APICALL threadStud : public thread {
2226 public:
2227
2237 threadStud& diameter(const float& d);
2242 float diameter() const;
2248 threadStud& diameterTop(const float& d);
2253 float diameterTop() const;
2259 threadStud& diameterBottom(const float& d);
2264 float diameterBottom() const;
2270 threadStud& length(const float& l);
2275 float length() const;
2280 float threadLength() const;
2287 threadStud& enableThread(const bool& enable);
2292 bool enableThread() const;
2304
2305 protected:
2310 virtual cMeshContainer* create_mesh();
2311 private:
2312 float _diameterTop;
2313 float _diameterBottom;
2314 float _length;
2315 bool _enableThread;
2316 ThreadStudBodyType _bodyType;
2317 };
2318
2323 none = -1,
2324 Slot = 0,
2325 Phillipse = 1,
2326 Pozidriv = 2,
2327 Robertson = 3,
2328 HexSocket = 4,
2329 SecurityHexSocket = 5,
2330 Torx = 6,
2331 SecurityTorx = 7,
2332 TriWing = 8,
2333 TorqSet = 9,
2334 TripleSquare = 10,
2335 Polydrive = 11,
2336 DoubleSquare = 12,
2337 SplineDrive = 13,
2338 DoubleHex = 14,
2339 Bristol = 15,
2340 Pentalobular = 16,
2341 Frearson = 17,
2342 SnakeEyes = 18,
2343 TA = 19,
2344 TP3 = 20,
2345 MorTorq = 21,
2346 ClutCHG = 22,
2347 ClutCHA = 23,
2348 GroupEyes = 24
2349 };
2350
2354 class APICALL Slit {
2355 public:
2367 Slit(float w, float h, float d, SlitType t);
2373 Slit& type(const int& _t);
2378 int type() const;
2384 Slit& width(const float& _w);
2389 float width() const;
2395 Slit& height(const float& _h);
2400 float height() const;
2406 Slit& depth(const float& _d);
2411 float depth() const;
2412
2413 private:
2414 float _width;
2415 float _height;
2416 float _depth;
2417 int _type;
2418 };
2419
2424 BoltNone = -1, // none
2425 BoltHexa = 0, // NutHexaParams
2426 Countersunk = 1,// countersunk(flat)
2427 BoltRound = 2, // round
2428 Pan = 3, // pan
2429 Dome = 4, // dome
2430 Oval = 5, // oval
2431 Square = 6, // square
2432 TShaped = 7, // t-shaped
2433 Cylinder = 8, // cylinder
2434 Lamb = 9, // LambParams
2435 Rim = 10, // RimParams
2436 Eye = 11, // EyeParams
2437 Bugle = 12, // bugle
2438 Clop = 13 // clop (self-tapping screw)
2439 };
2440
2444 class APICALL HeadParams {
2445 public:
2455 HeadParams(int _type, void* _param);
2465 HeadParams& setData(int _type, void* param);
2470 void* getData() const;
2474 HeadParams& operator = (const HeadParams& h);
2478 void copy(const HeadParams& h);
2482 void release();
2483 private:
2484 int _what;
2485 void* _data;
2486 };
2487
2488
2492 class APICALL HeadBaseParams {
2493 public:
2503 HeadBaseParams(float _d, float _h);
2519 operator void* () const;
2520 float _diameter;
2521 float _height;
2522 };
2523
2527 class APICALL TShapedParams {
2528 public:
2539 TShapedParams(float _d, float _h, float _w);
2561 operator void* () const;
2562 float _diameter;
2563 float _height;
2564 float _width;
2565 };
2566
2570 class APICALL LambParams {
2571 public:
2585 LambParams(float _l, float _dtop, float _dbottom, float _hh, float _h, float _thick);
2591 LambParams& length(float _l);
2609 LambParams& height(float _h);
2625 operator void* () const;
2626 float _length;
2627 float _diameterTop;
2628 float _diameterBottom;
2629 float _headHeight;
2630 float _height;
2631 float _thickness;
2632 };
2633
2637 class APICALL RimParams {
2638 public:
2650 RimParams(float _d, float _h, float _d1, float _d2);
2675
2679 operator void* () const;
2680 float _shoulderDiameter;
2681 float _shoulderHeight;
2682 float _inRingDiameter;
2683 float _outRingDiameter;
2684 };
2685
2689 class APICALL EyeParams {
2690 public:
2701 EyeParams(float _thick, float _d1, float _d2);
2723 operator void* () const;
2724 float _thickness;
2725 float _inRingDiameter;
2726 float _outRingDiameter;
2727 };
2731 class APICALL boltHead : public prim {
2732 public:
2752 const HeadParams& head() const;
2759 boltHead& head(const int& _type, void* data);
2765 boltHead& slit(const Slit& _s);
2775 const Slit& slit() const;
2779 boltHead& operator = (const boltHead& h);
2780 protected:
2785 virtual cMeshContainer* create_mesh();
2786 private:
2787 HeadParams _head;
2788 Slit _slit;
2789 };
2790
2794 enum NutType {
2795 NutNone = -1,
2796 NutHexa = 0,
2797 Quard = 1,
2798 Acorn = 2,
2799 Lowacorn = 3,
2800 NutFlange = 4,
2801 Slits = 5,
2802 Radial = 6,
2803 NutLamb = 7,
2804 NutRim = 8,
2805 Selflock = 9,
2806 NutTShaped = 10,
2807 Clamplever = 11,
2808 NtCount = 12
2809 };
2810
2811
2812 class APICALL NutHeadBaseParams {
2813 public:
2824 NutHeadBaseParams(NutType t, float d, float h);
2830 NutHeadBaseParams& diameter(const float& d);
2835 float diameter() const;
2841 NutHeadBaseParams& height(const float& h);
2846 float height()const;
2850 operator void* () const;
2861 int type() const;
2868
2869 private:
2870 int _type;
2871 float _diameter;
2872 float _height;
2873 };
2874
2875 // NutHexaParams
2876 class APICALL NutHexaParams : public NutHeadBaseParams {
2877 public:
2887 NutHexaParams(float d, float h);
2888 };
2889
2890 class APICALL NutQuardParams : public NutHeadBaseParams {
2900 NutQuardParams(float d, float h);
2901 };
2902
2903 class APICALL NutAcornParams : public NutHeadBaseParams {
2904 public:
2915 NutAcornParams(float d, float h, float h1);
2921 NutAcornParams& facetHeight(const float& _h);
2926 float facetHeight() const;
2933 private:
2934 float _facetHeight;
2935 };
2936
2937 class APICALL NutLowAcornParams : public NutAcornParams {
2938 public:
2949 NutLowAcornParams(float d, float h, float h1);
2950 };
2951
2952 class APICALL NutSelfLockParams : public NutAcornParams {
2953 public:
2964 NutSelfLockParams(float d, float h, float h1);
2965 };
2966
2967 class APICALL NutTShapedParams : public NutAcornParams {
2968 public:
2979 NutTShapedParams(float d, float h, float h1);
2980 };
2981
2982 class APICALL NutFlangeParams : public NutHeadBaseParams {
2983 public:
2993 NutFlangeParams(float d, float h);
3001 NutFlangeParams(float d, float h, float fw, float fh);
3007 NutFlangeParams& facetWidth(const float& w);
3018 float facetWidth() const;
3023 float facetHeight() const;
3030 private:
3031 float _facetWidth;
3032 float _facetHeight;
3033 };
3034
3035 class APICALL NutRadialParams : public NutHeadBaseParams {
3036 public:
3046 NutRadialParams(float d, float h);
3054 NutRadialParams(float d, float h, float d1, float d2);
3066 NutRadialParams& holeDepth(const float& d);
3071 float holeDiameter() const;
3076 float holeDepth() const;
3082 NutRadialParams& holePlace(const int& place);
3087 int holePlace() const;
3094 private:
3095 float _holeDiameter;
3096 float _holeDepth;
3097 int _holePlace;
3098 };
3099
3100 class APICALL NutLambParams : public NutHeadBaseParams {
3101 public:
3111 NutLambParams(float d, float h);
3117 NutLambParams& length(const float& _l);
3129 NutLambParams& diameterTop(const float& _d);
3135 NutLambParams& headHeight(const float& _h);
3141 NutLambParams& thickness(const float& _t);
3146 float length() const;
3151 float diameterBottom() const;
3156 float diameterTop() const;
3162 float headHeight() const;
3167 float thickness() const;
3174
3175 private:
3176 float _diameterBottom;
3177 float _diameterTop;
3178 int _length;
3179 int _thickness;
3180 int _headHeight;
3181 };
3182
3183 class APICALL NutSlitsParams : public NutHeadBaseParams {
3184 public:
3194 NutSlitsParams(float d, float h);
3200 NutSlitsParams& width(const float& w);
3206 NutSlitsParams& length(const float& l);
3212 NutSlitsParams& count(const int& n);
3217 float width() const;
3222 float length() const;
3227 int count() const;
3234 private:
3235 float _width;
3236 float _length;
3237 int _count;
3238 };
3239
3240 class APICALL NutRimParams : public NutHeadBaseParams {
3241 public:
3251 NutRimParams(float d, float h);
3257 NutRimParams& inRingDiameter(const float& _d);
3268 float inRingDiameter() const;
3273 float outRingDiameter() const;
3280 private:
3281 float _inRingDiameter;
3282 float _outRingDiameter;
3283 };
3284
3285 class APICALL NutClampLever : public NutHeadBaseParams {
3286 public:
3296 NutClampLever(float d, float h);
3308 NutClampLever& length(const float& _l);
3313 float holderDiameter() const;
3318 float length() const;
3325 private:
3326 float _holderDiameter;
3327 float _length;
3328 };
3329
3333 class APICALL nut : public prim {
3334 public:
3348 nut& setTypeData(void* data);
3359 nut& threadDiameter(const float& d);
3364 float threadDiameter() const;
3370 nut& pitch(const float& p);
3375 float pitch() const;
3381 nut& enableThread(const bool& f);
3386 bool enableThread() const;
3392 nut& threadType(const int& _t);
3397 int threadType() const;
3398
3399 protected:
3403 void release();
3408 virtual cMeshContainer* create_mesh();
3409 private:
3410 float _threadDiameter;
3411 float _pitch;
3412 int _threadType;
3413 bool _enableThread;
3414 void* _typeData;
3415 };
3416
3417 enum ThreadSurface {
3418 ThreadCylinder,
3419 ThreadCone,
3420 ThreadEdge
3421 };
3422
3426 class APICALL bolt : public prim {
3427 public:
3435 struct Info {
3436 float _diameter; // thread diameter
3437 float _pitch; // screw thread step
3438 float _theight; // screw thread height
3439 float _length; // bolt length
3440 float _tlength; // screw thread length
3441 int _ttype; // screw thread profile type (triangle,trapeze,rectangular,round)
3442 int _uhead; // underhead (-1-none, 0-cylinder,1-rect)
3443 float _uwidth; // underhead width
3444 float _uheight; // underhead height
3445 boltHead _head; // head
3446 int _nuttype; // nut type
3447 float _nutloc; // nut location reference thread
3448 float _nutHeight; // nut height
3449 };
3455 bolt& head(const boltHead& _h);
3460 const boltHead& head() const;
3466 bolt& diameter(const float& _d);
3471 float diameter();
3477 bolt& pitch(const float& _p);
3482 float pitch();
3488 bolt& threadHeight(const float& _h);
3499 bolt& length(const float& _l);
3504 float length();
3510 bolt& threadLength(const float& _l);
3521 bolt& threadType(const int& _t);
3532 bolt& underhead(const int& _uh);
3543 bolt& uwidth(const int& _uw);
3548 float uwidth();
3554 bolt& uheight(const int& _uh);
3559 float uheight();
3565 bolt& nutType(const int& _t);
3570 int nutType();
3576 bolt& nutLocation(const float& _loc);
3587 bolt& nutHeight(const float& _h);
3592 float nutHeight();
3593
3594 protected:
3599 virtual cMeshContainer* create_mesh();
3600 private:
3605 Info& info();
3606 const Info& info() const;
3607 Info _info;
3608 };
3609
3613 class APICALL screw : public prim {
3614 public:
3618 struct Info {
3619 float _diameter; // core diameter
3620 float _pitch; // screw thread step
3621 float _theight; // screw thread height
3622 float _tlength; // screw thread length
3623 float _tdiameter; // screw thread diameter
3624 float _length; // screw length
3625 int _uhead; // underhead (-1 none, 0-cylinder,1-rect)
3626 int _uwidth; // underhead width
3627 int _uheight; // underhead height
3628 boltHead _head; // bolt head
3629 };
3639 screw& head(const boltHead& _h);
3644 const boltHead& head() const;
3650 screw& diameter(const float& _d);
3655 float diameter();
3661 screw& pitch(const float& _p);
3666 float pitch();
3672 screw& threadDiameter(const float& _d);
3683 screw& threadHeight(const float& _h);
3694 screw& threadLength(const float& _l);
3705 screw& length(const float& _l);
3710 float length();
3716 screw& underhead(const int& _uh);
3727 screw& uwidth(const int& _uw);
3732 float uwidth();
3738 screw& uheight(const int& _uh);
3743 float uheight();
3744 protected:
3749 virtual cMeshContainer* create_mesh();
3750 private:
3755 Info& info();
3756 const Info& info() const;
3757 Info _info;
3758 };
3759
3763 class APICALL washer : public prim {
3764 public:
3768 enum Type {
3769 None = -1,
3770 Flat = 0,
3771 Grover = 1,
3772 Plate = 2,
3773 Wave = 3,
3774 Quard = 4,
3775 Sphere = 5,
3776 Conus = 6,
3777 Springlock = 7
3778 };
3788 washer& innerDiameter(const float& _d);
3793 float innerDiameter() const;
3799 washer& outerDiameter(const float& _d);
3804 float outerDiameter() const;
3810 washer& conusDiameter(const float& _d);
3815 float conusDiameter() const;
3821 washer& thickness(const float& _s);
3826 float thickness() const;
3832 washer& height(const float& _h);
3837 float height() const;
3843 washer& facet(const bool& _f);
3848 bool facet() const;
3860
3861 protected:
3866 virtual cMeshContainer* create_mesh();
3867 private:
3868 float _innerDiameter;
3869 float _outerDiameter;
3870 float _conusDiameter;
3871 float _thickness;
3872 float _height;
3873 bool _facet;
3874 Type _type;
3875 };
3876
3880 class APICALL freeform: public prim {
3881 public:
3882 typedef list<vec3> Points3D;
3883 struct ffElement {
3884 str name;
3885 list<str> subpaths;
3886 };
3887 typedef list<ffElement> ffObjsList;
3888 struct ffInfo {
3889 str name;
3890 str subName;
3891 bool symX;
3892 bool symY;
3893 bool symZ;
3894 Points3D points;
3895 };
3905 freeform(const char *_ffname, const char* _ffsubname);
3915 freeform& symx(const bool& x);
3921 freeform& symy(const bool& y);
3927 freeform& symz(const bool& z);
3935 freeform& size(float x, float y, float z);
3941 freeform& size(const vec3& v);
3948 freeform& ffname(const char* name);
3953 const char* ffname() const;
3959 freeform& ffsubname(const char* name);
3964 const char* ffsubname() const;
3971 freeform& SetPoint(int i, const vec3& point);
3976 int CountPoints() const;
3997 ffObjsList& objsList();
4002 Points3D& ffControlPoints();
4003 protected:
4008 virtual cMeshContainer* create_mesh();
4009 private:
4014 void SetupPoints();
4019 void SetObjectPaths();
4024 ffInfo& info();
4025 const ffInfo& info() const;
4026 /*
4027 * \brief gets the current object name.
4028 * \return object name
4029 */
4030 str& objName();
4031
4032 ffInfo _info;
4033 ffObjsList _ffobjs;
4034 list<str>* _subNames;
4035 str _objName;
4036 vec3 _side;
4037 int _ffDim[3];
4038 };
4039
4040}
4041#pragma pack(pop)
struct of the EyeParams data
Definition CorePrimAPI.h:2689
EyeParams & thickness(float _t)
set the thickness.
EyeParams()
constructor.
EyeParams & outRingDiameter(float _d)
set the outer ring diameter.
EyeParams & inRingDiameter(float _d)
set the inner ring diameter.
EyeParams(float _thick, float _d1, float _d2)
constructor.
Definition CorePrimAPI.h:1643
Font(const char *_fname, const int &_st)
constructs a new font object.
Font(const FontInfo &_finfo)
constructs a new font object.
int weight() const
get the font weight
int style() const
get the font style
Font(const char *_fname)
constructs a new font object.
Font & weight(const int &weight)
set the font weight
int size() const
get the font size
Font & size(const int &_size)
set the font size
Font & name(const char *_fname)
set the font name
Font()
The Font class specifies a query for a font used for drawing text.
Font & style(const int st)
set the style of the font
void select()
selects a font object into the viewport
const char * name() const
get the font name
Holds the general information about font.
Definition CorePrimAPI.h:1635
HeadBaseParams struct of the head data.
Definition CorePrimAPI.h:2492
HeadBaseParams()
constructor.
HeadBaseParams & diameter(float _d)
set the diameter.
HeadBaseParams(float _d, float _h)
constructor.
HeadBaseParams & height(float _h)
set the height.
class HeadParams
Definition CorePrimAPI.h:2444
HeadParams(int _type, void *_param)
constructor.
void release()
release the data
~HeadParams()
destructor
HeadParams()
constructor
void * getData() const
get the head data
HeadParams & setData(int _type, void *param)
set the parameters data with specified type.
void copy(const HeadParams &h)
copies the HeadParams object
struct of the LambParams data
Definition CorePrimAPI.h:2570
LambParams & length(float _l)
set the length.
LambParams & height(float _h)
set the height.
LambParams & headHeight(float _h)
set the head height.
LambParams & diameterTop(float _d)
set the top diameter.
LambParams & thickness(float _t)
set the thickness.
LambParams & diameterBottom(float _d)
set the bottom diameter.
LambParams()
constructor.
LambParams(float _l, float _dtop, float _dbottom, float _hh, float _h, float _thick)
constructor.
The mesh reference.
Definition CoreAPI.h:401
Definition CorePrimAPI.h:2903
NutAcornParams & facetHeight(const float &_h)
set the facet height.
virtual NutHeadBaseParams * copy(NutHeadBaseParams *p=nullptr)
copies the NutAcornParams object.
NutAcornParams()
constructor.
NutAcornParams(float d, float h, float h1)
constructor.
float facetHeight() const
get the facet height.
Definition CorePrimAPI.h:3285
NutClampLever & length(const float &_l)
set the length.
virtual NutHeadBaseParams * copy(NutHeadBaseParams *p=nullptr)
copies the NutClampLever object.
float length() const
get the length.
float holderDiameter() const
get the diameter of the holder.
NutClampLever & holderDiameter(const float &_d)
set the diameter of the holder.
NutClampLever()
constructor.
NutClampLever(float d, float h)
constructor.
Definition CorePrimAPI.h:2982
NutFlangeParams(float d, float h)
constructor.
float facetHeight() const
get the height.
float facetWidth() const
get the width.
NutFlangeParams()
constructor.
NutFlangeParams & facetWidth(const float &w)
set the width.
virtual NutHeadBaseParams * copy(NutHeadBaseParams *p=nullptr)
copies the NutFlangeParams object.
NutFlangeParams(float d, float h, float fw, float fh)
constructor.
NutFlangeParams & facetHeight(const float &h)
set the facet height.
Definition CorePrimAPI.h:2812
NutHeadBaseParams & type(int t)
set the nut type.
NutHeadBaseParams & height(const float &h)
set the height.
float height() const
get the height.
NutHeadBaseParams & diameter(const float &d)
set the diameter.
int type() const
set the nut type.
virtual NutHeadBaseParams * copy(NutHeadBaseParams *p=nullptr)
copies the object.
float diameter() const
get the diameter.
NutHeadBaseParams()
constructor.
NutHeadBaseParams(NutType t, float d, float h)
constructor.
Definition CorePrimAPI.h:2876
NutHexaParams()
constructor.
NutHexaParams(float d, float h)
constructor.
Definition CorePrimAPI.h:3100
float length() const
get the length.
NutLambParams & diameterBottom(const float &_d)
set the bottom diameter.
NutLambParams & diameterTop(const float &_d)
set the top diameter.
float diameterBottom() const
get the bottom diameter.
NutLambParams(float d, float h)
constructor.
NutLambParams()
constructor.
NutLambParams & headHeight(const float &_h)
set the head height.
float headHeight() const
get the head height.
float thickness() const
get the thickness.
virtual NutHeadBaseParams * copy(NutHeadBaseParams *p=nullptr)
copies the NutLambParams object.
float diameterTop() const
get the top diameter.
NutLambParams & thickness(const float &_t)
set the thickness.
NutLambParams & length(const float &_l)
set the length.
Definition CorePrimAPI.h:2937
NutLowAcornParams()
constructor.
NutLowAcornParams(float d, float h, float h1)
constructor.
Definition CorePrimAPI.h:2890
Definition CorePrimAPI.h:3035
NutRadialParams & holeDepth(const float &d)
set the hole depth.
float holeDepth() const
get the hole depth.
int holePlace() const
get the hole place.
float holeDiameter() const
set the hole diameter.
NutRadialParams(float d, float h, float d1, float d2)
constructor
virtual NutHeadBaseParams * copy(NutHeadBaseParams *p=nullptr)
copies the radial object.
NutRadialParams & holeDiameter(const float &d)
set the hole diameter.
NutRadialParams(float d, float h)
constructor.
NutRadialParams()
constructor.
NutRadialParams & holePlace(const int &place)
set the hole place (0 - face, 1 - side).
Definition CorePrimAPI.h:3240
NutRimParams & inRingDiameter(const float &_d)
set the inner ring diameter.
virtual NutHeadBaseParams * copy(NutHeadBaseParams *p=nullptr)
copies the NutRimParams object.
NutRimParams(float d, float h)
constructor.
NutRimParams & outRingDiameter(const float &_d)
set the outer ring diameter.
NutRimParams()
constructor.
float inRingDiameter() const
get the inner ring diameter.
float outRingDiameter() const
get the outer ring diameter.
Definition CorePrimAPI.h:2952
NutSelfLockParams()
constructor.
NutSelfLockParams(float d, float h, float h1)
constructor.
Definition CorePrimAPI.h:3183
NutSlitsParams & width(const float &w)
set the width.
virtual NutHeadBaseParams * copy(NutHeadBaseParams *p=nullptr)
copies the NutSlitsParams object.
float length() const
get the length.
NutSlitsParams & length(const float &l)
set the length.
float width() const
get the width.
int count() const
get the count of NutSlitsParams.
NutSlitsParams & count(const int &n)
set the count of NutSlitsParams.
NutSlitsParams()
constructor.
NutSlitsParams(float d, float h)
constructor.
Definition CorePrimAPI.h:2967
NutTShapedParams()
constructor.
NutTShapedParams(float d, float h, float h1)
constructor.
struct of the RimParams data
Definition CorePrimAPI.h:2637
RimParams & shoulderDiameter(float _d)
set the shoulder diameter.
RimParams & inRingDiameter(float _d)
set the inner ring diameter.
RimParams & outRingDiameter(float _d)
set the outer ring diameter.
RimParams(float _d, float _h, float _d1, float _d2)
constructor.
RimParams & shoulderHeight(float _h)
set the shoulder height.
RimParams()
constructor.
The scene element, like sculpt object or curve.
Definition CoreAPI.h:1609
class of the slits
Definition CorePrimAPI.h:2354
Slit()
constructor
Slit & height(const float &_h)
set the height.
Slit(float w, float h, float d, SlitType t)
slit constructor.
Slit & type(const int &_t)
set the slit type.
int type() const
get the slit type.
float height() const
get the height.
float width() const
get the width.
Slit & depth(const float &_d)
set the depth.
float depth() const
get the depth.
Slit & width(const float &_w)
set the width.
struct of the TShapedParams data
Definition CorePrimAPI.h:2527
TShapedParams & diameter(float _d)
set the diameter.
TShapedParams(float _d, float _h, float _w)
constructor.
TShapedParams & height(float _h)
set the height.
TShapedParams & width(float _w)
set the width.
TShapedParams()
constructor.
The class allows to operate over voxels/surface on the relatively low-level.
Definition CoreAPI.h:1899
bolt head primitive
Definition CorePrimAPI.h:2731
virtual cMeshContainer * create_mesh()
creates a mesh container for the bolt head.
const HeadParams & head() const
get the const HeadParams object.
boltHead & head(const int &_type, void *data)
set the head object with specified type and data.
Slit & slit()
get the slit object.
const Slit & slit() const
get the const slit object.
boltHead & slit(const Slit &_s)
set the slit object.
boltHead & head(const HeadParams &_h)
set the head object.
boltHead()
constructor.
HeadParams & head()
get the HeadParams object.
bolt primitive
Definition CorePrimAPI.h:3426
int threadType()
get the screw thread profile.
bolt & nutHeight(const float &_h)
set the nut height on the bolt.
const boltHead & head() const
get the head object.
bolt & pitch(const float &_p)
set the thread pitch.
float pitch()
get the thread pitch.
virtual cMeshContainer * create_mesh()
creates a mesh container for the bolt.
bolt & uheight(const int &_uh)
set the underhead height.
bolt & underhead(const int &_uh)
set the under head type.
float threadLength()
get the thread length.
bolt & head(const boltHead &_h)
set the head object.
bolt & diameter(const float &_d)
set the bolt diameter.
bolt & threadHeight(const float &_h)
set the thread height.
bolt & nutType(const int &_t)
set the nut type.
float nutLocation()
get the nut location on the bolt.
bolt & threadType(const int &_t)
set the screw thread profile.
bolt()
constructor.
float diameter()
get the bolt diameter.
float length()
get the bolt length.
bolt & nutLocation(const float &_loc)
set the nut location on the bolt.
bolt & length(const float &_l)
set the bolt length.
int underhead()
get the under head type.
float uwidth()
get the underhead width.
float uheight()
get the underhead height.
float nutHeight()
get the nut height on the bolt.
bolt & uwidth(const int &_uw)
set the underhead width.
int nutType()
get the nut type.
float threadHeight()
get the thread height.
bolt & threadLength(const float &_l)
set the thread length.
The box.
Definition CorePrimAPI.h:348
box(float sizeX, float sizeY, float sizeZ)
constructs a new box object.
box(const vec3 &pos, const vec3 &size)
constructs a new box object.
box & axis(const vec3 &directionX, const vec3 &directionY, const vec3 &directionZ)
set the x, y and z direction
vec3 axis_y()
get the y-axis
box & size(const vec3 &_size)
set the box size
box & divide(int nx, int ny, int nz)
set the number deviding
box & size(float x, float y, float z)
set the box size
vec3 axis_x()
get the x-axis
virtual cMeshContainer * create_mesh()
creates a mesh container for the box.
box & axis(const vec3 &directionX)
set the x-direction
virtual float fillet_relative()
calculates a fillet relative value (0..1).
box(const vec3 &size)
constructs a new box object.
void init()
initialize the default parameters
box & reset_axis()
reset the x, y and z direction
box & axis(const vec3 &directionX, const vec3 &directionY)
set the x and y direction
vec3 axis_z()
get the z-axis
vec3 size() const
get the box size.
box()
constructs a new box object.
box(const vec3 &pos, const vec3 &size, float fillet)
constructs a new box object.
The capsule.
Definition CorePrimAPI.h:1394
capsule(const vec3 &posTop, const vec3 &posBottom, const float &radiusTop, const float &radiusBottom)
constructs a new capsule object.
capsule()
constructs a new capsule object.
capsule(const float &height, const float &radiusTop, const float &radiusBottom)
constructs a new capsule object.
virtual cMeshContainer * create_mesh()
creates a mesh container for the capsule.
The cone.
Definition CorePrimAPI.h:1106
float fillet_relative() override
calculates a fillet relative value (0..1).
cone & diameter(const float &d)
set the value of diameter.
cone(const vec3 &posTop, const vec3 &posBottom, const float &radiusBottom, const float &fillet=0.0)
constructs a new cone object.
float radius() const
get the value of radius.
cone()
constructs a new cone object.
cone & radius(const float &r)
set the value of radius.
virtual cMeshContainer * create_mesh()
creates a mesh container for the cone.
float diameter() const
get the value of diameter.
cone(const float &height, const float &radiusBottom, const float &fillet=0.0)
constructs a new cone object.
The cylinder.
Definition CorePrimAPI.h:876
cylinder & radiusBottom(const float &r)
set the bottom radius.
cylinder & positionTop(const vec3 &pos)
set the top position.
cylinder & diameterTop(const float &d)
set the top diameter.
float bottomCapScale() const
get the bottom cap scale.
cMeshContainer * getCylinderPrim(bool iscone=false)
get a mesh container for the cylinder without account of fillet.
int rings() const
get the number of rings in the mesh.
mat4 getLTransform()
get a transform matrix between standard cylinder and cylinder with custom parameters
cylinder & bottomCapScale(const float &scale)
set the bottom cap scale.
int caps() const
get the number of caps in the mesh.
vec3 positionTop() const
get the top position.
float radius() const
get the radius.
int slices() const
get the number of slices in the mesh.
float diameter() const
get the diameter.
cylinder & height(const float &_height)
set the height in the z-axis.
float topCapScale() const
get the top cap scale.
cylinder & radiusTop(const float &r)
set the top radius.
vec3 positionBottom() const
get the bottom position.
cylinder & topCapScale(const float &scale)
set the top cap scale.
cylinder()
constructs a new cylinder object.
cylinder & diameter(const float &d)
set the diameter.
float diameterTop() const
get the top diameter.
float sectorAngle() const
get the sector angle.
cylinder & slices(const int &nslices)
set the number of slices in the mesh.
virtual cMeshContainer * create_mesh()
creates a mesh container for the cylinder.
float radiusBottom() const
get the bottom radius.
cylinder & radius(const float &r)
set the radius.
cylinder(const float &height, const float &radiusTop, const float &radiusBottom, const float &fillet=0.0)
constructs a new cylinder object.
cylinder & diameterBottom(const float &r)
set the bottom diameter.
virtual float fillet_relative()
calculates a fillet relative value (0..1).
cylinder & rings(const int &nrings)
set the number of rings in the mesh.
cylinder & positionBottom(const vec3 &pos)
set the bottom position.
cylinder(const vec3 &posTop, const vec3 &posBottom, const float &radiusTop, const float &radiusBottom, const float &fillet=0.0)
constructs a new cylinder object.
cylinder & caps(const int &ncaps)
set the number of caps in the mesh.
float radiusTop() const
get the top radius.
float height() const
get the height.
cylinder & sectorAngle(const float &angle)
set the angle for cylinder with sector.
float diameterBottom() const
get the bottom diameter.
The ellipse.
Definition CorePrimAPI.h:797
ellipse & axis(const vec3 &directionX, const vec3 &directionY=vec3::AxisY, const vec3 &directionZ=vec3::AxisZ)
set the axis x, y and z direction
ellipse(const vec3 &size)
constructs a new ellipse object.
virtual void density_subdiv(int &slices, int &rings)
calculates the density-based subdivisions.
vec3 size() const
get the size of the ellipse.
ellipse & size(const vec3 &_size)
set the size of the ellipse.
ellipse & reset_axis()
reset the x, y and z directions
virtual cMeshContainer * create_mesh()
creates a mesh container for the ellipse.
ellipse(const vec3 &pos, float rx, float ry, float rz)
constructs a new ellipse object.
ellipse(const vec3 &pos, const vec3 &size)
constructs a new ellipse object.
ellipse()
constructs a new ellipse object.
void init()
initializing of the ellipse.
freeform primitive
Definition CorePrimAPI.h:3880
freeform()
constructor
virtual cMeshContainer * create_mesh()
creates a mesh container for the screw.
freeform & symx(const bool &x)
Enable the XYZ-mirror symmetry.
freeform & symy(const bool &y)
Enable the XYZ-mirror symmetry.
~freeform()
destructor
void ResetPoints()
reset the knot points
freeform & ffsubname(const char *name)
set the free form sub name.
const char * ffname() const
get the free form name.
freeform & size(float x, float y, float z)
set the free form size
freeform & symz(const bool &z)
Enable the XYZ-mirror symmetry.
const char * ffsubname() const
get the free form sub name.
list< str > * ffSubNamesList(const str &ffName)
get the sub names for specified free form name.
list< str > * ffSubNamesList()
get the sub names for current free form name.
Points3D & ffControlPoints()
get the knot(control) points of the primitive.
freeform(const char *_ffname, const char *_ffsubname)
constructor
freeform & ffname(const char *name)
set the free form name.
freeform & SetPoint(int i, const vec3 &point)
set the knot point of the primitive.
ffObjsList & objsList()
gets the object's list.
int CountPoints() const
get the account of the knot points
freeform & size(const vec3 &v)
set the free form size
The gear.
Definition CorePrimAPI.h:1262
gear(const vec3 &posTop, const vec3 &posBottom, const float &radiusTop, const float &radiusBottom, float depth=0.1, float sharpness=0.5, const int &order=16)
constructs a new gear object.
gear & sharpness(const float &sharp)
set the sharpness value.
float depth() const
get the depth value.
virtual cMeshContainer * create_mesh()
creates a mesh container for the gear.
gear & depth(const float &__depth)
set the depth value.
gear & order(const int &nteeth)
set the number of teeth in gear.
gear(const float &height, const float &radiusTop, const float &radiusBottom, float depth, float sharpness=0.5, const int &order=16)
constructs a new gear object.
gear()
constructs a new gear object.
float sharpness() const
get the depth value.
int order() const
get the number of teeth in gear.
gear(const float &height, const float &radiusTop, const float &radiusBottom)
constructs a new gear object.
image primitive
Definition CorePrimAPI.h:1926
image & topTexture(const char *_texture)
set the top texture
image()
constructs a new image object.
float bumpThickness() const
get the bump thickness of image
float sizeInScene() const
get the size of image in the scene
str bottomTexture() const
get the bottom texture
float taperAngle() const
get the angle of tapering of image
image & topBumpTexture(const char *_texture)
set the top bump texture
image & topBottomWeight(const float &weight)
set the weight of the top and bottom image
image & sizeInScene(const float &_size)
set the size of image in the scene
image & taperAngle(const float &_angle)
set the angle of tapering
image & strencilTexture(const char *_texture)
set the strencil texture
image & bottomBumpTexture(const char *_texture)
set the bottom bump texture
str bottomBumpTexture() const
get the bottom bump texture
image & bottomStrencilTexture(const char *_texture)
set the bottom strencil texture
float topBottomWeight() const
get the weight of the top and bottom image
str strencilTexture() const
get the strencil texture
str topBumpTexture() const
get the top bump texture
image & bottomTexture(const char *_texture)
set the bottom texture
image & bumpThickness(const float &_thickness)
set the bump thickness of image
float basicThickness() const
get the basic thickness of image
str topTexture() const
get the top texture
image & basicThickness(const float &_thickness)
set the basic thickness of image
virtual cMeshContainer * create_mesh()
creates a mesh container for the image.
str bottomStrencilTexture() const
get the bottom strencil texture
lathe primitive
Definition CorePrimAPI.h:1848
lathe()
constructs a new lathe object.
pointState
enumeration of the point state for a lathe profile.
Definition CorePrimAPI.h:1854
lathe & type(const lathe::Type &t)
set the lathe type
virtual cMeshContainer * create_mesh()
creates a mesh container for the text.
~lathe()
object destructor.
curve2d * profile() const
get the pointer to the profile
lathe & add_point(const vec2 &point, int st)
add the point into curve
lathe::Type type() const
get the lathe type.
lathe & reset()
reset the curve points
lathe & clear()
clear points of the profile
Type
enumeration of the lathe type.
Definition CorePrimAPI.h:1865
The ngon.
Definition CorePrimAPI.h:1347
ngon()
constructs a new ngon object.
ngon(const float &height, const float &radiusTop, const float &radiusBottom, const int &order)
constructs a new ngon object.
ngon(const float &height, const float &radiusTop, const float &radiusBottom, const float &fillet, const int &order)
constructs a new ngon object.
virtual cMeshContainer * create_mesh()
creates a mesh container for the ngon.
virtual float fillet_relative()
calculates a fillet relative value (0..1).
ngon(const vec3 &posTop, const vec3 &posBottom, const float &radiusTop, const float &radiusBottom, const int &order)
constructs a new gear object.
nut primitive
Definition CorePrimAPI.h:3333
float threadDiameter() const
get the hole thread diameter.
nut & enableThread(const bool &f)
set the enabled thread.
~nut()
destructor.
nut & threadDiameter(const float &d)
set the hole thread diameter.
nut()
constructor.
float pitch() const
get the thread pitch.
virtual cMeshContainer * create_mesh()
creates a mesh container for the nut.
int threadType() const
get the nut thread profile.
nut & threadType(const int &_t)
set the nut thread profile.
bool enableThread() const
get the enabled thread.
nut & setTypeData(void *data)
set the typed data.
void * getTypeData()
get the typed data.
nut & pitch(const float &p)
set the thread pitch.
void release()
release the typed data
The abstract prim class.
Definition CorePrimAPI.h:15
static void debug_on(bool isOn=true)
indicates whether to turn on or off the debug mode.
Mesh mesh()
get the mesh prim
prim & color(DWORD CL)
assign the color to the primitive (in voxels)
prim & opacity(float value)
assign the opacity of the color over the voxel primitive. The color should be assigned before you ass...
void merge_debug(Volume &vol, Mesh &mesh)
merge the mesh debug into scene
void intersect(Volume &v)
intersect the prim into scene
static void debug_clear()
clear the debug info for primitive operations
static void reset_transform()
reset the global transform matrix
prim & roughness(float value)
assign the roughness for the voxel primitive, it will work only if the color already assigned
prim & color(float r, float g, float b, float a)
assign the color to the primitive (in voxels)
static void push_translate(const vec3 &d)
Set the translation to all primitives.
prim & details(const float det_level)
set the detail level
prim & metal(float value)
the metalliclty value for the voxel primitive, it will work only if the color already assigned
prim()
constructs a new prim object.
prim & name(const char *s)
set the primitive object name.
prim & x(float x)
shift the primitive along the x - axis
prim & color(const char *colorid)
assign the color to the primitive (in voxels)
void subtract(Volume &v)
subtract the prim from scene
static void push_transform(const mat4 &t)
set the global transform matrix to all primitives
static void push_scale(float scale)
Set the scale to all primitives.
prim & y(float y)
shift the primitive along the y - axis
prim & gloss(float value)
assign the gloss for the voxel primitive, it will work only if the color already assigned
prim & fillet(float radius)
set the fillet
vec3 scale() const
get the scale
prim & step_divide(float step)
set the step devide
prim & z(float z)
shift the primitive along the z - axis
prim & scale(const vec3 &v)
set the scale
void merge(Volume &v, const BoolOpType op)
merge the prim into scene
static void push_details(float details_modulator)
set the detail level to all primitives
virtual cMeshContainer * create_mesh()
abstract method to create a mesh container.
Definition CorePrimAPI.h:287
virtual float fillet_relative()
calculates a fillet relative value (0..1).
prim & translate(const vec3 &_pos)
Set the primitive translation.
prim & color(float r, float g, float b)
assign the color to the primitive (in voxels)
mat4 transform() const
get the transform matrix
prim & translate(float x, float y, float z)
Set the primitive translation.
str name() const
get the primitive object name.
vec3 translate() const
get the primitive translation
T & to_cast_this()
cast this prim to the obj type T
Definition CorePrimAPI.h:282
str class_name()
get the primitive class name.
prim & auto_divide(float average_div)
set the auto devide
T & Obj()
Get the primitive object reference.
Definition CorePrimAPI.h:264
static void push_scale(const vec3 &s)
Set the scale to all primitives.
float details()
get the detail level
bool isAs()
Check the prim's type.
Definition CorePrimAPI.h:270
void add(Volume &v)
add the prim into scene
prim & transform(const mat4 &t)
set the transform matrix
prim & scale(float scale)
set the scale
screw primitive
Definition CorePrimAPI.h:3613
screw & uwidth(const int &_uw)
set the underhead width.
float uwidth()
get the underhead width.
float length()
get the screw length.
float uheight()
get the underhead height.
screw & pitch(const float &_p)
set the screw thread step(pitch).
float threadLength()
get the screw thread length.
screw & underhead(const int &_uh)
set the underhead type.
int underhead()
get the underhead type.
screw()
constructor.
float threadDiameter()
get the thread diameter.
screw & threadDiameter(const float &_d)
set the thread diameter.
screw & head(const boltHead &_h)
set the bolt head object.
screw & threadHeight(const float &_h)
set the screw thread height.
screw & uheight(const int &_uh)
set the underhead height.
float pitch()
get the screw thread step(pitch).
screw & length(const float &_l)
set the screw length.
screw & diameter(const float &_d)
set the screw diameter.
float threadHeight()
get the screw thread height.
virtual cMeshContainer * create_mesh()
creates a mesh container for the screw.
float diameter()
get the screw diameter.
screw & threadLength(const float &_l)
set the screw thread length.
const boltHead & head() const
get the bolt head object.
The sphere.
Definition CorePrimAPI.h:620
float slice_to() const
get the angle where the sphere slice ends.
sphere & ring_to(const float &angle)
When sector is on, specifies the angle where the sphere ring ends.
float slice_from() const
get the angle where the sphere slice begins.
float ring_from() const
get the angle where the sphere ring begins.
sphere & slice_to(const float &angle)
When sector is on, specifies the angle where the sphere slice ends.
sphere(float radius)
constructs a new sphere object with radius.
float ring_to() const
get the angle where the sphere ring ends.
sphere & sub_division(const int subdiv)
set the degree for subdivision in the mesh.
sphere()
constructs a new sphere object.
sphere & slice_from(const float &angle)
When sector is on, specifies the angle where the sphere slice begins.
int slices() const
get the number of slices in the mesh.
sphere::DivisionMode sub_div_mode() const
get the division mode for the mesh.
float radius() const
get the radius of the sphere.
int sub_division() const
get the degree of subdivision triangular or cubic division of the sphere.
DivisionMode
division modes
Definition CorePrimAPI.h:625
sphere & sector_on(const bool &_switch)
set the flag to create a portion of sphere.
sphere & radius(const float &r)
set the radius of the sphere.
sphere & slices(const int &_slices)
set the number of slices in the mesh.
int rings() const
get the number of rings in the mesh.
virtual void density_subdiv(int &slices, int &rings)
calculates the density-based subdivisions.
sphere & diameter(const float &d)
set the diameter of the sphere.
sphere & sub_div_mode(const sphere::DivisionMode &divmode)
set the division mode for the mesh.
sphere(const vec3 &pos, float radius)
constructs a new sphere object with position and radius.
bool sector_on() const
get the flag of creating a portion of sphere. Default = false.
sphere & rings(const int &_rings)
set the number of rings in the mesh.
float diameter() const
get the diameter of the sphere.
sphere & ring_from(const float &angle)
When sector is on, specifies the angle where the sphere ring begins.
virtual cMeshContainer * create_mesh()
creates a mesh container for the sphere.
The spiral.
Definition CorePrimAPI.h:1441
float diameter() const
get the outer diameter.
int slices() const
get the number of slices in the mesh.
spiral(const float &out_radius, const float &in_radius, const float &_sstep, const float &nturns)
constructs a new spiral object.
int turns() const
get the number of turns.
spiral()
constructs a new spiral object.
spiral & turns(const int nturns)
set the number of turns.
int caps() const
get the number of caps in the mesh.
int rings() const
get the number of rings in the mesh.
float profile_height() const
get the profile height for rectangle profile.
float step() const
get the spiral step.
spiral & clock_wise(const bool &clockWise)
set the clockwise direction of the spiral.
spiral & profile_rect(const float width, const float height)
set the dimensions for the rectangle profile.
float profile_width() const
get the profile width for rectangle profile.
float profile_radius() const
get the profile radius.
spiral & diameter(const float &d)
set the outer diameter of the spiral.
float profile_diameter() const
get the profile diameter.
spiral & rings(const int &nrings)
set the number of rings in the mesh.
spiral & caps(const int &ncaps)
set the number of caps in the mesh.
spiral & radius(const float &r)
set the outer radius of the spiral.
spiral & profile_diameter(const float &d)
set the profile diameter.
spiral & profile_radius(const float &r)
set the profile radius.
float radius() const
get the outer radius.
virtual cMeshContainer * create_mesh()
creates a mesh container for the spiral.
spiral & profile_type(const SpiralProfile type)
set the type of profile (circle or rectangle).
spiral & slices(const int &nslices)
set the number of slices in the mesh.
bool clock_wise() const
get the clokwise direction of the spiral.
spiral & step(const float &vstep)
set the spiral step.
text primitive
Definition CorePrimAPI.h:1735
text()
constructs a new text object.
text & font(const Font &f)
set the text font
text & depth(const float &d)
set the text depth in the pixels
float width() const
get the text width
text & extraRotation(const float &rotation)
set the rotate angle around the x-axis.
float invertBending() const
get the invert of the text bending.
text(const char *s)
constructs a new text object.
float bendRadius() const
get the bend radius.
float extraRotation() const
get the rotate angle around the x-axis.
virtual cMeshContainer * create_mesh()
creates a mesh container for the text.
text & string(const char *s)
set the text's string.
void update_mesh(cMeshContainer *mc)
update the mesh container for the text.
float depth() const
get the text depth
text & bendRadius(const float &radius)
set the bend radius.
text & width(const float &w)
set the text width in the pixels
str string() const
get the text's string.
Font font() const
get the font object
text & invertBending(const bool &_binvert)
set the invert of the text bending.
thread primitive
Definition CorePrimAPI.h:2101
float height() const
get the height of the thread.
thread & close(const bool &b)
set the closed thread.
thread & diameter(const float d)
set the diameter of the thread.
thread & pitch(const float p)
set the pitch of the thread.
float stub() const
get the stub length of the thread.
float pitch() const
set the pitch of the thread.
thread & stub(const float &l)
set the stub length of the thread.
thread & height(const float &h)
set the height of the thread.
int turns() const
get the number of the thread turns.
thread & turns(const int &n)
set the number of the thread turns.
bool close() const
set the closed thread.
thread()
constructor
float diameter() const
get the diameter of the thread.
virtual cMeshContainer * create_mesh()
creates a mesh container for the thread.
bool clockwise() const
get the clockwise of the thread.
thread & clockwise(const bool &cw)
set the clockwise flag of the thread.
ThreadProfile profile() const
get the thread profile type.
thread & profile(const ThreadProfile &prf)
set the thread profile type.
thread stud primitive
Definition CorePrimAPI.h:2225
bool enableThread() const
get the indicator of the enabled thread.
threadStud & length(const float &l)
set the stud length.
float diameterTop() const
get the top diameter of the thread.
float threadLength() const
get the length of the thread.
float diameter() const
get the diameter of the thread.
threadStud & diameter(const float &d)
set the diameter of the thread.
threadStud & bodyType(const ThreadStudBodyType &bt)
set the body type.
ThreadStudBodyType bodyType() const
get the body type.
threadStud & diameterBottom(const float &d)
set the bottom diameter of the thread.
float diameterBottom() const
get the bottom diameter of the thread.
float length() const
get the length of the stud.
threadStud & diameterTop(const float &d)
get the top diameter of the thread.
virtual cMeshContainer * create_mesh()
creates a mesh container for the thread stud.
threadStud()
constructor
threadStud & enableThread(const bool &enable)
enabled or disabled thread in the stud.
The torus.
Definition CorePrimAPI.h:480
float rings_angle() const
get the angle for torus rings
int rings() const
get the number of rings in the mesh.
virtual cMeshContainer * create_mesh()
creates a mesh container for the torus.
torus & section_diameter(const float &section_d)
set the cross section diameter.
torus & rings(const int &_rings)
set the number of rings in the mesh.
torus(const vec3 &pos, const float &ringRadius, const float &crossSectionRadius)
constructs a new torus object.
float section_diameter() const
get the cross section diameter.
torus & section_radius(const float &section_r)
set the cross section radius.
torus & rings_angle(const float &angle)
When sector is on, specifies the angle for torus rings. Default = 360 degrees.
float radius() const
get the ring radius.
float section_radius() const
get the cross section radius.
torus()
constructs a new torus object.
bool sector_on() const
get the flag of creating a portion of torus. Default = false.
int slices() const
get the number of slices in the mesh.
torus & sector_on(const bool &_switch)
set the flag to create a portion of torus.
torus & radius(const float &r)
set the ring radius.
torus(const float &ringRadius, const float &crossSectionRadius)
constructs a new torus object.
torus & diameter(const float &d)
set the ring diameter.
torus & slices_angle(const float &angle)
When sector is on, specifies the angle for torus slices. Default = 360 degrees.
float diameter() const
get the ring diameter.
torus & slices(const int &_slices)
set the number of slices in the mesh.
float slices_angle() const
get the angle for torus slices
The tube.
Definition CorePrimAPI.h:1169
tube(const float &height, const float &radiusTop, const float &radiusBottom, const float &relativeHoleRadius, const float &fillet)
constructs a new tube object.
tube & relativeHoleRadius(const float &r)
set the relative value of the hole radius.
tube(const float &height, const float &radiusTop, const float &radiusBottom, const float &fillet)
constructs a new tube object.
tube & thickness(const float &w)
set the wall thickness value.
float thickness() const
get the relative value of the hole radius.
tube(const vec3 &posTop, const vec3 &posBottom, const float &radiusTop, const float &radiusBottom, const float &relativeHoleRadius, const float &fillet)
constructs a new tube object.
float fillet_relative() override
calculates a fillet relative value (0..1).
tube(const float &height, const float &radiusTop, const float &radiusBottom)
constructs a new tube object.
tube()
constructs a new tube object.
tube(const vec3 &posTop, const vec3 &posBottom, const float &radiusTop, const float &radiusBottom, const float &relativeHoleRadius)
constructs a new tube object.
virtual cMeshContainer * create_mesh()
creates a mesh container for the tube.
float relativeHoleRadius() const
get the relative value of the hole radius.
washer primitive
Definition CorePrimAPI.h:3763
float height() const
get the washer height.
washer & facet(const bool &_f)
indicates the facet usage.
washer & outerDiameter(const float &_d)
set the outer diameter.
float thickness() const
get the washer thickness.
washer::Type type() const
get the washer type.
washer()
constructor.
float innerDiameter() const
get the inner diameter.
washer & conusDiameter(const float &_d)
set the diameter of the conus washer.
Type
enumeration the types of the washer
Definition CorePrimAPI.h:3768
bool facet() const
get the facet flag.
washer & thickness(const float &_s)
set the washer thickness.
virtual cMeshContainer * create_mesh()
creates a mesh container for the washer.
washer & innerDiameter(const float &_d)
set the inner diameter.
float conusDiameter() const
get the diameter of the conus washer.
float outerDiameter() const
get the outer diameter.
washer & type(washer::Type _t)
set the washer type.
washer & height(const float &_h)
set the washer height.
The coat namespace used for most 3DCoat API calls except low-level internal structures.
Definition CoreAPI.h:43
SlitType
enumeration the slit types
Definition CorePrimAPI.h:2322
comms::cVec3 vec3
3D - float vector, see the cVec3
Definition CoreAPI.h:50
BoolOpType
Boolean operations type.
Definition CoreAPI.h:87
ThreadStudBodyType
thread body type
Definition CorePrimAPI.h:2217
FontStyle
Enumeration of the string drawing styles.
Definition CorePrimAPI.h:1612
comms::cVec2 vec2
2D - vector, see the cVec2
Definition CoreAPI.h:56
comms::cMat4 mat4
4x4 float matrix, see the cMat4
Definition CoreAPI.h:59
SpiralProfile
The profile type of the spiral.
Definition CorePrimAPI.h:1431
@ RECTANGLE
rectangle
NutType
enumeration the types of the nut
Definition CorePrimAPI.h:2794
comms::cRect rect
rect float, see the cRect
Definition CoreAPI.h:73
ThreadProfile
thread profile types
Definition CorePrimAPI.h:2089
BoltHeadType
enumeration the types of the bolt head
Definition CorePrimAPI.h:2423
comms::cStr str
the string that is compatible with the 3DCoat engine, see the cStr
Definition CoreAPI.h:67
comms::cList< X > list
the array template, see cList
Definition CoreAPI.h:70
Holds the general information about bolt parameters.
Definition CorePrimAPI.h:3435
Definition CorePrimAPI.h:3883
Definition CorePrimAPI.h:3888
Holds the general information about image parameters.
Definition CorePrimAPI.h:1931
Holds the general information about bolt parameters.
Definition CorePrimAPI.h:3618