# Stepped Topography

When we are representing Topography in a lot of our early design, we show it as a stepped site at determined intervals.This is just a graphical preference for our office, once the project progresses, a true topography is utilised.

I have devised a Dynamo>Revit workflow that gets the topography and plots the contours and the perimeter as line work (modelcurves) in Revit. This allows us to tab select the the contour lines to create the steps, not only saving a lot of time, but also allows us to set different height contour intervals.

The question is, that once I have extracted the contour lines and the perimeter, is it possible to get Dynamo to create the plates automatically? I have tried Extracting the Point Z values of the Curves and then Grouping them with the the highest contour line, but getting to the next step where it will create and outline curve that I can then set at a specific level has me a little stumped.
I was thinking that using the Floor.ByOutlineTypeAndLevel node would be a good way of getting the information back into the Revit model, That way the floor thickness could be set by the contour intervals and the Level set by the Z coordinates of the Curves? Below is the beginnings of the scriptâ€¦

Any help would be appreciated, otherwise the current workflow is good timesaver.

Hi @Scott_Crichton ,
hereâ€™s a proposition :

The floorbyoutlinefloortypeandlevel node doesnt take z values, it requires actual levelsâ€¦ In order to avoid creating one level per â€śstepâ€ť , i first create the floors on the lowest level then offset them using the width of the floor type youâ€™ll be using. â€śDĂ©calage par rapport au niveauâ€ť is just french for â€śHeight Offset From Levelâ€ť
I hope this gets you closer to what you want to achieve

``````//Turning Topography into polysurface

m = t.Mesh;
p = m.VertexPositions;
f = m.FaceIndices;
a = f.A;
b = f.B;
c = f.C;
i = List.Transpose({a,b,c});
pi = List.GetItemAtIndex(p,i);
s = Surface.ByPerimeterPoints(pi);
ps = PolySurface.ByJoinedSurfaces(s);
perim = PolyCurve.ByJoinedCurves(ps.PerimeterCurves());

//Creating the desired amount of "step" planes

z = p.Z;
range = List.MinimumItem(z)..List.MaximumItem(z)..step;
o = Autodesk.Point.ByCoordinates(0,0,range);
pl = Plane.ByOriginNormal(o,Vector.ZAxis());

//creating outlines

cvs = PolyCurve.ByJoinedCurves(ps.Intersect(pl));
cvsp = Flatten(perim.Trim(cvs,List.LastItem(cvs).StartPoint));
contours = List.Clean(PolyCurve.ByJoinedCurves(List.Transpose({cvs,cvsp})));
List.RemoveItemAtIndex(contours.PullOntoPlane(pl[0]),List.Count(contours)-1);

//offset range

List.RemoveItemAtIndex(range,List.Count(contours)-1);
``````

Also, you can join thoses layers to get a more aesthetically satisfying result :

``````import clr
from Autodesk.Revit.DB import*
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

TransactionManager.Instance.EnsureInTransaction(doc)

floors = [UnwrapElement(i) for i in IN[0]]
i = 0
while i < len(floors)-1 :
joined = JoinGeometryUtils.JoinGeometry(doc,floors[i],floors[i+1])
i = i+1

OUT = joined``````
6 Likes

Thanks so much for your help Mostafa,
I tried to run this on a sample topography surface and got a â€śPolycurves may not be branchingâ€ť error???

I expanded your Codeblock out into nodes to see if I could find where the error could be coming from, (also so I could get a better understanding of your workflow), but I got a bit stuck at creating the outlines. I have included the script and the sample topography so if you get a chance to have a quick look to see where the error might be coming from it would be greatly appreciated.

Stepped Surface from Topo.dyn (25.6 KB)

Stepped Topography.rvt (384 KB)

HI Scott,

You forgot to change Lacing to Longest:

1 Like

Thanksâ€¦missed that one!!!

@Scott_Crichton A simpler way to create topography as stepped floor, might compromise on boundary accuracy though.
steppedTopo.dyn (21.4 KB)

``````//Create stepped Floor by Contour
crv1=RemoveIfNot(Flatten(topo.Geometry()),"PolyCurve");
pln1=Plane.ByOriginNormal(crv1.StartPoint,Vector.ZAxis());
crv3=crv1[0].Project(List.DropItems(pln1,1),Vector.ByCoordinates(0,0,-1));
crv4={List.DropItems(crv1,1),PolyCurve.ByJoinedCurves(crv3)};
out=PolyCurve.ByJoinedCurves(PolySurface.ByLoft(Transpose(crv4)).PerimeterCurves());
flr=Floor.ByOutlineTypeAndLevel(out<1>,typ,lvl);``````

Thanks for all of the help.
When the topography gets a little more complicated the scripts bring up errors, or donâ€™t create certain floors. So, examining your workflows I have managed to come up with a script that is a little more robust (although it still has some problems on very complex topography, but perfect for our immediate needs!!). It does handle mounds in the topography though.
It certainly isnâ€™t a pretty as your scripts, but it gets the job done.
Thanks again.

Stepped Surface from Topo.dyn (65.1 KB)

1 Like

Hi All,

A different approach, which I have found very robust, inspired by the Mesh Primerâ€¦

I have found that Dynamo struggles mightily with the curves created from Topos, even if you convert them to Solids or Surfaces, I was getting lots of WIRE_SELF_INTERSECTS2. However if you convert to mesh, you can get working Polycurves for patching. If there were a way round this, then everything would get a bit easier.

Mark

Topo3D-ActiveView.dyn (57.9 KB)

Hi Mark,
thanks for your skript, but how to use this in Dynamo 1.3?. The package chynamo is not working. Canâ€™t download it.

Hey, it seems to still be there? It was built in 1.3â€¦

Hereâ€™s an updated version, Iâ€™ve copied the chynamo stuff out of their nodes, hopefully they donâ€™t mind.
SteppedTopoFromActiveView-noChynamo.dyn (75.3 KB)

Hope that helps,

Mark

Thx for your help Mark. In the moment there are a lot errors in the script. I will have a look, if I have time.