Programming is the process of creating a set of instructions that tell a computer how to perform a task.
You can manage 3DСoat features with the help of scripting.
Run or create new commands using scripting or compiling them by accessing the Core API.
The start is quite easy. Just use Scripts Menu → Create your Script or Create a new Core API script.
– Scripting is a series of commands that can be executed without compiling.
When we select a tool or execute a function, we execute a command already included in the program. Creating a script allows us to combine these commands to automatically execute a series of steps that speed up our work.
– Core API (Application Programming Interface) is not just the scripting; the code you write runs at the full speed of compiled C++.
It is a powerful method to extend the 3DCoat’s functionality. You may automate the job or add principally new tools.
– Python API is very similar to the C++ Core API, but has its own advantages and drawbacks.
3DCoat uses AngelScript, which is a C++-like language. The script is a text file with commands executed in a personal order.
That command can be known by recording it in memory by pressing over the function RMB+MMB simultaneously. Opening a notepad and pasting it, we will obtain the text of the corresponding command. It is helpful to view and edit it in Notepad++ (choose “C” syntax). Then run the script via the file menu “Scripts / Run Script”.
The Core API is a powerful method to extend the 3DCoat’s functionality. You may automate the job or add principally new tools.
This is not just the scripting; the code you write runs at the full speed of compiled C++.
Core API script is a compliable C++17 program that works on the full native C++ speed. This is far more than just a script; you may make even time-critical and multithreaded tasks and customize the 3DCoat in-depth, creating principally new functionality and tools.
But the whole process is completely transparent for you. You don’t need to configure anything or manage complex project configurations. 3DCoat will lead you through the whole process with a simple wizard.
* Core API works correctly for users with non-English user names, all the installing process is now super easy.
* The CoreAPI compiling process changed essentially. Now only Visual Studio is used; no need for clang-cl. It simplifies usage because you need to install only one additional software, not two as before. The download and install process is completely automated.
* Core API supports colored voxels as well.
The 3DCoat Python API is intended to trigger UI commands, operate over the scene, and create new tools. It is very similar to the C++ Core API, but has its own advantages and drawbacks.
- No need for any additional setup to make your scripts; Python is embedded into the 3DCoat distributive.
- Python is like a Swiss-knife, allowing you to bring the whole power of Python libraries into 3DCoat.
- Python is much slower than C++, so it may be used only for general management, not for deep and complex algorithms.
- If you are already familiar with the C++ Core API, the Python API is very similar, almost 1:1, with the same logic and function names.
The start is quite easy. Just use Scripts→Create new Core API script
Then choose the template, and choose a path for your project.
If Visual Studio (or Visual Studio Code) is installed, it will start with your new file. Each example is well documented and uses relatively simple syntax, so it is easy to understand from easy to complex.
Read all the commands in this document.
You don't need to set any standard syntax in VStudio. Just type code and execute in 3DCoat, not in Visual Studio. VStudio is just like a text editor there that may show hints and help while coding. Write your code on VStudio and save the *.cpp, open it in 3DC and it automatically runs.
Looking at the Examples is the best way to understand the API.
Use Scripts→Create a new Core API script to experiment with that examples.