/***************************************************/ public static bool IsEqual(this BHG.NurbsCurve bhCurve, RHG.NurbsCurve rhCurve, double tolerance = BHG.Tolerance.Distance) { if (bhCurve == null & rhCurve == null) { return(true); } List <BHG.Point> bhPoints = bhCurve.ControlPoints; List <double> bhWeights = bhCurve.Weights; List <double> bhKnots = bhCurve.Knots; RHG.Collections.NurbsCurvePointList rhPoints = rhCurve.Points; bool pointsEqual = true; bool weightsEqual = true; bool knotsEqual = true; for (int i = 0; i < bhPoints.Count; i++) { pointsEqual &= bhPoints[i].IsEqual(rhPoints[i], tolerance); } for (int i = 0; i < bhWeights.Count; i++) { weightsEqual &= Math.Abs(bhWeights[i] - rhPoints[i].Weight) < tolerance; } for (int i = 0; i < bhKnots.Count; i++) { knotsEqual &= Math.Abs(bhKnots[i] - rhCurve.Knots[i]) < tolerance; } return(pointsEqual && weightsEqual && knotsEqual); }
static XYZ[] ToXYZArray(Rhino.Geometry.Collections.NurbsCurvePointList list, double factor) { var count = list.Count; var points = new XYZ[count]; int p = 0; if (factor == 1.0) { while (p < count) { var location = list[p].Location; points[p++] = new XYZ(location.X, location.Y, location.Z); } } else { while (p < count) { var location = list[p].Location; points[p++] = new XYZ(location.X * factor, location.Y * factor, location.Z * factor); } } return(points); }
public List <Point3d> Ptsss(Curve x) //给定曲线找出其控制点 { NurbsCurve mm = x.ToNurbsCurve(); ControlPoint list = new ControlPoint(); List <Point3d> ptss = new List <Point3d>(); Rhino.Geometry.Collections.NurbsCurvePointList listA = mm.Points; for (int i = 0; i < listA.Count; i++) { list = listA.ElementAt(i); Point3d pt = list.Location; ptss.Add(pt); } return(ptss); }
// ************************************************ RevitModelBuilder Data Functions ***************************************************** public HbCurve Hb(NurbsCurve nurbsCurveRhino) { HbNurbSpline nurbSplineRevit = new HbNurbSpline(); Rhino.Geometry.Collections.NurbsCurvePointList points = nurbsCurveRhino.Points; for (int k = 0; k < points.Count; k++) { Rhino.Geometry.ControlPoint controlPoint = points[k]; Point3d xyzRhino = controlPoint.Location; HbXYZ xyzRevit = new HbXYZ(xyzRhino.X, xyzRhino.Y, xyzRhino.Z); nurbSplineRevit.Points.Add(xyzRevit); } HbCurve hbCurve = nurbSplineRevit; return(hbCurve); }
////////////////////////////////////////////////////////////////////////////////////////////////////////给定曲线找出其控制点 public static List <Point3d> Ptsss(Curve x) { NurbsCurve mm = x.ToNurbsCurve(); ControlPoint list = new ControlPoint(); List <Point3d> ptss = new List <Point3d>(); Rhino.Geometry.Collections.NurbsCurvePointList listA = mm.Points; for (int i = 0; i < listA.Count; i++) { list = listA.ElementAt(i); Point3d pt = list.Location; ptss.Add(pt); } List <Point3d> ptssResult = ptss.Distinct().ToList();/////删除重合部分(多边形) return(ptssResult); }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object can be used to retrieve data from input parameters and /// to store data in output parameters.</param> protected override void SolveInstance(IGH_DataAccess DA) { // First, we need to retrieve all data from the input parameters. List <string> fields = new List <string>(); GH_Structure <IGH_Goo> attributes = new GH_Structure <IGH_Goo>(); GH_Structure <GH_Curve> inputCurveTree = new GH_Structure <GH_Curve>(); bool writeFile = false; string filePath = ""; int epsg = -1; if (!DA.GetData(5, ref writeFile)) { return; } if (!DA.GetData(4, ref filePath)) { return; } // access the input parameter by index. if (!DA.GetDataTree(0, out inputCurveTree)) { return; } if (!DA.GetDataList(1, fields)) { return; } if (!DA.GetDataTree(2, out attributes)) { return; } if (!DA.GetData(3, ref epsg)) { return; } // We should now validate the data and warn the user if invalid data is supplied. //if (radius0 < 0.0){ // AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Inner radius must be bigger than or equal to zero"); // return;} //Create geojson dic Dictionary <string, Object> geoDict = new Dictionary <string, Object>(); // We're set to create the geojson now. To keep the size of the SolveInstance() method small, // The actual functionality will be in a different method: //Curve spiral = CreateSpiral(plane, radius0, radius1, turns); //Basic esriJSON headder info geoDict.Add("displayFieldName", " "); Dictionary <string, string> fieldAliasDic = new Dictionary <string, string>(); foreach (string field in fields) { fieldAliasDic.Add(field, field); } geoDict.Add("fieldAliases", fieldAliasDic); geoDict.Add("geometryType", "esriGeometryPolyline"); Dictionary <string, int> sr = new Dictionary <string, int>() { { "wkid", 102729 }, { "latestWkid", 2272 } }; geoDict.Add("spatialReference", sr); // package the below in a function List <Dictionary <string, string> > fieldsList = new List <Dictionary <string, string> >(); foreach (var item in fields.Select((Value, Index) => new { Value, Index })) { Dictionary <string, string> fieldTypeDict = new Dictionary <string, string>(); fieldTypeDict.Add("name", item.Value.ToString()); var typeItem = attributes.get_Branch(attributes.Paths[0])[item.Index]; if (typeItem is Grasshopper.Kernel.Types.GH_Integer) { fieldTypeDict.Add("type", "esriFieldTypeInteger"); } else if (typeItem is Grasshopper.Kernel.Types.GH_Number) // else if (typeItem is long //|| typeItem is ulong //|| typeItem is float //|| typeItem is double //|| typeItem is decimal) { fieldTypeDict.Add("type", "esriFieldTypeDouble"); } else if (typeItem is Grasshopper.Kernel.Types.GH_String) { fieldTypeDict.Add("type", "esriFieldTypeString"); } else if (typeItem is Grasshopper.Kernel.Types.GH_Time) { fieldTypeDict.Add("type", "esriFieldTypeDate"); } else { fieldTypeDict.Add("type", "esriFieldTypeString"); fieldTypeDict.Add("GH_Type", typeItem.GetType().ToString()); } if (item.Value.ToString().Length > 7) { fieldTypeDict.Add("alias", item.Value.ToString().Substring(0, 7)); } else { fieldTypeDict.Add("alias", item.Value.ToString()); } fieldsList.Add(fieldTypeDict); }//end for each fields geoDict.Add("fields", fieldsList); // package the above in a function ^^^ //features: [ // { // geometry:{Paths:[ [-[x,y],[x1,y1]-], [-[x,y],[x1,y1]-] ] // attributes:{ field:value, field1:value1} // }, // { // geometry:{Paths:[ [-[x,y],[x1,y1]-], [-[x,y],[x1,y1]-] ] // attributes:{ field:value, field1:value1} // } //] // Start of feature construction---------------------------------------------------- // create feature list List <Object> featuresList = new List <Object>(); // for every branch (ie feature) foreach (GH_Path path in inputCurveTree.Paths) { //set branch IList branch = inputCurveTree.get_Branch(path); //create geometry key Dictionary <string, object> thisGeometry = new Dictionary <string, object>(); List <object> thisPaths = new List <object>(); // for every curve in branch foreach (GH_Curve thisGhCurve in branch) { List <List <double> > thisPath = new List <List <double> >(); //convert to rhino curve Curve rhinoCurve = null; GH_Convert.ToCurve(thisGhCurve, ref rhinoCurve, 0); //curve to nurbes NurbsCurve thisNurbsCurve = rhinoCurve.ToNurbsCurve(); //Get list of control points Rhino.Geometry.Collections.NurbsCurvePointList theseControlPoints = thisNurbsCurve.Points; //for each control point foreach (ControlPoint thisPoint in theseControlPoints) { //create coordinate list and add to path list List <double> thisCoordinate = new List <double>(); thisCoordinate.Add(thisPoint.Location.X); thisCoordinate.Add(thisPoint.Location.Y); thisPath.Add(thisCoordinate); }//end each control point //add this path or paths thisPaths.Add(thisPath); }//end of each curve in branch //add all paths to geometry key for this feature thisGeometry.Add("Paths", thisPaths); //creat attriabtrues key Dictionary <string, object> thisAttribtues = new Dictionary <string, object>(); IList attributesBranch = attributes.get_Branch(path); //foreach (var item in attributesBranch.Select((Value, Index) => new { Value, Index })) //this needs list not IList foreach (var item in attributesBranch) //for (int i = 0; i < attributesBranch.Count; i++) { string thisField = fields[attributesBranch.IndexOf(item)]; //fields are string // ---------------------this is in order add the riight type? if (item is Grasshopper.Kernel.Types.GH_Integer) { string thisAttribute = item.ToString(); Convert.ChangeType(thisAttribute, typeof(int)); thisAttribtues.Add(thisField, thisAttribute); } else if (item is Grasshopper.Kernel.Types.GH_Number) // else if (typeItem is long //|| typeItem is ulong //|| typeItem is float //|| typeItem is double //|| typeItem is decimal) { string thisAttribute = item.ToString(); Convert.ChangeType(thisAttribute, typeof(double)); thisAttribtues.Add(thisField, thisAttribute); } else if (item is Grasshopper.Kernel.Types.GH_String) { string thisAttribute = item.ToString(); thisAttribtues.Add(thisField, thisAttribute); } else if (item is Grasshopper.Kernel.Types.GH_Time) { string thisAttribute = item.ToString(); Convert.ChangeType(thisAttribute, typeof(DateTime)); thisAttribtues.Add(thisField, thisAttribute); } else { string thisAttribute = "wasent a type"; item.ToString(); thisAttribtues.Add(thisField, thisAttribute); } // ------------------------how to add value of igh_goo verbatum.... //thisAttribtues.Add(thisField, thisAttribute); } //wrap up into feature and add to feature list; Dictionary <string, Object> thisFeature = new Dictionary <string, Object>(); thisFeature.Add("geometry", thisGeometry); thisFeature.Add("attributes", thisAttribtues); featuresList.Add(thisFeature); }//end of each branch path // end of feature construction // finaly add features list to master object geoDict.Add("features", featuresList); //Produces convert dictionary to json text var json = Newtonsoft.Json.JsonConvert.SerializeObject(geoDict, Newtonsoft.Json.Formatting.Indented); // Finally assign the retults to the output parameter. //DA.SetData(0, spiral); //write string to file if (writeFile == true) { //@"D:\path.txt" System.IO.File.WriteAllText(@filePath, json); } DA.SetData(0, json); }
public bool ReadDataTreeBranch(List <Grasshopper.Kernel.Types.GH_Curve> branches, ref List <List <HbCurve> > curvesListListRevit, bool AllowNurbs, bool NestBranch) { try { Rhino.Geometry.NurbsCurve nurbsCurveRhino; Rhino.Geometry.LineCurve lineCurveRhino; Rhino.Geometry.ArcCurve arcCurveRhino; List <HbCurve> curvesListRevit = new List <HbCurve>(); for (int i = 0; i < branches.Count; i++) { //if (NestBranch) curvesListRevit.Clear(); if (NestBranch) { curvesListRevit = new List <HbCurve>(); } GH_Curve branch = branches[i]; Curve curveBranch = null; Curve curveBranch2 = null; GH_Convert.ToCurve(branch, ref curveBranch, GH_Conversion.Both); if (curveBranch == null) { Print("Null branch value in ReadDataTreeBranch() ignored."); continue; } switch (curveBranch.GetType().Name) { case "PolyCurve": // Note: The simplify functions only used with a PolyCureve so moved inside the switch statement. // Note: Logic of this step is not clear. It may be that only the CurveSimplifyOptions.All if (curveBranch.Degree == 1) { curveBranch2 = curveBranch.Simplify(CurveSimplifyOptions.RebuildLines, 0, 0); if (curveBranch2 == null) { Print("Simplify() with CurveSimplifyOptions.RebuildLines returned null."); } else { curveBranch = curveBranch2; } } if (curveBranch.Degree == 2) { curveBranch2 = curveBranch.Simplify(CurveSimplifyOptions.RebuildArcs, 0, 0); if (curveBranch2 == null) { Print("Simplify() with CurveSimplifyOptions.RebuildArcs returned null."); } else { curveBranch = curveBranch2; } } curveBranch2 = curveBranch.Simplify(CurveSimplifyOptions.All, .0001, 1); if (curveBranch2 == null) { Print("Simplify() with CurveSimplifyOptions.All returned null."); } else { curveBranch = curveBranch2; } PolyCurve polyCurve = (PolyCurve)curveBranch; for (int j = 0; j < polyCurve.SegmentCount; j++) { Curve curveRhino = polyCurve.SegmentCurve(j); switch (curveRhino.GetType().Name) { case "LineCurve": lineCurveRhino = (LineCurve)curveRhino; curvesListRevit.Add(Hb(lineCurveRhino)); break; case "NurbsCurve": if (!AllowNurbs) { break; } nurbsCurveRhino = (NurbsCurve)curveRhino; curvesListRevit.Add(Hb(nurbsCurveRhino)); break; case "ArcCurve": arcCurveRhino = (ArcCurve)curveRhino; curvesListRevit.Add(Hb(arcCurveRhino)); break; case "PolylineCurve": //NurbsCurve nurbsLineCurve = (NurbsCurve)curveBranch.ToNurbsCurve(); NurbsCurve nurbsLineCurve = (NurbsCurve)curveRhino.ToNurbsCurve(); Rhino.Geometry.Collections.NurbsCurvePointList points = nurbsLineCurve.Points; for (int k = 0; k < points.Count - 1; k++) { HbLine lineRevit = new HbLine(); Rhino.Geometry.ControlPoint controlPointStart = points[k]; Rhino.Geometry.ControlPoint controlPointEnd = points[k + 1]; Point3d xyzRhinoStart = controlPointStart.Location; Point3d xyzRhinoEnd = controlPointEnd.Location; HbXYZ xyzRevitStart = new HbXYZ(xyzRhinoStart.X, xyzRhinoStart.Y, xyzRhinoStart.Z); HbXYZ xyzRevitEnd = new HbXYZ(xyzRhinoEnd.X, xyzRhinoEnd.Y, xyzRhinoEnd.Z); lineRevit.PointStart = new HbXYZ(xyzRevitStart.X, xyzRevitStart.Y, xyzRevitStart.Z); lineRevit.PointEnd = new HbXYZ(xyzRevitEnd.X, xyzRevitEnd.Y, xyzRevitEnd.Z); curvesListRevit.Add(lineRevit); } break; default: Print("Unknown Rhino PolyCurve curve type: " + curveRhino.GetType().Name); break; } } break; case "NurbsCurve": if (!AllowNurbs) { break; } nurbsCurveRhino = (NurbsCurve)curveBranch; //if !nurbsCurveRhino.IsClosed() curvesListRevit.Add(Hb(nurbsCurveRhino)); break; case "PolylineCurve": NurbsCurve nurbsLineCurve2 = (NurbsCurve)curveBranch.ToNurbsCurve(); Rhino.Geometry.Collections.NurbsCurvePointList points2 = nurbsLineCurve2.Points; for (int k = 0; k < points2.Count - 1; k++) { HbLine lineRevit = new HbLine(); Rhino.Geometry.ControlPoint controlPointStart = points2[k]; Rhino.Geometry.ControlPoint controlPointEnd = points2[k + 1]; Point3d xyzRhinoStart = controlPointStart.Location; Point3d xyzRhinoEnd = controlPointEnd.Location; HbXYZ xyzRevitStart = new HbXYZ(xyzRhinoStart.X, xyzRhinoStart.Y, xyzRhinoStart.Z); HbXYZ xyzRevitEnd = new HbXYZ(xyzRhinoEnd.X, xyzRhinoEnd.Y, xyzRhinoEnd.Z); lineRevit.PointStart = new HbXYZ(xyzRevitStart.X, xyzRevitStart.Y, xyzRevitStart.Z); lineRevit.PointEnd = new HbXYZ(xyzRevitEnd.X, xyzRevitEnd.Y, xyzRevitEnd.Z); curvesListRevit.Add(lineRevit); } break; case "LineCurve": lineCurveRhino = (LineCurve)curveBranch; curvesListRevit.Add(Hb(lineCurveRhino)); break; case "ArcCurve": arcCurveRhino = (ArcCurve)curveBranch; curvesListRevit.Add(Hb(arcCurveRhino)); break; default: Print("Unknown Rhino curve type: " + curveBranch.GetType().Name); break; } if (NestBranch) { curvesListListRevit.Add(curvesListRevit); } } if (!NestBranch) { curvesListListRevit.Add(curvesListRevit); } return(true); } catch (Exception exception) { Print("Exception in 'ReadDataTreeBranch' w/ curves: " + exception.Message); return(false); } }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { // First, we need to retrieve all data from the input parameters. List <string> fields = new List <string>(); GH_Structure <IGH_Goo> attributes = new GH_Structure <IGH_Goo>(); GH_Structure <GH_Curve> inputPolylineTree = new GH_Structure <GH_Curve>(); bool writeFile = false; string filePath = ""; string prj = null; // access the input parameter by index. if (!DA.GetData(5, ref writeFile)) { return; } if (!DA.GetData(4, ref filePath)) { return; } if (!DA.GetDataTree(0, out inputPolylineTree)) { return; } if (!DA.GetDataList(1, fields)) { return; } if (!DA.GetDataTree(2, out attributes)) { return; } if (!DA.GetData(3, ref prj)) { return; } //create new feature set to add data to //FeatureSet fs = new FeatureSet(FeatureType.Polygon); //FeatureSet fs = new FeatureSet(FeatureType.Point); //FeatureSet fs = new FeatureSet(FeatureType.MultiPoint); FeatureSet fs = new FeatureSet(FeatureType.Line); if (prj != null) { //load projection file string cur_proj = System.IO.File.ReadAllText(@prj); ///create Projection system ProjectionInfo targetProjection = new ProjectionInfo(); targetProjection.ParseEsriString(cur_proj); fs.Projection = targetProjection; } if (writeFile) { // Add fields to the feature sets attribute table foreach (string field in fields) { //check for type string[] splitField = field.Split(';'); //if field type provided, specify it if (splitField.Length == 2) { fs.DataTable.Columns.Add(new DataColumn(splitField[0], Type.GetType(splitField[1]))); } else { //otherwise jsut use a string fs.DataTable.Columns.Add(new DataColumn(field, typeof(string))); } } // for every branch (ie feature) foreach (GH_Path path in inputPolylineTree.Paths) { //set branch IList branch = inputPolylineTree.get_Branch(path); List <DotSpatial.Topology.LineString> theseLines = new List <DotSpatial.Topology.LineString>(); foreach (GH_Curve curve in branch) { // create vertex list for this curve List <Coordinate> vertices = new List <Coordinate>(); //convert to rhino curve Curve rhinoCurve = null; GH_Convert.ToCurve(curve, ref rhinoCurve, 0); //curve to nurbes NurbsCurve thisNurbsCurve = rhinoCurve.ToNurbsCurve(); //Get list of control points Rhino.Geometry.Collections.NurbsCurvePointList theseControlPoints = thisNurbsCurve.Points; //for each control point foreach (ControlPoint thisPoint in theseControlPoints) { vertices.Add(new Coordinate(thisPoint.Location.X, thisPoint.Location.Y)); }//end each control point //create lineString Geometry from coordinates DotSpatial.Topology.LineString thisLine = new DotSpatial.Topology.LineString(vertices); // add linestring to linestring list theseLines.Add(thisLine); }//end curve itteration //Convert Coordinates to dot spatial point or multipoint geometry //DotSpatial.Topology.Point geom = new DotSpatial.Topology.Point(vertices); //DotSpatial.Topology.MultiPoint geom = new DotSpatial.Topology.MultiPoint(vertices); //convert list of line strings into single multilinestring feature MultiLineString geom = new MultiLineString(theseLines); //convert geom to a feature IFeature feature = fs.AddFeature(geom); //begin editing to add feature attributes feature.DataRow.BeginEdit(); //get this features attributes by its path IList <string> featrueAttributes = attributes.get_Branch(path) as IList <string>; int thisIndex = 0; //add each attribute for the pt's path foreach (var thisAttribute in attributes.get_Branch(path)) { string thisField = fields[thisIndex].Split(';')[0]; feature.DataRow[thisField] = thisAttribute.ToString(); //currently everything is a string.... thisIndex++; } //finish attribute additions feature.DataRow.EndEdit(); }//end of itterating through branches of pt tree fs.SaveAs(filePath, true); } }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { // First, we need to retrieve all data from the input parameters. List <string> fields = new List <string>(); GH_Structure <IGH_Goo> attributes = new GH_Structure <IGH_Goo>(); GH_Structure <GH_Curve> inputPolygonTree = new GH_Structure <GH_Curve>(); bool writeFile = false; string filePath = ""; string prj = null; // access the input parameter by index. if (!DA.GetData(5, ref writeFile)) { return; } if (!DA.GetData(4, ref filePath)) { return; } if (!DA.GetDataTree(0, out inputPolygonTree)) { return; } if (!DA.GetDataList(1, fields)) { return; } if (!DA.GetDataTree(2, out attributes)) { return; } if (!DA.GetData(3, ref prj)) { return; } //create new feature set to add data to FeatureSet fs = new FeatureSet(FeatureType.Polygon); //FeatureSet fs = new FeatureSet(FeatureType.Point); //FeatureSet fs = new FeatureSet(FeatureType.MultiPoint); //FeatureSet fs = new FeatureSet(FeatureType.Line); if (prj != null) { //load projection file string cur_proj = System.IO.File.ReadAllText(@prj); ///create Projection system ProjectionInfo targetProjection = new ProjectionInfo(); targetProjection.ParseEsriString(cur_proj); fs.Projection = targetProjection; } if (writeFile) { // Add fields to the feature sets attribute table foreach (string field in fields) { //<<<dubble chack if this is properly declaring type>>>\\ fs.DataTable.Columns.Add(new DataColumn(field, typeof(string))); } // for every branch (ie feature) foreach (GH_Path path in inputPolygonTree.Paths) { //set branch IList branch = inputPolygonTree.get_Branch(path); //List<DotSpatial.Topology.LineString> theseLines = new List<DotSpatial.Topology.LineString>(); List <LinearRing> theseCurves = new List <LinearRing>(); foreach (GH_Curve curve in branch) { // create vertex list for this curve List <Coordinate> vertices = new List <Coordinate>(); //convert to rhino curve Curve rhinoCurve = null; GH_Convert.ToCurve(curve, ref rhinoCurve, 0); //curve to nurbes NurbsCurve thisNurbsCurve = rhinoCurve.ToNurbsCurve(); //Get list of control points Rhino.Geometry.Collections.NurbsCurvePointList theseControlPoints = thisNurbsCurve.Points; //for each control point foreach (ControlPoint thisPoint in theseControlPoints) { vertices.Add(new Coordinate(thisPoint.Location.X, thisPoint.Location.Y)); }//end each control point //create linering Geometry from coordinates LinearRing thisCurve = new LinearRing(vertices); // add curve to curve list theseCurves.Add(thisCurve); }//end curve itteration //Convert Coordinates to dot spatial point or multipoint geometry //DotSpatial.Topology.Point geom = new DotSpatial.Topology.Point(vertices); //DotSpatial.Topology.MultiPoint geom = new DotSpatial.Topology.MultiPoint(vertices); DotSpatial.Topology.ILinearRing outerCurve = theseCurves[0]; var innerCurves = theseCurves.GetRange(1, theseCurves.Count - 1).ToArray(); //convert list of line strings into single multilinestring feature //MultiLineString geom = new MultiLineString(theseLines); Polygon geom = new Polygon(outerCurve, innerCurves); //convert geom to a feature IFeature feature = fs.AddFeature(geom); //begin editing to add feature attributes feature.DataRow.BeginEdit(); //get this features attributes by its path IList <string> featrueAttributes = attributes.get_Branch(path) as IList <string>; int thisIndex = 0; //add each attribute for the pt's path foreach (var thisAttribute in attributes.get_Branch(path)) { //converting all fields to (((Proper Type...?))) feature.DataRow[fields[thisIndex]] = thisAttribute.ToString(); //currently everything is a string.... //<<<!!!!!!!!!! dubble chack if this is properly converting to the type declared above !!!!!!!!!!>>>\\ thisIndex++; } //finish attribute additions feature.DataRow.EndEdit(); }//end of itterating through branches of pt tree fs.SaveAs(filePath, true); } }