Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revit async fix for sending #362

Merged
merged 6 commits into from
Nov 7, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ public async Task<RootObjectBuilderResult> Build(
SendInfo sendInfo,
IProgress<CardProgress> onOperationProgressed,
CancellationToken ct = default
) => await RevitTask.RunAsync(() => BuildSync(objects, sendInfo, onOperationProgressed, ct)).ConfigureAwait(false);

private RootObjectBuilderResult BuildSync(
IReadOnlyList<ElementId> objects,
SendInfo sendInfo,
IProgress<CardProgress> onOperationProgressed,
CancellationToken ct = default
)
{
var doc = _converterSettings.Current.Document;
Expand Down Expand Up @@ -110,7 +117,7 @@ public async Task<RootObjectBuilderResult> Build(
}
else
{
converted = await RevitTask.RunAsync(() => _converter.Convert(revitElement)).ConfigureAwait(false); // Could we run these batched? Is there maybe a performance penalty for running these to speckle conversions individually in revittask.runasync?
converted = _converter.Convert(revitElement);
converted.applicationId = applicationId;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,8 @@ definition is DB.InternalDefinition internalDefinition
internalDefinitionName = internalDefinition.BuiltInParameter.ToString();
}

#pragma warning disable CA1854 // swapping leads to nullability errors; should be resolved once we type this more strongly.
if (Definitions.ContainsKey(internalDefinitionName))
#pragma warning restore CA1854
if (Definitions.TryGetValue(internalDefinitionName, out var def))
{
var def = Definitions[internalDefinitionName];
return (
internalDefinitionName,
humanReadableName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ IConverterSettingsStore<RevitConversionSettings> converterSettings
public Dictionary<string, object> Convert(DB.Element target)
{
Dictionary<string, object> quantities = new();
if (target.Category.HasMaterialQuantities)
if (target.Category?.HasMaterialQuantities ?? false) //category can be null
{
foreach (DB.ElementId matId in target.GetMaterialIds(false))
{
Expand Down
Loading