- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Denunciar
Buenas tardes, en un foro mas o menos del 2014 encontré un codigo para unir el piso con las paredes para revit, cuando lo pego en mi visual studio community 2019 me registra error en la linea "Document doc = this.ActiveUIDocument.Document;", cuando leo el detalle del error, visual me muestra lo siguiente.
Error CS1061 "Class1" no contiene una definición para "ActiveUIDocument" ni un método de extensión accesible "ActiveUIDocument" que acepte un primer argumento del tipo "Class1" (¿falta alguna directiva using o una referencia de ensamblado?).
podrian ayudarme para saber que falta en el codigo o si hay que actualizar algo ya que es muy viejo.
este es el codigo completo.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
namespace Autojoining_floors_and_walls
{
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
public class Class1
{
private bool overlap1D(double a1, double a2, double b1, double b2)
{
if (a2 >= b1 && b2 >= a1) return true;
return false;
}
private bool bbIntersect(BoundingBoxXYZ A, BoundingBoxXYZ B)
{
return overlap1D(A.Min.X, A.Max.X, B.Min.X, B.Max.X) &&
overlap1D(A.Min.Y, A.Max.Y, B.Min.Y, B.Max.Y) &&
overlap1D(A.Min.Z, A.Max.Z, B.Min.Z, B.Max.Z);
}
public void joinFloorWall()
{
Document doc = this.ActiveUIDocument.Document;
UIDocument uiDoc = new UIDocument(doc);
FilteredElementCollector walls = new FilteredElementCollector(doc)
.OfCategory(BuiltInCategory.OST_Walls).WhereElementIsNotElementType();
FilteredElementCollector floors = new FilteredElementCollector(doc)
.OfCategory(BuiltInCategory.OST_Floors).WhereElementIsNotElementType();
using (Transaction t = new Transaction(doc, "Join walls to floors"))
{
t.Start();
foreach (Wall w in walls)
{
BoundingBoxXYZ wBB = w.get_BoundingBox(null);
if (wBB != null) foreach (Floor f in floors)
{
BoundingBoxXYZ fBB = f.get_BoundingBox(null);
if (fBB != null) if (bbIntersect(wBB, fBB))
{
if (!JoinGeometryUtils.AreElementsJoined(doc, w, f))
{
try
{
JoinGeometryUtils.JoinGeometry(doc, w, f);
}
catch (Autodesk.Revit.Exceptions.ApplicationException)
{
}
}
}
}
}
t.Commit();
}
}
}
}
¡Resuelto! Ir a solución.