public EDT_StandardElement SetStandardElementWithCheck(EDT_StandardElement STD) { CheckErrors(STD); EDT_StandardElement checkedSTD = SetStandardElement(STD.Occurrence); return(checkedSTD); }
private void CheckErrors(EDT_StandardElement STD) { string errors = ""; if (STD.Category != "STD") { errors += "The Element must have a Custom iProperty called 'Category' that is set to 'STD'. \n"; } if (STD.ConductorQuantity != 3 || STD.ConductorQuantity != 4 || STD.ConductorQuantity != 5 || STD.ConductorQuantity != 6) { errors += "The Element can only have 3-6 conductors. \n"; } if (STD.CurrentRating != 400 || STD.CurrentRating != 630 || STD.CurrentRating != 800 || STD.CurrentRating != 1000 || STD.CurrentRating != 1350 || STD.CurrentRating != 1250 || STD.CurrentRating != 1400 || STD.CurrentRating != 1600 || STD.CurrentRating != 1700 || STD.CurrentRating != 2000 || STD.CurrentRating != 2500 || STD.CurrentRating != 3200 || STD.CurrentRating != 4000 || STD.CurrentRating != 5000 || STD.CurrentRating != 6300) { errors += $"An element with the current rating of {STD.CurrentRating} does NOT exist. \n"; } //if (STD.Material != "Cu" || STD.Material != "Al") //{ // errors += $"A standard element can only be of 'Cu' or 'Al' material. \n"; //} if (STD.Mass <= 0) { errors += "The element has to weigh more than 0kg \n"; } if (errors.Length > 0) { throw new ArgumentException(errors); } }
public List <EDT_IDocument> GetTerminalsList(AssemblyDocument assembly) { List <EDT_IDocument> monoblocks = new List <EDT_IDocument>(); foreach (ComponentOccurrence OCC in assembly.ComponentDefinition.Occurrences) { Document oDoc = OCC.Definition.Document; try { string category = oDoc.PropertySets["Inventor User Defined Properties"]["Category"].Value; if (category == "TER") { //StandardElementHandler STDhandler = new StandardElementHandler(); EDT_StandardElement STD = new EDT_StandardElement(OCC); monoblocks.Add(STD); //handler.SetStandardElementWithCheck(STD)); } } catch { throw new ArgumentException(); //MessageBox.Show("Valami nem jo"); } } return(monoblocks); }
public EDT_StandardElement SetStandardElement(ComponentOccurrence occurrence) { EDT_StandardElement STE = new EDT_StandardElement(occurrence); return(STE); }