Radial Grids

@Marcel_Rijsmus great start…but I think there is more to the question, than what you have answered here.

Mainly that aside from the Grid.ByLine the OP can create more complicated Grids using the Multi-Segment Grid class. I talked about creating those here: Multi-Segment grids

Now in this particular case we are dealing with simple line based grids as well as potentially a multi-segment grid where multiple arcs/lines would be used to create it. Please keep in mind that MultiSegmentGrids can only be created from Lines and Arcs. Below is a little bit more robust interpretation of the answer that @Marcel_Rijsmus posted.

Couple things worth noting:

  • I added a Element.SetParameterByName node at the end of the routine for creating the linear Grids. I bet that creating grids is not the end of the road here. Vertical grids usually have numbers i think. The other ones would have letters. (I will leave that for the OP to sort out)
  • I also broke down the ellipse curve into lines and arcs, so that OP understands the kind of input that is needed for the multi-segment grids.
  • There are nodes that trim the ellipse at start and end. The reason I did that was to make sure that the curves that we are feeding into the MultiSegmentGrid creation python nodes, is not a closed curve (circle, ellipse etc.). Revit doesn’t allow closed curve grids. So I basically cut the curve back a little at each end to add a small gap in the curve.
  • just for shits and giggles I also extended the lines a little. it’s just better looking this way.

Result:

Here’s the Python code:

# Copyright(c) 2019, Konrad K Sobon
# @arch_laboratory, http://archi-lab.net

import clr
clr.AddReference('ProtoGeometry')
import Autodesk.DesignScript.Geometry

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *

import System
from System import Array
from System.Collections.Generic import *

import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)

def create_grid(type, curves, plane):
	typeId = UnwrapElement(type).Id
	plane = Plane.CreateByNormalAndOrigin(XYZ(0,0,1), XYZ(0,0,0))
	sketchPlane = SketchPlane.Create(doc, plane)
	curveLoop = CurveLoop()
	for i in curves:
		c = i.ToRevitType()
		curveLoop.Append(c)
	gridId = MultiSegmentGrid.Create(doc, typeId, curveLoop, sketchPlane.Id)
	return doc.GetElement(gridId)

try:
    errorReport = None
    TransactionManager.Instance.EnsureInTransaction(doc)
    output = []
    for i in IN[1]:
    	output.append(create_grid(IN[0], i, IN[2]))
    TransactionManager.Instance.TransactionTaskDone()

except:
    import traceback
    errorReport = traceback.format_exc()

if None == errorReport:
    OUT = output
else:
    OUT = errorReport
11 Likes