
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am new at Revit API (and I don't know english very well), so I don`t know if the words that I use are correct. But...
I have a class (in Transaction.Mode) and a form.
When I press a button in the form my code catch points written in the form and put beams in its place (I am using delegate to do this). The problem is that it's not working. There`s no errors when I execute the code, but the beams are not being placed. Below there is a summary of the code.
Can anyone help me? Besides I have searched about calling forms in applications and the best solution was use 'delegate'. Is there another solution?
[Transaction(TransactionMode.Manual)]
public class Estrutura : IExternalCommand
{
public Result Execute(
ExternalCommandData commandData,
ref string message,
ElementSet elements)
{
UIApplication uiapp = commandData.Application;
UIDocument uidoc = uiapp.ActiveUIDocument;
Autodesk.Revit.ApplicationServices.Application app = uiapp.Application;
Document doc = uidoc.Document;
Autodesk.Revit.DB.View view = doc.ActiveView;
Autodesk.Revit.ApplicationServices.Application application = doc.Application;
var dados = new RevitAddin1.Form2();
dados.Show();
dados.button3.Click += delegate
{
double[][] matriz = dados.AtribuiValores(); //It's the method used to catch the points.
. //I hid this part of the code to let it cleaner.
.
.
.
.
instance = doc.Create.NewFamilyInstance(line, gotSymbol, l, StructuralType.Beam);
dados.Close();
};
\\I have already tried to place the beams with another Transaction, but the code stops in dados.Close();
using (Transaction tx = new Transaction(doc, "Viga"))
{
tx.Start("v");
foreach (Line linha in lista)
{
instance = doc.Create.NewFamilyInstance(linha, gotSymbol, l, StructuralType.Beam);
}
tx.Commit();
}
return Result.Succeeded;
}
}
Solved! Go to Solution.