# Gestire Script

**URL:** <https://it.discourse.mcneel.com/t/gestire-script/4800>\
**Category:** Bar-Rhino\
**Created:** [24 Novembre 2022, 11:06am UTC](https://it.discourse.mcneel.com/t/gestire-script/4800 "2022-11-24T11:06:27Z")\
**Posts on this page:** 11\
**Page:** 2

<div class="post-metadata">

**Author:** ![emilio](https://sea3.discourse-cdn.com/mcneel/user_avatar/it.discourse.mcneel.com/emilio/32/23060_2.png) [@emilio](https://it.discourse.mcneel.com/u/emilio)\
**Post date:** [26 Novembre 2022, 9:04pm UTC](https://it.discourse.mcneel.com/t/gestire-script/4800/21 "2022-11-26T21:04:22Z")

</div>

> [@0904](#):
>
> RhinoCommand

Cos’e’ RhinoCommand ?  
Dove lo hai letto ?

---

<div class="post-metadata">

**Author:** ![0904](https://avatars.discourse-cdn.com/v4/letter/0/b3f665/32.png) [@0904](https://it.discourse.mcneel.com/u/0904)\
**Post date:** [26 Novembre 2022, 9:34pm UTC](https://it.discourse.mcneel.com/t/gestire-script/4800/22 "2022-11-26T21:34:04Z")

</div>

> [@emilio](#):
>
> Cos’e’ RhinoCommand ?

la fretta la fretta RhinoCommon sorry

---

<div class="post-metadata">

**Author:** ![0904](https://avatars.discourse-cdn.com/v4/letter/0/b3f665/32.png) [@0904](https://it.discourse.mcneel.com/u/0904)\
**Post date:** [26 Novembre 2022, 9:43pm UTC](https://it.discourse.mcneel.com/t/gestire-script/4800/23 "2022-11-26T21:43:36Z")

</div>

> [@Sergio\_Alessi](#):
>
> Esempio molto banale:

ottima. . . come dire: escamotage 😉

Sergio io ho seguito le indicazioni del link che hai postato, adesso non mi lasciare solo però. . .  
che se sto cercando di iniziare questa nuova sfida e per colmare le lacune che ci sono con VBS/Py

---

<div class="post-metadata">

**Author:** ![0904](https://avatars.discourse-cdn.com/v4/letter/0/b3f665/32.png) [@0904](https://it.discourse.mcneel.com/u/0904)\
**Post date:** [26 Novembre 2022, 10:09pm UTC](https://it.discourse.mcneel.com/t/gestire-script/4800/24 "2022-11-26T22:09:45Z")

</div>

[https://developer.rhino3d.com/guides/rhinoscript/primer-101/4-operators-and-functions/](https://developer.rhino3d.com/guides/rhinoscript/primer-101/4-operators-and-functions/)

> So what if we want our function to manipulate several variables? How do we get around the ‘one return value only’ limitation? There are essentially four solutions to this, two of which are far too difficult for you at this moment and one of which is just stupid… try to guess which is which:
> 
> ```
> Use global variables
> Declare arguments by reference
> Return an array
> Return a class instance
> 
> ```
> 
> We’ll focus on number two for the time being. (#1 was the stupid option in case you were wondering.)

mi sa che la scelta 1 è quella che senza saperlo avevo scelto 😆 😆 😅

> Since the arguments are passed in by value, intA and intB are left intact when AnotherBogusFunction is called. Although the function received the values 4 and 7 respectively, it does not know where they came from and thus when it increments them on lines 11 and 12, the operation only applies to the local variable copies intNumber1 and intNumber2.
> 
> Passing arguments by reference is quite a tricky thing to wrap your head around, so don’t feel bad if you don’t get it at first. You can rest assured that in almost all cases we’ll be using the ByVal approach which means our data is simply copied out of harms way.
> 
> There is one other reason to use ByRef arguments which has to do with optimization. Whenever you pass an argument to a function it will be copied in the computer memory. With small stuff like integers, vectors and shorts strings this doesn’t matter, but when you start copying huge arrays back and forth you’re wasting memory and processor cycles. If it turns out your script is running slowly you could consider passing arguments by reference in order to avoid casual copying. You have to be careful not to change them, or very unpredictable things will start happening.

se non erro si tratta dell’argomento di cui parlasti con Emilio: ByRef e ByVal

---

<div class="post-metadata">

**Author:** ![0904](https://avatars.discourse-cdn.com/v4/letter/0/b3f665/32.png) [@0904](https://it.discourse.mcneel.com/u/0904)\
**Post date:** [26 Novembre 2022, 10:28pm UTC](https://it.discourse.mcneel.com/t/gestire-script/4800/25 "2022-11-26T22:28:43Z")

</div>

> [@0904](#):
>
> mi sa che la scelta 1 è quella che senza saperlo avevo scelto 😆 😆 😅

alla fine quello che intendevo fare con le classi in VBS si fa direttamente con le Funzioni  
mentre io invece all’epoca per far funzionare la Funzione dovetti dichiarare le variabili pubbliche  
invece leggendo alcuni passi che spiegavano le Funzioni ho trovato proprio quello che m interessava:

```auto
Option Explicit

Function somma()
	somma = 3 * 3
End Function

Call Main()
Sub Main()
	Rhino.Print somma()
End Sub

```

---

<div class="post-metadata">

**Author:** ![Sergio\_Alessi](https://sea3.discourse-cdn.com/mcneel/user_avatar/it.discourse.mcneel.com/sergio_alessi/32/22676_2.png) [@Sergio\_Alessi](https://it.discourse.mcneel.com/u/Sergio_Alessi)\
**Post date:** [26 Novembre 2022, 10:42pm UTC](https://it.discourse.mcneel.com/t/gestire-script/4800/26 "2022-11-26T22:42:17Z")

</div>

🤨

---

<div class="post-metadata">

**Author:** ![0904](https://avatars.discourse-cdn.com/v4/letter/0/b3f665/32.png) [@0904](https://it.discourse.mcneel.com/u/0904)\
**Post date:** [26 Novembre 2022, 10:47pm UTC](https://it.discourse.mcneel.com/t/gestire-script/4800/27 "2022-11-26T22:47:41Z")

</div>

> [@Sergio\_Alessi](#):
>
> 🤨

perplesso? non ti convince. . .

 ![Screenshot 2022-11-26 at 23-51-20 4 Operators and functions](https://global.discourse-cdn.com/mcneel/uploads/mcneel_it/original/2X/8/885e56b1c9891b2c2b68e68b87f3f4b0d41d0612.png)

---

<div class="post-metadata">

**Author:** ![Sergio\_Alessi](https://sea3.discourse-cdn.com/mcneel/user_avatar/it.discourse.mcneel.com/sergio_alessi/32/22676_2.png) [@Sergio\_Alessi](https://it.discourse.mcneel.com/u/Sergio_Alessi)\
**Post date:** [26 Novembre 2022, 11:15pm UTC](https://it.discourse.mcneel.com/t/gestire-script/4800/28 "2022-11-26T23:15:32Z")

</div>

> [@0904](#):
>
> perplesso? non ti convince. . .

… no no … sono stupefatto. Del resto anche il titolo,  
Advanced function syntax, è molto appropriato.

---

<div class="post-metadata">

**Author:** ![emilio](https://sea3.discourse-cdn.com/mcneel/user_avatar/it.discourse.mcneel.com/emilio/32/23060_2.png) [@emilio](https://it.discourse.mcneel.com/u/emilio)\
**Post date:** [26 Novembre 2022, 11:25pm UTC](https://it.discourse.mcneel.com/t/gestire-script/4800/29 "2022-11-26T23:25:48Z")

</div>

> [@Sergio\_Alessi](#):
>
> … no no … sono stupefatto. Del resto anche il titolo,

Hahahahahaha …  
Confessa che non lo sapevi, Sergio 😉 … le funzioni sono una cosa MOOOOOLTO advanced.  
😄 😄 😄

---

<div class="post-metadata">

**Author:** ![emilio](https://sea3.discourse-cdn.com/mcneel/user_avatar/it.discourse.mcneel.com/emilio/32/23060_2.png) [@emilio](https://it.discourse.mcneel.com/u/emilio)\
**Post date:** [26 Novembre 2022, 11:28pm UTC](https://it.discourse.mcneel.com/t/gestire-script/4800/30 "2022-11-26T23:28:54Z")

</div>

> [@0904](#):
>
> RhinoCommon

Si’, certo.  
Quella pagina fa parte della documentazione relativa a RhinoCommon.  
E comunque per comunicare con Rhino tramite C# c’e’ poco da sbagliare. 😉  
Puoi usare solo RhinoCommon. 😀

---

<div class="post-metadata">

**Author:** ![0904](https://avatars.discourse-cdn.com/v4/letter/0/b3f665/32.png) [@0904](https://it.discourse.mcneel.com/u/0904)\
**Post date:** [27 Novembre 2022, 12:13am UTC](https://it.discourse.mcneel.com/t/gestire-script/4800/31 "2022-11-27T00:13:50Z")

</div>

inizio col dire che ho aperto un 3d proprio su C# in Rhino:

> [@C# for Rhino](https://it.discourse.mcneel.com/t/c-for-rhino/4811):
>
> per Sergio che mi ha indicato il link con i 2 passaggi (entrambi eseguiti senza problemi) e anche per chi vorrà contribuire/partecipare a questo 3d io lo faccio con lo spirito della scoperta inizio col dire che dopo aver eseguito l’installazione di VStudio e RCommon ho avviato un nuovo progetto come indicato dalla guida e mi sono ritrovato con questa schermata dove selezionando Command.cs mi ritrovo con questo codice avvio l’esecuzione con la freccia Verde mi …

> [@emilio](#):
>
> Quella pagina fa parte della documentazione relativa a RhinoCommon.  
> E comunque per comunicare con Rhino tramite C# c’e’ poco da sbagliare. 😉  
> Puoi usare solo RhinoCommon. 😀

👍

[Pagina precedente](https://it.discourse.mcneel.com/t/gestire-script/4800.md?page=1)
