Hello,
In my graph I have several profile families, which are not placed in the project, which also have multiple types.
My goal is to create a function which will take profile family and type, find correct type and extract it’s curves as polycurve.
So far, I used code found in the Dynamo forum and can’t create right filter.
I tried two ways - to filter all profiles and get Sketch and try to build FilteredElementParameter to get just a Sketch of one type. So far I don’t know how I can do it properly.
Any tips or ideas how I could access the sketch of particular family type of a family?
Would be thankful for help
`def profil_to_pcrv(profil):
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
type = UnwrapElement(profil.Family.Name)
name = UnwrapElement(profil.Name)
family = UnwrapElement(profil).Family
TransactionManager.Instance.ForceCloseTransaction()
famDoc = doc.EditFamily(family)
familyManager = famDoc.FamilyManager
famCollector = FilteredElementCollector(famDoc)
#not working
bip = BuiltInParameter.ELEM_TYPE_PARAM
provider = ParameterValueProvider(ElementId(bip))
evaluator = FilterStringEquals();
rule = FilterStringRule(provider, evaluator, "Get_7,3", False);
filter = ElementParameterFilter(rule)
cprof = FilteredElementCollector(famDoc).WherePasses(filter).OfClass(Sketch)
#not working as well
bip = BuiltInParameter.ELEM_TYPE_PARAM
provider = ParameterValueProvider(ElementId(bip))
evaluator = FilterStringEquals();
rule = FilterStringRule(provider, evaluator, "Get_7,3", False);
filter = ElementParameterFilter(rule)
cprof2 = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_ProfileFamilies).WherePasses(filter).OfClass(Sketch)
sketch = famCollector.OfClass(Sketch)
for i in sketch:
cArray = list(i.Profile)
cArray[:] = [[Revit.GeometryConversion.RevitToProtoCurve.ToProtoType(y, True ) for y in x] for x in cArray]
polycurve = PolyCurve.ByJoinedCurves(cArray[0], False)
return cprof`