Message 1 of 6

Not applicable
02-17-2021
01:24 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have searched the forum and the API documentation and could not find a way to solve my problem. Here is the question:
I would like to create a add-in (for different users)to add parameters to the families that created by users before it loaded into project. I tried to use FamilyLoadingIntoDocumentEventArgs to achieve it.
private void checkFamilyAndInsertParameter(object sender, FamilyLoadingIntoDocumentEventArgs e)
{
string familyPath = e.FamilyPath;
{
Document familyDoc = e.Document.Application.OpenDocumentFile(familyPath + "//" + e.FamilyName + ".rfa");
App.ThisApp.ShowForm(uiapp, familyDoc);
}
}
//*****Application Code*****
//I triger the add parameters by a button click.
private void Button_Click(object sender, RoutedEventArgs e)
{
_mExternalMethodWpfArg.Execute(m_app,familyDoc,UI);
}
public override void Execute(UIApplication uiApp, Document familyDoc, Ui ui)
{
bool succeeded = Methods.AddParameters(uiApp,familyDoc,dataInputing);
}
//here is the add parameters code:
public static bool AddParameters(UIApplication m_app, Document familyDoc, Data data)
{
ParameterAssigner assigner = new ParameterAssigner(m_app.Application, familyDoc);
using (SubTransaction t = new SubTransaction(familyDoc))
{
t.Start();
succeeded = assigner.AddParameters(data);
if (succeeded)
{
t.Commit();
return true;
}
else
{
t.RollBack();
return false;
}
}
}
No Errors, but nothing happened to the family that loaded into project. No parameters added.
Anyone know why? Thanks
Solved! Go to Solution.