//get elements of certain group public bool GetElementsOfGroup(string groupString, out GsaElement[] elementsOfGroup) { int[] elementsRefsOfGroup = new int[0]; GsaEntity listType = GsaEntity.ELEMENT; gsaObject.EntitiesInList(groupString, ref listType, out elementsRefsOfGroup); elementsOfGroup = new GsaElement[0]; gsaObject.Elements(elementsRefsOfGroup, out elementsOfGroup); return(true); }
//create an element public bool CreateElement(List <Point3d> nodePositions, int elementNumber, out GsaElement element) { element = new GsaElement(); element.NumTopo = nodePositions.Count(); element.Ref = elementNumber; switch (element.NumTopo) { case 0: //Print("element sent in with zero nodePositions - bad news!"); return(false); case 1: //Print("element sent in with 1 nodePosition - bad news!"); return(false); case 2: //looks like we have a beam! element.eType = (int)ElementType.BEAM; break; case 3: //looks like we have a TRI3! element.eType = (int)ElementType.TRI3; break; case 4: //looks like we have a QUAD! element.eType = (int)ElementType.QUAD4; break; default: //Print("element sent in with an unrecognised number of node positions - bad news!"); return(false); } List <int> topo = new List <int>(); for (int i = 0; i < element.NumTopo; i++) { topo.Add(gsaObject.Gen_NodeAt(nodePositions[i].X, nodePositions[i].Y, nodePositions[i].Z, tolerance)); } element.Topo = topo.ToArray(); //these are defaults - best to change these after element.Property = 1; element.Group = 1; element.Color = (int)Colours.GREY; return(true); }
//TODO: perhaps these can be set up to work with sections and nodes too? public bool SetElements(GsaElement singleElement, bool overwrite) { GsaElement[] arrayOfElements = new GsaElement[] { singleElement }; return(SetElements(arrayOfElements, overwrite)); }