Gestire Script

Cos’e’ RhinoCommand ?
Dove lo hai letto ?

la fretta la fretta RhinoCommon sorry

ottima. . . come dire: escamotage :wink:

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

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 :laughing: :laughing: :sweat_smile:

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

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:

Option Explicit

Function somma()
	somma = 3 * 3
End Function

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

:face_with_raised_eyebrow:

1 Mi Piace

perplesso? non ti convince. . .

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

Hahahahahaha …
Confessa che non lo sapevi, Sergio :wink: … le funzioni sono una cosa MOOOOOLTO advanced.
:grinning_face_with_smiling_eyes: :grinning_face_with_smiling_eyes: :grinning_face_with_smiling_eyes:

1 Mi Piace

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

1 Mi Piace

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

:+1: