mirror of
https://github.com/eliasstepanik/OSCADSharpDotnet7.git
synced 2026-01-11 13:38:33 +00:00
Reduced visibility on many more methods / constructors to meet more NDepend rules.
This commit is contained in:
parent
d7beb68e58
commit
1edce998d1
@ -3,27 +3,75 @@ namespace OSCADSharp.ConsoleTests
|
||||
{
|
||||
class Program
|
||||
{
|
||||
private static OSCADObject getEndCover(OSCADObject outer)
|
||||
{
|
||||
var bounds = outer.Bounds();
|
||||
var endCover = new Cube(Inches.Sixteenth, bounds.Width, bounds.Height, true);
|
||||
var choppedOut = endCover.Clone().Scale(2, (bounds.Width-Inches.Quarter)/ bounds.Width, (bounds.Height - Inches.Half) / bounds.Height);
|
||||
choppedOut = choppedOut.Translate(0, Inches.Quarter, 0);
|
||||
|
||||
return endCover - choppedOut;
|
||||
}
|
||||
|
||||
private static void makeBracket()
|
||||
{
|
||||
OSCADObject cube = new Cube(new Vector3(Inches.ToMillimeters(2.75), Inches.One, Inches.ToMillimeters(1.25)), true);
|
||||
var outside = cube.Clone();
|
||||
((Cube)outside).Size.X += Inches.Sixteenth;
|
||||
((Cube)outside).Size.Z += Inches.Sixteenth;
|
||||
cube = cube.Scale(2, 1, 1).Translate(0, Inches.Sixteenth, 0);
|
||||
|
||||
var obj = outside - cube;
|
||||
var bounds = obj.Bounds();
|
||||
|
||||
obj = obj + getEndCover(outside).Translate(bounds.XMax, 0, 0);
|
||||
obj = obj + getEndCover(outside).Translate(-bounds.XMax, 0, 0);
|
||||
|
||||
obj.ToFile("leftBracket").Open();
|
||||
}
|
||||
|
||||
private static void makePeg()
|
||||
{
|
||||
Variables.Global.Add("$fn", 30);
|
||||
|
||||
OSCADObject flatInnerPortion = new Cylinder(Inches.Quarter, Inches.Eigth, true);
|
||||
OSCADObject shaft = new Cylinder(Inches.Eigth, Inches.Half, true);
|
||||
flatInnerPortion = flatInnerPortion.Translate(0, 0, shaft.Bounds().ZMax);
|
||||
|
||||
OSCADObject pegShaft = new Cylinder(Inches.Quarter, Inches.Half - Inches.Eigth, true)
|
||||
.Translate(0, 0, -Inches.Eigth);
|
||||
OSCADObject bottomBall = new Sphere(Inches.Quarter* 1.1)
|
||||
.Translate(0, 0, pegShaft.Bounds().ZMin);
|
||||
|
||||
var obj = flatInnerPortion + shaft + pegShaft + bottomBall;
|
||||
obj = obj.Rotate(0, 180, 0).Translate(0, 0, obj.Bounds().ZMax);
|
||||
|
||||
obj.ToFile("peg");
|
||||
}
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
var diam = new Variable("mainColumn", Inches.Half);
|
||||
var height = new Variable("overallHeight", Inches.Quarter);
|
||||
Variables.Global.Add(diam);
|
||||
Variables.Global.Add(height);
|
||||
makePeg();
|
||||
|
||||
var cyl = new Cylinder(diam, diam, height);
|
||||
|
||||
//var diam = new Variable("mainColumn", Inches.Half);
|
||||
//var height = new Variable("overallHeight", Inches.Quarter);
|
||||
//Variables.Global.Add(diam);
|
||||
//Variables.Global.Add(height);
|
||||
|
||||
var pos = cyl.Position();
|
||||
var cyl1 = new Cylinder(1, 100, true).Translate(pos);
|
||||
var cyl2 = new Cylinder(1, 100, true).Rotate(0, 90, 0).Translate(pos);
|
||||
var cyl3 = new Cylinder(1, 100, true).Rotate(90, 0, 0).Translate(pos);
|
||||
var axisHelper = cyl1.Union(cyl2, cyl3).Color("Red");
|
||||
//var cyl = new Cylinder(diam, diam, height);
|
||||
|
||||
//var topCorner = new Sphere().Translate(obj.Bounds().TopRight);
|
||||
//var botCorner = new Sphere().Translate(obj.Bounds().BottomLeft);
|
||||
|
||||
(cyl + axisHelper).ToFile("test.scad").Open();
|
||||
|
||||
//var pos = cyl.Position();
|
||||
//var cyl1 = new Cylinder(1, 100, true).Translate(pos);
|
||||
//var cyl2 = new Cylinder(1, 100, true).Rotate(0, 90, 0).Translate(pos);
|
||||
//var cyl3 = new Cylinder(1, 100, true).Rotate(90, 0, 0).Translate(pos);
|
||||
//var axisHelper = cyl1.Union(cyl2, cyl3).Color("Red");
|
||||
|
||||
////var topCorner = new Sphere().Translate(obj.Bounds().TopRight);
|
||||
////var botCorner = new Sphere().Translate(obj.Bounds().BottomLeft);
|
||||
|
||||
//(cyl + axisHelper).ToFile("test.scad").Open();
|
||||
|
||||
//Console.ReadKey();
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ namespace OSCADSharp
|
||||
{ "z", "z" }
|
||||
});
|
||||
|
||||
public BindableVector(Vector3 vector, Dictionary<string, string> synonyms = null) : this(vector.X, vector.Y, vector.Z)
|
||||
internal BindableVector(Vector3 vector, Dictionary<string, string> synonyms = null) : this(vector.X, vector.Y, vector.Z)
|
||||
{
|
||||
this.X = vector.X;
|
||||
this.Y = vector.Y;
|
||||
@ -24,7 +24,7 @@ namespace OSCADSharp
|
||||
this.setSynonyms(synonyms);
|
||||
}
|
||||
|
||||
public BindableVector(double x = 0, double y = 0, double z = 0, Dictionary<string, string> synonyms = null)
|
||||
internal BindableVector(double x = 0, double y = 0, double z = 0, Dictionary<string, string> synonyms = null)
|
||||
{
|
||||
this.X = x;
|
||||
this.Y = y;
|
||||
@ -58,7 +58,7 @@ namespace OSCADSharp
|
||||
return String.Format("[{0}, {1}, {2}]", x, y, z);
|
||||
}
|
||||
|
||||
public new BindableVector Clone()
|
||||
internal new BindableVector Clone()
|
||||
{
|
||||
var clone = new BindableVector(base.Clone());
|
||||
clone.bindings = this.bindings.Clone();
|
||||
|
||||
@ -16,7 +16,7 @@ namespace OSCADSharp
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
public Bindings()
|
||||
internal Bindings()
|
||||
{
|
||||
this.propertyNametoOpenSCADFieldMappings = new Dictionary<string, string>();
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ namespace OSCADSharp
|
||||
/// Creates a subtraction of child nodes
|
||||
/// </summary>
|
||||
/// <param name="children"></param>
|
||||
public Difference(IEnumerable<OSCADObject> children) : base("difference()", children)
|
||||
internal Difference(IEnumerable<OSCADObject> children) : base("difference()", children)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ namespace OSCADSharp
|
||||
/// Creates the intersection of all child nodes
|
||||
/// </summary>
|
||||
/// <param name="children"></param>
|
||||
public Intersection(IEnumerable<OSCADObject> children) : base("intersection()", children)
|
||||
internal Intersection(IEnumerable<OSCADObject> children) : base("intersection()", children)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace OSCADSharp
|
||||
internal class DefaultFileInvoker : IFileInvoker
|
||||
{
|
||||
private readonly string filePath;
|
||||
public DefaultFileInvoker(string filePath)
|
||||
internal DefaultFileInvoker(string filePath)
|
||||
{
|
||||
this.filePath = filePath;
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ namespace OSCADSharp
|
||||
{
|
||||
internal class CompoundVariable : Variable
|
||||
{
|
||||
public CompoundVariable(string name, object value) : base(name, value, false)
|
||||
internal CompoundVariable(string name, object value) : base(name, value, false)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@ namespace OSCADSharp
|
||||
private IBindings bindings;
|
||||
private Sphere sphere;
|
||||
|
||||
public SphereScriptBuilder(IBindings bindings, Sphere sphere)
|
||||
internal SphereScriptBuilder(IBindings bindings, Sphere sphere)
|
||||
{
|
||||
this.bindings = bindings;
|
||||
this.sphere = sphere;
|
||||
|
||||
@ -32,7 +32,7 @@ namespace OSCADSharp
|
||||
/// <param name="name">The Name of the value-pair</param>
|
||||
/// <param name="value">The value - if null this method does nothing</param>
|
||||
/// <param name="prefixWithComma">(optional) Flag indicating whether a comma should be added before the value-pair</param>
|
||||
public void AppendValuePairIfExists(string name, object value, bool prefixWithComma = false)
|
||||
internal void AppendValuePairIfExists(string name, object value, bool prefixWithComma = false)
|
||||
{
|
||||
bool useBinding = this.shouldUseBinding(name);
|
||||
|
||||
@ -68,7 +68,7 @@ namespace OSCADSharp
|
||||
/// Pass-through for StringBuilder.Append
|
||||
/// </summary>
|
||||
/// <param name="text"></param>
|
||||
public void Append(string text)
|
||||
internal void Append(string text)
|
||||
{
|
||||
SB.Append(text);
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@ namespace OSCADSharp
|
||||
/// </summary>
|
||||
internal class HulledObject : MultiStatementObject
|
||||
{
|
||||
public HulledObject(IEnumerable<OSCADObject> children) : base("hull()", children)
|
||||
internal HulledObject(IEnumerable<OSCADObject> children) : base("hull()", children)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ namespace OSCADSharp
|
||||
internal class MinkowskiedObject : MultiStatementObject
|
||||
{
|
||||
|
||||
public MinkowskiedObject(IEnumerable<OSCADObject> children) : base("minkowski()", children)
|
||||
internal MinkowskiedObject(IEnumerable<OSCADObject> children) : base("minkowski()", children)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ namespace OSCADSharp
|
||||
/// <summary>
|
||||
/// Constants and conversions for units for us imperial-minded folks.
|
||||
/// </summary>
|
||||
public class Inches
|
||||
public static class Inches
|
||||
{
|
||||
/// <summary>
|
||||
/// One imperial inch
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user