<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How can i add a projet parameter in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/how-can-i-add-a-projet-parameter/m-p/7252362#M57080</link>
    <description>&lt;P&gt;for moment I thought it was possible, but no it's not(it is still shareadParameter) and this stupid forum don't allow to delete posts&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ha it is possible, I just made it. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;this is how :&lt;/P&gt;&lt;PRE&gt;          Transaction trans = new Transaction(doc);
            trans.Start("Project Parameter");
//first you need to create Definition group 
            DefinitionGroup defGr = //your metod to create it, my is to long to past here but there is a exemple in SDK
            ExternalDefinitionCreationOptions option = new ExternalDefinitionCreationOptions("nowe", ParameterType.Text);
// here we create Definition
            Definition ed = defGr.Definitions.Create(option);
//chose in witch category schould it be
            CategorySet cs = new CategorySet();
            cs.Insert(Category.GetCategory(uidoc.Document, BuiltInCategory.OST_PipeCurves));
//you can bind it as instance or type, I did with Instance
            InstanceBinding bind = new InstanceBinding(cs);
// with it you made a new project parameter
            uidoc.Document.ParameterBindings.Insert(ed, bind);
            trans.Commit();&lt;/PRE&gt;&lt;P&gt;---------------------------------------------&lt;/P&gt;</description>
    <pubDate>Tue, 25 Jul 2017 12:37:49 GMT</pubDate>
    <dc:creator>MarryTookMyCoffe</dc:creator>
    <dc:date>2017-07-25T12:37:49Z</dc:date>
    <item>
      <title>How can i add a projet parameter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-can-i-add-a-projet-parameter/m-p/7244665#M57078</link>
      <description>&lt;P&gt;Hello ,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to add a new projet parameter using C# code and set a value to this created parameter during adding a Material&amp;nbsp; anyone can help me please&amp;nbsp; ?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2017 12:16:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-can-i-add-a-projet-parameter/m-p/7244665#M57078</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-21T12:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: How can i add a projet parameter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-can-i-add-a-projet-parameter/m-p/7245253#M57079</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;if I'm not mistaken, you can't create project parameter via Revit API.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2017 15:10:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-can-i-add-a-projet-parameter/m-p/7245253#M57079</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-21T15:10:45Z</dc:date>
    </item>
    <item>
      <title>Re: How can i add a projet parameter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-can-i-add-a-projet-parameter/m-p/7252362#M57080</link>
      <description>&lt;P&gt;for moment I thought it was possible, but no it's not(it is still shareadParameter) and this stupid forum don't allow to delete posts&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ha it is possible, I just made it. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;this is how :&lt;/P&gt;&lt;PRE&gt;          Transaction trans = new Transaction(doc);
            trans.Start("Project Parameter");
//first you need to create Definition group 
            DefinitionGroup defGr = //your metod to create it, my is to long to past here but there is a exemple in SDK
            ExternalDefinitionCreationOptions option = new ExternalDefinitionCreationOptions("nowe", ParameterType.Text);
// here we create Definition
            Definition ed = defGr.Definitions.Create(option);
//chose in witch category schould it be
            CategorySet cs = new CategorySet();
            cs.Insert(Category.GetCategory(uidoc.Document, BuiltInCategory.OST_PipeCurves));
//you can bind it as instance or type, I did with Instance
            InstanceBinding bind = new InstanceBinding(cs);
// with it you made a new project parameter
            uidoc.Document.ParameterBindings.Insert(ed, bind);
            trans.Commit();&lt;/PRE&gt;&lt;P&gt;---------------------------------------------&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2017 12:37:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-can-i-add-a-projet-parameter/m-p/7252362#M57080</guid>
      <dc:creator>MarryTookMyCoffe</dc:creator>
      <dc:date>2017-07-25T12:37:49Z</dc:date>
    </item>
    <item>
      <title>Re: How can i add a projet parameter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-can-i-add-a-projet-parameter/m-p/7252437#M57081</link>
      <description>&lt;P&gt;Is it project parameter?&lt;/P&gt;&lt;P&gt;I think this shared parameter!&lt;/P&gt;&lt;P&gt;Can you show your&amp;nbsp;externalDefinition creating?&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2017 12:45:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-can-i-add-a-projet-parameter/m-p/7252437#M57081</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-25T12:45:06Z</dc:date>
    </item>
    <item>
      <title>Re: How can i add a projet parameter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-can-i-add-a-projet-parameter/m-p/7252568#M57082</link>
      <description>&lt;P&gt;Me to i was able to do it 2 days ago by using this code&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;string originalFile = uiapp.Application.SharedParametersFilename;
                                            string tempFile = Path.GetTempFileName() + ".txt";
                                            using (File.Create(tempFile)) { }
                                            uiapp.Application.SharedParametersFilename = tempFile;
                                            string param = range.Cells[4, j].Value2;
                                            if (myMaterial.LookupParameter(param) == null)
                                            {
                                                ExternalDefinitionCreationOptions edco = new ExternalDefinitionCreationOptions(param, ParameterType.Text);
                                                edco.Visible = true;
                                                var definition = uiapp.Application.OpenSharedParameterFile().Groups.Create("MaterialsParameters").Definitions.Create(edco);
                                                uiapp.Application.SharedParametersFilename = originalFile;
                                                File.Delete(tempFile);
                                                var newCategory = doc.Settings.Categories.get_Item(BuiltInCategory.OST_Materials);
                                                var newCategorySet = uiapp.Application.Create.NewCategorySet();
                                                newCategorySet.Insert(newCategory);
                                                Autodesk.Revit.DB.Binding binding = uiapp.Application.Create.NewInstanceBinding(newCategorySet);
                                                doc.ParameterBindings.Insert(definition, binding, BuiltInParameterGroup.PG_DATA);
                                                myMaterial.LookupParameter(param).Set((string)range.Cells[iRow, j].Value2);
                                            }
                                            else
                                            {
                                                if (!string.IsNullOrEmpty((string)range.Cells[iRow, j].Value2))
                                                    myMaterial.LookupParameter(param).Set((string)range.Cells[iRow, j].Value2);
                                            }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2017 13:24:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-can-i-add-a-projet-parameter/m-p/7252568#M57082</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-25T13:24:00Z</dc:date>
    </item>
  </channel>
</rss>

