Skip to content

Instantly share code, notes, and snippets.

@PrestonII
Created May 8, 2020 19:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PrestonII/e8ca3f404743730839a2d8557834a7bc to your computer and use it in GitHub Desktop.
Save PrestonII/e8ca3f404743730839a2d8557834a7bc to your computer and use it in GitHub Desktop.
Example of creating a parameter for ventilation
// in a family document
if (!CurrentDocument.IsFamilyDocument)
throw new Exception();
var mgr = CurrentDocument.FamilyManager;
// get the UNIT_TYPE parameter
var param = mgr.get_Parameter("UNIT_TYPE");
if(param == null)
{
// If it doesn't exist, create it
using(var tr = new Transaction(CurrentDocument, "PARAM CREATION"))
{
if (!tr.HasStarted())
tr.Start();
// name it measurements or whatever
param = mgr.AddParameter("UNIT_TYPE", BuiltInParameterGroup.PG_ADSK_MODEL_PROPERTIES, ParameterType.Text, false);
tr.Commit();
}
}
// input value as something "imperial/metric"
mgr.Set(param, "IMPERIAL");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment