Design Script contest (4 final)

The challenge is to reproduce this in design script
This time bringing in Revit geometry or else is ok, but the arm must be fixed in length
Have fun
content-1523374680-crank-moves-in-a-circle

8 Likes

a = Math.Ceiling(Dictionary.ValueAtKey(DateTime.Components(d), "second")*0.58);

ps1 = 3;
xx1 = -5..5..#30;
yy1 = Math.Sqrt(ps1*ps1-Math.Pow(xx1,2));
sg1 = List.FilterByBoolMask(Math.Sign(xx1),yy1>0)["in"];
xx2 = Math.Round(List.FilterByBoolMask(xx1,yy1>0)["in"],6);
yy2 = Math.Round(List.FilterByBoolMask(yy1,yy1>0)["in"],6)*sg1;

pv1 = Point.ByCoordinates(xx2);
pv2 = Point.ByCoordinates(0,yy2);
ln1 = List.Flatten(Line.ByStartPointEndPoint(pv1,[pv2,List.Reverse(pv2)]<1>),-1);
an1 = ln1.ExtendEnd(3).EndPoint.AsVector().AngleAboutAxis(Vector.XAxis(),Vector.ZAxis());
ln2 = List.SortByKey(ln1,an1)["sortedList"];
ln3 = List.GetItemAtIndex(ln2,a);

//Solids
cl1 = Circle.ByCenterPointRadius(ln3.StartPoint,0.07).ExtrudeAsSolid(Vector.ZAxis(),0.125);
cl2 = Circle.ByCenterPointRadius(ln3.EndPoint,0.07).ExtrudeAsSolid(Vector.ZAxis(),0.125);
cl3 = Circle.ByCenterPointRadius(ln3.ExtendEnd(4.15).EndPoint,0.1).ExtrudeAsSolid(Vector.ZAxis(),0.15);
ln4 = PolyCurve.ByThickeningCurveNormal(ln3.ExtendEnd(4.5).ExtendStart(0.15),0.5,Vector.ZAxis()).ExtrudeAsSolid(Vector.ZAxis(),0.05);
rt1 = Rectangle.ByWidthLength(0.75,0.5).Translate(Vector.XAxis(),ln3.StartPoint.X).ExtrudeAsSolid(Vector.ZAxis(),-0.2);
rt2 = Rectangle.ByWidthLength(0.5,0.75).Translate(Vector.YAxis(),ln3.EndPoint.Y).ExtrudeAsSolid(Vector.ZAxis(),-0.2);
rt3 = Rectangle.ByWidthLength(3,3).Translate([1.75,1.75,-1.75,-1.75],[1.75,-1.75,-1.75,1.75],-0.1).ExtrudeAsSolid(Vector.ZAxis(),-0.1);
rt4 = Solid.ByUnion(List.Flatten([rt3,Rectangle.ByWidthLength(6.5,6.5).Translate(0,0,-0.2).ExtrudeAsSolid(Vector.ZAxis(),-0.3)],-1));

//Color
cr1 = GeometryColor.ByGeometryColor(ln4,Color.ByARGB(255,204,102,0));
cr2 = GeometryColor.ByGeometryColor([rt1,rt2],Color.ByARGB(255,255,255,0));
cr3 = GeometryColor.ByGeometryColor(rt4,Color.ByARGB(255,255,255,200));
cr4 = GeometryColor.ByGeometryColor([cl1,cl2,cl3],Color.ByARGB(255,0,255,200));
18 Likes

Hats off for @Vikram_Subbaiah :clap: and @Dimitar_Venkov too
And here is all you need.
Maybe @solamour can give a link to his class at Autodesk University :slight_smile:

https://www.autodesk.com/research/publications/designscript
DesignScriptDocumentation.pdf (705.5 KB) designscript-final.pdf (1.5 MB) DesignScriptGuideV2.1.pdf (343.2 KB)

7 Likes

My DesignScript presentation is located here: GitHub - Amoursol/dynamoDesignScript: DesignScript workflows for Dynamo :slight_smile:

3 Likes

@solamour Was there a recording of this class we can view on Autodesk University? (video)

This was from BILT Europe 2018 in Ljubljana, so unfortunately no recording is available :frowning:

2 Likes

In dynamo the DateTime.Now doesn’t update… So how do you make it move?

Change Run mode from Automatic to Periodic

2 Likes

How have I never spotted that before! Thank you! :heart_eyes:

Hi, it is very nice. Is here someone who has already tried make time tracker in Dynamo?

What kind of time tracker are you after :slight_smile: ? How long a graph, and individual nodes take to run? If so, then take a look at our package called TuneUp which enables said profiling operations.

https://dynamobim.org/tuneup-extension-explore-your-node-and-graph-execution-times/

1 Like

Hi @solamour, this looks cool and I hope I can test it soon. I was only wondering if I can make my own very simple task time tracker. In my mind was very simple graph, where I have for example 5 names of my projects and I somehow (manually changing input which is project name) count total time as I work on different project during day.

1 Like

Ah, I see! A different kind of use case :slight_smile: TuneUp is specifically for Dynamo graph runtimes.