Results 1 to 3 of 3

Thread: is it possible to "extract" a parameter into a "tag" (or similar)

  1. #1
    AUGI Addict luigi's Avatar
    Join Date
    2015-11
    Location
    Royal oak, Michigan
    Posts
    1,513
    Login to Give a bone
    0

    Default is it possible to "extract" a parameter into a "tag" (or similar)

    Basically, if there is a parameter containing data, i.e. Top of wall or footing, can this data, through the API, be extracted and placed in a tag (or something similar)?
    Thanks in Advance!

  2. #2
    Member
    Join Date
    2005-12
    Posts
    44
    Login to Give a bone
    0

    Default Re: is it possible to "extract" a parameter into a "tag" (or similar)

    Yes it is possible but it takes a lot of code. You have to pull the object and scan thru its parameters until you find the one that you want and then you can set it to a variable. I did one similiar to this with a macro I wrote for room number tags. The code is about a page and half long.

  3. #3
    Member
    Join Date
    2008-09
    Location
    Atlanta, GA
    Posts
    19
    Login to Give a bone
    0

    Default Re: is it possible to "extract" a parameter into a "tag" (or similar)

    Well, here's a VB.Net version !

    Assuming you already have a loop that gets the element for you, you can use the following 2 functions to get the parameter in a string format .... and then store it in a tag may be ! You may have to modify the things slightly ...

    ******* YOU WILL HAVE TO REPLACE "ParemeterName" IN THE CODE WITH YOUR ACTUAL PARAMETER NAME **********************************

    Code:
    'Function to get the value of a specific parameter
    Public Function GetParamVal(ByVal elem As Autodesk.Revit.Element) As String
    
                Dim paramIter As Autodesk.Revit.ParameterSetIterator
                paramIter = elem.Parameters.ForwardIterator
                While (paramIter.MoveNext)
                    If (CType(paramIter.Current, Autodesk.Revit.Parameter).Definition.Name _ 
                           = "ParameterName") Then
                        
                       return ParameterValue(paramIter.Current)
                   End If
    
                End While
                Return ""
    End Function
    
    'Function to convert the value of an element.parameter to a string 
    Private Function ParameterValue(ByVal param As Autodesk.Revit.Parameter) As String
                If (param Is Nothing) Then
                    Return ""
                End If
    
                Dim value As String = ""
                Select Case param.StorageType
                    Case Parameters.StorageType.Double
                        value += param.AsDouble().ToString()
                    Case Parameters.StorageType.ElementId
                        value += param.AsElementId().ToString()
                    Case Parameters.StorageType.Integer
                        value += param.AsInteger().ToString
                    Case Parameters.StorageType.None
                        value += "NONE"
                    Case Parameters.StorageType.String
                        value += param.AsString()
                    Case Else
                        value += "ELSE CASE"
    
                End Select
                Return value
    End Function

    Prashant
    Last edited by RobertB; 2009-05-20 at 04:33 AM. Reason: Added code tags

Similar Threads

  1. 2015: What determines instance parameter grip "snap" and "align" behavior?
    By patricks in forum Revit Architecture - General
    Replies: 4
    Last Post: 2019-05-20, 08:45 PM
  2. 2014: Can't change parameter from "Instance" to "Type" in template family
    By Pavlin in forum Revit MEP - Families
    Replies: 2
    Last Post: 2014-02-11, 11:52 AM
  3. Replies: 0
    Last Post: 2012-06-06, 11:54 AM
  4. Replies: 4
    Last Post: 2009-07-29, 09:43 PM
  5. ENTIDADES EN ALIGNMENT COMO "FIXED", "FLOTING" y "FREE"
    By cadia in forum AutoCAD Civil 3D - General
    Replies: 1
    Last Post: 2009-02-01, 04:21 AM

Posting Permissions

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