protected override void SolveInstance(IGH_DataAccess DA) { string file = null; GH_Target target = null; Point3d? point = null; if (!DA.GetData(0, ref file)) { return; } if (!DA.GetData(1, ref target)) { return; } DA.GetData(2, ref point); var alignment = Vector3d.XAxis; if (point.HasValue) { alignment = (Vector3d)point.Value; } var toolpath = new Model.Toolpaths.Milling.GCodeToolpath(file, target.Value as CartesianTarget, alignment); var(tool, mcs, rapidStarts, ignored) = toolpath.Toolpath; DA.SetData(0, toolpath); DA.SetData(1, tool); DA.SetData(2, mcs.Plane); DA.SetDataList(3, rapidStarts); DA.SetDataList(4, ignored); }
protected override void SolveInstance(IGH_DataAccess DA) { var curves = new List <Curve>(); if (!DA.GetDataList(0, curves)) { return; } var polylines = curves.Select(c => c.ToPolyline()); var variables = new List <double>(); if (!DA.GetDataList(1, variables)) { return; } GH_Target target = null; if (!DA.GetData(2, ref target)) { return; } if (!(target.Value is CartesianTarget)) { throw new Exception(" Target must be a cartesian target."); } var speeds = new List <double>(); if (!DA.GetDataList(3, speeds)) { return; } var waits = new List <double>(); if (!DA.GetDataList(4, waits)) { return; } var dos = new List <int>(); if (!DA.GetDataList(5, dos)) { return; } var environment = new List <GeometryBase>(); DA.GetDataList(6, environment); var attributes = new SpatialAttributes(variables, (target.Value) as CartesianTarget, speeds, waits, dos, environment); var spatial = new SpatialExtrusion(polylines, attributes); DA.SetDataList(0, spatial.Targets); DA.SetDataList(1, spatial.Display.Select(d => d.segment)); DA.SetDataList(2, spatial.Display.Select(d => d.type)); }
protected override void SolveInstance(IGH_DataAccess DA) { string file = null, mask = null; GH_Target target = null; bool reverse = false; double cuttingSpeed = 0; Point3d? point = null; if (!DA.GetData(0, ref file)) { return; } if (!DA.GetData(1, ref target)) { return; } if (!DA.GetData(2, ref mask)) { return; } if (!DA.GetData(3, ref reverse)) { return; } DA.GetData(4, ref cuttingSpeed); DA.GetData(5, ref point); var converter = new Toolpaths.CSVConverter(file, target.Value as CartesianTarget, mask, reverse, cuttingSpeed, point); DA.SetDataList(0, converter.Targets); DA.SetDataList(1, converter.ToolPath); }
/// <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) { // Warning that this component is OBSOLETE AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "This component is OBSOLETE and will be removed in the future."); // Variable for catchint the datatree GH_Structure <IGH_Goo> actions; // Clear the list with targets before catching new input data _targetGoos.Clear(); // Catch the input data if (!DA.GetDataTree(0, out actions)) { return; } if (!DA.GetData(1, ref _displayNames)) { return; } if (!DA.GetData(2, ref _displayPoints)) { return; } if (!DA.GetData(3, ref _displayDirections)) { return; } if (!DA.GetData(4, ref _color)) { return; } if (!DA.GetData(5, ref _textSize)) { return; } if (!DA.GetData(6, ref _pointSize)) { return; } // Get the paths of the datatree with actions var paths = actions.Paths; // Check and concert the input data to the right datatype (target) for (int i = 0; i < actions.Branches.Count; i++) { var branches = actions.Branches[i]; GH_Path iPath = paths[i]; for (int j = 0; j < branches.Count; j++) { // Get the target from the movement instance if the input data is a movement if (actions.Branches[i][j] is GH_Movement) { GH_Movement movementGoo = actions.Branches[i][j] as GH_Movement; GH_Target targetGoo = new GH_Target(movementGoo.Value.Target); _targetGoos.Append(targetGoo, iPath); } // Get the target data directly if the input data is a target else if (actions.Branches[i][j] is GH_Target) { GH_Target targetGoo = actions.Branches[i][j] as GH_Target; _targetGoos.Append(targetGoo, iPath); } // Make a target from the input plane if the input data is a plane else if (actions.Branches[i][j] is GH_Plane) { string targetName; if (actions.Branches.Count == 1) { targetName = "plane" + "_" + j; } else { targetName = "plane" + "_" + i + "_" + j; } GH_Plane planeGoo = actions.Branches[i][j] as GH_Plane; RobotTarget target = new RobotTarget(targetName, planeGoo.Value); GH_Target targetGoo = new GH_Target(target); _targetGoos.Append(targetGoo, iPath); } // Let all other data pass (raise no warning or error) else { // empty } } } }
public GH_Target(GH_Target goo) { Value = goo.Value; }