02_user_tutorials:07_additional_interfaces:cli:startup-cli-model
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| 02_user_tutorials:07_additional_interfaces:cli:startup-cli-model [2025/01/24 15:51] – removed - external edit (Unknown date) 127.0.0.1 | 02_user_tutorials:07_additional_interfaces:cli:startup-cli-model [2025/01/24 16:33] (current) – tim2 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | {{howhard> | ||
| + | ===== Start a model in CLI ===== | ||
| + | In this tutorial we will go through the creation, modification and basic interactions of a RGG project. | ||
| + | |||
| + | Let's start by starting GroIMP in CLI with the command '' | ||
| + | |||
| + | ==== Create the project ==== | ||
| + | |||
| + | Use the command '' | ||
| + | |||
| + | The prompt changed and is now **[myproject]**. This indicates that you are within the workbench of your project. You can list all workbenches and select another one with '' | ||
| + | |||
| + | The project contains two rgg files: _Model.rgg_ and _param/ | ||
| + | |||
| + | You can display the project graph with the command '' | ||
| + | |||
| + | You should see: | ||
| + | |||
| + | < | ||
| + | [0] : Node [0] | ||
| + | [1] : RGGRoot [21] | ||
| + | [2] : A [23] | ||
| + | </ | ||
| + | |||
| + | For now the project graph only has one rgg node: the Node _A_. | ||
| + | |||
| + | ==== Run the project ==== | ||
| + | |||
| + | You can open the file _Model.rgg_ of your project to see what it is doing with the command: '' | ||
| + | |||
| + | Exit nano (by pressing CTRL+X). | ||
| + | |||
| + | Let's apply the rgg function _run_ by using the command '' | ||
| + | |||
| + | You can see that the graph changed by reprinting it: '' | ||
| + | |||
| + | You can use the command '' | ||
| + | |||
| + | Let's add a new file to the project that will includes a new rgg function. Create the file with '' | ||
| + | Copy the following function, that count and print the number of Node A in the graph: | ||
| + | |||
| + | <code java> | ||
| + | public void countNodeA(){ | ||
| + | println(count((*Model.A*))); | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | Quit nano and accept to save the file (CTRL+X to quit, then //y// to save, then //enter// to accept the temporary file path). | ||
| + | When editing and saving a file in a project, the graph is automatically reseted and the project is recompiled. | ||
| + | |||
| + | Use '' | ||
| + | |||
| + | < | ||
| + | - countNodeA | ||
| + | - Run countNode | ||
| + | - run | ||
| + | - Run run | ||
| + | </ | ||
| + | |||
| + | You can run _countNodeA_ by simply typing its name: '' | ||
| + | |||
| + | |||
| + | ==== Modify Node's attributes ==== | ||
| + | |||
| + | It is possible to modify a Node attribute (which do not recompile the project), by using the command '' | ||
| + | The tree id is the id displayed on the left by the '' | ||
| + | |||
| + | Let's recompile, and run few time the project: '' | ||
| + | |||
| + | < | ||
| + | [0] : Node [0] | ||
| + | [1] : RGGRoot [71] | ||
| + | [2] : F [74] | ||
| + | [3] : RU [75] | ||
| + | [4] : RH [76] | ||
| + | [5] : F [81] | ||
| + | ... | ||
| + | </ | ||
| + | |||
| + | In this case the tree id of the first //F// is 2. | ||
| + | |||
| + | Let's modify it: '' | ||
| + | The attributes of the nodes are: | ||
| + | |||
| + | < | ||
| + | Transforms children: | ||
| + | diameter: | ||
| + | color: | ||
| + | Length: | ||
| + | Treated as infinite: | ||
| + | Render as Wireframe: | ||
| + | Layer: | ||
| + | Scale V: | ||
| + | Name: | ||
| + | </ | ||
| + | |||
| + | We can change the color for instance, setting the value to 5. (color: | ||
| + | |||
| + | ==== Export the project ==== | ||
| + | |||
| + | To visualize the scene we need to export it, as CLI do not have a 3d view. | ||
| + | |||
| + | We can export the scene with the command '' | ||
| + | |||
| + | We can do for example '' | ||
| + | |||
| + | You can open it and see the default newrgg tree with a purple first node. | ||
| + | |||
| + | ==== Save the project ==== | ||
| + | |||
| + | Finally, you can save your project with the command '' | ||
| + | |||
| + | You can then close and reopen your project with '' | ||
| + | |||
| + | ==== Example models ===== | ||
| + | |||
| + | GroIMP includes many example projects. You can list all available examples with the command '' | ||
| + | |||
| + | Then, you can load one with '' | ||
| + | |||
| + | This project includes objects that needs to be instanciated (this step is automatically done when opened in the GUI, but not in the CLI). This can be done by compiling the project: '' | ||
