Пример #1
0
        /// <summary>
        /// Adds the 3d prop with the correct textures applied
        /// </summary>
        /// <param name="information"></param>
        /// <param name="material"></param>
        public void AddTexturedGeometry(GeometryInformation information, RenderMaterial material)
        {
            // add the geometry
            var ids = AddGeometry(information);

            // create a new instance of material access
            var matAccess = new MaterialData(_doc);

            // apply the texture
            foreach (var guid in ids)
            {
                matAccess.TextureExistingGeometry(material, guid);

                // check what type of geometry should exist in the document
                if (RhinoBridgePlugIn.Instance.AssetGeometryType != AssetImportGeometryFlavor.Block)
                {
                    continue;
                }

                // get object
                var obj = GetObjectFromId(guid);

                // convert to block
                ConvertObjectToBlock(obj, information.ToString());
            }
        }
Пример #2
0
        /// <summary>
        /// Adds the given geometry to the document
        /// </summary>
        /// <param name="information"></param>
        /// <returns></returns>
        public Guid[] AddGeometry(GeometryInformation information)
        {
            // deselect all objects
            DeselectAllObjects();

            // run the import script
            var script = BuildScript(information);

            RhinoApp.RunScript(script, false);

            // get the ids
            var ids =
                (from rhinoObject
                 in _doc.Objects.GetSelectedObjects(false, false)
                 select rhinoObject.Id)
                .ToArray();

            // props come in mapped with their z axis to the rhino y axis,
            // we need to rotate them around the x axis by pi/2
            foreach (var guid in ids)
            {
                var obj = GetObjectFromId(guid);
                RemapPropAxis(obj);
            }

            // the imported asset will be selected
            return(ids);
        }
        public List <ImportGeometryObject> SubPlotBatchImport(Stream inputFile)
        {
            Plotchart                   plotChart = new Plotchart();
            GeometryInformation         output;
            List <ImportGeometryObject> subPlotList = new List <ImportGeometryObject>();

            using (var reader = new StreamReader(inputFile, Encoding.UTF8))
            {
                int index = 0;
                while (!reader.EndOfStream)
                {
                    var line   = reader.ReadLine();
                    var values = line.Split(';');
                    GeometryInformation geometry = new GeometryInformation();
                    geometry.Id             = values[0] == "" ? -1 : Convert.ToInt32(values[0]);
                    geometry.Name           = values[1];
                    geometry.GeometryType   = values[2];
                    geometry.Coordinate     = values[3];
                    geometry.CoordinateType = values[4];
                    geometry.LineWidth      = Convert.ToByte(values[5]);
                    geometry.Color          = values[6];
                    geometry.Description    = values[7];
                    geometry.Status         = Convert.ToByte(values[8]);
                    String plotId = values[9];////////////////////////////// some problem for plotid

                    if (geometry.Id == -1)
                    {
                        output = plotChart.AddGeometry(geometry.PlotId, geometry.Coordinate, geometry.GeometryType, geometry.CoordinateType, geometry.Color, geometry.Name, geometry.Description);
                        if (output == null)
                        {
                            subPlotList.Add(new ImportGeometryObject(index, geometry, "Insert", false));
                        }
                        else
                        {
                            subPlotList.Add(new ImportGeometryObject(index, geometry, "Insert", true));
                        }
                    }
                    else
                    {
                        output = plotChart.UpdateGeometry(geometry.Id, geometry.Coordinate, geometry.GeometryType, geometry.CoordinateType, geometry.Color, geometry.Name, geometry.Description);
                        if (output == null)
                        {
                            subPlotList.Add(new ImportGeometryObject(index, geometry, "Update", false));
                        }
                        else
                        {
                            subPlotList.Add(new ImportGeometryObject(index, geometry, "Update", true));
                        }
                    }
                    index++;
                }
            }
            return(subPlotList);
        }
Пример #4
0
 /// <summary>
 /// Build the import script to be run by the rhino application
 /// </summary>
 /// <param name="information"></param>
 /// <returns></returns>
 private string BuildScript(GeometryInformation information)
 {
     return($"{COMMAND} \"{information.FilePath}\" {OPTIONS} _Enter");
 }
Пример #5
0
 public GeometryExportEventArgs(GeometryInformation geometryInformation)
 {
     GeometryInformation = geometryInformation;
 }
Пример #6
0
        public ActionResult _updateGeometry(string plotid, string coordinate, string geometrytype, string coordinatetype, string color, long geometryId, string name, string description, string referencePoint = "")
        {
            GeometryInformation result = helper.UpdateGeometry(geometryId, coordinate, geometrytype, coordinatetype, color, name, description, referencePoint);

            return(Json(result != null));
        }