Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Revit_Core_Adapter/CRUD/Create.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public List<IBHoMObject> Create(IEnumerable<IBHoMObject> bHoMObjects, RevitPushC
Document document = this.Document;
RevitSettings settings = this.RevitSettings.DefaultIfNull();

Dictionary<Guid, List<int>> refObjects = new Dictionary<Guid, List<int>>();
Dictionary<Guid, List<long>> refObjects = new Dictionary<Guid, List<long>>();
List<IBHoMObject> created = new List<IBHoMObject>();
foreach (IBHoMObject obj in bHoMObjects)
{
Expand All @@ -55,7 +55,7 @@ public List<IBHoMObject> Create(IEnumerable<IBHoMObject> bHoMObjects, RevitPushC

/***************************************************/

public static Element Create(IBHoMObject bHoMObject, Document document, RevitSettings settings, Dictionary<Guid, List<int>> refObjects)
public static Element Create(IBHoMObject bHoMObject, Document document, RevitSettings settings, Dictionary<Guid, List<long>> refObjects)
{
if (bHoMObject == null)
{
Expand All @@ -67,12 +67,12 @@ public static Element Create(IBHoMObject bHoMObject, Document document, RevitSet
{
Element element = bHoMObject.IToRevit(document, settings, refObjects);
bHoMObject.SetIdentifiers(element);

//Assign Tags
string tagsParameterName = null;
if (settings != null)
tagsParameterName = settings.MappingSettings?.TagsParameter;

if (!string.IsNullOrEmpty(tagsParameterName))
element.SetTags(bHoMObject, tagsParameterName);

Expand Down
2 changes: 1 addition & 1 deletion Revit_Core_Adapter/CRUD/Delete.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public static bool Delete(IBHoMObject bHoMObject, Document document)
}
}

if (elementId == null || elementId.IntegerValue < 0)
if (elementId == null || elementId.Value() < 0)
return false;

return Delete(elementId, document, false).Count() != 0;
Expand Down
2 changes: 1 addition & 1 deletion Revit_Core_Adapter/CRUD/Read.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ protected override IEnumerable<IBHoMObject> Read(IRequest request, ActionConfig
{
Document doc;
Transform transform = Transform.Identity;
if (requestByLink.Key.IntegerValue == -1)
if (requestByLink.Key.Value() == -1)
doc = this.Document;
else
{
Expand Down
2 changes: 1 addition & 1 deletion Revit_Core_Adapter/ExecuteCommands/Isolate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public Output<List<object>, bool> Isolate(Isolate command)
}

uidoc.Selection.SetElementIds(elementIds);
output.Item1 = elementIds.Select(x => x.IntegerValue).Cast<object>().ToList();
output.Item1 = elementIds.Select(x => x.Value()).Cast<object>().ToList();
output.Item2 = true;

return output;
Expand Down
2 changes: 1 addition & 1 deletion Revit_Core_Adapter/ExecuteCommands/Select.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public Output<List<object>, bool> Select(Select command)

uidoc.Selection.SetElementIds(elementIds);

output.Item1 = elementIds.Select(x => x.IntegerValue).Cast<object>().ToList();
output.Item1 = elementIds.Select(x => x.Value()).Cast<object>().ToList();
output.Item2 = true;
return output;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<RevitAddIns>
<AddIn Type="Application">
<Name>BHoM Revit</Name>
<Assembly>C:\ProgramData\BHoM\Assemblies\Revit_Core_Adapter_2021.dll</Assembly>
<Assembly>C:\ProgramData\BHoM\Assemblies\Revit_Core_Adapter_2026.dll</Assembly>
<FullClassName>BH.Revit.Adapter.Core.RevitListener</FullClassName> |
<AddInId>05D16C68-EA24-4E38-A9D9-6029E2F8C760</AddInId>
<Text>Buildings and Habitats object Model (BHoM) Revit Addin</Text>
Expand Down
16 changes: 8 additions & 8 deletions Revit_Core_Adapter/Revit_Core_Adapter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,13 @@
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<AppendTargetFrameworkToOutputpath>false</AppendTargetFrameworkToOutputpath>
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
<Configurations>Debug;Release;Debug2021;Release2021;Debug2022;Release2022;Debug2023;Release2023;Debug2024;Release2024;Debug2025;Release2025</Configurations>
<Configurations>Debug;Release;Debug2022;Release2022;Debug2023;Release2023;Debug2024;Release2024;Debug2025;Release2025;Debug2026;Release2026</Configurations>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Debug' Or '$(Configuration)'=='Release'">
<RevitVersion>2021</RevitVersion>
<TargetFramework>net48</TargetFramework>
<DefineConstants>REVIT2021</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(Configuration.Contains('2021'))">
<RevitVersion>2021</RevitVersion>
<RevitVersion>2022</RevitVersion>
<TargetFramework>net48</TargetFramework>
<DefineConstants>REVIT2021</DefineConstants>
<DefineConstants>REVIT2022</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(Configuration.Contains('2022'))">
<RevitVersion>2022</RevitVersion>
Expand All @@ -49,6 +44,11 @@
<TargetFramework>net8.0-windows</TargetFramework>
<DefineConstants>REVIT2025</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(Configuration.Contains('2026'))">
<RevitVersion>2026</RevitVersion>
<TargetFramework>net8.0-windows</TargetFramework>
<DefineConstants>REVIT2026</DefineConstants>
</PropertyGroup>

<PropertyGroup>
<AssemblyName>Revit_Core_Adapter_$(RevitVersion)</AssemblyName>
Expand Down
4 changes: 2 additions & 2 deletions Revit_Core_Engine/Compute/CompareValues.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static partial class Compute
return null;

bool invert = comparisonType == ValueComparisonType.NotEqualTo;
bool equal = id.IntegerValue == value.AsElementId()?.IntegerValue;
bool equal = id.Value() == value.AsElementId()?.Value();
return equal != invert;
}
else if (referenceValue is Element e)
Expand All @@ -69,7 +69,7 @@ public static partial class Compute
return null;

bool invert = comparisonType == ValueComparisonType.NotEqualTo;
bool equal = e.Id.IntegerValue == value.AsElementId()?.IntegerValue && e.Document.PathName == value.Element?.Document.PathName;
bool equal = e.Id.Value() == value.AsElementId()?.Value() && e.Document.PathName == value.Element?.Document.PathName;
return equal != invert;
}
else
Expand Down
12 changes: 6 additions & 6 deletions Revit_Core_Engine/Compute/Errors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,35 +54,35 @@ internal static void ConvertBeforePushError(this IBHoMObject iBHoMObject, Type t

internal static void NoPanelLocationError(this Element element)
{
BH.Engine.Base.Compute.RecordError(string.Format("Location of the Revit {0} could not be converted to BHoM, and therefore the output BHoM object will have empty location and no openings. Please note that BHoM panel conversion supports only planar faces. Revit ElementId: {1}", element.GetType().Name, element.Id.IntegerValue));
BH.Engine.Base.Compute.RecordError(string.Format("Location of the Revit {0} could not be converted to BHoM, and therefore the output BHoM object will have empty location and no openings. Please note that BHoM panel conversion supports only planar faces. Revit ElementId: {1}", element.GetType().Name, element.Id.Value()));
}

/***************************************************/

internal static void InvalidFamilyPlacementTypeError(this IBHoMObject bHoMObject, ElementType elementType)
{
BH.Engine.Base.Compute.RecordError($"BHoM Object location does not match with the required placement type of Revit family. BHoM Guid: {bHoMObject.BHoM_Guid}, Revit ElementId: {elementType.Id.IntegerValue}");
BH.Engine.Base.Compute.RecordError($"BHoM Object location does not match with the required placement type of Revit family. BHoM Guid: {bHoMObject.BHoM_Guid}, Revit ElementId: {elementType.Id.Value()}");
}

/***************************************************/

internal static void FamilyPlacementTypeDraftingError(this FamilySymbol familySymbol)
{
BH.Engine.Base.Compute.RecordError($"Revit family placement type named {familySymbol.Family.FamilyPlacementType} indicates that the family is a drafting family. Please use DraftingInstance instead of a ModelInstance in order to push it. Revit ElementId: {familySymbol.Id.IntegerValue}");
BH.Engine.Base.Compute.RecordError($"Revit family placement type named {familySymbol.Family.FamilyPlacementType} indicates that the family is a drafting family. Please use DraftingInstance instead of a ModelInstance in order to push it. Revit ElementId: {familySymbol.Id.Value()}");
}

/***************************************************/

internal static void FamilyPlacementTypeModelError(this FamilySymbol familySymbol)
{
BH.Engine.Base.Compute.RecordError($"Revit family placement type named {familySymbol.Family.FamilyPlacementType} indicates that the family is a model family. Please use ModelInstance instead of a DraftingInstance in order to push it. Revit ElementId: {familySymbol.Id.IntegerValue}");
BH.Engine.Base.Compute.RecordError($"Revit family placement type named {familySymbol.Family.FamilyPlacementType} indicates that the family is a model family. Please use ModelInstance instead of a DraftingInstance in order to push it. Revit ElementId: {familySymbol.Id.Value()}");
}

/***************************************************/

internal static void LinearOnlyError(this FamilySymbol familySymbol)
{
BH.Engine.Base.Compute.RecordError($"Revit family placement type named {familySymbol.Family.FamilyPlacementType} accepts only linear curves. Please use ModelInstance instead of a DraftingInstance in order to push it. Revit ElementId: {familySymbol.Id.IntegerValue}");
BH.Engine.Base.Compute.RecordError($"Revit family placement type named {familySymbol.Family.FamilyPlacementType} accepts only linear curves. Please use ModelInstance instead of a DraftingInstance in order to push it. Revit ElementId: {familySymbol.Id.Value()}");
}

/***************************************************/
Expand All @@ -96,7 +96,7 @@ internal static void InvalidRegionSurfaceError(this DraftingInstance draftingIns

internal static void InvalidTwoLevelLocationError(this FamilySymbol familySymbol)
{
BH.Engine.Base.Compute.RecordError($"Location line of the two-level based element is upside-down, which is not allowed for given family placement type. ElementId: {familySymbol.Id.IntegerValue}");
BH.Engine.Base.Compute.RecordError($"Location line of the two-level based element is upside-down, which is not allowed for given family placement type. ElementId: {familySymbol.Id.Value()}");
}

/***************************************************/
Expand Down
14 changes: 4 additions & 10 deletions Revit_Core_Engine/Compute/Isolate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ private static View GetTargetView(Document doc, View currentView, List<ElementId
// Check invalid element IDs
List<ElementId> invalidedIds = elementIds.Where(id => doc.GetElement(id) == null).ToList();
if (invalidedIds.Count > 0)
BH.Engine.Base.Compute.RecordWarning($"Elements under some element IDs do not exist in the current document: {string.Join(", ", invalidedIds.Select(id => id.IntegerValue))}");
BH.Engine.Base.Compute.RecordWarning($"Elements under some element IDs do not exist in the current document: {string.Join(", ", invalidedIds.Select(id => id.Value()))}");

// Check if selected viewspecific elements are at same view, then check host elements
List<ElementId> viewSpecific = elementIds.Where(id => doc.GetElement(id)?.ViewSpecific == true).ToList();
HashSet<int> nonViewSpecificSet = elementIds.Except(viewSpecific).Select(id => id.IntegerValue).ToHashSet();
HashSet<long> nonViewSpecificSet = elementIds.Except(viewSpecific).Select(id => id.Value()).ToHashSet();

if (viewSpecific.Count > 0)
{
Expand All @@ -116,10 +116,10 @@ private static View GetTargetView(Document doc, View currentView, List<ElementId
}

// Warn if hosts of view-specific items are not included in selection
List<int> hostIds = viewSpecific.GetHostElementIds(doc).Select(x => x.IntegerValue).ToList();
List<long> hostIds = viewSpecific.GetHostElementIds(doc).Select(x => x.Value()).ToList();
if (hostIds.Count > 0)
{
List<int> missingHosts = hostIds.Where(h => !nonViewSpecificSet.Contains(h)).Distinct().ToList();
List<long> missingHosts = hostIds.Where(h => !nonViewSpecificSet.Contains(h)).Distinct().ToList();
if (missingHosts.Count > 0)
{
BH.Engine.Base.Compute.RecordWarning($"Some host elements are not selected: {string.Join(", ", missingHosts)}. " +
Expand Down Expand Up @@ -218,13 +218,7 @@ private static ICollection<ElementId> GetHostElementIds(this IEnumerable<Element
{
Element el = doc.GetElement(id);
if (el is IndependentTag tag)
{
#if (REVIT2021)
hostIds.Add(tag.GetTaggedLocalElement().Id);//Check for local host elements only
#else
hostIds.AddRange(tag.GetTaggedLocalElementIds().ToList());//Check for local host elements only
#endif
}

if (el is FamilyInstance fi && fi.Host != null)
{
Expand Down
2 changes: 1 addition & 1 deletion Revit_Core_Engine/Compute/Notes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ internal static void MaterialNotInLibraryNote(this Material material)
string message = "Material could not be found in BHoM Library.";

if (material != null)
message = string.Format("{0} Material Id: {1}", message, material.Id.IntegerValue);
message = string.Format("{0} Material Id: {1}", message, material.Id.Value());

BH.Engine.Base.Compute.RecordNote(message);
}
Expand Down
2 changes: 1 addition & 1 deletion Revit_Core_Engine/Compute/PrepareForLinkDimensioning.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static partial class Compute
[Output("reference", "Linked element reference prepared for dimensioning in the host document.")]
public static Reference PrepareForLinkDimensioning(this Reference reference, Document hostDocument)
{
if (reference.LinkedElementId.IntegerValue == -1)
if (reference.LinkedElementId.Value() == -1)
return null;

string[] ss = reference.ConvertToStableRepresentation(hostDocument).Split(':');
Expand Down
6 changes: 2 additions & 4 deletions Revit_Core_Engine/Compute/SplitRequestTreeByLinks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@
using Autodesk.Revit.DB;
using BH.Engine.Data;
using BH.oM.Adapters.Revit.Requests;
using BH.oM.Data.Requests;
using BH.oM.Base.Attributes;
using BH.Revit.Engine.Core;
using System;
using BH.oM.Data.Requests;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
Expand Down Expand Up @@ -77,7 +75,7 @@ private static bool TryOrganizeByLink(this IRequest request, Document document,
List<IRequest> linkRequests = request.AllRequestsOfType(typeof(FilterByLink));
if (linkRequests.Count == 0)
{
requestsByLinks.AddRequestByLink(request, new ElementId(-1));
requestsByLinks.AddRequestByLink(request, ElementId.InvalidElementId);
return true;
}
else if (linkRequests.Count == 1)
Expand Down
2 changes: 1 addition & 1 deletion Revit_Core_Engine/Compute/TryGetValueFromSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static Output<bool, object> TryGetValueFromSource(this Element element, P
{
param = element.Document.GetElement(element.GetTypeId())?.LookupParameter(valueSource.ParameterName);
if (param != null)
BH.Engine.Base.Compute.RecordNote($"Parameter {valueSource.ParameterName} was not found in the instance of element {element.Id.IntegerValue}, but was found in the type.");
BH.Engine.Base.Compute.RecordNote($"Parameter {valueSource.ParameterName} was not found in the instance of element {element.Id.Value()}, but was found in the type.");
}

if (param == null)
Expand Down
Loading