Revit APP Blog

Information on Revit APP.

Browsing Posts published in September, 2010

Some times we need retrieve all level elevatioins, here is the code:

string strMsg = “”;
Transaction trans = new Transaction(doc, “Show Level”);
trans.Start();
FilteredElementCollector collector = new FilteredElementCollector(doc);
ICollection<Element> elems = collector.WhereElementIsNotElementType().OfClass(typeof(Level)).ToElements();
foreach (Level lv in elems)
{
strMsg += lv.Name + ” : elevation” + lv.Elevation.ToString(“F2″) + “\n”;
}
TaskDialog.Show(“Level elements”, strMsg);
trans.RollBack();

Just notice that, the Elevation got from the Level element is stored in feet unit, if you want to show other unit (like inches or meters), you need to transform it before use it.

All materials in a document is stored in doc.Settings.Materials (doc is the pointer of the document). You can get all available materials through this property.

Material’s specified properties:

Color The color of the material.
CutPattern The cut pattern of the material.
CutPatternColor The cut pattern color of the material.
Glow Whether the material can glow.
RenderAppearance The rendering appearance property of the material.
Shininess The shininess of the material.
Smoothness The smoothness of the material.
SurfacePattern The surface pattern of the material.
SurfacePatternColor The surface pattern color of the material.
Transparency The transparency of the material.

You can modify a meterial through these properties. Of course, you can also add/insert/remove materials for doc.Settings.Materials.

Load family is a frequent action when we use Revit. However, try to find a desire family is frustrated because the folder structure is too complex. This tool is trying to let you find your family easily. It will filter the path name, then the file name, and it’s quite easy to use. Take a look at the demo vedio in following link to see how easy it is:-)

V0.3:
Add:
- Support 3 level of thumbnail sizes (Large, Medium, Small)
- Support hide file name when thumbnail is shown
- Support file name only (don’t show thumbnail to fasten the speed)
- Move two ribbon buttons into one split button to save space

Fix:
- Error when copy/paste foler path when setting searching root path

The link: http://en.revitapp.com/easy_family_loader.html

An old post http://blog.revitapp.com/2010/05/autodesk-revit-api-overview/ descibed what we can do with Revit API. Let’s recall the concept:

What Can I Do With the Autodesk Revit API?

The following are general areas where the API is suitable:

  • Creating add-ins to automate repetitive tasks in the Autodesk Revit user interface
  • Enforcing project design standards by checking for errors automatically
  • Extracting project data for analysis and to generate reports
  • Importing external data to create new elements or parameter values
  • Integrating other applications, including analysis applications, into Autodesk Revit products
  • Creating Autodesk Revit project documentation automatically

From the items, we can see that there actually are still restrictions for us to develop Revit addins applications. The main point is, most disabilities of Revit cannot be achieved by Revit API. That’s to say, if user can’t do the work manually in Revit, then most probably it also can’t be accomplished by Revit API. However, I think Revit API would be able to extend much in the future and real extend Revit capabilities.

So this doc only wants to help an API developer quickly judge the feasiblity of a requirement. Anyway, keep in mind that this is not always true, sometimes there is workaround for us.

We know that family can be inserted into a project, sometimes we want to specify a special point when we insert the family. We can pass the point (XYZ) as the first parameter of FamilyInstanceCreationData when call Document::NewFamilyInstances.

However, how can you know whether the insertion point is the right place you input? You can call FamilyInstance::Location to get the insertion point, but in Revit, you can use following method to know what exactly the insertion point is:

Add two perpendicular module lines in a plan view, drag a family into the view and move the mouse until two model lines are highlighted, click mouse to put down the family. The cross point of the two lines is the insertion point of this family. You can know the coordinate through “Manage” tab -> “Project Location” panel -> Coordinates -> Report Shared Coordinates.

Powered by WordPress Web Design by SRS Solutions © 2012 Revit APP Blog Design by SRS Solutions