« Another Revit API Blog | Main | Defining a New Parameter »

November 19, 2008

Comments

Dear Jeremy,

Following this post and the possibilities you commented us on the training this week, I would like to know how much data a parameter can store. As you know in Autocad the XData has a limit. I really liked your idea to store a xml tree structure on a parameter with our custom data instead of many different parameters.

Thanks a lot for the training the last three days, it has been a fantastic time.

Cheers, RJ.

Dear Ramon,

How nice to hear from you again so soon, and I am very glad you liked the training. I also enjoyed it very much.

The technique of storing large amounts of structured data encoded into XML and then further encoded into a string using base64 encoding has been used successfully for some pretty large data sets. As far as I know, the only limitation is memory size, but of course Revit has never been tested in this context. So please be aware that you are using this technique at your own risk! I am planning to post on this topic quite soon, and will provide a detailed code sample when I do so.

Cheers, Jeremy.

Hey Jeremy,

I noticed for certain special parameters I can't access the value.
For example with Lighting Fixtures, there are parameters like Light Loss Factor, Initial Intensity and Initial Color. The value field is a button, which opens a special window.
Do you think it's possible to access the value of these parameters?

Dear Nicholas,

Thank you for posting your query as a comment instead of just sending a mail, that helps keep things sorted and in place, and ensures that others can share and participate in our conversation.

As far as I know, the only element properties accessible through the Revit API are the ones that are listed through the element viewer mentioned above. These do include some properties that are not present in the element Parameters collection.

Have you tried to list the properties of one of your lighting fixture instances using this tool?

I had a look at one lighting fixture instances in my installation, but I did not see the properties that you mention.

Cheers, Jeremy.

Hey Jeremy,

These parameters I mentioned above are available when there is a Light Source Definition in the family and can be found under the Type parameters.

When I use param.Definition.ParameterType.ToString on these parameters, the result is "Invalid". The value of these parameters is "0" and it's an Integer (checked that with Parameters.StorageType.Integer)

Cheers

Dear Nicolas,

Thank you for the update and clarification. I am exploring this issue and found that it merits an own post, which I plan to submit next week. I hope you can wait until then. I wish you a nice weekend.

Cheers, Jeremy.

The discussion of this topic is continued at:

http://thebuildingcoder.typepad.com/blog/2009/04/deeper-parameter-exploration.html

Hi Jeremy,

Just a quick question, I was having trouble with your code above, were you executing this all through VSTA and the macro editor built into Revit, or through MS Visual Studio with DLL com links to Revit? And was this the entire code required? Any clarifications would be greatly appreciated!

Thanks,

Brandon

Dear Brandon,

I don't know exactly which "code above" you mean. In any case, I almost never executed any VSTA code myself at all, I always use the plug-in style implementation as illustrated by The Building Code samples.

Cheers, Jeremy.

Dear Jeremy,
I want to explore the all available parameters in entire revit so that will get clear idea for all parameters.

Thanks
Sandeep

Dear Sandeep,

I would suggest RevitLookup first of all, and my built-in parameter checker included in the Revit API introduction labs:

http://thebuildingcoder.typepad.com/blog/2010/07/change-element-type.html

Cheers, Jeremy.

Hi Jeremy,
Thank you so much for the link. Form download i got the "BuilInParameter" for particular element.Specially, small code as below explains a lot:

Array bips = Enum.GetValues(typeof(BuiltInParameter));
Parameter p;
foreach (BuiltInParameter a in bips)
{
try
{
p = elem.get_Parameter(a);

}
catch { }

}

Thanks
Sandeep

Dear Sandeep,

I am glad that it helped and clarified things.

That try-catch statement to retrieve a value for each and every built-in parameter enum value is also used by the RevitLookup 'Built-In Enum Snoop' in the Snoop Parameters dialogue.

Cheers, Jeremy.

Hello, Jeremy.
In my project I've found parameter of particular Element that doesn't exists in Element.Parameters collection.

You wrote: "Sometimes an element will have other parameters attached to it as well, which are not listed in the 'official' collection returned by the Parameters property. To explore all parameters attached to an element, one can make use of the built-in parameter checker." And nothing more. Can you explain that means these parameters?

In my case I need to get length of any element if length exists. I wrote next code for it:
http://pastebin.com/GgKFmxdD
At first In BuiltInParameters I find parametes that contains "LENGTH" word. Then I check if this BuiltInParameter exists in element. If it exists return value of this parameter. The problem there are no length parameter in element.Parameters but a can get it via element.get_Parameter.
Of course I can get length of the element enumerate each parameter and check parameter for length but I'm curios about these "strange invisible" parameters.

Best regards, Victor

Dear Victor,

Yes, there are lots of parameters attached to elements that do not appear in the 'official' Element.Parameters collection.

You can retrieve them using any of the standard Element.Parameter property overloads. Yes, it is a property, and yes, it still takes an argument, and yes, it does not exist in C#, because it is called get_Parameter there. All a bit strange. The overloads are

Parameter(BuiltInParameter) Retrieves a parameter from the element given a parameter id.

Parameter(Definition) Retrieves a parameter from the element based on its definition.

Parameter(Guid) Retrieves a parameter from the element given a GUID for a shared parameter.

Parameter(String) Retrieves a parameter from the element given its name.

So if the parameter you are looking for is named "Length", you can retrieve it using that name.

I would recommend you not to do so, however, because this makes you code language dependent.

Better is to determine exactly which built-in parameter corresponds to it and use that instead.

Here is a code snippet with a loop that shows how to retrieve all parameters from an element. Actually, it may not retrieve all, but it mostly retrieves more than the official Parameters collection contains:

Array bips = Enum.GetValues(typeof(BuiltInParameter));
Parameter p;
foreach (BuiltInParameter a in bips)
{
try
{
p = elem.get_Parameter(a);
}
catch { }
}

This kind of loop to retrieve a value for each and every built-in parameter enumeration value is also used by the RevitLookup 'Built-In Enum Snoop' in the Snoop Parameters dialogue and my own built-in parameter checker:

http://thebuildingcoder.typepad.com/blog/2008/11/exploring-element-parameters.html

http://thebuildingcoder.typepad.com/blog/2009/02/locked-dimensioning.html

http://thebuildingcoder.typepad.com/blog/2009/04/deeper-parameter-exploration.html

http://thebuildingcoder.typepad.com/blog/2009/09/door-marks.html

http://thebuildingcoder.typepad.com/blog/2009/11/room-occupancy.html

http://thebuildingcoder.typepad.com/blog/2009/11/title-block-of-sheet.html

http://thebuildingcoder.typepad.com/blog/2010/05/pre-post-and-pick-select.html

http://thebuildingcoder.typepad.com/blog/2010/05/determine-sheet-size.html

I hope this explains.

Actually, after direct email contact and lots more discussion with Victor, this thread was promoted to an entirely new blog post of its own, including a completely revamped version of the built-in parameter checker, BipChecker:

http://thebuildingcoder.typepad.com/blog/2011/09/unofficial-parameters-and-bipchecker.html

Cheers, Jeremy.

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Your Information

(Name and email address are required. Email address will not be displayed with the comment.)

Jeremy Tammik

AboutTopicsIndexSource