/***************************************************/ /**** Public Methods ****/ /***************************************************/ public static Node ToNode(this IFPoint lusasPoint, HashSet <string> groupNames, Dictionary <string, Constraint6DOF> constraint6DOFs) { HashSet <string> tags = new HashSet <string>(IsMemberOf(lusasPoint, groupNames)); List <string> supportAssignments = GetAttributeAssignments(lusasPoint, "Support"); Constraint6DOF nodeConstraint = null; if (!(supportAssignments.Count() == 0)) { constraint6DOFs.TryGetValue(supportAssignments[0], out nodeConstraint); } Node node = new Node { Position = new Point { X = lusasPoint.getX(), Y = lusasPoint.getY(), Z = lusasPoint.getZ() }, Name = "", Support = nodeConstraint }; node.Tags = tags; string adapterID = lusasPoint.getID().ToString(); node.SetAdapterId(typeof(LusasId), adapterID); return(node); }
/***************************************************/ /**** Private Methods ****/ /***************************************************/ private IFPoint CreatePoint(Node node) { if (!CheckPropertyError(node, x => x.Position, true)) { return(null); } Point position = node.Position; IFDatabaseOperations databasePoint = d_LusasData.createPoint( position.X, position.Y, position.Z); IFPoint lusasPoint = d_LusasData.getPointByNumber(d_LusasData.getLargestPointID()); int adapterIdName = lusasPoint.getID(); node.SetAdapterId(typeof(LusasId), adapterIdName); if (!(node.Tags.Count == 0)) { AssignObjectSet(lusasPoint, node.Tags); } if (!(node.Support == null)) { IFAttribute lusasSupport = d_LusasData.getAttribute("Support", System.Convert.ToInt32(node.Support.AdapterId <int>(typeof(LusasId)))); lusasSupport.assignTo(lusasPoint); } return(lusasPoint); }
/***************************************************/ /**** Private Methods ****/ /***************************************************/ private static Node GetNode(IFLine lusasLine, int nodeIndex, Dictionary <string, Node> nodes) { Node node; IFPoint lusasPoint = lusasLine.getLOFs()[nodeIndex]; nodes.TryGetValue(lusasPoint.getID().ToString(), out node); return(node); }
public List <List <double[]> > getSurfaceCoordinatesFromLusas() { IFSelection userInp = lusas.getSelection(); //check if selection is at least one point if (userInp.countSurfaces() < 1) { MessageBox.Show("please select at least one point", "", MessageBoxButtons.OK); return(null); } //create collection to popoulate surfaces List <List <double[]> > surfaces = new List <List <double[]> >(); for (int i = 0; i < userInp.countSurfaces(); i++) { //gereate array of ids List <int> pointIds = new List <int>(); //generate collection for populating vertices List <double[]> vertexes = new List <double[]>(); IFSurface surface = userInp.getSurface(i); object[] lines = surface.getLOFs() as object[]; for (int l = 0; l < lines.Length; l++) { IFLine line = lines[l] as IFLine; object[] points = line.getLOFs() as object[]; for (int k = 0; k < points.Length; k++) { IFPoint point = points[k] as IFPoint; int id = point.getID(); if (!pointIds.Contains(id)) { pointIds.Add(id); double[] position = new double[3]; position[0] = point.getX(); position[1] = point.getY(); position[2] = point.getZ(); //point.getXYZ(position[0],position[1],position[2]); vertexes.Add(position); } } } surfaces.Add(vertexes); } return(surfaces); }
/***************************************************/ /**** Private Methods ****/ /***************************************************/ private static IEnumerable <Node> GetPointAssignments(IEnumerable <IFAssignment> lusasAssignments, Dictionary <string, Node> nodes) { List <Node> assignedNodes = new List <Node>(); Node node; foreach (IFAssignment lusasAssignment in lusasAssignments) { if (lusasAssignment.getDatabaseObject() is IFPoint) { IFPoint lusasPoint = (IFPoint)lusasAssignment.getDatabaseObject(); nodes.TryGetValue(lusasPoint.getID().ToString(), out node); assignedNodes.Add(node); } else { AssignmentWarning(lusasAssignment); } } return(assignedNodes); }