Primitives in 3DCoat are shapes (figures) in 3D, which can be complex in a certain way. For instance, the Gear primitive looks more complex that a sphere or cube. But still it is called a "primitive".
Lets start with a sphere.
Sphere
Copy this script to your local drive and run it from 3DCoat: "Script / Run Script". Don't know how to do that, check here.
void main() {
SculptRoom room;
room.clear().toSurface();
Builder builder;
Mesh mesh = builder.sphere()
.radius( 70 )
.details( 0.1 )
.build();
room += mesh;
}
Lets run through this code.
Get access to sculpt room. Now use `room` for scene making.
With help of `builder` we'll make various meshes.
Mesh mesh = builder.sphere()
Tell builder-script that we'd like to create sphere...
With radius 70 px...
and low density wireframe.
Tell 3DCoat to create a sphere with set parameters.
It is allowed to write
- Warning
- Pay attention that
()
is written without leading dot, but .build()
with.
Round brackets will build a sphere just like build()
.
Lets create a cube.
Cube or cuboid.
void main() {
SculptRoom room;
room.clear().toSurface();
Builder builder;
Mesh mesh = builder.cuboid()
.side( Vec3( 100, 80, 60 ) )
.details( 0.1 )
.build();
room += mesh;
}
We won't analyze code below. Everything is explained on sphere.
All parameters related to Cube check here.
Cylinder
All parameters related to Cylinder check here.
Ellipsoid
void main() {
SculptRoom room;
room.clear().toSurface();
Builder builder;
Mesh mesh = builder.ellipsoid()
.radius( Vec3( 80, 60, 40 ) )
.details( 0.1 )
.build();
room += mesh;
}
end of script
All parameters related to Ellipsoid check here.
Cone
void main() {
SculptRoom room;
room.clear().toSurface();
Builder builder;
Mesh mesh = builder.cone()
.radius( 50 )
.height( 120 )
.details( 0.1 )
.build();
room += mesh;
}
All parameters related to Cone check here.
Tube
void main() {
SculptRoom room;
room.clear().toSurface();
Builder builder;
Mesh mesh = builder.tube()
.startPoint( Vec3( 0, 0, 0 ) )
.endPoint( Vec3( 30, 50, 70 ) )
.topRadius( 30 )
.bottomRadius( 40 )
.relativeHoleRadius( 0.8 )
.details( 0.1 )
.build();
room += mesh;
}
All parameters related to Tube check here.
Capsule
void main() {
SculptRoom room;
room.clear().toSurface();
Builder builder;
Mesh mesh = builder.capsule()
.startPosition( Vec3( 0 ) )
.endPosition( Vec3( 40, 50, 60 ) )
.startRadius( 30 )
.endRadius( 50 )
.details( 0.1 )
.build();
room += mesh;
}
All parameters related to Capsule check here.
NGon
void main() {
SculptRoom room;
room.clear().toSurface();
Builder builder;
Mesh mesh = builder.ngon()
.startPoint( Vec3( 0, 0, 0 ) )
.endPoint( Vec3( 90, 90, 90 ) )
.topRadius( 30 )
.bottomRadius( 40 )
.relativeHoleRadius( 0.3 )
.teeth( 3 )
.details( 0.1 )
.build();
room += mesh;
}
All parameters related to NGone check here.
Gear
void main() {
SculptRoom room;
room.clear().toSurface();
Builder builder;
Mesh mesh = builder.gear()
.startPoint( Vec3( 0, 0, 0 ) )
.endPoint( Vec3( 90, 90, 90 ) )
.topRadius( 30 )
.bottomRadius( 50 )
.relativeHoleRadius( 0.3 )
.depth( 0.5 )
.sharpness( 0.2 )
.teeth( 3 )
.details( 0.1 )
.build();
room += mesh;
}
All parameters related to Gear check here.
Click the links to know more about class's capabilities:
Functions for making Primitives
You may also use functions for making primitives:
DEPRECATED void ResetPrimTransform();
DEPRECATED void PrimTranslate(float dx,float dy,float dz);
DEPRECATED void PrimScaleAt(float x,float y,float z,float scalex,float scaley,float scalez);
DEPRECATED void PrimRotateX(float x,float y,float z,float Angle);
DEPRECATED void PrimRotateY(float x,float y,float z,float Angle);
DEPRECATED void PrimRotateZ(float x,float y,float z,float Angle);
DEPRECATED void PrimRotateAroundRode(float x,float y,float z,float xend,float yend,float zend,float Angle);
DEPRECATED void PrimStretchBetweenPoints(float x,float y,float z,float xend,float yend,float zend);
void main(){
ResetPrimTransform();
PrimStretchBetweenPoints(10,20,30,40,50,60);
cylinder(0,-1,0,10,10,2,0);
}
DEPRECATED void PrimDensity(float density);
DEPRECATED string GetPrimTransform();
DEPRECATED void SetPrimTransform(string& in M);
SetPrimTransform(
"1.0 2.0 3.0 1.0\n"
"4.0 5.0 6.0 1.0\n"
"7.0 8.0 9.0 1.0\n"
"1.1 2.2 3.3 1.0" );
DEPRECATED void sphere(float x,float y,float z,float r,int mode);
DEPRECATED void ellipse(float x,float y,float z,float rx,float ry,float rz,int mode);
DEPRECATED void cube(float x,float y,float z,float sizex,float sizey,float sizez,int mode);
DEPRECATED void cylinder(float x,float y,float z,float topradius,float bottomradius,float height,int mode);
DEPRECATED void cone(float x,float y,float z,float radius,float height,int mode);
DEPRECATED void ngon(float x,float y,float z,int sides,float topradius,float bottomradius,float height,int mode);
DEPRECATED void tube(float x,float y,float z,float topradius,float bottomradius,float height,float wallthickness,int mode);
DEPRECATED void ngontube(float x,float y,float z,int sides,float topradius,float bottomradius,float height,float wallthickness,int mode);
DEPRECATED void capsule(float xstart,float ystart,float zstart,float xend,float yend,float zend,float startradius,float endradius,int mode);
Also check out this list of available functions:
string getCommandLine();
DEPRECATED void SetGlobalVar(string& Name,string& Value)
DEPRECATED string GetGlobalVar (string& Name)
DEPRECATED string GetSceneFileName()
DEPRECATED void SetSceneFileName(string& Name)
void HighlightUIElement(string &ID, float time);
DEPRECATED void back(int steps=1);
DEPRECATED void open(string &Path);
DEPRECATED void ppp(string &path);
DEPRECATED void mv(string &path);
DEPRECATED void ptex(string &path);
DEPRECATED void imagemesh();
DEPRECATED void refmesh(string &path);
DEPRECATED void vertexpaint(string &path);
DEPRECATED void autopo(string &path);
DEPRECATED void repair(string &id);
DEPRECATED void bass();
DEPRECATED void undercut();
DEPRECATED void activate(string &id);
DEPRECATED void retopo();
DEPRECATED void retopopen();
DEPRECATED void ToRoom(string &name);
DEPRECATED bool IsInRoom(string &name);
DEPRECATED void AddNewVolume(string &name);
DEPRECATED void uv();
DEPRECATED void vox();
DEPRECATED void sphere(float x,float y,float z,float r,int mode);
DEPRECATED void cube(float x,float y,float z,float sizex,float sizey,float sizez,int mode);
DEPRECATED void surf();
DEPRECATED void cursurf();
DEPRECATED void voxelize();
DEPRECATED void mergeopt(string &opt);
mergeopt( "[voxelize=true][as_skin=true][skin=4.5]" );
DEPRECATED void merge(string &model);
DEPRECATED void prim(string &id);
DEPRECATED void apply();
DEPRECATED void ApplyAndKeepScale();
DEPRECATED void mapply();
DEPRECATED void recent3b();
DEPRECATED void Log(string &line);
int rand(int min,int max);
float randF(float min,float max);
void seed(int val);
DEPRECATED void ProgressBar(const string& message,int pos);
DEPRECATED void SetOrthoMode(bool value);
- See Also
- π Math for 3D graphics
-
π Mesh Transform
-
π Boolean operations for meshes