Quantcast
Channel: All Revit API Forum posts
Viewing all articles
Browse latest Browse all 66743

Shared Parameter : Set default value

$
0
0

Hi,

 

I have created un shared parameter on a type with API, but I don't found how set the parameter with a default value.

This is my code :

 

 

using (Transaction transaction = new Transaction(doc, "Some operations")) { transaction.Start(); ElementType duplicate = type.Duplicate("Test - " + type.Name); // Récupération des paramètres partagées GlobalApp.Instance.CreateSharedFile(); this._application.Application.SharedParametersFilename = GlobalApp.Instance.CurrentDocumentRoot + "-PIMSharedParameters.txt"; DefinitionFile file = this._application.Application.OpenSharedParameterFile(); if (file == null) return; DefinitionGroup group = file.Groups.get_Item("MyGroup"); if (group == null) group = file.Groups.Create("MyGroup"); Definition def; if (group.Definitions.Contains(group.Definitions.get_Item("My Param"))) def = group.Definitions.get_Item("My Param"); else { ExternalDefinitionCreationOptions options = new ExternalDefinitionCreationOptions("My Param", ParameterType.Text); options.Visible = true; options.HideWhenNoValue = false; options.UserModifiable = true; def = group.Definitions.Create(options); } BuiltInCategory builtInCategory = (BuiltInCategory)Enum.ToObject(typeof(BuiltInCategory), duplicate.Category.Id.IntegerValue); CategorySet cats = this._application.Application.Create.NewCategorySet(); cats.Insert(doc.Settings.Categories.get_Item(builtInCategory)); TypeBinding bind = this._application.Application.Create.NewTypeBinding(cats); bool result = doc.ParameterBindings.Insert(def, bind, BuiltInParameterGroup.PG_DATA); // Default value // ??? transaction.Commit(); }

 

 

Can someone help me ?

 

Thnaks.


Viewing all articles
Browse latest Browse all 66743

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>