algorithmic modeling for Rhino
I enter the following math expression:
A = -(x ^ 2 + y ^ 2 + z ^ 2) * If((Math.Abs(x) < 1) & (Math.Abs(y) < 1) & (Math.Abs(z) < 1), (.5 + x ^ 2) * (0.7 + y ^ 2) * (0.7 + z ^ 2) + 4 * x * y * z - .5, -1)
When I run the VB script, I get an error. When I reopen the VB editor the math expression has changed itself to the following:
A = -(x ^ 2 + y ^ 2 + z ^ 2) * If((Math.Abs(x) < 1) & (Math.Abs(y) < 1) & (Math.Abs(z) < 1), (.5 ) 0.7 ) 0.7 ) 5, -1)
any ideas why this is happening?
Tags:
I had suspected that "&" might be the problem, I did not know that "and" is used in VB net. Thanks! :)
I know simple cutting and pasting code from one application to another can frequently lead to problems. I have been looking for a concise glossary containing VB net functions, is there such a thing?
Cheers!
There's too many functions and classes for any sort of concise summary, but MSDN has information on all types and methods, and it also has tables of operators and stuff.
I have 2 additional issues, I need help with:
1.What is the VB script equivalent for DEG ?
Example: A = if( (Math.Cos(Deg(3*X))/0.9)^20+(Math.Cos(Deg(3*Y))/0.9)^20+(Math.Cos(Deg(3*Z))/0.9)^20-1>0,Math.Abs((X^100+Y^100+Z^100)^0.01-3.801 )-0.1 , 1)
2. How do I run 2 ISO Equation in one VB script ? (note: in the example below the Colon. : separates the 2 ISO equations)
Example: (((Math.Cos(x) * Math.Sin(y) - Math.Cos(y) * Math.Sin(z) - Math.Cos(z) * Math.Sin(x)) ^ 2 - 0.1) ^ 2 - 0.8) + .012 * (x ^ 6 + y ^ 6 + z ^ 6):(((Math.Cos(x) * Math.Sin(y) - Math.Cos(y) * Math.Sin(z) - Math.Cos(z) * Math.Sin(x)) ^ 2 - 0.1) ^ 2 - 0.9) + .011 * (x ^ 6 + y ^ 6 + z ^ 6)
RhinoMath.ToDegrees Method
Convert an angle from radians to degrees.
public static double ToDegrees(
double radians
)
Visual Basic
Public Shared Function ToDegrees ( _
radians As Double _
) As Double
Parameters
radians
Type: System.Double
Radians to convert (180 degrees equals pi radians).
Return Value
See http://4.rhino3d.com/5/rhinocommon/
2) You must Add a second output of VB (by default B) click on + rename if needed
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by