Hello,
I am new to programming Revit APIs, so I would need some help to start. I am trying to create simple API for calculating beams. To do taht I need Beam Type Parameters.
Can anyone tell me how to get Type Parameter, or send me related link ( I can find any).
I suppose code should looks something like this:
Selection sel = uidoc.Selection; Reference pickedRef = null; pickedRef = sel.PickObject(ObjectType.Element, "Please select beam"); Element e = doc.GetElement(pickedRef); //don't know which parameter of Element object to use double sectionHeight = e.???
Or should I create some other object, not Element object to get Type Parameters?
Thanks,
Milos
Solved! Go to Solution.
Solved by Revitalizer. Go to Solution.
Solved by Revitalizer. Go to Solution.
Hi,
an Element's type parameters are in fact its ElementType's instance parameters:
http://forums.autodesk.com/t5/revit-api/reading-instance-parameters-by-api/td-p/5904422
Revitalizer
Hi,
Thanks! Yes, that was what I did't know.
I supose now I sould select type parameter like this:
Element e = doc.GetElement(pickedRef); ElementType type = doc.GetElement(e.GetTypeId()) as ElementType; BuiltInParameter height = BuiltInParameter.FAMILY_HEIGHT_PARAM; Parameter h = type.get_Parameter(height);
But where I try to use that Parameter h, I get null exception, am I missing somthing again?
Hi MilosNS90,
I would suppose to use RevitLookup to examine the parameters of these objects:
Element e
ElementType type
and, if e is a FamilyInstance and type is a FamilySymbol,
this FamilySymbols's Family also has a set of its own parameters.
If BuiltInParameter.FAMILY_HEIGHT_PARAM is not present, you may find the matching BuiltInParameter this way.
Revitalizer
Hi,
this would be what I was looking for:
Element e = doc.GetElement(pickedRef); ElementType type = doc.GetElement(e.GetTypeId()) as ElementType; //to get height of section Parameter h = type.LookupParameter("h"); double height = h.AsDouble(); //to get width of section Parameter b = type.LookupParameter("b"); double width = b.AsDouble(); //and so on...
Can't find what you're looking for? Ask the community or share your knowledge.