Exemple #1
0
        /// <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)
        {
            bool resetCommand = false;

            DA.GetData(0, ref resetCommand);
            if (resetCommand)
            {
                if (topoData != IntPtr.Zero)
                {
                    TopoCreator.deleteStructure(topoData);
                }
                topoData = TopoCreator.initStructure();
            }

            DA.SetData(0, topoData);
        }
Exemple #2
0
        /// <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)
        {
            String xml_file = "";

            // Then we need to access the input parameters individually.
            // When data cannot be extracted from a parameter, we should abort this method.
            if (!DA.GetData(0, ref xml_file))
            {
                return;
            }

            // We should now validate the data and warn the user if invalid data is supplied.
            if (Path.GetExtension(xml_file.ToString()) != ".xml")
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Input File must be xml file");
                return;
            }

            //if (tilt_angle < 0 || tilt_angle > 90)
            //{
            //    AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid Tilt Angle");
            //    return;
            //}

            if (xmlPath != xml_file || xmlPath == "")
            {
                if (topoData != IntPtr.Zero)
                {
                    TopoCreator.deleteStructure(topoData);
                }
                topoData = TopoCreator.readXML(xml_file);
                xmlPath  = xml_file;
            }

            DA.SetData(0, topoData);
        }