February 2013

02/22/2013

Announcing yet another blog by DevTech team, "Technology Perspective from Japan." This is by DevTech team in Japan + myself. As this will be written in Japanese, many of you are most likely not able to read it. Still, with the assumption that some of the audience out there understand Japanese like myself, I'm putting a note here. I will be writing mostly about Revit API and other AEC related products API's. Toshiaki will be focusing on platform including could and mobile. Shigekaze, manufacturing.

02/21/2013

When Quick Properties are switched on, you can view property information in a tooltip style window as you move your cursor over objects in the Scene View. You don’t need to select objects first. The quick properties tooltip disappears after a few seconds. By default, quick properties show the name and type of the object, but you can use the Options Editor to define which properties are shown. Each definition that you configure enables you to display an additional category/property combination in quick properties. You can choose whether to hide category names in quick properties or not.

In [Global Options] >> [Interface] >> [Quick Properties], you can add more definitions for the quick properties.

Currently, only COM API allows you to access and edit the quick properties. In API terminology, Quick Properties is called Smart Tag.

02/20/2013

Whenever there is a requirement to access any specific parameter value of an element, like the Material value of a Panel, in this case, Revit LookUp tool often provides the exact approach required to access the desired information.

So getting back to this specific case, we can create an instance of the StoreFront curtain wall type and select a panel and drill in through the instance (and/or type) parameters to see which one contains the Materials based information (this can be also figured out using UI). In this case, the Material information of a standard curtain wall panel is stored in the PanelType. And based on this information as obtained from the LookUp tool, the following code should help extract (and if required, set) the Curtain Wall panel.

using System;

using System.Collections.Generic;

using System.Text;

using System.Linq;

using Autodesk.Revit.Attributes;

using Autodesk.Revit.DB;

using Autodesk.Revit.UI;

namespace Revit.SDK.Samples.HelloRevit.CS

{

[Transaction(TransactionMode.Manual)]

publicclassCommand : IExternalCommand

{

publicResult Execute(ExternalCommandData commandData,

refstring message,

ElementSet elements)

{

UIApplication uiApp = commandData.Application;

foreach (Element ele in

uiApp.ActiveUIDocument.Selection.Elements)

{

Panel panel = ele asPanel;

PanelType panelType =

doc.GetElement(panel.GetTypeId()) asPanelType;

if (null != panelType)

{

ElementId id =

panelType.get_Parameter(

BuiltInParameter.MATERIAL_ID_PARAM).AsElementId();

if (id != null)

{

Material mat = doc.GetElement(id) asMaterial;

TaskDialog.Show("Material Name", mat.Name);

}

}

}

returnResult.Succeeded;

}

}

}

If you have a custom curtain wall, the approach will be different and you can get an idea of how to access the required parameter values using the Revit LookUp tool again.

02/18/2013

In the recent past, we had received some queries around refreshing the sections directly using the API (without having to use SendCommand).

There isn’t any direct API which allows API users to the refresh on the sections/elevations. Sending the command using SendCommand would be one workaround for some API users. But if SendCommand is not an option (as in this case), the ACA 2013 .NET API provides a method called GenerateSection which can help generate 2D sections programmatically. The method signature is included below - Autodesk.Aec.ApplicationServices.Utility.SectionUtilities.GenerateSection(Autodesk.AutoCAD.DatabaseServices.ObjectId, Autodesk.AutoCAD.Runtime.RXClass, string, string, bool, string)

This API might help re-create sections and this might be closest to what we can do as work-around for now.

02/15/2013

I am using the following code to associate/disassociate a family parameter from/to an element parameter. doc.FamilyManager.AssociateElementParameterToFamilyParameter(ep, fp)

I can associate fine. However, there are no instructions on how to disassociate. Can you let me know how to disassociate a Family parameter from an Element parameter.

Resolution:

As per the Revit API chm file, the same AssociateElementParameterToFamilyParameter() method can help disassociate a element parameter from an existing family parameter. The only change would be that the value of the family parameter would be null (or Nothing in VB).

So to test this, calling the AssociateElementParameterToFamilyParameter() method once, it creates a column family and also associated the element parameter with family parameter, as shown below:

Next, if we add another line of code to call the same method and instead pass null as family parameter, the following dialog confirms that the disassociation works as expected:

02/14/2013

In the Auto_08.vbs sample in Navisworks Manage 2012 (or the AutoPublishScriptExample sample in Navisworks 2013), which can be located from the Navisworks install folder location (typically under Navisworks 2012\api\COM\examples location) - the VB Script file takes an input file and creates an expiring output file using the Publish API.

If a system has multiple versions of Navisworks installed and we want to determine which version of roamer.exe was used to do the publish, we can add the following simple lines of code and extract the required information:

ver=roamer.state.fileversion(arg_out) MsgBox(ver)

All that is being done here is to check the file version of the output file and determine which flavor and version of NW was used to generate the NWD file. Please do remember to declare the variable ver using the Dim statement, at the beginning of the sample.

02/07/2013

A question that has often come up repeatedly is on retrieving wall paint materials:

There is a Paint tool in Revit that a material can be 'painted' on a surface of a wall. How can we access the paint material information via the API?

With the Revit API, we have the ability to get the regions of each face of solids (walls in this case) and each region will provide material information as well.

Following is a note from the Revit 2012 API chm file on this topic, that provides further details on how to use the API to access the Paint material :

Face.HasRegions & Face.GetRegions()

This property and method provide information about the faces created by the Split Face command. HasRegions returns a boolean indicating if the face has any Split Face regions. GetRegions returns a list of faces. As the material of these faces can be independently modified through the UI with the Paint tool, the material of each face can be found from its MaterialElementId property.

02/06/2013

Is it possible to update saved viewpoints in Navisworks through the .NET API after they have been created. For example, if we want to update views after hiding some objects.

Navisworks .NET API includes a method called DocumentSavedViewpoints.ReplaceFromCurrentView(). This method can help replace the SavedViewpoint that is being passed on to this method with an updated copy. Viewpoint, Redlines and visibility are updated to those in the current View

02/05/2013

Similar questions like that of the title of this post, has come up a couple of times in the recent past. This topic has been covered in this blog-post too – though from a slightly different perspective.

As mentioned in this blog-post, the key to finding out if a Family Instance requires a host or not is to find out the Host parameter of the Family itself. This blog-post contains a screenshot of a Outlet-Duplex family instance (which is wall based) and shows how Revit LookUp tool can be used to confirm that the value of the HOST parameter as 1 (which confirms that the Family is wall-based). Once a given family that needs to be determined, is loaded into a Revit model, there is no need to create an instance of the family and then edit it and then access the HOST parameter – the loaded Family itself will provide access to the value of this parameter directly to help determine if the family needs a host and if yes, of which type.