How do I bake a revit line out

hello,

I have found my lines that are currently Autodesk.Revit.DB-Lines

Firstly I just want to be able to bake these lines out to my revit canvas,

Secondly, I want to be able to find the midpoint of these lines within my python script. would I then start using grasshopper commands to do this?

Here is a grasshopper version, to get into the rhino you can bake the curve/points.

1 Like

Hi @rRickson,

Thankyou for replying

At the moment I am passing the lines out of my script that i want, how do I then turned these into GH curves? Just for references, these are curtain grids that I have turned into lines.

You can see my output in the image,

Try casting to a curve (using a grasshopper curve component)

I know if using the RiR Analyze Curtain Wall/Grid component it will cast to curves.

I believe they have a ToGeometry method or something like that in the RiR as well.

Agree about the component.

However what I want to know is how do I use the API to convert Autodesk.Revit.DB.Line (as seen in the image) into a grasshopper line that i can either bake out or even better, start to manipulate.

I just want to know where I can go next from the - Autodesk.Revit.DB.Line output

Hello -
Does anyone have information how I can bake out a revit line- as shown above- into rhino.

Or more to the point convert it to gh geometry.

Thankyou

You can use Autodesk.Revit.DB.Line.GetEndPoint(index) Method and index is 0 for the start or 1 for end of the curve. Then use those points to create Gh Lines.

https://www.revitapidocs.com/2015/a02da994-2976-38c0-e16b-20292de9fe57.htm

I have done this- but it seems a pretty long work around for something that you should just be able to cast out?

You could also argue that if I can get the point as you say and turn it to a gh point then I should in theory just be able to do the same for the line?

The way that Dynamo python button deals with this is to use ToProto() to make it into proto geometry (which I would compare to Gh geometry), and as far as I’m aware there isn’t something like this in RIR.

You could also argue that if I can get the point as you say and turn it to a gh point then I should in theory just be able to do the same for the line?

The difference is that the GetEndPoint Method is an actual Revit API Method. I’m pretty sure there isn’t a Revit API method that turns a line into a Gh line. If that get element geometry button doesn’t work then I don’t think it’s available at this point.

That really good to know- it would also be great if this was introduced in the future as a built in node for rir! @scottd