public PDLength()
        {
            System.Type[] selectionType = new System.Type[1];
            selectionType.SetValue(typeof(TSM.CustomPart), 0);

            Model myModel = new Model();
            ModelObjectEnumerator allObjects = myModel.GetModelObjectSelector().GetAllObjectsWithType(selectionType);

            while (allObjects.MoveNext())
            {
                if (allObjects.Current is TSM.CustomPart)
                {
                    TSM.CustomPart currentComponent = allObjects.Current as TSM.CustomPart;
                    if (currentComponent.Name == "EB_PD")
                    {
                        double curWidth = 0.0;
                        double curLength = 0.0;

                        currentComponent.GetUserProperty("w", ref curWidth);
                        currentComponent.GetUserProperty("L", ref curLength);

                        string newName = "PD" + curWidth.ToString() + " L=" + curLength.ToString();
                        currentComponent.SetUserProperty("P1a", newName);
                        currentComponent.Modify();
                    }
                }
            }
            myModel.CommitChanges();
        }
 private List<ModelObjectEnumerator> GetObjectsToCheck(bool checkAll)
 {
     Model model = new Model();
     List<ModelObjectEnumerator> list = new List<ModelObjectEnumerator>();
     if (checkAll)
     {
         list.Add(model.GetModelObjectSelector().GetAllObjectsWithType(ModelObject.ModelObjectEnum.BEAM));
         list.Add(model.GetModelObjectSelector().GetAllObjectsWithType(ModelObject.ModelObjectEnum.CONTOURPLATE));
         list.Add(model.GetModelObjectSelector().GetAllObjectsWithType(ModelObject.ModelObjectEnum.POLYBEAM));
     }
     else
     {
         Tekla.Structures.Model.UI.ModelObjectSelector modelObjectSelector = new Tekla.Structures.Model.UI.ModelObjectSelector();
         ModelObjectEnumerator selectedObjects = modelObjectSelector.GetSelectedObjects();
         list.Add(selectedObjects);
     }
     return list;
 }