BuildingCoder.CmdFamilyParamGuid.Execute C# (CSharp) Method

Execute() public method

public Execute ( ExternalCommandData commandData, string &message, ElementSet elements ) : System.Result
commandData ExternalCommandData
message string
elements ElementSet
return System.Result
        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements)
        {
            UIApplication app = commandData.Application;
              Document doc = app.ActiveUIDocument.Document;

              if( !doc.IsFamilyDocument )
              {
            message =
              "Please run this command in a family document.";

            return Result.Failed;
              }
              else
              {
            bool isShared;
            string guid;

            FamilyManager mgr = doc.FamilyManager;

            foreach( FamilyParameter fp in mgr.Parameters )
            {
              // Using GetFamilyParamGuid method,
              // internally accessing m_Parameter:

              isShared = GetFamilyParamGuid( fp, out guid );

              // Using extension method, internally
              // accessing getParameter:

              if( fp.IsShared() )
              {
            Guid giud2 = fp.GUID;
              }
            }
            return Result.Succeeded;
              }
        }