Results 1 to 5 of 5

Thread: Retrieve element parameter by GUID

  1. #1
    Woo! Hoo! my 1st post
    Join Date
    2015-08
    Posts
    1
    Login to Give a bone
    0

    Default Retrieve element parameter by GUID

    What is the recommended way to access a parameter by its GUID? get_Parameter(...) accepts a GUID but its successor LookupParameter(...) doesn't anymore.

    Regards,

    Thomas Schmidt

  2. #2
    Member
    Join Date
    2015-12
    Posts
    19
    Login to Give a bone
    0

    Default Re: Retrieve element parameter by GUID

    Apparently only Shared Parameters have GUIDs. According to the Revit 2016 SDK help, you use this static method which returns a SharedParameterElement:

    SharedParameterElement SharedParameterElement.Lookup(Guid)

  3. #3
    Active Member
    Join Date
    2011-11
    Location
    Saint-Omer, Pas-de-Calais, France
    Posts
    58
    Login to Give a bone
    0

    Default Re: Retrieve element parameter by GUID

    Element.get_Parameter(System.Guid guid) is still there. Element.LookupParameter(string name) replace Element.get_Parameter(string name) because you can have multiple shared parameters with the same name (but different Guids) coming from different shared parameter files.

  4. #4
    Member
    Join Date
    2015-12
    Posts
    19
    Login to Give a bone
    0

    Default Re: Retrieve element parameter by GUID

    According to Revit 2016 SDK definition:
    Parameter.GUID is "The Guid for a shared parameter"

    ParameterElement is "User Defined parameter which includes Shared and non-Shared parameters"
    But this element does not have a GUID property.

    SharedParameterElement inherits from ParameterElement
    SharedParameterElement is defined as "An element that stores the definition of a shared parameter which is loaded into the document"

    This means that SharedParameterElement is a subset of the ParameterElement objects and thus GUID can be an additional property specific to Shared Parameters Elements only.

    The Parameter.get_Element is not documented, and is probably being phased out.

    To make a story short and to answer the question "what is best practice to get a parameter from Guid", you should use this method:
    SharedParameterElement.Lookup(Guid)

    I'm supposing that non-shared parameters (user defined and built-in) don't have Guids, as this is what the SDK documentation says. Also I checked using the RevitLookup Addin to read the Guid property of a parameter within Revit and it gives the following message in the value of the Guid: "Parameter is not shared parameter."

    See attached screenshot.
    2017-03-22 21_13_18-Snoop Parameters.png

  5. #5
    Active Member
    Join Date
    2011-01
    Posts
    87
    Login to Give a bone
    0

    Default Re: Retrieve element parameter by GUID

    There are 2 types of parameters and ID strings. (type and instance) (guid and a 6 number value)

Similar Threads

  1. 2016: How to retrieve Parameter Value of a Family Element ?
    By huiput2006707889 in forum Revit - API
    Replies: 2
    Last Post: 2015-09-04, 03:20 AM
  2. Replies: 8
    Last Post: 2013-11-27, 09:07 AM
  3. Element ID (as parameter value ?)
    By dante_van_wettum in forum Revit Structure - General
    Replies: 13
    Last Post: 2012-02-25, 02:36 PM
  4. Element ID as parameter
    By mui in forum Revit Architecture - General
    Replies: 0
    Last Post: 2011-10-14, 12:26 AM
  5. element.parameter overload-V8.1
    By GuyR in forum Revit - API
    Replies: 8
    Last Post: 2005-09-29, 03:19 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •