public override bool Read(GH_IReader reader) { e = reader.GetDouble("e"); t0 = reader.GetDouble("t0"); t1 = reader.GetDouble("t1"); return(true); }
/* * static public bool Write(GH_IWriter writer, RobotInfo r) * { * writer.SetString("RobotName", r.RobotName); * writer.SetString("TaskName", r.TaskName); * writer.SetString("ModuleName", r.ModuleName); * writer.SetString("LocalFolder", r.LocalFolder); * * return true; * } */ #endregion #region READING static public bool Read(GH_IReader reader, ref ToolSettings t) { t.ToolDiameter = reader.GetDouble("ToolDiameter"); t.StepDown = reader.GetDouble("StepDown"); t.StepOver = reader.GetDouble("StepOver"); return(true); }
public override bool Read(GH_IReader reader) { settings.RapidRate = reader.GetDouble("RapidRate"); settings.RapidZ = reader.GetDouble("RapidZ"); settings.SafeZ = reader.GetDouble("SafeZ"); settings.FeedRate = reader.GetDouble("FeedRate"); settings.UseExternalAxis = reader.GetBoolean("UseExternalAxis"); return(base.Read(reader)); }
bool GH_ISerializable.Read(GH_IReader reader) { var pt = reader.GetPoint3D("Location"); Text = reader.GetString("Text"); Font = reader.GetString("Font"); Colour = reader.GetDrawingColor("Colour"); Location = new Point3d(pt.x, pt.y, pt.z); HorizontalAlignment = reader.GetDouble("Horizontal"); VerticalAlignment = reader.GetDouble("Vertical"); Rotation = reader.GetDouble("Rotation"); return(true); }
public override bool Read(GH_IReader reader) { GH_IReader gH_IReader = reader.FindChunk("Slider", Index); minValue = gH_IReader.GetDouble("MinValue"); maxValue = gH_IReader.GetDouble("MaxValue"); currentValue = gH_IReader.GetDouble("CurrentValue"); if (!gH_IReader.TryGetInt32("NumDecimals", ref numDecimals)) { numDecimals = 2; } FixValues(); return(true); }
public static GlulamData ReadGlulamData(GH_IReader reader) { var data = new GlulamData( reader.GetInt32("data_NumWidth"), reader.GetInt32("data_NumHeight"), reader.GetDouble("data_LamWidth"), reader.GetDouble("data_LamHeight") ); data.Samples = reader.GetInt32("data_Samples"); data.InterpolationType = (GlulamData.Interpolation)reader.GetInt32("data_Interpolation"); data.SectionAlignment = (GlulamData.CrossSectionPosition)reader.GetInt32("data_SectionAlignment"); return(data); }
public override bool Read(GH_IReader reader) { SpacingMode = reader.GetInt32("Size"); PatternModeStatus = reader.GetInt32("Pattern"); PatternWeight = reader.GetDouble("Width"); this.UpdateMessage(); this.ExpireSolution(true); return(base.Read(reader)); }
public override bool Read(GH_IReader reader) { FillSpace = reader.GetInt32("Space"); IsEmbedded = reader.GetBoolean("Embed"); ScaleFactor = reader.GetDouble("Scale"); this.UpdateMessage(); this.ExpireSolution(true); return(base.Read(reader)); }
public override bool Read(GH_IReader reader) { MachineTool mt = new MachineTool(); mt.Name = reader.GetString("name"); mt.FeedRate = reader.GetInt32("maxfeed"); mt.SpindleSpeed = reader.GetInt32("maxspeed"); mt.PlungeRate = reader.GetInt32("plunge"); mt.Diameter = reader.GetDouble("diameter"); mt.Length = reader.GetDouble("length"); mt.Number = reader.GetInt32("number"); mt.OffsetNumber = reader.GetInt32("offset"); int shape = 0; if (reader.TryGetInt32("shape", ref shape)) { mt.Shape = (ToolShape)shape; } return(base.Read(reader)); }
public override bool Read(GH_IReader reader) { int lcx = reader.GetInt32("lcx"); int lcy = reader.GetInt32("lcy"); double lsx = reader.GetDouble("lsx"); double lsy = reader.GetDouble("lsy"); int interpolation = reader.GetInt32("interpolation"); int samples = reader.GetInt32("samples"); GlulamData data = new GlulamData(lcx, lcy, lsx, lsy, samples); data.InterpolationType = (GlulamData.Interpolation)interpolation; Value = data; if (Value == null) { throw new Exception("What in the Lord's name..."); } return(true); }
public override bool Read(GH_IReader reader) { hJustify = reader.GetInt32("Vertical"); vJustify = reader.GetInt32("Horizontal"); IsBold = reader.GetBoolean("Bold"); IsItalic = reader.GetBoolean("Italic"); IsUnder = reader.GetBoolean("Under"); DrawColor = reader.GetDrawingColor("Color"); fName = reader.GetString("FontName"); fSize = reader.GetDouble("FontSize"); return(base.Read(reader)); }
public static CrossSectionOrientation ReadCrossSectionOrientation(GH_IReader reader) { var type = reader.GetString("orientation"); switch (type) { case "RmfOrientation": return(new RmfOrientation()); case "PlanarOrientation": var plane = reader.GetPlane("orientation_plane"); return(new PlanarOrientation(new Plane( new Point3d(plane.Origin.x, plane.Origin.y, plane.Origin.z), new Vector3d(plane.XAxis.x, plane.XAxis.y, plane.XAxis.z), new Vector3d(plane.YAxis.x, plane.YAxis.y, plane.YAxis.z)))); case "VectorOrientation": var pt = reader.GetPoint3D("orientation_vector"); return(new VectorOrientation(new Vector3d(pt.x, pt.y, pt.z))); case "SurfaceOrientation": var srf_bytes = reader.GetByteArray("orientation_surface"); var srf = GH_Convert.ByteArrayToCommonObject <Brep>(srf_bytes); return(new SurfaceOrientation(srf)); case "VectorListOrientation": var vlguide = reader.GetByteArray("orientation_guide"); var num_vecs = reader.GetInt32("orientation_num_vectors"); List <Vector3d> vectors = new List <Vector3d>(); List <double> parameters = new List <double>(); for (int i = 0; i < num_vecs; ++i) { var v = reader.GetPoint3D("orientation_vector", i); var t = reader.GetDouble("orientation_parameter", i); vectors.Add(new Vector3d(v.x, v.y, v.z)); } return(new VectorListOrientation(GH_Convert.ByteArrayToCommonObject <Curve>(vlguide), parameters, vectors)); default: return(new RmfOrientation()); } }
public override bool Read(GH_IReader reader) { if (reader.ItemExists("Count")) { int n = reader.GetInt32("Count"); for (int m = 0; m < n; m++) { try { keyPoints[reader.GetInt32(m.ToString() + "K")] = reader.GetDouble(m.ToString() + "V"); } catch { } } } reader.TryGetBoolean("ShowGraphSlider", ref ShowGraphOnSlider); return(base.Read(reader)); }
private void readCustomControls(GH_IReader reader, IEnumerable <GHControl> customControls, string path) { foreach (GHControl control in customControls) { string name = (path.Length > 0) ? (path + "." + control.Name) : control.Name; if (control is GHParameter) { if (reader.FindItem(name) == null) { continue; } GHParameter param = (GHParameter)control; switch (param.DataType) { case GH_Types.gh_bool: param.CurrentValue = reader.GetBoolean(name); break; case GH_Types.gh_double: param.CurrentValue = reader.GetDouble(name); break; case GH_Types.gh_int32: param.CurrentValue = reader.GetInt32(name); break; case GH_Types.gh_decimal: param.CurrentValue = (float)reader.GetDecimal(name); break; } } if (control is IGHPanel) { readCustomControls(reader, ((IGHPanel)control).Items, name); } } }
public static double ReadDouble(GH_IReader reader, string itemName) { return(reader.GetDouble(itemName)); }
public override bool Read(GH_IReader reader) { if (!reader.ItemExists("guide")) { Value = null; throw new Exception("Couldn't retrieve 'guide'."); } byte[] rawGuide = reader.GetByteArray("guide"); Curve guide = GH_Convert.ByteArrayToCommonObject <Curve>(rawGuide); if (guide == null) { throw new Exception("Failed to convert 'guide'."); } int N = reader.GetInt32("num_frames"); Plane[] frames = new Plane[N]; for (int i = 0; i < N; ++i) { var gp = reader.GetPlane("frames", i); frames[i] = new Plane( new Point3d( gp.Origin.x, gp.Origin.y, gp.Origin.z), new Vector3d( gp.XAxis.x, gp.XAxis.y, gp.XAxis.z), new Vector3d( gp.YAxis.x, gp.YAxis.y, gp.YAxis.z) ); } int lcx = reader.GetInt32("lcx"); int lcy = reader.GetInt32("lcy"); double lsx = reader.GetDouble("lsx"); double lsy = reader.GetDouble("lsy"); int interpolation = reader.GetInt32("interpolation"); int samples = reader.GetInt32("samples"); GlulamData data = new GlulamData(lcx, lcy, lsx, lsy, samples); data.InterpolationType = (GlulamData.Interpolation)interpolation; Value = Glulam.CreateGlulam(guide, frames, data); if (Value == null) { throw new Exception("What in the Lord's name..."); } //DisplayMesh = Value.GetBoundingMesh(); return(true); }
public static double ReadDouble(GH_IReader reader, string itemName, int itemIndex) { return(reader.GetDouble(itemName, itemIndex)); }