Quantcast
Channel: All Revit API Forum posts
Viewing all articles
Browse latest Browse all 66666

Cannot Open .rfa File

$
0
0

Hi all,

 

I'm having some issues importing *.rfa files into a project via code.  I've created a watered down version of the code I am using below:

 

string currentDirectory = "C:/Users/spaceroppa/Documents/bim_examples/";
string fileName = "Single Window.rfa";
string fullPath = currentDirectory + fileName;

if (!File.Exists(fullPath))
{
	TaskDialog.Show("Load Bim Object", "Can't find the file " + fullPath);
}

Document rvtDoc = uiApp.ActiveUIDocument.Document;
using (Transaction t = new Transaction(rvtDoc, "Import Bim Object"))
{
	t.Start();
	bool loadSuccess = rvtDoc.LoadFamily(fullPath);
	t.Commit();
	if (loadSuccess)
	{
		TaskDialog.Show("Load Bim Object", fullPath + " successfully loaded!");
	} else
	{
		TaskDialog.Show("Load Bim Object", "Failed to load " + fullPath);
	}
}

However, I cannot get this to work correctly.  Can anybody point out what I've done wrong or provide me with a functional example?

 

 

Cheers,

Adam


Viewing all articles
Browse latest Browse all 66666

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>