Skip to content

Commit

Permalink
Merge pull request #242 from SergeyNefyodov/dev-family-manager
Browse files Browse the repository at this point in the history
Add support to FamilyManager methods
  • Loading branch information
Nice3point authored May 19, 2024
2 parents 71680cc + ed2418f commit dc603af
Showing 1 changed file with 30 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public Func<IVariants> Resolve(Document context, string target, ParameterInfo[]
return target switch
{
nameof(FamilyManager.GetAssociatedFamilyParameter) => ResolveGetAssociatedFamilyParameter,
nameof(FamilyManager.IsParameterLockable) => ResolveIsParameterLockable,
nameof(FamilyManager.IsParameterLocked) => ResolveIsParameterLocked,
_ => null
};

Expand All @@ -41,7 +43,7 @@ IVariants ResolveGetAssociatedFamilyParameter()
var elements = elementTypes
.UnionWith(elementInstances)
.ToElements();

var resolveSet = new Variants<KeyValuePair<Parameter, FamilyParameter>>(elements.Count);
foreach (var element in elements)
{
Expand All @@ -54,7 +56,33 @@ IVariants ResolveGetAssociatedFamilyParameter()
}
}
}


return resolveSet;
}

IVariants ResolveIsParameterLockable()
{
var familyParameters = familyManager.Parameters;
var resolveSet = new Variants<bool>(familyParameters.Size);
foreach (FamilyParameter parameter in familyParameters)
{
var result = familyManager.IsParameterLockable(parameter);
resolveSet.Add(result, $"{parameter.Definition.Name}: {result}");
}

return resolveSet;
}

IVariants ResolveIsParameterLocked()
{
var familyParameters = familyManager.Parameters;
var resolveSet = new Variants<bool>(familyParameters.Size);
foreach (FamilyParameter parameter in familyParameters)
{
var result = familyManager.IsParameterLocked(parameter);
resolveSet.Add(result, $"{parameter.Definition.Name}: {result}");
}

return resolveSet;
}
}
Expand Down

0 comments on commit dc603af

Please sign in to comment.