DesignScript If-statement not working when trying to convert ModelCurves/Grids into Dynamo Lines

Hi all,

I have a script and I would like it to work with both ModelCurves or Grids as input selection by the end user seamlessly. I have gotten it to work, using the nodes on the right, so it’s not a big deal if I can’t get the DesignScript to work but I would like to understand why my DesignScript doesn’t work here.

PS: The function.apply nodes on the right are just to suppress unwanted errors when trying to convert lines using the Grid.Curve node.

DSCore.Object.Type(elements) == "Revit.Elements.Grid" ?
	Grid.Curve(elements) :
		Revit.Element.Geometry(elements);

You’re asking if a DSCore.List object is a Grid. The answer is ‘no more than my grocery list is dinner’ so this looks right to me.

Try asking @L1 or with longest lacing or specify the data structure. :slight_smile:

I’m not too familiar with apply list levels and list lacing directly in DesignScript, how would I do that? I’m going to check it in the documentation now but thought to let you know in the meantime.

Hey, list levels in design script are pretty straight forward
@L2

use block to code on some test notes to get a hang of things:
image

list lacing is atleast for me a little more complex:


Source is on Page 28:
DesignScriptGuide_.pdf (460.1 KB)

Glood luck

Thanks for the suggestion @Huettig , however I just can’t get the Grid.Curve to give me anything, no matter what level or lacing option. The Element.Geometry ‘option’ works fine though

The problem is that Element.Geometry returns a list. Just use an If statement with CurveElement.Curve instead of Element.Geometry.
image

Thanks @Nick_Boyts !! I already suspected something regarding that but wasn’t able to get it to work. I knew there was a node specifically for getting the geometry from Revit curves but couldn’t find it so I tried Element.Geometry instead.