# Python script to Design Script

**URL:** <https://forum.dynamobim.com/t/python-script-to-design-script/12508>\
**Category:** DesignScript\
**Tags:** designscript, python\
**Created:** [June 16, 2017, 9:03am UTC](https://forum.dynamobim.com/t/python-script-to-design-script/12508 "2017-06-16T09:03:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jigu](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jigu/32/17981_2.png) [@jigu](https://forum.dynamobim.com/u/jigu)\
**Post date:** [June 16, 2017, 9:03am UTC](https://forum.dynamobim.com/t/python-script-to-design-script/12508/1 "2017-06-16T09:03:34Z")

</div>

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 :  
 ![](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/3X/e/6/e6140581380446a5f662171ec471dd29c2b6e77f.png)

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?

---

<div class="post-metadata">

**Author:** ![Michael\_Kirschner2](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/michael_kirschner2/32/75576_2.png) [@Michael\_Kirschner2](https://forum.dynamobim.com/u/Michael_Kirschner2)\
**Post date:** [June 16, 2017, 7:43pm UTC](https://forum.dynamobim.com/t/python-script-to-design-script/12508/2 "2017-06-16T19:43:31Z")

</div>

@Racel fyi

---

<div class="post-metadata">

**Author:** ![Michael\_Kirschner2](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/michael_kirschner2/32/75576_2.png) [@Michael\_Kirschner2](https://forum.dynamobim.com/u/Michael_Kirschner2)\
**Post date:** [June 16, 2017, 7:44pm UTC](https://forum.dynamobim.com/t/python-script-to-design-script/12508/3 "2017-06-16T19:44:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Dimitar\_Venkov](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/dimitar_venkov/32/2068_2.png) [@Dimitar\_Venkov](https://forum.dynamobim.com/u/Dimitar_Venkov)\
**Post date:** [June 17, 2017, 9:56am UTC](https://forum.dynamobim.com/t/python-script-to-design-script/12508/4 "2017-06-17T09:56:24Z")

</div>

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:

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/9/099cad2781b7fe46c038b644e42e97d1648c477d.png)

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;
}};
```

---

<div class="post-metadata">

**Author:** ![Racel](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/racel/32/8562_2.png) [@Racel](https://forum.dynamobim.com/u/Racel)\
**Post date:** [June 19, 2017, 1:43pm UTC](https://forum.dynamobim.com/t/python-script-to-design-script/12508/5 "2017-06-19T13:43:48Z")

</div>

@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.
