# Christmas Tree Mantle (gifts inside)

Hello to everyone!

Here is a simple dynamo script for creation of stylish Christmas tree mantle. Basically, it’s just curves (in Dynamo divided by points) which can be transferred to Revit as model lines and be decorated with some custom lighting bulb family elements.

Dynamo environment:

Main body of the script:

Revit model lines creation part from the script:

Revit lighting bulbs creation part from the script:

Revit environment:

Revit renders for better visualization:

Dynamo script and Revit light bulb family files:

Inspired by Vilnius city (Lithuania) Christmas tree 2017:
http://www.vilnius-tourism.lt/en/what-to-see/latest-tips/christmas-in-vilnius-2017/

Merry Christmas and happy New Year!

12 Likes

A very creative and comprehensive post. Nice job. Happy holidays to you also.

3 Likes

Nicely done indeed! I was attempting a parametric tree using a branching function earlier this month, but didn’t get to a ‘publishable’ point just yet. May change it to a palm tree or something. In any case once I get some wifi on the laptop I’ll post some code as well.

2 Likes

Link to the fractal version of the graph I mentioned is below. DYN can be downloaded there, and code is pasted after the link. Merry Christmas to all.

https://www.fractal.live/share/5a2cdb15179dcd7fa743073f

Create Tree:
def AltCreateBranch (line,cnt)
{
baseline =
line.Length > 0.25?
line:
null;

``````	Breakpoints =
Math.Random(
0.25,
List.OfRepeatedItem(
0.75,
cnt
)
);

InitialPoint =
baseline.PointAtParameter(
Breakpoints
);

LengthOfBranch =
baseline.Length*(1-Breakpoints);

InitialVector =
baseline.Direction;

OutsidePointSurface =
InitialPoint,
LengthOfBranch
).Explode();

ConeStartPoint =
Geometry.Translate(
InitialPoint,
InitialVector
);

ConeOfReference =
List.FirstItem(
ConeStartPoint,
InitialPoint,
LengthOfBranch*Math.Random(
1,
List.OfRepeatedItem(
4,
cnt
)
)
).Explode()<1L>
);

TargetSurface =
List.LastItem(
Flatten(
Geometry.Split(
OutsidePointSurface,
ConeOfReference
)<1L>
)<1L>
);

Branch =
Line.ByStartPointEndPoint(
InitialPoint,
TargetSurface.PointAtParameter(
Math.Random(
0,
List.OfRepeatedItem(
1,
cnt
)
),
Math.Random(
0,
List.OfRepeatedItem(
1,
cnt
)
)
)
);

return = Branch;
};
``````

Create Branches:
def branchit (line,count)
{
geometry = [Imperative]
{
branches = line;
cnt= count;
while (cnt > 0)
{
number =
cnt;
oldbranches =
Flatten(
branches
);
NewStartSet =
List.LastItem(
branches
);
AltCreateBranch(
NewStartSet,
cnt
);
cnt =
number-1;
branches =
oldbranches,
);
}
return =
Flatten(
branches
);
};
return =
geometry;
};

Nicely done!
How did you setup up the render?