Esempio n. 1
0
        SetParameter(Revit.Parameter parameterToSet, Revit.ParameterSet parameterSet)
        {
            foreach (Revit.Parameter param in parameterSet)
            {
                if (param.Definition.Name == parameterToSet.Definition.Name)
                {
                    switch (param.StorageType)
                    {
                    case Revit.StorageType.Double:
                        parameterToSet.Set(param.AsDouble());
                        break;

                    case Revit.StorageType.ElementId:
                        Revit.ElementId elemId = param.AsElementId();
                        parameterToSet.Set(elemId);
                        break;

                    case Revit.StorageType.Integer:
                        parameterToSet.Set(param.AsInteger());
                        break;

                    case Revit.StorageType.String:
                        parameterToSet.Set(param.AsString());
                        break;
                    }
                    return;
                }
            }
        }
Esempio n. 2
0
 SetParameters(Revit.ParameterSet parameterSetToSet, Revit.ParameterSet parameterSet)
 {
     foreach (Revit.Parameter param in parameterSetToSet)
     {
         SetParameter(param, parameterSet);
     }
 }
Esempio n. 3
0
        private static void _transferParameters(RevitElem SourceElement, RevitElem DestinationElement)
        {
            RevitDB.ParameterSet sourceParameters = SourceElement.Parameters;

            foreach (RevitDB.Parameter sourceParam in sourceParameters)
            {
                if (sourceParam.IsReadOnly == false)
                {
                    RevitDB.Definition def = sourceParam.Definition;
                    RevitDB.Parameter  destinationParam = DestinationElement.get_Parameter(def);

                    RevitDB.StorageType st = sourceParam.StorageType;
                    switch (st)
                    {
                    case RevitDB.StorageType.Double:
                        destinationParam.Set(sourceParam.AsDouble());
                        break;

                    case RevitDB.StorageType.ElementId:
                        destinationParam.Set(sourceParam.AsElementId());
                        break;

                    case RevitDB.StorageType.Integer:
                        destinationParam.Set(sourceParam.AsInteger());
                        break;

                    case RevitDB.StorageType.String:
                        destinationParam.Set(sourceParam.AsString());
                        break;
                    }
                }
            }
        }
Esempio n. 4
0
 ParameterSet(string label, Element elem, Autodesk.Revit.DB.ParameterSet val)
     :   base(label)
 {
     m_val  = val;
     m_elem = elem;
 }
Esempio n. 5
0
 public ParameterSet(string label, Element elem, Autodesk.Revit.DB.ParameterSet val)
     : base(label)
 {
     m_val = val;
     m_elem = elem;
 }
Esempio n. 6
0
        public void sendParameters(Autodesk.Revit.DB.Element elem)
        {
            // iterate element's parameters
              Autodesk.Revit.DB.ParameterSet vrps=new Autodesk.Revit.DB.ParameterSet();
              foreach (Autodesk.Revit.DB.Parameter para in elem.Parameters)
              {
              if (para.Definition.Name != null && para.Definition.Name.Length > 4)
              {
                  if (String.Compare(para.Definition.Name, 0, "coVR", 0, 4, true) == 0)
                  {
                      vrps.Insert(para);
                  }
              }
              }
              if (vrps.Size > 0)
              {

              MessageBuffer mb = new MessageBuffer();
              mb.add(elem.Id.IntegerValue);
              mb.add(vrps.Size);
              foreach (Autodesk.Revit.DB.Parameter para in vrps)
              {
                  mb.add(para.Id.IntegerValue);
                  mb.add(para.Definition.Name);
                  mb.add((int)para.StorageType);
                  mb.add((int)para.Definition.ParameterType);
                  switch (para.StorageType)
                  {
                      case Autodesk.Revit.DB.StorageType.Double:
                          mb.add(para.AsDouble());
                          break;
                      case Autodesk.Revit.DB.StorageType.ElementId:
                          //find out the name of the element
                          Autodesk.Revit.DB.ElementId id = para.AsElementId();
                          mb.add(id.IntegerValue);
                          break;
                      case Autodesk.Revit.DB.StorageType.Integer:
                          mb.add(para.AsInteger());
                          break;
                      case Autodesk.Revit.DB.StorageType.String:
                          mb.add(para.AsString());
                          break;
                      default:
                          mb.add("Unknown Parameter Storage Type");
                          break;
                  }

              }
              sendMessage(mb.buf, MessageTypes.NewParameters);
              }
        }