This commit is contained in:
ShrlAlgo
2025-07-11 09:20:23 +08:00
parent c7b104f44f
commit 4d35cadb56
840 changed files with 102347 additions and 11595 deletions

View File

@@ -210,7 +210,7 @@ public static class RoomExtensions
}
/// <summary>
/// 得到房间的三实体
/// 得到房间的三实体
/// </summary>
/// <param name="room"></param>
/// <param name="curveLoops"></param>
@@ -227,13 +227,18 @@ public static class RoomExtensions
options = new SolidOptions(material.Id, ElementId.InvalidElementId);
var solid = GeometryCreationUtilities.CreateExtrusionGeometry(curveLoops, XYZ.BasisZ, height);
var ds = DirectShape.CreateElement(doc, new ElementId(BuiltInCategory.OST_GenericModel));
ds.SetName(room.Name);
var option = ds.GetOptions();
option.ReferencingOption = DirectShapeReferencingOption.NotReferenceable;
ds.SetOptions(option);
ds.AppendShape(new List<GeometryObject> { solid });
room.Document.Regenerate();
var directShape = doc.CreateDirectShapeInstance(
"房间实体",
BuiltInCategory.OST_GenericModel,
new List<GeometryObject> { solid });
directShape.get_Parameter(BuiltInParameter.DOOR_NUMBER).Set(room.Name);
//var ds = DirectShape.CreateElement(doc, new ElementId(BuiltInCategory.OST_GenericModel));
//ds.SetName(room.Name);
//var option = ds.GetOptions();
//option.ReferencingOption = DirectShapeReferencingOption.NotReferenceable;
//ds.SetOptions(option);
//ds.AppendShape(new List<GeometryObject> { solid });
//room.Document.Regenerate();
var elements = new FilteredElementCollector(doc);
var solidFillPattern = elements.OfClass(typeof(FillPatternElement)).Cast<FillPatternElement>().First(a => a.GetFillPattern().IsSolidFill);