Created
May 8, 2020 19:23
-
-
Save PrestonII/e8ca3f404743730839a2d8557834a7bc to your computer and use it in GitHub Desktop.
Example of creating a parameter for ventilation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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