Skip to content

Commit

Permalink
fix(projects): project work for 2022_HH_DAC
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Svilans committed May 5, 2022
1 parent f18e3ba commit 0610f1e
Show file tree
Hide file tree
Showing 4 changed files with 197 additions and 27 deletions.
14 changes: 13 additions & 1 deletion GluLamb/Joints/Connectors.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

Expand All @@ -17,9 +18,15 @@ public class ConnectorPlate
public Plane Plane;
public Brep Geometry;

public ConnectorPlate()
public string Name;

public List<Dowel> Dowels;

public ConnectorPlate(string name = "ConnectorPlate")
{
Outlines = new Polyline[2];
Dowels = new List<Dowel>();
Name = name;
}
}

Expand All @@ -35,5 +42,10 @@ public Dowel(Line axis, double diameter=16, double depth=0)
Diameter = diameter;
DrillDepth = depth > 0? depth : axis.Length;
}

public void Transform(Transform xform)
{
Axis.Transform(xform);
}
}
}
17 changes: 15 additions & 2 deletions GluLamb/Joints/SpliceJoints/SpliceJoint_BlindTenon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,20 @@ public override bool Construct(bool append = false)
FirstHalf.Element.UserDictionary.Set(string.Format("EndCut_{0}", SecondHalf.Element.Name), EndPlaneT);
SecondHalf.Element.UserDictionary.Set(string.Format("EndCut_{0}", FirstHalf.Element.Name), FacePlane);

var tapHoleAd = new ArchivableDictionary();
tapHoleAd.Set("EndPlane", EndPlane);
//tapHoleAd.Set("EndPlane", new Plane(EndPlane.Origin + EndPlane.ZAxis * ToleranceEnd, EndPlane.XAxis, EndPlane.YAxis));
tapHoleAd.Set("SlotPlane", FacePlane);
tapHoleAd.Set("PlateFace0", new Plane(FacePlane.Origin + FacePlane.YAxis * (TenonHeight / 2 + ToleranceSide), FacePlane.ZAxis, FacePlane.XAxis));
tapHoleAd.Set("PlateFace1", new Plane(FacePlane.Origin - FacePlane.YAxis * (TenonHeight / 2 + ToleranceSide), FacePlane.ZAxis, FacePlane.XAxis));
tapHoleAd.Set("TenonSide0", new Plane(FacePlane.Origin + FacePlane.XAxis * (TenonWidth / 2 + ToleranceSide), FacePlane.ZAxis, FacePlane.YAxis));
tapHoleAd.Set("TenonSide1", new Plane(FacePlane.Origin - FacePlane.XAxis * (TenonWidth / 2 + ToleranceSide), FacePlane.ZAxis, FacePlane.YAxis));
tapHoleAd.Set("PlateThickness", TenonHeight);
tapHoleAd.Set("Depth", Math.Abs(EndPlane.DistanceTo(FacePlane.Origin)));

var tapAd = new ArchivableDictionary();
tapAd.Set("EndPlane", EndPlane);
//tapAd.Set("EndPlane", EndPlane);
tapAd.Set("EndPlane", EndPlaneT);
tapAd.Set("SlotPlane", FacePlane);
tapAd.Set("PlateFace0", new Plane(FacePlane.Origin + FacePlane.YAxis * TenonHeight / 2, FacePlane.ZAxis, FacePlane.XAxis));
tapAd.Set("PlateFace1", new Plane(FacePlane.Origin - FacePlane.YAxis * TenonHeight / 2, FacePlane.ZAxis, FacePlane.XAxis));
Expand All @@ -188,7 +200,8 @@ public override bool Construct(bool append = false)
tapAd.Set("PlateThickness", TenonHeight);
tapAd.Set("Depth", Math.Abs(EndPlane.DistanceTo(FacePlane.Origin)));

SecondHalf.Element.UserDictionary.Set(String.Format("TenonSlot_{0}", FirstHalf.Element.Name), tapAd);
SecondHalf.Element.UserDictionary.Set(String.Format("SillTenonSlot_{0}", FirstHalf.Element.Name), tapHoleAd);
FirstHalf.Element.UserDictionary.Set(String.Format("SillTenonTap_{0}", SecondHalf.Element.Name), tapAd);

// Create dowels
var dowelPlane = new Plane(planes[0].Origin + planes[0].ZAxis * TenonLength * 0.5, planes[0].YAxis);
Expand Down
59 changes: 52 additions & 7 deletions GluLamb/Joints/VBeamJoints/KJoint_Plate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1360,10 +1360,24 @@ protected Brep CreatePlateSlot(int index, Vector3d vec)

//return joined;


double r = 8;
var filleted = Brep.CreateFilletEdges(joined, new int[] { 8, 9 }, new double[] { r, r }, new double[] { r, r },
BlendType.Fillet, RailType.RollingBall, 0.01);

if (true)
{
var dowelBreps = new List<Brep>();
foreach (var dowel in Dowels)
{
dowelBreps.Add(new Cylinder(
new Circle(
new Plane(dowel.Axis.From, dowel.Axis.Direction), dowel.Diameter * 0.5), dowel.Axis.Length).ToBrep(true, true));
}

return filleted[0].Cut(dowelBreps, 0.01);
}

return filleted[0];
}

Expand Down Expand Up @@ -2541,8 +2555,22 @@ public Brep CreatePlate()
if (joined == null || joined.Length < 1)
return null;

if (true)
{
var dowelBreps = new List<Brep>();
foreach (var dowel in Dowels)
{
dowelBreps.Add(new Cylinder(
new Circle(
new Plane(dowel.Axis.From, dowel.Axis.Direction), dowel.Diameter * 0.5), dowel.Axis.Length).ToBrep(true, true));
}

joined[0] = joined[0].Cut(dowelBreps, 0.01);
}

joined[0].Faces.SplitKinkyFaces(0.1);
Plate.Geometry = joined[0];
Plate.Name = string.Format("{0}_{1}_{2}", Parts[0].Element.Name, Parts[1].Element.Name, Parts[2].Element.Name);

return Plate.Geometry;
}
Expand Down Expand Up @@ -3054,26 +3082,43 @@ public override bool Construct(bool append = false)

//var dowelPlane01 = new Plane(dowelPoints[i] - BeamPlanes[i].YAxis * DowelLength * 0.5, BeamPlanes[i].YAxis);
var dowelCyl = new Cylinder(
new Circle(dowelPlanes[i], DowelDiameter * 0.5), DowelDrillDepth).ToBrep(true, true);
new Circle(dowelPlanes[i], DowelDiameter * 0.5), DowelDrillDepth);
dowelCyl.Height1 = -10;
dowelCyl.Height2 = DowelDrillDepth + 10;

Dowels.Add(new Dowel(new Line(dowelPlanes[i].Origin, dowelPlanes[i].ZAxis * DowelLength), DowelDiameter, DowelDrillDepth));
var dowelAxis = new Line(dowelPlanes[i].Origin, dowelPlanes[i].ZAxis * DowelLength);

Parts[i].Geometry.Add(dowelCyl);
//Dowels.Add(new Dowel(dowelAxis, DowelDiameter, DowelDrillDepth));

Parts[i].Geometry.Add(dowelCyl.ToBrep(true, true));
Parts[i].Element.UserDictionary.Set(String.Format("PlateDowel_{0}", Guid.NewGuid().ToString().Substring(0, 8)), new Line(dowelPlanes[i].Origin, dowelPlanes[i].ZAxis * DowelLength));


var plateDowelAxis = dowelAxis;
plateDowelAxis.Transform(Transform.Translation(-BeamDirections[i] * 0.5));
Dowels.Add(new Dowel(plateDowelAxis, DowelDiameter));

}

var portalDowelPoint = (TenonSidePlanes[0].Origin + TenonSidePlanes[1].Origin) * 0.5;
portalDowelPoint = Beams[2].GetPlane(portalDowelPoint).Origin;

var portalDowelPlane = new Plane(portalDowelPoint - KPlane.YAxis * DowelLength * 0.5, KPlane.YAxis);
var portalDowelCyl = new Cylinder(
new Circle(portalDowelPlane, DowelDiameter * 0.5), DowelLength).ToBrep(true, true);
new Circle(portalDowelPlane, DowelDiameter * 0.5), DowelLength);
portalDowelCyl.Height1 = -10;
portalDowelCyl.Height2 = DowelLength + 10;

Dowels.Add(new Dowel(new Line(portalDowelPlane.Origin, portalDowelPlane.ZAxis * DowelLength), DowelDiameter));
var portalDowelAxis = new Line(portalDowelPlane.Origin, portalDowelPlane.ZAxis * DowelLength);

this.Beam.Geometry.Add(portalDowelCyl.ToBrep(true, true));
this.Beam.Element.UserDictionary.Set(String.Format("PlateDowel_{0}", Guid.NewGuid().ToString().Substring(0, 8)), portalDowelAxis);

var portalPlateDowelAxis = portalDowelAxis;
portalPlateDowelAxis.Transform(Transform.Translation(SillPlane.ZAxis * 0.0)); // Offset of hole towards the joint centre, 0 for tenon hole

Dowels.Add(new Dowel(portalPlateDowelAxis, DowelDiameter));

this.Beam.Geometry.Add(portalDowelCyl);
this.Beam.Element.UserDictionary.Set(String.Format("PlateDowel_{0}", Guid.NewGuid().ToString().Substring(0, 8)), new Line(portalDowelPlane.Origin, portalDowelPlane.ZAxis * DowelLength));

return true;
}
Expand Down
134 changes: 117 additions & 17 deletions GluLamb/Projects/2022_HH_DAC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,17 @@ public class SlotMachining : Operation
public double Radius;
public double Depth;
public double Depth0;
public string OperationName = "SLIDS_LODRET";
public bool LongSlot = false;

public bool Rough = false;

public SlotMachining(string name = "SlotMachining", bool rough= false)
{
Name = name;
Rough = rough;
OperationName = "SLIDS_LODRET";
LongSlot = false;
}

public override List<object> GetObjects()
Expand All @@ -151,7 +155,7 @@ public override List<object> GetObjects()
public override void ToCix(List<string> cix, string prefix = "")
{
string postfix = Rough ? "_GROV" : "";
cix.Add(string.Format("{0}SLIDS_LODRET_{1}{2}=1", prefix, Id, postfix));
cix.Add(string.Format("{0}{3}_{1}{2}=1", prefix, Id, postfix, OperationName));
// Sort out plane transformation here

Point3d Origin = XLine.From;
Expand All @@ -169,14 +173,14 @@ public override void ToCix(List<string> cix, string prefix = "")
}


cix.Add(string.Format("{0}SLIDS_LODRET_{1}{2}_PL_PKT_1_X={3:0.###}", prefix, Id, postfix, Origin.X));
cix.Add(string.Format("{0}SLIDS_LODRET_{1}{2}_PL_PKT_1_Y={3:0.###}", prefix, Id, postfix, Origin.Y));
cix.Add(string.Format("{0}SLIDS_LODRET_{1}{2}_PL_PKT_1_Z={3:0.###}", prefix, Id, postfix, -Origin.Z));
cix.Add(string.Format("{0}{4}_{1}{2}_PL_PKT_1_X={3:0.###}", prefix, Id, postfix, Origin.X, OperationName));
cix.Add(string.Format("{0}{4}_{1}{2}_PL_PKT_1_Y={3:0.###}", prefix, Id, postfix, Origin.Y, OperationName));
cix.Add(string.Format("{0}{4}_{1}{2}_PL_PKT_1_Z={3:0.###}", prefix, Id, postfix, -Origin.Z, OperationName));

cix.Add(string.Format("{0}SLIDS_LODRET_{1}{2}_PL_PKT_2_X={3:0.###}", prefix, Id, postfix, XPoint.X));
cix.Add(string.Format("{0}SLIDS_LODRET_{1}{2}_PL_PKT_2_Y={3:0.###}", prefix, Id, postfix, XPoint.Y));
cix.Add(string.Format("{0}SLIDS_LODRET_{1}{2}_PL_PKT_2_Z={3:0.###}", prefix, Id, postfix, -XPoint.Z));
cix.Add(string.Format("{0}SLIDS_LODRET_{1}{2}_PL_ALFA={3:0.###}", prefix, Id, postfix, RhinoMath.ToDegrees(angle)));
cix.Add(string.Format("{0}{4}_{1}{2}_PL_PKT_2_X={3:0.###}", prefix, Id, postfix, XPoint.X, OperationName));
cix.Add(string.Format("{0}{4}_{1}{2}_PL_PKT_2_Y={3:0.###}", prefix, Id, postfix, XPoint.Y, OperationName));
cix.Add(string.Format("{0}{4}_{1}{2}_PL_PKT_2_Z={3:0.###}", prefix, Id, postfix, -XPoint.Z, OperationName));
cix.Add(string.Format("{0}{4}_{1}{2}_PL_ALFA={3:0.###}", prefix, Id, postfix, RhinoMath.ToDegrees(angle), OperationName));

int N = Rough ? 5 : 9;

Expand All @@ -191,27 +195,119 @@ public override void ToCix(List<string> cix, string prefix = "")
for (int i = 0; i < Outline.Count; ++i)
{
Plane.RemapToPlaneSpace(Outline[i], out temp);
cix.Add(string.Format("{0}SLIDS_LODRET_{1}{2}_PKT_{3}_X={4:0.###}", prefix, Id, postfix, i + 1, temp.X));
cix.Add(string.Format("{0}SLIDS_LODRET_{1}{2}_PKT_{3}_Y={4:0.###}", prefix, Id, postfix, i + 1, temp.Y));
cix.Add(string.Format("{0}{5}_{1}{2}_PKT_{3}_X={4:0.###}", prefix, Id, postfix, i + 1, temp.X, OperationName));
cix.Add(string.Format("{0}{5}_{1}{2}_PKT_{3}_Y={4:0.###}", prefix, Id, postfix, i + 1, temp.Y, OperationName));
}

var BorL = new string[] { "B", "L" };
if (LongSlot && false)
BorL = new string[] { "L", "B" };

if (Rough)
{
cix.Add(string.Format("{0}SLIDS_LODRET_{1}{2}_B={3:0.###}", prefix, Id, postfix, Outline[1].DistanceTo(Outline[2])));
cix.Add(string.Format("{0}SLIDS_LODRET_{1}{2}_L={3:0.###}", prefix, Id, postfix, Outline[2].DistanceTo(Outline[3])));
cix.Add(string.Format("{0}{4}_{1}{2}_{5}={3:0.###}", prefix, Id, postfix, Outline[1].DistanceTo(Outline[2]), OperationName, BorL[0]));
cix.Add(string.Format("{0}{4}_{1}{2}_{5}={3:0.###}", prefix, Id, postfix, Outline[2].DistanceTo(Outline[3]), OperationName, BorL[1]));
}
else
{
cix.Add(string.Format("{0}SLIDS_LODRET_{1}{2}_B={3:0.###}", prefix, Id, postfix, Outline[5].DistanceTo(Outline[8])));
cix.Add(string.Format("{0}SLIDS_LODRET_{1}{2}_L={3:0.###}", prefix, Id, postfix, Outline[3].DistanceTo(Outline[6])));
cix.Add(string.Format("{0}{4}_{1}{2}_{5}={3:0.###}", prefix, Id, postfix, Outline[5].DistanceTo(Outline[8]), OperationName, BorL[0]));
cix.Add(string.Format("{0}{4}_{1}{2}_{5}={3:0.###}", prefix, Id, postfix, Outline[3].DistanceTo(Outline[6]), OperationName, BorL[1]));
}
}

if (!Rough)
cix.Add(string.Format("{0}SLIDS_LODRET_{1}_R={2:0.###}", prefix, Id, Radius));
cix.Add(string.Format("{0}{3}_{1}_R={2:0.###}", prefix, Id, Radius, OperationName));

cix.Add(string.Format("{0}{4}_{1}{2}_DYBDE={3:0.###}", prefix, Id, postfix, Depth, OperationName));
cix.Add(string.Format("{0}{4}_{1}{2}_DYBDE_0={3:0.###}", prefix, Id, postfix, Depth0, OperationName));
}

public override void Transform(Transform xform)
{
Plane.Transform(xform);
Outline.Transform(xform);
}
}

public class TenonMachining : Operation
{
public Line XLine;
public double Angle;
public bool OverridePlane = false;
public Plane Plane;
public Polyline Outline;
public double Radius;
public double Depth;
public double Depth0;
public string OperationName = "TAP";


public TenonMachining(string name = "TenonMachining")
{
Name = name;
OperationName = "TAP";
}

public override List<object> GetObjects()
{
return new List<object> { Plane, Outline };
}

public override void ToCix(List<string> cix, string prefix = "")
{
cix.Add(string.Format("{0}{1}_{2}=1", prefix, OperationName, Id));
// Sort out plane transformation here

cix.Add(string.Format("{0}SLIDS_LODRET_{1}{2}_DYBDE={3:0.###}", prefix, Id, postfix, Depth));
cix.Add(string.Format("{0}SLIDS_LODRET_{1}{2}_DYBDE_0={3:0.###}", prefix, Id, postfix, Depth0));
Point3d Origin = XLine.From;
Point3d XPoint = XLine.To;
double angle = Angle;

if (!OverridePlane)
{
var xaxis = Plane.XAxis;
Origin = Plane.Origin;
XPoint = Origin + xaxis * 100;

Plane plane;
GluLamb.Utility.AlignedPlane(Origin, Plane.ZAxis, out plane, out angle);
}


cix.Add(string.Format("{0}{1}_{2}_PL_PKT_1_X={3:0.###}", prefix, OperationName, Id, Origin.X));
cix.Add(string.Format("{0}{1}_{2}_PL_PKT_1_Y={3:0.###}", prefix, OperationName, Id, Origin.Y));
cix.Add(string.Format("{0}{1}_{2}_PL_PKT_1_Z={3:0.###}", prefix, OperationName, Id, -Origin.Z));

cix.Add(string.Format("{0}{1}_{2}_PL_PKT_2_X={3:0.###}", prefix, OperationName, Id, XPoint.X));
cix.Add(string.Format("{0}{1}_{2}_PL_PKT_2_Y={3:0.###}", prefix, OperationName, Id, XPoint.Y));
cix.Add(string.Format("{0}{1}_{2}_PL_PKT_2_Z={3:0.###}", prefix, OperationName, Id, -XPoint.Z));
cix.Add(string.Format("{0}{1}_{2}_PL_ALFA={3:0.###}", prefix, OperationName, Id, RhinoMath.ToDegrees(angle)));

int N = 9;
if (Outline.Count != N)
{
throw new Exception(string.Format("Incorrect number of points for slot machining. Requires {1} points.", N));
}

if (Outline != null)
{
Point3d temp;
for (int i = 0; i < Outline.Count; ++i)
{
Plane.RemapToPlaneSpace(Outline[i], out temp);
cix.Add(string.Format("{0}{1}_{2}_PKT_{3}_X={4:0.###}", prefix, OperationName, Id, i + 1, temp.X));
cix.Add(string.Format("{0}{1}_{2}_PKT_{3}_Y={4:0.###}", prefix, OperationName, Id, i + 1, temp.Y));
}

var BorL = new string[] { "B", "L" };

cix.Add(string.Format("{0}{1}_{2}_{4}={3:0.###}", prefix, OperationName, Id, Outline[5].DistanceTo(Outline[8]), BorL[0]));
cix.Add(string.Format("{0}{1}_{2}_{4}={3:0.###}", prefix, OperationName, Id, Outline[3].DistanceTo(Outline[6]), BorL[1]));
}

cix.Add(string.Format("{0}{1}_R={2:0.###}", prefix, Id, Radius, OperationName));

cix.Add(string.Format("{0}{1}_{2}_DYBDE={3:0.###}", prefix, OperationName, Id, Depth));
cix.Add(string.Format("{0}{1}_{2}_DYBDE_0={3:0.###}", prefix, OperationName, Id, Depth0));
}

public override void Transform(Transform xform)
Expand Down Expand Up @@ -372,11 +468,13 @@ public class EndCut : Operation
{
public Plane Plane;
public Line CutLine;
public double ExtraDepth;
public EndCut(string name = "EndCut")
{
Name = name;
Plane = Plane.Unset;
CutLine = Line.Unset;
ExtraDepth = 10;
}

public override List<object> GetObjects()
Expand Down Expand Up @@ -412,6 +510,8 @@ public override void ToCix(List<string> cix, string prefix = "")
cix.Add(string.Format("{0}CUT_{1}_LINE_PKT_2_Z={2:0.###}", prefix, Id, CutLine.To.Z));

cix.Add(string.Format("{0}CUT_{1}_ALFA={2:0.###}", prefix, Id, RhinoMath.ToDegrees(angle)));
cix.Add(string.Format("{0}CUT_{1}_DYBDE_EKSTRA={2:0.###}", prefix, Id, ExtraDepth));

}

public override void Transform(Transform xform)
Expand Down

0 comments on commit 0610f1e

Please sign in to comment.