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: 

ROOM_CALCULATION_POINT parameter

5 REPLIES 5
Reply
Message 1 of 6
Tiny_v_M
1214 Views, 5 Replies

ROOM_CALCULATION_POINT parameter

Hi,

I am trying to read out the parameter that gives the room the object is in, the ROOM_CALCULATION_POINT parameter.

I want to apply this on doors and families.

 

I can read he other parameters of these object, but get stuck by the options SpatialElementCalculationPoint and SpatialElementFromToCalculationPoints.

 

Can anybody give me some direction how I can do this?

A bit of code would be nice.

 

I would really appreciate it,

Tiny

5 REPLIES 5
Message 2 of 6
Joe.Ye
in reply to: Tiny_v_M

Hi Tiny,

You can get the family object, and get the family instance. Then get the parameter(ROOM_CALCULATION_POINT).
And change its value.

Here is the code fragment

<code>
//doc is the family document.
Family fam = doc.OwnerFamily;
Parameter param = fam.get_Parameter(BuiltInParameter.ROOM_CALCULATION_POINT);


<code>


Joe Ye
Contractor
Developer Technical Services
Autodesk Developer Network
Message 3 of 6
Tiny_v_M
in reply to: Joe.Ye

Thank you for your reaction.



If I understand you correctly, this is the code to set the Parameter in the
Family.



When I set the parameter, with what code can I read it out for all the
families and door/windows in the model.

The parameters that I want to read are the Room name and number.



Thanks,

Tiny
Message 4 of 6
Joe.Ye
in reply to: Tiny_v_M

Hi Tiny,

Not quite sure I got your idea.

Answer your latest question:
Using the following code you can get the parameter of ROOM_CALCULATION_POINT.

<code>
[TransactionAttribute(Autodesk.Revit.Attributes.TransactionMode.Manual)]
public class RevitCommand : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string messages, ElementSet elements)
{

UIApplication app = commandData.Application;
Document doc = app.ActiveUIDocument.Document;


Selection sel = app.ActiveUIDocument.Selection;
Reference ref1=sel.PickObject(ObjectType.Element, "please pick a window/door");
FamilyInstance inst = doc.GetElement(ref1) as FamilyInstance;
if(inst == null)
{
messages = "No family instance was picked";
return Result.Failed;
}

Family family = inst.Symbol.Family;
Parameter param1 = family.get_Parameter(BuiltInParameter.ROOM_CALCULATION_POINT);
if (param1 != null)
{
//Get the parameter value.
}


return Result.Succeeded ;
}
}
<code>

Which element/object do you want to get the Room name and number? from the window or door? Are you trying to get the room nam name and room number from a given door/window?


Joe Ye
Contractor
Developer Technical Services
Autodesk Developer Network
Message 5 of 6
Tiny_v_M
in reply to: Joe.Ye

Hi Joe,



Thank you for your reaction.

I going to try to implement this in my code.



With kind regards,

Tiny
Message 6 of 6
stenvabrit
in reply to: Tiny_v_M

Hi!

 

I´m quite new to coding and Macro Manager in Revit, but is it possible to have a parameter for the doors which would pretty much indicate the following: Room Calculation Point TO = Room name. So if I create a door tag, I could add a label indicating where the door is opening to.

 

I´m using Revit 2016.

 

Regards,

 

Sten

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community