Skip to content

Commit

Permalink
try stuff for columns?
Browse files Browse the repository at this point in the history
  • Loading branch information
adamhathcock committed Jun 27, 2024
1 parent 0557fd5 commit 433aacf
Showing 1 changed file with 43 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,48 @@ public RevitColumn Convert(DB.FamilyInstance target)
RevitColumn speckleColumn =
new() { family = symbol.FamilyName, type = target.Document.GetElement(target.GetTypeId()).Name };

Level level = _parameterValueExtractor.GetValueAsDocumentObject<Level>(
target,
BuiltInParameter.FAMILY_BASE_LEVEL_PARAM
);
speckleColumn.level = _levelConverter.Convert(level);

Level topLevel = _parameterValueExtractor.GetValueAsDocumentObject<Level>(
target,
BuiltInParameter.FAMILY_TOP_LEVEL_PARAM
);

speckleColumn.topLevel = _levelConverter.Convert(topLevel);
speckleColumn.baseOffset = _parameterValueExtractor.GetValueAsDouble(
target,
DB.BuiltInParameter.FAMILY_BASE_LEVEL_OFFSET_PARAM
);
speckleColumn.topOffset = _parameterValueExtractor.GetValueAsDouble(
target,
DB.BuiltInParameter.FAMILY_TOP_LEVEL_OFFSET_PARAM
);
if (
_parameterValueExtractor.TryGetValueAsDocumentObject<Level>(
target,
BuiltInParameter.FAMILY_BASE_LEVEL_PARAM,
out var level
)
)
{
speckleColumn.level = _levelConverter.Convert(level.NotNull());
}
if (
_parameterValueExtractor.TryGetValueAsDocumentObject<Level>(
target,
BuiltInParameter.FAMILY_TOP_LEVEL_PARAM,
out var topLevel
)
)
{
speckleColumn.topLevel = _levelConverter.Convert(topLevel.NotNull());
}

if (
_parameterValueExtractor.TryGetValueAsDouble(
target,
BuiltInParameter.FAMILY_BASE_LEVEL_OFFSET_PARAM,
out var baseOffset
)
)
{
speckleColumn.baseOffset = baseOffset.NotNull();
}

if (
_parameterValueExtractor.TryGetValueAsDouble(
target,
BuiltInParameter.FAMILY_TOP_LEVEL_OFFSET_PARAM,
out var topOffset
)
)
{
speckleColumn.topOffset = topOffset.NotNull();
}

speckleColumn.facingFlipped = target.FacingFlipped;
speckleColumn.handFlipped = target.HandFlipped;
Expand All @@ -74,7 +96,7 @@ public RevitColumn Convert(DB.FamilyInstance target)
}

speckleColumn.baseLine =
GetBaseCurve(target, speckleColumn.topLevel.elevation, speckleColumn.topOffset)
GetBaseCurve(target, speckleColumn.topLevel?.elevation ?? -1, speckleColumn.topOffset)
?? throw new SpeckleConversionException("Unable to find a valid baseCurve for column");

speckleColumn.displayValue = _displayValueExtractor.GetDisplayValue(target);
Expand Down

0 comments on commit 433aacf

Please sign in to comment.