Results 1 to 6 of 6

Thread: Setting Parameters Programmatically

  1. #1
    Member
    Join Date
    2006-05
    Posts
    9
    Login to Give a bone
    0

    Default Setting Parameters Programmatically

    Hey all:

    Is it possible to change an object's parameters programmatically? In VB2005, I get an error that the property 'Parameter' is read only when using the following line:

    Set elem.Parameter(Parameters.BuiltInParameter.STRUCTURAL_NUMBER_OF_STUDS) = "(24)"

    Is there another way to set this that I'm missing or is this not accessible currently through the API?

    I'd like to make an improved "match type" command for composite steel beams, but am not sure if it's possible. The "match type" program native to REVIT will only change the beam size, but the other parameters do not carry over (for example, "number of studs" and "camber"). So, I'd like a program that would not only change the beam, but also set the parameters for "number of studs" and "camber". Currently, the user has to manually enter in the number of studs and camber for every beam, either by accessing the object's properties or selecting its tag. This is obviously brutally slow compared to our previous customization in other platforms.

    Thanks in advance,
    Aaron

  2. #2
    AUGI Addict
    Join Date
    2003-11
    Location
    New Zealand
    Posts
    1,116
    Login to Give a bone
    0

    Default Re: Setting Parameters Programmatically

    Try this (in c#)

    Parameter Param = elem.get_Parameter(Parameters.BuiltInParameter.STRUCTURAL_NUMBER_OF_STUDS);

    Param.Set = 24;

    HTH,

    Guy

  3. #3
    I could stop if I wanted to Danny Polkinhorn's Avatar
    Join Date
    2003-12
    Location
    San Francisco, CA
    Posts
    448
    Login to Give a bone
    0

    Default Re: Setting Parameters Programmatically

    Not all of the Built-in parameters are read/write. If you're getting a read-only error, unfortunately that's means it's read-only.

    Sorry, I'm not too familiar with the structural API, but is there another read-write parameter which drives this value, which you could change instead?

    HTH,

  4. #4
    Active Member
    Join Date
    2005-09
    Posts
    69
    Login to Give a bone
    0

    Default Re: Setting Parameters Programmatically

    Did you sort this out because I found the 2 answers misleading.

    This parameter is definitely not read only, (unless the elements are locked in a multi-user environment), because our application sets the value but is written in C#. You need to be aware that this is a string, not a numeric parameter, and you need to call the Set method with a string argument. I think this should work in Basic.

    Dim studParameter As Parameter = elem.Parameter(Autodesk.Revit.Parameters.BuiltInParameter.STRUCTURAL_NUMBER_OF_STUDS)

    studParameter.Set("24")

  5. #5
    I could stop if I wanted to Danny Polkinhorn's Avatar
    Join Date
    2003-12
    Location
    San Francisco, CA
    Posts
    448
    Login to Give a bone
    0

    Default Re: Setting Parameters Programmatically

    Sorry, wasn't trying to be misleading. If he was passing the wrong parameter type, it wouldn't have given him a read-only error, it would have given an invalid type error.

    Looking at your post, it appears he had a syntax error.

    HTH,

  6. #6
    Member
    Join Date
    2006-05
    Posts
    9
    Login to Give a bone
    0

    Default Re: Setting Parameters Programmatically

    David, Guy, and Danny:

    Thanks for all your replies...I tried David's method this morning and it worked like a charm...My syntax was incorrect as Danny notes and that must have been causing the read-only error for some reason...

    Sorry for the pedestrian question (I'm switching from VBA in AutoCAD/Excel/Word to VB in RST).

    Thanks again,
    Aaron

Similar Threads

  1. Change Cut Plane Programmatically?
    By treaves04413213 in forum AutoLISP
    Replies: 0
    Last Post: 2013-08-29, 05:58 PM
  2. How to programmatically call refedit.
    By Paul Bryan Porter in forum ARX
    Replies: 4
    Last Post: 2012-01-17, 04:10 PM
  3. Setting Section Parameters
    By dbumgarner in forum Revit Structure - General
    Replies: 3
    Last Post: 2010-07-06, 12:27 AM
  4. Correctly setting up lookup parameters to use with a steel joist
    By Animal in forum Dynamic Blocks - Technical
    Replies: 3
    Last Post: 2007-05-10, 02:23 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
  •