ROOM_CALCULATION_POINT parameter

ROOM_CALCULATION_POINT parameter

Anonymous
Not applicable
1,591 Views
5 Replies
Message 1 of 6

ROOM_CALCULATION_POINT parameter

Anonymous
Not applicable

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

0 Likes
1,592 Views
5 Replies
Replies (5)
Message 2 of 6

Joe.Ye
Alumni
Alumni
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
0 Likes
Message 3 of 6

Anonymous
Not applicable
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
0 Likes
Message 4 of 6

Joe.Ye
Alumni
Alumni
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
0 Likes
Message 5 of 6

Anonymous
Not applicable
Hi Joe,



Thank you for your reaction.

I going to try to implement this in my code.



With kind regards,

Tiny
0 Likes
Message 6 of 6

Anonymous
Not applicable

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

0 Likes