How does lacing work in Design Script?

Hi guys,

Yesterday I started with Design Scripting and I like it very much! :slight_smile:
Can someone explain to me how lacing works?
Behind which part of my input should I apply the lacing?

For example v6 or vp1

// Sheets ophalen (Get Sheets)

t1 = DocumentTools.Documents.activeDocument();
t2 = DesignScript.Dictionary.ValueAtKey(t1, "activeDocument");
t3 = Category.ByName("Sheets");
t4 = Collector.ElementsOfCategoryInDocument(t2, t3);

// Sheet sorteren ahv gegevens (Sort Sheets)
t5 = Elements.Element.GetParameterValueByName(t4, "Sheet Number");
t6 = String.Contains(t5,"L", true);
t7 = String.Contains(t5,"W", true);
t8 = List.FilterByBoolMask(t4, t6)["in"];
t9 = List.FilterByBoolMask(t4, t7)["in"];
t10 = List.Join([t8,t9]);
t11 = Elements.Element.GetParameterValueByName(t10, "Sheet Number");
t12 = List.GetItemAtIndex(t10, 3);

// Views selecteren en sorteren (Sort en select views)

v1 = Category.ByName("Views");
v2 = Collector.ElementsOfCategoryInDocument(t2, v1);
v3 = String.Split(t11, "_");
v4 = List.GetItemAtIndex(v3<1L>, 1);
v5 = Elements.Element.Name(v2);
v6 = String.Contains(v5<1L>,v4<1L>,true);
v7 = List.FilterByBoolMask(v2,v6)["in"];
v8 = List.GetItemAtIndex(v7,4);

// View plaatsen (Place view on sheet)
vp1 = Rhythm.Elements.Viewport.Create(t12<1L>,v8<1L>,Point.ByCoordinates(0,0,0));

Thanks in advance

1 Like

Thank you for you’re answer, I did read this topic too but I don’t understand when I need to use <1> or (<2> I dont know of this is available)? And after which input do I have to place this lacing symbol?


good question, i ve never wrote it separtly, i did just code to block

2 Likes

Haha, so:
Shorterst : <1> after both inputs
Longest : <1L> after both inputs
Cross : 1 input <1> and 1 input <2>

Does it matter which input gets the 1 or the 2?
And what’s happend with more than 2 inputs…

I do the same with the code to node tool but I want to understand how dynamo is thinking haha.

2 Likes

and two links about advanced lacing:

Teaching people to fish here rather than giving an answer. :slight_smile:

Find a function which takes two inputs produce a clear result, say Point.ByCoordinates(x<1>,y<2>).

Feed it a range like 0…3 for both inputs.

Then disable the geometry preview. Note the list structure should be a list of lists.

Now add a List.FirstItem node to pull the first sublist out of the results.

Now change the <1> to <2> and check the results. Then change the <2> to <1> and see what happens.

Keep playing with input numbers - add a <4> somewhere. Really go nuts with it - after a few it will click. :slight_smile:

7 Likes

Ah that is a really nice way to learn this! Thanks!
So this function is more than just lacing?

Yup! It also dictates what input is dominant and the hierarchy of all inputs :slight_smile: An excerpt from my Introduction to DesignScript course at BILT EUR 2018 may help explain.

10 Likes

Thank you Sol Amour!
This is a really nice document :slight_smile: !

1 Like