Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CREATE STL FILE

4 REPLIES 4
Reply
Message 1 of 5
tselvakkani23
598 Views, 4 Replies

CREATE STL FILE

tselvakkani23
Observer
Observer

I need to export the revit families file to STL file(as like as Export manual process) using C#.Net API code. Is it possible?

If possible, please provide the sample code for Revit 2021.

0 Likes

CREATE STL FILE

I need to export the revit families file to STL file(as like as Export manual process) using C#.Net API code. Is it possible?

If possible, please provide the sample code for Revit 2021.

4 REPLIES 4
Message 2 of 5

richard.schmitt.sg
Contributor
Contributor

pretty simple take your document and tell it to export an STL (only available for 2021 and onward)

revit api docs Document.Export 

 

STLExportOptions options = new STLExportOptions();
doc.Export(folderPath, fileName, options);
0 Likes

pretty simple take your document and tell it to export an STL (only available for 2021 and onward)

revit api docs Document.Export 

 

STLExportOptions options = new STLExportOptions();
doc.Export(folderPath, fileName, options);
Message 3 of 5
LyleHardin
in reply to: tselvakkani23

LyleHardin
Advisor
Advisor

Just a heads up. Not much help from my end, but I thought I'd let you know that depending on what you're exporting and what you plan on doing with it, it may or may not work. For instance, exporting a building to be 3D printed doesn't work well at all on the 3D printer side of things. At least it didn't for me when I used the STL Export command from Revit. Way too much detail and data. And it wasn't watertight. I ended up having to remodel everything in AutoCAD 3D Solids (which only took a few hours) then export that to STL for it to work with the 3D printers we sere using.

 

0 Likes

Just a heads up. Not much help from my end, but I thought I'd let you know that depending on what you're exporting and what you plan on doing with it, it may or may not work. For instance, exporting a building to be 3D printed doesn't work well at all on the 3D printer side of things. At least it didn't for me when I used the STL Export command from Revit. Way too much detail and data. And it wasn't watertight. I ended up having to remodel everything in AutoCAD 3D Solids (which only took a few hours) then export that to STL for it to work with the 3D printers we sere using.

 

Message 4 of 5

chrisP6TSM
Explorer
Explorer

Getting the following error when trying this code in Revit 2023: "the provided options are not valid"

0 Likes

Getting the following error when trying this code in Revit 2023: "the provided options are not valid"

Message 5 of 5
Mohamed_Arshad
in reply to: chrisP6TSM

Mohamed_Arshad
Advisor
Advisor

HI @chrisP6TSM 

You have to give the ViewId in the STLExportOptions. Means Defining View to Export.

Kindly refer the below code for additional reference.And use the given options in the STLExportOptions to export STL with more accuracy.

 

            //Export Options
            STLExportOptions opt = new STLExportOptions();
            opt.ViewId = doc.ActiveView.Id;

            //folder--> Give only the Folder path
            doc.Export(folder, "Demo.stl", opt);

 

Hope this will Helps 🙂

 

Thanks & Regards,
Mohamed Arshad K
0 Likes

HI @chrisP6TSM 

You have to give the ViewId in the STLExportOptions. Means Defining View to Export.

Kindly refer the below code for additional reference.And use the given options in the STLExportOptions to export STL with more accuracy.

 

            //Export Options
            STLExportOptions opt = new STLExportOptions();
            opt.ViewId = doc.ActiveView.Id;

            //folder--> Give only the Folder path
            doc.Export(folder, "Demo.stl", opt);

 

Hope this will Helps 🙂

 

Thanks & Regards,
Mohamed Arshad K

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report