jigu
June 16, 2017, 9:03am
1
I need to publish a Dynamo Studio script to Fractal. But, fractal won’t take in any Python scripts so I need to translate following Python script to Design script :

I=IN[0] - is a list
J=IN[1] - is a list
K=IN[2] - is a list
C=IN[3] - is a list
x=IN[4] - is a double
y=IN[5] - is a double
z=IN[6] - is a double

Can someone please help?

btw - I think it would be a really fun project for someone to take some subset of python, parse it and convert it to DesignScript using antlr.

Hi,

You would have gotten a much faster response if:

You’ve included your code as actual text
You provided some test data and the expected result, otherwise how else can the people willing to help you, make sure their solution works?
Provide as much additional context as possible. Somebody could have faced a similar problem before and have a better alternative
Luckily in this case the code looks straight-forward enough but please consider the above in the future. Here’s my take on it:

and the code:

```
def someScalingFunc(I:var[],
J:var[],
K:var[],
C:var[],
x:double,
y:double,
z:double){
return = [Imperative]{
F = 0;
for (i in GetKeys(I) )
{
F = F + C[i] * Math.Pow(x, Math.Round(I[i]) )
* Math.Pow(x, Math.Round(I[i]) )
* Math.Pow(y, Math.Round(J[i]) )
* Math.Pow(z, Math.Round(K[i]) );
}
return = F;
}};
```

7 Likes

Racel
June 19, 2017, 1:43pm
5
@jigu @Dimitar_Venkov - Just curious, were there any barriers to you implementing this code in DesignScript? If so, what were they?

We are actively working on refining the language and any feedback would be helpful.

Thanks @Michael_Kirschner2 for the headds up.