|
@@ -16,6 +16,7 @@ using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Threading.Tasks;
|
|
|
|
+using RevitToJBim.Extension;
|
|
|
|
|
|
namespace RevitToJBim
|
|
namespace RevitToJBim
|
|
{
|
|
{
|
|
@@ -30,17 +31,25 @@ namespace RevitToJBim
|
|
List<ElementWrapper> wrappers = new List<ElementWrapper>();
|
|
List<ElementWrapper> wrappers = new List<ElementWrapper>();
|
|
//应对传入元素,不是document全集的情况
|
|
//应对传入元素,不是document全集的情况
|
|
//FilteredElementCollector collector = new FilteredElementCollector(doc, elements.Select(e => e.Id).ToList());
|
|
//FilteredElementCollector collector = new FilteredElementCollector(doc, elements.Select(e => e.Id).ToList());
|
|
|
|
+
|
|
|
|
+ #region Unit
|
|
|
|
+
|
|
|
|
+ var formatOptions = doc.GetUnits().GetFormatOptions(UnitType.UT_Length);
|
|
|
|
+ ElementWrapper wrapper = new ElementWrapper(formatOptions, null);
|
|
|
|
+ wrappers.Add(wrapper);
|
|
|
|
+
|
|
|
|
+ #endregion
|
|
FilteredElementCollector collector = new FilteredElementCollector(doc);
|
|
FilteredElementCollector collector = new FilteredElementCollector(doc);
|
|
- //wrappers.AddRange(collector.Clone().FilterElements<Wall>().Select(e => new ElementWrapper(e)));
|
|
|
|
- //wrappers.AddRange(collector.Clone().FilterElements<CurveElement>(BuiltInCategory.OST_MEPSpaceSeparationLines).Select(e => new ElementWrapper(e)));
|
|
|
|
- //var sourceSpaces = collector.Clone().FilterElements<SpatialElement>(BuiltInCategory.OST_MEPSpaces).OfType<Space>().ToList();
|
|
|
|
- ////附加逻辑判断
|
|
|
|
- //// var originSpaces = collector.Clone().GetUseSpaces();
|
|
|
|
|
|
+ wrappers.AddRange(collector.Clone().FilterElements<Wall>().Select(e => new ElementWrapper(e)));
|
|
|
|
+ wrappers.AddRange(collector.Clone().FilterElements<CurveElement>(BuiltInCategory.OST_MEPSpaceSeparationLines).Select(e => new ElementWrapper(e)));
|
|
|
|
+ var sourceSpaces = collector.Clone().FilterElements<SpatialElement>(BuiltInCategory.OST_MEPSpaces).OfType<Space>().Where(t=>t.IsSpace()).ToList();
|
|
|
|
+ //附加逻辑判断
|
|
|
|
+ // var originSpaces = collector.Clone().GetUseSpaces();
|
|
|
|
|
|
- //wrappers.AddRange(sourceSpaces.Select(e => new ElementWrapper(e)));
|
|
|
|
|
|
+ wrappers.AddRange(sourceSpaces.Select(e => new ElementWrapper(e)));
|
|
|
|
|
|
- //wrappers.AddRange(collector.Clone().FilterElements<Pipe>().Select(e => new ElementWrapper(e)));
|
|
|
|
- //wrappers.AddRange(collector.Clone().FilterElements<Duct>().Select(e => new ElementWrapper(e)));
|
|
|
|
|
|
+ wrappers.AddRange(collector.Clone().FilterElements<Pipe>().Select(e => new ElementWrapper(e)));
|
|
|
|
+ wrappers.AddRange(collector.Clone().FilterElements<Duct>().Select(e => new ElementWrapper(e)));
|
|
var familyInstances = collector.Clone().FilterElements<FamilyInstance>();
|
|
var familyInstances = collector.Clone().FilterElements<FamilyInstance>();
|
|
foreach (FamilyInstance familyInstance in familyInstances)
|
|
foreach (FamilyInstance familyInstance in familyInstances)
|
|
{
|
|
{
|