Skip to content

Commit

Permalink
* lead-in rapids are shown now
Browse files Browse the repository at this point in the history
  • Loading branch information
jkmnt committed Jan 10, 2017
1 parent 7f6ac5b commit f9c01ef
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 25 deletions.
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.1.0")]
[assembly: AssemblyFileVersion("2.0.1.0")]
[assembly: AssemblyVersion("2.1.0.0")]
[assembly: AssemblyFileVersion("2.1.0.0")]
53 changes: 30 additions & 23 deletions mop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,11 @@ private Polyline gen_leadin(Toolpath path)
{
Traj_metainfo meta = (Traj_metainfo) path.Trajectory.Extension;
start_normal = meta.Start_normal;
}
}

LeadMoveInfo move = _leadin.Cached;
Polyline p = move.GetLeadInToolPath(spiral,
spiral.Direction,
spiral.Direction,
start_normal,
base.PlungeFeedrate.Cached,
base.CutFeedrate.Cached,
Expand All @@ -292,31 +292,38 @@ protected void redraw_parameters()
CamBamUI.MainUI.ObjectProperties.Refresh();
}

// rapids are not shown
private List<Surface> calc_visual_cut_widths(List<Sliced_path> trajectories, double bottom)
private Surface polyline_to_surface(Polyline p, double z)
{
List<Surface> surfaces = new List<Surface>();

foreach (Sliced_path traj in trajectories)
if (base.Transform.Cached != null && !Transform.Cached.IsIdentity())
{
foreach(Sliced_path_item item in traj)
{
Polyline p = item;
p = (Polyline)p.Clone();
p.ApplyTransformation(Transform.Cached);
}

if (item.Item_type != Sliced_path_item_type.SLICE && item.Item_type != Sliced_path_item_type.SPIRAL)
continue;
PolylineToMesh mesh = new PolylineToMesh(p);
Surface surface = mesh.ToWideLine(base.ToolDiameter.Cached);
surface.ApplyTransformation(Matrix4x4F.Translation(0.0, 0.0, z - 0.001));
return surface;
}

// TODO: maybe a single transform of surface will suffice ?
if (base.Transform.Cached != null && ! Transform.Cached.IsIdentity())
{
p = (Polyline) p.Clone();
p.ApplyTransformation(Transform.Cached);
}
private List<Surface> calc_visual_cut_widths(List<Toolpath> toolpaths, double first_bottom, double last_bottom)
{
List<Surface> surfaces = new List<Surface>();

PolylineToMesh mesh = new PolylineToMesh(p);
Surface surface = mesh.ToWideLine(base.ToolDiameter.Cached);
surface.ApplyTransformation(Matrix4x4F.Translation(0.0, 0.0, bottom - 0.001));
surfaces.Add(surface);
foreach (Toolpath path in toolpaths)
{
// show lead-ins for the first depth level
if (path.Bottom == first_bottom && path.Leadin != null)
surfaces.Add(polyline_to_surface(path.Leadin, path.Bottom));

// show cut traces for the last depth level
if (path.Bottom == last_bottom)
{
foreach (Sliced_path_item item in path.Trajectory)
{
if (item.Item_type == Sliced_path_item_type.SLICE || item.Item_type == Sliced_path_item_type.SPIRAL)
surfaces.Add(polyline_to_surface(item, path.Bottom));
}
}
}

Expand Down Expand Up @@ -459,7 +466,7 @@ internal void insert_toolpaths(List<Sliced_path> trajectories)
_trajectories = trajectories;
double[] bottoms = get_z_layers();
_toolpaths = gen_ordered_toolpath(_trajectories, bottoms);
_visual_cut_widths = calc_visual_cut_widths(_trajectories, bottoms[bottoms.Length - 1]); // for the last depth only
_visual_cut_widths = calc_visual_cut_widths(_toolpaths, bottoms[0], bottoms[bottoms.Length - 1]);
_visual_rapids = calc_visual_rapids(_toolpaths);

print_toolpath_stats(_toolpaths, _visual_rapids);
Expand Down

0 comments on commit f9c01ef

Please sign in to comment.