Skip to content

Commit

Permalink
searched unsuccessfully for suitable SpecTypeId
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremytammik committed Apr 15, 2021
1 parent ce1cc66 commit 6a8c2e9
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions CS/Snoop/CollectorExts/FamilyTypeParameterValuesStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,36 @@
using Autodesk.Revit.DB;

namespace RevitLookup.Snoop.CollectorExts
{
public class FamilyTypeParameterValuesStream : IElementStream
{
private readonly ArrayList data;
private readonly object elem;

public FamilyTypeParameterValuesStream(ArrayList data, object elem)
{
this.data = data;
this.elem = elem;
}

public void Stream(Type type)
{
if (type != typeof(Parameter))
return;

var parameter = (Parameter)elem;

var family = (parameter.Element as FamilyInstance)?.Symbol.Family ?? (parameter.Element as FamilySymbol)?.Family;

if (parameter.Definition.ParameterType != ParameterType.FamilyType || family == null)
return;

var familyTypeParameterValues = family
.GetFamilyTypeParameterValues(parameter.Id)
.Select(family.Document.GetElement)
.ToList();

data.Add(new Data.Enumerable($"{nameof(Family)}.{nameof(Family.GetFamilyTypeParameterValues)}()", familyTypeParameterValues));
}
}
{
public class FamilyTypeParameterValuesStream : IElementStream
{
private readonly ArrayList data;
private readonly object elem;

public FamilyTypeParameterValuesStream( ArrayList data, object elem )
{
this.data = data;
this.elem = elem;
}

public void Stream( Type type )
{
if( type != typeof( Parameter ) )
return;

var parameter = (Parameter) elem;

var family = (parameter.Element as FamilyInstance)?.Symbol.Family ?? (parameter.Element as FamilySymbol)?.Family;

if (parameter.Definition.ParameterType != ParameterType.FamilyType || family == null) // Revit 2021
return;

var familyTypeParameterValues = family
.GetFamilyTypeParameterValues( parameter.Id )
.Select( family.Document.GetElement )
.ToList();

data.Add( new Data.Enumerable( $"{nameof( Family )}.{nameof( Family.GetFamilyTypeParameterValues )}()", familyTypeParameterValues ) );
}
}
}

0 comments on commit 6a8c2e9

Please sign in to comment.