样式demo

This commit is contained in:
GG Z
2025-12-28 11:47:54 +08:00
parent ceccab9abb
commit 1fd8d2ced7
65 changed files with 2369 additions and 799 deletions

View File

@@ -1,7 +1,8 @@
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Architecture;
using ShrlAlgoToolkit.Core.Assists;
namespace ShrlAlgoToolkit.Revit.Assists;
namespace ShrlAlgoToolkit.Revit.Extensions;
/// <summary>
@@ -224,13 +225,12 @@ public static class RoomExtensions
material == null
? new SolidOptions(ElementId.InvalidElementId, ElementId.InvalidElementId)
: new SolidOptions(material.Id, ElementId.InvalidElementId);
options = new SolidOptions(material.Id, ElementId.InvalidElementId);
var solid = GeometryCreationUtilities.CreateExtrusionGeometry(curveLoops, XYZ.BasisZ, height);
var solid = GeometryCreationUtilities.CreateExtrusionGeometry(curveLoops, XYZ.BasisZ, height, options);
var directShape = doc.CreateDirectShapeInstance(
"房间实体",
BuiltInCategory.OST_GenericModel,
new List<GeometryObject> { solid });
[solid]);
directShape.get_Parameter(BuiltInParameter.DOOR_NUMBER).Set(room.Name);
//ds.SetName(room.Name);
//var option = ds.GetOptions();
@@ -241,11 +241,7 @@ public static class RoomExtensions
var elements = new FilteredElementCollector(doc);
var solidFillPattern = elements.OfClass(typeof(FillPatternElement)).Cast<FillPatternElement>().First(a => a.GetFillPattern().IsSolidFill);
var random = new Random(DateTime.Now.Millisecond);
var r = Convert.ToByte(random.Next(0, 255));
var g = Convert.ToByte(random.Next(0, 255));
var b = Convert.ToByte(random.Next(0, 255));
var color = new Color(r, g, b);
var color = ColorAssist.GetDistinctColorById(directShape.Id);
var ogs = new OverrideGraphicSettings();
ogs.SetProjectionLineColor(color);
#if REVIT2018