Design Script contest (1)

The challenge is to reproduce this in design script
I have a few more coming
Have fun

8 Likes

Nice. Here is my submission :slight_smile:

spiral

a = Dictionary.ValueAtKey(DateTime.Components(d), "second")*12;

x1 = (0..(Math.PiTimes2)..#500);
y1 = Math.Sin(a..(a+360)*3..#500);
z1 = Math.Cos(a..(a+360)*3..#500);
n1 = NurbsCurve.ByPoints(Point.ByCoordinates(x1,y1+4));
n2 = NurbsCurve.ByPoints(Point.ByCoordinates(x1,0,z1+4));
n3 = NurbsCurve.ByPoints(Point.ByCoordinates(x1,y1+4,z1+4));
l1 = Line.ByStartPointEndPoint(n1.StartPoint,n3.StartPoint);
l2 = Line.ByStartPointEndPoint(n2.StartPoint,n3.StartPoint);
c1 = GeometryColor.ByGeometryColor([n1,l1],Color.ByARGB(255,0,0,255));
c2 = GeometryColor.ByGeometryColor([n2,l2],Color.ByARGB(255,255,0,0));
11 Likes

Thats Great


Getting an error While Doing this

Try again in Dynamo Sandbox.
What you see might be due to installed packages.

I tried in Dynamo sand Box

Warning: Point.ByCoordinates operation failed.
The type initializer for ‘Autodesk.LibG.LibGPINVOKE’ threw an exception.

What version of Revit and Dynamo are you running?

revit 2020,

image

No worries, just wait a little while please.
Someone on the other side of the globe that can help is sleeping now.
When they wake up, they will step in. :slight_smile:
One last question: Is that the same error in sandbox and revit dynamo?

1 Like

Try prefixing all instances of DateTime, Math and Color with DSCore.
sineCurve_2021-01-31_07-57-04

Warning: GeometryColor.ByGeometryColor operation failed.
Value cannot be null.
Parameter name: geometry.

Seems like your Dynamo installation is faulty. If you do not receive any suggestions from others, consider reinstalling Revit and Dynamo

Probably you should read the message first. It might find multiple definitions of Line. So prefixing it with ‘DesignScript.Geometry’ will solve it:

It happens if you run this in D4C3D.

Warning: Point.ByCoordinates operation failed.
The type initializer for ‘Autodesk.LibG.LibGPINVOKE’ threw an exception.

From Past 2 Years, there were lot of amendments happening in the DesignScripting itself. Please keep an eye on mostly the NameSpaces, Classes. :slight_smile:

a = DesignScript.Dictionary.ValueAtKey(DateTime.Components(d), “second”)*12;

x1 = (0…(DSCore.Math.PiTimes2)…#500);
y1 = DSCore.Math.Sin(a…(a+360)*3…#500);
z1 = DSCore.Math.Cos(a…(a+360)*3…#500);
n1 = NurbsCurve.ByPoints(Point.ByCoordinates(x1,y1+4));
n2 = NurbsCurve.ByPoints(Point.ByCoordinates(x1,0,z1+4));
n3 = NurbsCurve.ByPoints(Point.ByCoordinates(x1,y1+4,z1+4));
l1 = Autodesk.DesignScript.Geometry.Line.ByStartPointEndPoint(n1.StartPoint,n3.StartPoint);
l2 = Autodesk.DesignScript.Geometry.Line.ByStartPointEndPoint(n2.StartPoint,n3.StartPoint);
c1 = GeometryColor.ByGeometryColor([n1,l1],Color.ByARGB(255,0,0,255));
c2 = GeometryColor.ByGeometryColor([n2,l2],Color.ByARGB(255,255,0,0));

3 Likes

Hi everybody,

I’m playing around with design scripting.
How many ms do you have it on?