While often times sufficient, I sometimes find the standard means of Importing/Exporting model information using file formats to be quite cumbersome and limiting… especially in the case of Revit where it is next to impossible to modify or build from linked/imported files
Below is a basic example of streaming a list of XYZ coordinates from Grasshopper into a *csv file and then using that file to create reference points in a Revit conceptual mass… A custom script was written using the Revit API to read the CSV file and make the points.
WHAT you will need
Here is the Revit API code (in VB.NET) for reading the *.csv file.
Dim XYZfile As String = "insert file path here" If File.Exists(XYZfile) Then Dim FileReadXYZ As New StreamReader(XYZfile) Do While FileReadXYZ.Peek <> -1 Dim XYZLine As String = FileReadXYZ.ReadLine() Dim XYZData As String() = XYZLine.Split(",") Dim XYZ As Autodesk.Revit.Geometry.XYZ Dim RefPt As Autodesk.Revit.Elements.ReferencePoint XYZ = revit_app.Create.NewXYZ(Convert.ToDouble(XYZData(0)), Convert.ToDouble(XYZData(1)), Convert.ToDouble(XYZData(2))) RefPt = revit_doc.FamilyCreate.NewReferencePoint(XYZ) Loop End If