Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: Key Schedule Parameter

  1. #11
    Login to Give a bone
    0

    Post Re: Key Schedule Parameter

    I figured out how to get the key parameter value if anyone is interested:

    Code:
    ElementId keyId = area.get_Parameter("YourKeyParameterName").AsElementId();
    Element elem = doc.GetElement(new ElementId(keyId.IntegerValue));
    string keyname = "";
    if (elem != null)
    {
        keyname = elem.get_Parameter(BuiltInParameter.REF_TABLE_ELEM_NAME).AsString();
    }
    else
    {
        keyname = "(none)";
    }

  2. #12
    All AUGI, all the time
    Join Date
    2006-08
    Posts
    636
    Login to Give a bone
    0

    Default Re: Key Schedule Parameter

    Quote Originally Posted by coffey.architect980066 View Post
    I figured out how to get the key parameter value if anyone is interested:

    Code:
    ElementId keyId = area.get_Parameter("YourKeyParameterName").AsElementId();
    Element elem = doc.GetElement(new ElementId(keyId.IntegerValue));
    string keyname = "";
    if (elem != null)
    {
        keyname = elem.get_Parameter(BuiltInParameter.REF_TABLE_ELEM_NAME).AsString();
    }
    else
    {
        keyname = "(none)";
    }
    hi coffey, try to get my feet wet in (key) schedule stuff, keyname is in fact key parameter value, right? how do you specify "YourKeyParameterName"? thanks.

  3. #13
    Login to Give a bone
    0

    Default Re: Key Schedule Parameter

    Quote Originally Posted by Ning Zhou View Post
    hi coffey, try to get my feet wet in (key) schedule stuff, keyname is in fact key parameter value, right? how do you specify "YourKeyParameterName"? thanks.
    Hi. YourKeyParameterName is just a string for the name of your key parameter that your trying to get the value of.

  4. #14
    All AUGI, all the time
    Join Date
    2006-08
    Posts
    636
    Login to Give a bone
    0

    Default Re: Key Schedule Parameter

    thanks coffey.
    seems i can no longer upload attachment files (reached 20mb limit but don't know how to delete old uploaded files?!) so i just type something here (looks like Revit key schedule):

    --------------------------
    KeyName Comments
    ------------------------
    1 x
    --------------------------
    2 xx
    ------------------
    3 xxx
    --------------------

    i tried "KeyName", "1", etc., no luck, maybe i totally misunderstand your question and solution?!

  5. #15
    Login to Give a bone
    0

    Default Re: Key Schedule Parameter

    Quote Originally Posted by Ning Zhou View Post
    thanks coffey.
    seems i can no longer upload attachment files (reached 20mb limit but don't know how to delete old uploaded files?!) so i just type something here (looks like Revit key schedule):

    --------------------------
    KeyName Comments
    ------------------------
    1 x
    --------------------------
    2 xx
    ------------------
    3 xxx
    --------------------

    i tried "KeyName", "1", etc., no luck, maybe i totally misunderstand your question and solution?!
    When your in the key schedule, look in the properties for "Parameter Name". That's the one to use. The only slight problem is that this name does not need to be unique in Revit. So you could be returning the incorrect one if u have two key schedules with the same Parameter Name (which would be silly). Also take a look in the Revit Lookup for the element whose parameter your trying to obtain. Hope this helps.

  6. #16
    All AUGI, all the time
    Join Date
    2006-08
    Posts
    636
    Login to Give a bone
    0

    Default Re: Key Schedule Parameter

    OK, then what is the "area" in your code? at first i assume it's ViewSchedule like below:

    ViewSchedule vs = new FilteredElementCollector(doc).OfClass(typeof(ViewSchedule)).ElementAt(1) as ViewSchedule; // assume casework keyschedule
    parmId = vs.get_Parameter("Casework Style").AsElementId();
    elem = doc.GetElement(new ElementId(parmId.IntegerValue));
    if (elem != null)
    value = elem.get_Parameter(BuiltInParameter.REF_TABLE_ELEM_NAME).AsString();
    else
    value = "(none)";

    well, at first i thought you can get mapped field value like "1" -> "x", "2" -> "xx", "3" -> "xxx", etc.

  7. #17
    Login to Give a bone
    0

    Post Re: Key Schedule Parameter

    Quote Originally Posted by Ning Zhou View Post
    OK, then what is the "area" in your code? at first i assume it's ViewSchedule like below:

    ViewSchedule vs = new FilteredElementCollector(doc).OfClass(typeof(ViewSchedule)).ElementAt(1) as ViewSchedule; // assume casework keyschedule
    parmId = vs.get_Parameter("Casework Style").AsElementId();
    elem = doc.GetElement(new ElementId(parmId.IntegerValue));
    if (elem != null)
    value = elem.get_Parameter(BuiltInParameter.REF_TABLE_ELEM_NAME).AsString();
    else
    value = "(none)";

    well, at first i thought you can get mapped field value like "1" -> "x", "2" -> "xx", "3" -> "xxx", etc.

    area was the element I was getting the key value of. I would image you can use any element that has a key parameter for it. After you get the key element, then you can get its parameters which I think are the values you are looking for. I don't think you can do what you seem to be trying to do which is grab the keys and all their values from a schedule. Unless you already have all the ElementIds of the keys, which there doesn't seem to be enough properties in order to get them or you have a set of elements that each have a key assigned to it that you can grab from. Alternatively, but prone to error, you can use the code below (in macro form). It searches for a key based on its name instead of the Key Parameter name. The problem is that keys could have the same name, so it only works if all the key names are unique:

    Code:
    public void GetKeyParameterValues()
    {
    	Document doc = this.ActiveUIDocument.Document;
    	UIDocument uidoc = this.ActiveUIDocument;
    			
    	string data = "";
    	string keyName = "4";  // name of key you want to get - hopefully no duplicates in project!
    	foreach (Element key in new FilteredElementCollector(doc).WhereElementIsNotElementType())
    	{
    		try
    		{
    			if (key.get_Parameter(BuiltInParameter.REF_TABLE_ELEM_NAME).AsString() == keyName)
    			{
    				foreach (Parameter p in key.Parameters)
    				{
    					data += p.Definition.Name + ": " + getParameterString(p) + Environment.NewLine;	
    				}
    				break;
    			}
    						
    		}
    		catch { continue; }
    	}
    			
    	TaskDialog.Show("Info", data);
    }
    public static string getParameterString(Parameter p)
    {
    	if (p.StorageType == StorageType.Integer)
    		return p.AsInteger().ToString();
    	else if (p.StorageType == StorageType.Double)
    	{
    		return p.AsDouble().ToString();
    	}
    	else if (p.StorageType == StorageType.ElementId)
    	{
    		return p.AsElementId().ToString();
    	}
    	else if (p.StorageType == StorageType.String)
    	{
    		return p.AsString();
    	}
    	else
    		return "?";
    }

  8. #18
    All AUGI, all the time
    Join Date
    2006-08
    Posts
    636
    Login to Give a bone
    0

    Default Re: Key Schedule Parameter

    got it, thanks coffey.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. 2015: Family parameter in schedule.
    By swapr78 in forum Revit MEP - General
    Replies: 4
    Last Post: 2015-05-08, 08:17 PM
  2. Replies: 1
    Last Post: 2013-06-08, 04:52 AM
  3. Add parameter to panel schedule
    By wags5116 in forum Revit MEP - General
    Replies: 4
    Last Post: 2011-08-17, 10:52 AM
  4. Yes/No Parameter display in a schedule
    By Joshua Kohl in forum Revit Architecture - General
    Replies: 3
    Last Post: 2010-05-03, 12:41 PM
  5. Window schedule parameter
    By bob.86982 in forum Revit Architecture - General
    Replies: 2
    Last Post: 2008-10-30, 02:39 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
  •