Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, I am stuck a bit with this.
What would be the process to open family file and make edit to it? By using the snippet below I get the following error: "starting a transaction from an external application running outside of API context is not allowed" And though I totally understand that I am trying to access it from outside, I have no clue what to do to access it right. Thank you in advance!
private void GetBfAndDfromRevit(Autodesk.Revit.ApplicationServices.Application app)
{
string path = ArticalNumberList.GetPath(articularTxtBox.Text);
//Open Revit Family File in a separate document
if(path!="")
{
Document revDoc = app.OpenDocumentFile(path);
//Get the familyManager instance from the open document
FamilyManager mgr = revDoc.FamilyManager;
using (Transaction tx = new Transaction(revDoc))
{
tx.Start("addtype");
if (mgr.Types.Size == 0)
{
mgr.NewType("Type 1");
}
tx.Commit();
}
}
}
Solved! Go to Solution.