RhinoSCRipt parametric editing script program tutorial
1, Introduction
RhinoScript is a parametric editing script program that comes with Rhinoceros (rhinoceros modeling software).
Step 2 explain
RhinoScript scripting language is a VBScript language based on Microsoft. With RhinoScript, you can quickly add functions or automate the repetitive work of rhinoceros.
Scripting language is an explanation that can be obtained from a subset of Microsoft. It is a programming language. If you already know Visual Basic or Visual Basic Application (VBA), you can be very familiar with it. Even if you don't know VisualBasic, once you learn VBScript, you are planning VB language with your family in your own way.
RhinoScript can be translated into "rhinoscript" if it is translated literally. RhinoScript is a special programming language for Rhino based on VB(VisualBasic), which can be roughly divided into two parts: Marc and Script. Let's briefly explain the difference between Marco and Script.
Marcos = static (fixed, linear sequence)
Script = Dynamic (Nonlinear)
Flow control (skip and repeat pipeline)
Variable control (logical and mathematical operations)
Input and output (user interaction)
Description: Simply put, Marcos (which can be called a macro) in Rhino is like a password and an action, asking Rhino to help us perform the "action". Marco's command line is linear and static, which means that if we give a hundred instructions, Rhino will execute all the way from the first, second, third and so on to the hundredth command, and we can't jump or repeat a command. In contrast, scripts are dynamic and nonlinear. First of all, through FlowControl, we can skip or repeat some command lines, while VariableControl allows us to create logical and mathematical operations. Input/output (I/O) is the interaction between users and Rhino. Users can pass in various types of data, and then output them in various data forms after operation.
The main purpose of this paper is to explain the difference between Marcos and script, and then further explain the grammar, function and application of script.
02 = introduction to sinoscript (grammar)
After understanding the difference between Marcos and scripts, let's first introduce a simple "grammar". Grammar in computer programming language is actually just like learning English or other foreign languages. We need to memorize words and learn grammar. The grammar here is a bit like grammar. Therefore, grammar is a set of rules. In this way, of course, there will be so-called legal and illegal grammars, but in general daily life, if sentences that do not conform to grammar are said, people can basically guess from the context. However, computers are not so smart. If we write an ungrammatical command line, the computer will not guess, but simply ignore it. It will only tell us warning sentences such as "description error" and "illegal grammar", and tell us to go back and check which command line is wrong.
The VB language syntax used by RhinoScript is basically simple, very close to daily spoken language, which is a great boon for non-computer users. So, let's briefly explain several basic grammars that will be used in Rhino.
If we want to draw a line, we will say, "Draw a line, starting at the position of coordinate (0,0,0) and ending at the position of (10,0,0). Similarly, in Rhino's Marco command line, we can give the following instructions (please open ToolsCommandsMarcoEditor):
_Line0,0,0 10,0,0
However, if we are not in Marco, but in the environment of Script (please open ToolsRhinoScriptEdit), two statements will appear. One is to list the instructions directly under the command bar in the Rhino work interface. It can be said that:
Rhino. Command "_ line0,0,0 0 10/0,0,0"
Another way of saying this is to call many methods (more than 200) internally constructed in RhinoScript, so we should write like this:
Carl Reynolds. AddLine(Array(0,0,0),Array( 10,0,0))
Basically, the purpose of this paper is not to explain all the instructions or methods built in Rhino, but to simply explain the relationship between grammar in computer language and Chinese methods in everyday language. Therefore, the only difference is that Rhino will not respond if an instruction is given. This is definitely not the rhinoceros's fault. Go back and check if your command line is wrong.
In addition, if you want to know the grammar of VB in detail, you can refer to the Microsoft teaching manual on the network, which can be downloaded for free and has a Chinese version. If you want to know more about the syntax of all the methods in RhinoScript, please open the HelpPlug-insRhinoScript, which records the purpose, syntax and return value of each method in detail. Of course, we will mention it later.
The content of "RhinoSCRipt Parameterized Editing Script Program Tutorial of Rhinoscript" is shared here. After reading this sharing, you must have a deeper understanding of rhinoceros. If you have any other questions about the use of rhinoceros, you can click this link to learn more about Rhinoscript software: