Skip to content

Commit

Permalink
Merge branch '1.x' into pedro/analytical/bConditions
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrocortesark committed Dec 24, 2024
2 parents 65a4c35 + 7bbfab6 commit 75ceff4
Show file tree
Hide file tree
Showing 11 changed files with 152 additions and 113 deletions.
9 changes: 9 additions & 0 deletions docs/pages/_en/1.0/reference/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ group: Deployment & Configs

{% include ltr/release_header_next.html title="Upcoming Changes" note=rc_release_notes %}

{% include ltr/release-header.html title="v1.28 RC1" version="v1.28.9121.7332" pre_release=true time="12/21/2024" %}

- Miscellaneous Improvements

{% include ltr/release-header.html title="v1.27" version="v1.27.9121.7152" time="12/21/2024" %}

- Includes all changes under 1.27 RC releases listed below
- Miscellaneous improvements and bug fixes

{% include ltr/release-header.html title="v1.27 RC2" version="v1.27.9101.27850" pre_release=true time="12/01/2024" %}

- Added {% include ltr/comp.html uuid='7b229f5e' %}
Expand Down
2 changes: 1 addition & 1 deletion src/Product.targets
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ If `ReleaseVersion` contains "wip" the product expires.
<ProductReleaseVersion></ProductReleaseVersion>
<ProductMetaVersion></ProductMetaVersion>
<ProductMajorVersion>1</ProductMajorVersion>
<ProductMinorVersion>28</ProductMinorVersion>
<ProductMinorVersion>29</ProductMinorVersion>
<ProductBuildVersion Condition="$(Configuration.Contains('Debug'))">0</ProductBuildVersion>
<ProductRevisionVersion Condition="$(Configuration.Contains('Debug'))">0</ProductRevisionVersion>
</PropertyGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/RhinoInside.Revit.GH/Components/Sheets/AddRevision.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ protected override void TrySolveInstance(IGH_DataAccess DA)
(
revision,
doc.Value,
description, date,
date, description,
issuedBy, issuedTo,
issued,
ARDB.RevisionVisibility.CloudAndTagVisible
Expand All @@ -159,8 +159,8 @@ ARDB.Revision Reconstruct
(
ARDB.Revision revision,
ARDB.Document document,
string description,
string date,
string description,
string issuedBy,
string issuedTo,
bool? issued,
Expand All @@ -170,7 +170,7 @@ ARDB.Revision Reconstruct
if (revision is null)
revision = ARDB.Revision.Create(document);

RevisionIssue.Invoke(this, revision, description, date, issuedBy, issuedTo, issued);
RevisionIssue.Invoke(this, revision, date, description, issuedBy, issuedTo, issued);

if (visibility is object && visibility.Value != revision.Visibility)
revision.Visibility = visibility.Value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,11 @@ public AddAreaBoundaryConditions() : base
protected override void TrySolveInstance(IGH_DataAccess DA)
{
if (!Parameters.Document.TryGetDocumentOrCurrent(this, DA, "Document", out var doc) || !doc.IsValid) return;
Parameters.Document.GetStructuralSettings(this, DA, "Document", out var hasSymbols);
if (!hasSymbols) this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Document does not have symbols for Boundary Conditions representation.");
if (!Parameters.Document.TryGetStructuralSettings(doc, out var settings) || !settings.BoundaryConditionFamilySymbolFixed.IsValid())
{
AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Document does not have symbols for Boundary Conditions representation.");
return;
}

ReconstructElement<ARDB.Structure.BoundaryConditions>
(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,11 @@ public AddLineBoundaryConditions() : base
protected override void TrySolveInstance(IGH_DataAccess DA)
{
if (!Parameters.Document.TryGetDocumentOrCurrent(this, DA, "Document", out var doc) || !doc.IsValid) return;
Parameters.Document.GetStructuralSettings(this, DA, "Document", out var hasSymbols);
if (!hasSymbols) this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Document does not have symbols for Boundary Conditions representation.");
if (!Parameters.Document.TryGetStructuralSettings(doc, out var settings) || !settings.BoundaryConditionFamilySymbolFixed.IsValid())
{
AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Document does not have symbols for Boundary Conditions representation.");
return;
}

ReconstructElement<ARDB.Structure.BoundaryConditions>
(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,11 @@ public AddPointBoundaryConditions() : base
protected override void TrySolveInstance(IGH_DataAccess DA)
{
if (!Parameters.Document.TryGetDocumentOrCurrent(this, DA, "Document", out var doc) || !doc.IsValid) return;
Parameters.Document.GetStructuralSettings(this, DA, "Document", out var hasSymbols);
if (!hasSymbols) this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Document does not have symbols for Boundary Conditions representation.");
if (!Parameters.Document.TryGetStructuralSettings(doc, out var settings) || !settings.BoundaryConditionFamilySymbolFixed.IsValid())
{
AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Document does not have symbols for Boundary Conditions representation.");
return;
}

ReconstructElement<ARDB.Structure.BoundaryConditions>
(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
using System;
using Grasshopper.Kernel;
using Grasshopper.Kernel.Parameters;
using RhinoInside.Revit.GH.Exceptions;
using ARDB = Autodesk.Revit.DB;

namespace RhinoInside.Revit.GH.Components.Structure
{
[ComponentVersion(introduced: "1.27")]
public class StructuralSettings : TransactionalChainComponent
public class BoundaryConditionsSettings : TransactionalChainComponent
{
public override Guid ComponentGuid => new Guid("B5144C5D-F374-4786-99A7-6A579ED2FD59");
public override GH_Exposure Exposure => GH_Exposure.senary | GH_Exposure.obscure;

public StructuralSettings() : base
public BoundaryConditionsSettings() : base
(
name: "Structural Settings",
nickname: "SS",
description: "Main structural settings associated with a Revit document.",
name: "Boundary Conditions Settings",
nickname: "BCS",
description: "Boundary conditions settings associated with a Revit document.",
category: "Revit",
subCategory: "Structure"
)
Expand All @@ -31,20 +30,9 @@ public StructuralSettings() : base
Name = "Document",
NickName = "DOC",
Description = "Document",
Optional = true
}, ParamRelevance.Occasional
),
new ParamDefinition
(
new Param_Number
{
Name = _Spacing_,
NickName = _Spacing_.Substring(0,1),
Description = "Symbol spacing for boundary conditions.",
Optional = true,
}, ParamRelevance.Primary
),
new ParamDefinition
(
new Parameters.FamilySymbol()
{
Expand Down Expand Up @@ -83,21 +71,31 @@ public StructuralSettings() : base
Description = "The FamilySymbol to represent a user defined boundary condition.",
Optional = true,
}, ParamRelevance.Primary
)
};

protected override ParamDefinition[] Outputs => outputs;
static readonly ParamDefinition[] outputs =
{
),
new ParamDefinition
(
new Param_Number
{
Name = _Spacing_,
NickName = _Spacing_.Substring(0,1),
Description = "Symbol spacing for boundary conditions.",
Optional = true,
}, ParamRelevance.Primary
),
};

protected override ParamDefinition[] Outputs => outputs;
static readonly ParamDefinition[] outputs =
{
new ParamDefinition
(
new Parameters.Element
{
Name = _StructuralSettings_,
NickName = "SS",
Description = "Structural Settings element.",
}, ParamRelevance.Occasional
),
new ParamDefinition
(
new Parameters.FamilySymbol()
Expand Down Expand Up @@ -133,63 +131,71 @@ public StructuralSettings() : base
NickName = _User_.Substring(0,1),
Description = "The FamilySymbol to represent a user defined boundary condition.",
}, ParamRelevance.Primary
)
),
new ParamDefinition
(
new Param_Number
{
Name = _Spacing_,
NickName = _Spacing_.Substring(0,1),
Description = "Symbol spacing for boundary conditions.",
}, ParamRelevance.Primary
),
};

const string _Spacing_ = "Spacing";
const string _StructuralSettings_ = "Structural Settings";
const string _Fixed_ = "Fixed";
const string _Pinned_ = "Pinned";
const string _Roller_ = "Roller";
const string _User_ = "User";
const string _Spacing_ = "Spacing";

protected override void TrySolveInstance(IGH_DataAccess DA)
{
if (!Parameters.Document.TryGetDocumentOrCurrent(this, DA, "Document", out var doc)) return;
var settings = Parameters.Document.GetStructuralSettings(this, DA, "Document", out var hasSymbols);
if (!Parameters.Document.TryGetStructuralSettings(doc, out var settings)) return;
else Params.TrySetData(DA, _StructuralSettings_, () => settings);

if (!Params.TryGetData(DA, _Fixed_, out Types.FamilySymbol fixedSymbol)) return;
if (!Params.TryGetData(DA, _Pinned_, out Types.FamilySymbol pinnedSymbol)) return;
if (!Params.TryGetData(DA, _Roller_, out Types.FamilySymbol rollerSymbol)) return;
if (!Params.TryGetData(DA, _User_, out Types.FamilySymbol userSymbol)) return;

if (!Params.TryGetData(DA, _Spacing_, out double? spacing)) return;
if (spacing.HasValue)
{
StartTransaction(doc.Value);
settings.BoundaryConditionAreaAndLineSymbolSpacing = spacing.Value / Revit.ModelUnits;
}
Params.TrySetData(DA, _Spacing_, () => settings.BoundaryConditionAreaAndLineSymbolSpacing * Revit.ModelUnits);

if (fixedSymbol is object)
if (fixedSymbol is object && settings.BoundaryConditionFamilySymbolFixed != fixedSymbol.Id)
{
StartTransaction(doc.Value);
settings.BoundaryConditionFamilySymbolFixed = fixedSymbol.Id;
}
Params.TrySetData(DA, _Fixed_, () => Types.FamilySymbol.FromElementId(doc.Value, settings.BoundaryConditionFamilySymbolFixed));
Params.TrySetData(DA, _Fixed_, () => doc.GetElement<Types.FamilySymbol>(settings.BoundaryConditionFamilySymbolFixed));

if (pinnedSymbol is object)
if (pinnedSymbol is object && settings.BoundaryConditionFamilySymbolPinned != pinnedSymbol.Id)
{
StartTransaction(doc.Value);
settings.BoundaryConditionFamilySymbolPinned = pinnedSymbol.Id;
}
Params.TrySetData(DA, "Pinned",
() => doc.Value.GetElement(settings.BoundaryConditionFamilySymbolPinned) as ARDB.FamilySymbol);
Params.TrySetData(DA, _Pinned_, () => doc.GetElement<Types.FamilySymbol>(settings.BoundaryConditionFamilySymbolPinned));

if (rollerSymbol is object)
if (rollerSymbol is object && settings.BoundaryConditionFamilySymbolRoller != rollerSymbol.Id)
{
StartTransaction(doc.Value);
settings.BoundaryConditionFamilySymbolRoller = rollerSymbol.Id;
}
Params.TrySetData(DA, "Roller",
() => doc.Value.GetElement(settings.BoundaryConditionFamilySymbolRoller) as ARDB.FamilySymbol);
Params.TrySetData(DA, _Roller_, () => doc.GetElement<Types.FamilySymbol>(settings.BoundaryConditionFamilySymbolRoller));

if (userSymbol is object)
if (userSymbol is object && settings.BoundaryConditionFamilySymbolUserDefined != userSymbol.Id)
{
StartTransaction(doc.Value);
settings.BoundaryConditionFamilySymbolUserDefined = userSymbol.Id;
}
Params.TrySetData(DA, "User",
() => doc.Value.GetElement(settings.BoundaryConditionFamilySymbolUserDefined) as ARDB.FamilySymbol);
Params.TrySetData(DA, _User_, () => doc.GetElement<Types.FamilySymbol>(settings.BoundaryConditionFamilySymbolUserDefined));

if (spacing.HasValue && settings.BoundaryConditionAreaAndLineSymbolSpacing != spacing.Value / Revit.ModelUnits)
{
StartTransaction(doc.Value);
settings.BoundaryConditionAreaAndLineSymbolSpacing = spacing.Value / Revit.ModelUnits;
}
Params.TrySetData(DA, _Spacing_, () => settings.BoundaryConditionAreaAndLineSymbolSpacing * Revit.ModelUnits);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace RhinoInside.Revit.GH.Components.Walls
public class QueryBoundaryConditions : ElementCollectorComponent
{
public override Guid ComponentGuid => new Guid("F8C6588F-4131-4692-A43D-CC4E34F88AB4");
public override GH_Exposure Exposure => GH_Exposure.tertiary | GH_Exposure.obscure;
public override GH_Exposure Exposure => GH_Exposure.senary | GH_Exposure.obscure;

private ARDB.ElementFilter _ElementFilter = new ARDB.ElementClassFilter(typeof(ARDB.Structure.BoundaryConditions));
protected override ARDB.ElementFilter ElementFilter => _ElementFilter;
Expand Down
18 changes: 13 additions & 5 deletions src/RhinoInside.Revit.GH/Parameters/Document.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,20 @@ public static bool GetDataOrDefault(IGH_Component component, IGH_DataAccess DA,
return document is object;
}

public static ARDB.Structure.StructuralSettings GetStructuralSettings(IGH_Component component, IGH_DataAccess DA, string name, out bool hasSymbols)
internal static bool TryGetStructuralSettings(Types.Document document, out ARDB.Structure.StructuralSettings settings)
{
TryGetDocumentOrCurrent(component, DA, name, out var doc);
var settings = ARDB.Structure.StructuralSettings.GetStructuralSettings(doc?.Value);
hasSymbols = settings.BoundaryConditionFamilySymbolFixed != ARDB.ElementId.InvalidElementId;
return settings;
try
{
if (document?.Value is ARDB.Document doc)
{
settings = ARDB.Structure.StructuralSettings.GetStructuralSettings(doc);
return settings.BoundaryConditionFamilySymbolFixed.IsValid();
}
}
catch { }

settings = null;
return false;
}

#region UI
Expand Down
9 changes: 9 additions & 0 deletions src/RhinoInside.Revit.GH/Types/Document.cs
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,15 @@ public bool? HasPendingChanges
#endregion

#region Elements

internal T GetElement<T>(ARDB.ElementId id) where T : Element, new()
{
if (Value is ARDB.Document document && id.IsValid())
return (T) Element.FromElementId(document, id);

return id == ElementIdExtension.Invalid ? new T() : null;
}

public Element GetNamesakeElement(Element element)
{
if (element is object)
Expand Down
Loading

0 comments on commit 75ceff4

Please sign in to comment.