Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to get Type Parameters of beam?

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
Anonymous
8751 Views, 5 Replies

How to get Type Parameters of beam?

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

5 REPLIES 5
Message 2 of 6
Revitalizer
in reply to: Anonymous

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




Rudolf Honke
Software Developer
Mensch und Maschine





Message 3 of 6
Anonymous
in reply to: 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?

 

 

Message 4 of 6
Revitalizer
in reply to: Anonymous

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




Rudolf Honke
Software Developer
Mensch und Maschine





Message 5 of 6
Anonymous
in reply to: 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...
Message 6 of 6
hauvillec
in reply to: Anonymous

Hi ! 

 

I am trying to do the same with a "bathtube" family to get the width and length of it but it's not successful...

Any idea ? 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report