Results 1 to 7 of 7

Thread: shared parameters

  1. #1
    Member
    Join Date
    2012-12
    Posts
    9
    Login to Give a bone
    0

    Default shared parameters

    NEW to Revit API.

    I have seen the example - Revit 2013 SDK\Samples\ProjectInfo - which shows default project info on a form.

    I have created a sheet which contains new labels from attached shared parameter file.

    How can I load my new labels/attribute values onto a form - is this possible.

    Can I load each value into a seperate textbox?

    Any help would be much appreaciated.
    Attached Files Attached Files

  2. #2
    Member
    Join Date
    2012-12
    Location
    Boston, MA
    Posts
    9
    Login to Give a bone
    0

    Default Re: shared parameters

    Hi,

    I've provided some thoughts on how to do this at http://boostyourbim.wordpress.com/20...arameter-data/

    Regards
    Harry

  3. #3
    Member
    Join Date
    2012-12
    Posts
    9
    Login to Give a bone
    0

    Default Re: shared parameters

    Quote Originally Posted by harrymattison345771 View Post
    Hi,

    I've provided some thoughts on how to do this at http://boostyourbim.wordpress.com/20...arameter-data/

    Regards
    Harry
    Thanks for the link : when I try I get error :
    get_parameter is not a memeber of autodesk.revit.db.element on line:

    Code:
    Dim parameter AsParameter = e.get_Parameter("myproject")
    I have converted to vb.net

  4. #4
    Member
    Join Date
    2012-12
    Posts
    9
    Login to Give a bone
    0

    Default Re: shared parameters

    Have now tried:

    Code:
      Public Sub GetSheetParams()
    
            Dim doc As Document = Command.RevitStartInfo.RevitDoc
    
            Dim sheetInfo As String = ""
            For Each e As Element In New FilteredElementCollector(doc).OfClass(GetType(ViewSheet))
                ' get the parameter
                Dim parameter As Parameter = e.Parameter("myProjectNo")
    
    
                ' get the string value of the parameter
              Dim cadFileData = parameter.AsString
                sheetInfo += cadFileData + vbLf
            Next
            TaskDialog.Show("myProjectNo", sheetInfo)
        End Sub
    
    End Class
    but now get error : Object Reference not set to an instance of an object on line -
    Code:
    Dim cadFileData = parameter.AsString
    I am launching (GetSheetParams) from a button on my form - maybe this is wrong method.

    Any help is much appreciated.
    Last edited by info347074; 2012-12-17 at 08:47 PM.

  5. #5
    Member
    Join Date
    2012-09
    Posts
    34
    Login to Give a bone
    0

    Default Re: shared parameters

    Quote Originally Posted by info347074 View Post
    Have now tried:

    Code:
      Public Sub GetSheetParams()
    
            Dim doc As Document = Command.RevitStartInfo.RevitDoc
    
            Dim sheetInfo As String = ""
            For Each e As Element In New FilteredElementCollector(doc).OfClass(GetType(ViewSheet))
                ' get the parameter
                Dim parameter As Parameter = e.Parameter("myProjectNo")
    
    
                ' get the string value of the parameter
              Dim cadFileData = parameter.AsString
                sheetInfo += cadFileData + vbLf
            Next
            TaskDialog.Show("myProjectNo", sheetInfo)
        End Sub
    
    End Class
    but now get error : Object Reference not set to an instance of an object on line -
    Code:
    Dim cadFileData = parameter.AsString
    Any help is much appreciated.
    The parameter variable is null, meaning that the parameter was not found on that element. I see that the parameter name in the shared parameter file you posted is actually "ProjectNo" and not "myProjectNo". Make sure you've spelled the parameter name correctly - the name is also case sensitive so keep that in mind as well.

    If you want to explore an element's parameters, you should use RevitLookup which is part of the SDK. I don't think it comes pre-built so you'll need to compile it in Visual Studio and add the add-in to Revit yourself. It comes with instructions on how to do this.

  6. #6
    Member
    Join Date
    2012-12
    Posts
    9
    Login to Give a bone
    0

    Default Re: shared parameters

    Quote Originally Posted by cshha View Post
    The parameter variable is null, meaning that the parameter was not found on that element. I see that the parameter name in the shared parameter file you posted is actually "ProjectNo" and not "myProjectNo". Make sure you've spelled the parameter name correctly - the name is also case sensitive so keep that in mind as well.

    If you want to explore an element's parameters, you should use RevitLookup which is part of the SDK. I don't think it comes pre-built so you'll need to compile it in Visual Studio and add the add-in to Revit yourself. It comes with instructions on how to do this.
    I think it is this line that is returning nothing :
    Code:
     Dim parameter As Parameter = e.Parameter("ProjectNo")
    If I change it to one of the builtin parameters I get a value ie :
    Code:
      
    Dim myRevision AsParameter = e.Parameter(BuiltInParameter.SHEET_CURRENT_REVISION)

  7. #7
    Member
    Join Date
    2012-09
    Posts
    34
    Login to Give a bone
    0

    Default Re: shared parameters

    The parameter probably hasn't been added to the element yet then. When dealing with shared parameters, the parameter needs to be bound to the element before it can be set.

    Check out this post from Jeremy Tammik's blog. There's a link near the bottom to download a set of helper functions to deal with shared parameters. The function you'll be interested in is GetOrCreateElemSharedParam

    http://thebuildingcoder.typepad.com/...r-binding.html

Similar Threads

  1. 2014: Criteria for Project Parameters vs. Shared Parameters
    By jagostinho in forum Revit - Platform
    Replies: 3
    Last Post: 2014-03-21, 02:46 PM
  2. How YOU use shared parameters
    By enerGwizz in forum Revit MEP - General
    Replies: 8
    Last Post: 2011-06-24, 08:55 PM
  3. shared parameters
    By wags5116 in forum Revit MEP - General
    Replies: 2
    Last Post: 2011-05-19, 06:43 AM
  4. Shared Parameters
    By hpannu in forum Revit Structure - Families
    Replies: 6
    Last Post: 2007-10-23, 03:42 PM
  5. Shared parameters
    By Anthony.d in forum Revit Architecture - Wish List
    Replies: 0
    Last Post: 2006-12-31, 12:37 PM

Posting Permissions

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