How to set the default value of a "Yes/No" shared parameter property to no?

How to set the default value of a "Yes/No" shared parameter property to no?

Anonymous
Not applicable
5,910 Views
11 Replies
Message 1 of 12

How to set the default value of a "Yes/No" shared parameter property to no?

Anonymous
Not applicable

I have a shared "yes/no" parameter attached to walls which should be defaulted to no. How can this be done?

0 Likes
Accepted solutions (1)
5,911 Views
11 Replies
Replies (11)
Message 2 of 12

Anonymous
Not applicable

If it's a Family parameter that you wish to modify, then you can go in to the Family Editor and open the wall Family in question.  Then, simply edit the parameters desired.  You can access them multiple ways, depending on what you need:

 

1.png

 

After you're done, just save the Family and if should save that as your default for when you use it in your designs.  Hope that helps.  Good Luck!

0 Likes
Message 3 of 12

Anonymous
Not applicable

It is not a family parameter.

0 Likes
Message 4 of 12

Anonymous
Not applicable

Is it a BuiltInParameter? Do you know the name of the parameter?

0 Likes
Message 5 of 12

Anonymous
Not applicable

It is a shared parameter of type "Yes/No" and i am binding it to Wall types

0 Likes
Message 6 of 12

Anonymous
Not applicable

So a couple of things: 

1. That is a Family Parameter - the fact that it's shared just means it can be shared by multiple Families. 
2. Based on your drawing, you are in the Project Editor - not the Family Editor.  If you want to set default Family values, you must be in the Family Editor.

2.png

 

Once you're in the Family Editor and you've found the wall you want to edit the defaults for, see my previous screen shot on where you can do that.  Once you've modified the parameter, just save the Family, and you'll be good to go.

 

UNLESS:

Are you a programmer trying to modify this parameter with code when creating the wall?  Or are you a designer and you want to modify the defaults for your drawings?  And did you create the parameter, or is it a Revit generate (built-in) parameter?

0 Likes
Message 7 of 12

Anonymous
Not applicable

I am a programmer and I am binding this shared parameter to all the wall types when our plugin is loaded. However I noticed that the default value for this is gray checkbox that is checked. I want the default value to be unchecked.

 

 

0 Likes
Message 8 of 12

matthew_taylor
Advisor
Advisor
Accepted solution
Hi,
From what I can see from the image, the instance shared parameter doesn't have a default. It's in that not yes, but not no state. That is, it doesn't have a value yet. .hasvalue = false.
You may want to use an updater to set newly created walls to default to 'No'. There may be other ways, but that's a fairly easy one. There are examples in the SDK.
Let us know if you need help!

Cheers,
-Matt

Cheers,

-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?
Message 9 of 12

Anonymous
Not applicable

Did you (or your company) create the parameter?  If so, use the Family Editor.  If not, you need to know the parameter name.  Then you can use something like this:

 

//If it's a BuiltInParameter
var pParam = pWall.get_Parameter(BuiltInParameter.RBS_WALL_PANELIZED);
//If not
var pParam = pWall.get_Parameter("Panelized");

pParam?.Set("No");

If you're trying to set it every time you draw a wall via your code, you need to set the parameter via a Parameter variable and the Set(..).  If you want to not have to set it every time, it HAS TO be done through the editor.

0 Likes
Message 10 of 12

Anonymous
Not applicable

It worked. Thnx! Created an updater as follows -

 

// Register wall updater with Revit
WallUpdater updater = new WallUpdater(App.ActiveAddInId);
UpdaterRegistry.RegisterUpdater(updater);
ElementClassFilter wallFilter = new ElementClassFilter(typeof(Wall));
pdaterRegistry.AddTrigger(updater.GetUpdaterId(), wallFilter, Element.GetChangeTypeElementAddition());

 

 

 public class WallUpdater : IUpdater
    {
        static AddInId m_appId;
        static UpdaterId m_updaterId;

 

        // constructor takes the AddInId for the add-in associated with this updater
        public WallUpdater(AddInId id)
        {
            m_appId = id;
            m_updaterId = new UpdaterId(m_appId, new Guid("2FAF3F05-E54D-41CF-9ACB-868D063805B9"));
        }

        public void Execute(UpdaterData data)
        {
            Document doc = data.GetDocument();
            foreach (ElementId addedElemId in data.GetAddedElementIds())
            {
                Wall wall = doc.GetElement(addedElemId) as Wall;
                if (wall != null)
                {
                    Parameter param = wall.LookupParameter(WevrConstants.IsPanelized);
                    if (null != param)
                    {
                       param.Set(0);
                    }                   
                }
            }
        }

        ......

}

0 Likes
Message 11 of 12

Anonymous
Not applicable

This parameter needs to be attached and set to default as no for all the wall types created. When certain process in our plugin is executed it sets after processing the wall. Update solution is working.

 

Thanks for your support!

 

0 Likes
Message 12 of 12

matthew_taylor
Advisor
Advisor
Glad to hear it!
Watch that the updater will trigger when a panelized or non-panelized wall is copied, so you may only want to set the value if .hasvalue is false.

Cheers,

-Matt

Cheers,

-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?
0 Likes