Monday, April 25, 2011

Retrieving elements that are not only in the project, but in the model.

For instance, the following Filtered Element Collector will gather all of the types of fascia in the project:

FilteredElementCollector collectorCoreFascia = new FilteredElementCollector(m_doc).OfCategory(BuiltInCategory.OST_Fascia).WherePasses(filter);
IList<Element> coreFascia = collectorCoreFascia.ToElements();

This will get every single type of fascia, whether it's in the model or not.  To get only the pieces that are in the model, we'll check it for a

PhaseCreated != null
inside of our loop:


foreach (Element eCoreFascia in coreFascia)
{
if (null != eCore.Category && 0 < eCore.Parameters.Size && (eCore.Category.HasMaterialQuantities || null != eCore.PhaseCreated) )
  {
 (do something)
  }
}

Thursday, March 10, 2011

Order of Parameters

I've been working on a project in which I retrieve all of the Instance and Type Parameters from an object and I've noticed something odd.

foreach (Parameter para in eCoreWall.Parameters)
{
  results += Util.GetParameterInformation(para, m_doc);
} 

Each time I pull the parameters, they are listed in a different order.  Anyone know why?
Here's an abbreviated example:

1st Time- 
Area: 27.72 SF
Length: 59.00
Function: Exterior


2nd Time-
Length: 59.00
Area: 27.72 SF
Function: Exterior

Monday, February 7, 2011

Using Visiblity Graphics (VG) to Hide and Display Walls by Function

Changing the visibility of certain objects is quite easy with the use of Revit's Visibility Graphic Overrides for 3D Views. The easiest way to access it is by pressing 'V' then 'G' or by going to View>Graphics>Visibility/Graphics.



Exterior and Interior Walls

Exterior Walls

Interior Walls

Visibility Graphics 'Filters'

Exterior Walls Filter


Foundation Walls Filter

Interior Walls Filter

Revit Extension

So, I'm installing Revit Extensions and the Extension SDK today- looking forward to learning even more about the inner-workings of Revit.

Friday, January 21, 2011

Spot Slope Markers


This is an odd occurrence that we encountered today. When adding slope marker annotations in elevation views, we've noticed that it will pick up the slopes of not only the roof surfaces, but also the adjoining hips and valleys.

Is there any way to make them only pick up the surfaces? Otherwise, it takes a few clicks of the TAB button to find the right one. Not that it's a big deal, but it makes the user double-think the annotation which should be automatic.

Thursday, January 13, 2011

Door Functions and Names

Another part of my material collection process it to gather all doors and group them by Exterior and Interior. I had a bit of trouble getting the door functions- it wasn't the same as the walls. Doors are family instances inside the project document, so in addition to the base family parameters, each has its own family type instance parameters.

By default, a door has its function set to 0 which is Interior (1 is Exterior). If you ever create a type catalog for a door family, remember to use 0 and 1 instead of Interior/Exterior!




Again, this doesn't work and results in an error:
Parameter doorFunc = e.get_Parameter(BuiltInParameter.FUNCTION_PARAM);

This returns the door's function- Interior or Exterior:
static public string GetDoorFunction(Element e)
{
 Parameter param = e.ObjectType.get_Parameter(BuiltInParameter.FUNCTION_PARAM);
 string doorFuncVal = param.AsInteger().ToString();
 return doorFuncVal;
}

I noticed that 'ObjectType' is deprecated, but I'm not having any luck with using the ElementId/ElementType right now.

And to get a door's family name:
static public string GetDoorType(Element e)
{
 FamilyInstance fi = e as FamilyInstance;
 string value = fi.Symbol.Family.Name;
 return value;
}

And the result:
BASE Interior Doors:
**********
Single swing, 2468
Single swing, 2468
Bi-Fold 2 Panel (TC), 2068
Double bifold, 4068
Single swing, 1668
Single Swing, 2068 

BASE Exterior Doors:
**********
double slider, 6068 SGD
garage door_16ft, 1680

Retrieving Classes and Categories from the 'Main Model'

We just got another 5 or 6 inches of snow over the last couple of days.  After the foot or so that we had over Christmas (that quickly melted once it got up to the 60's for a day!) I believe this is probably the most snow we've had this early for quite some time.

I'm working on a material collection project in Revit right now.  Part of this collection hinges on  obtaining a plus-minus report that lists all elements and their properties for each 'option set' in the house.

Revit has a 'DesignOption' field for each element, whether it be a system family or a custom family, that defaults to 'Main Model.'  Once the item is placed into a design option, this is obviously changed to the design option id in the database. Here I get an IList<T> of the walls in the main model:

/*Walls in Main Model*/
BuiltInParameter bip = BuiltInParameter.DESIGN_OPTION_PARAM;
ParameterValueProvider provider = new ParameterValueProvider(new ElementId(bip));
FilterStringRuleEvaluator evaluator = new FilterStringEquals();
FilterRule rule = new FilterStringRule(provider, evaluator, "Main Model", false);
ElementParameterFilter filter = new ElementParameterFilter(rule);


FilteredElementCollector collectorCoreWalls = new 
    FilteredElementCollector(m_doc).OfClass(typeof(Wall)).WherePasses(filter);
IList<Element> coreWalls = collectorCoreWalls.ToElements();

The same can be done for Floors (Floor), Roofs (RoofBase), Ceilings and Floors (CeilingAndFloor) and others.

Next post I'll show how to loop through Design Option Elements.