mirror of
https://github.com/eliasstepanik/OSCADSharpDotnet7.git
synced 2026-01-11 21:48:34 +00:00
ToString methods for solids
This commit is contained in:
parent
ff4da516e5
commit
6288a63fdd
@ -47,6 +47,9 @@
|
||||
<Compile Include="Solids\Sphere.cs" />
|
||||
<Compile Include="Vector3.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Transforms\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
@ -24,5 +24,11 @@ namespace OSCADSharp.Solids
|
||||
/// </summary>
|
||||
public bool Center { get; set; } = false;
|
||||
#endregion
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("cube(size = [{0}, {1}, {2}], center = {3});",
|
||||
this.Size.X.ToString(), this.Size.Y.ToString(), this.Size.Z.ToString(), this.Center.ToString().ToLower()); ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,6 +95,11 @@ namespace OSCADSharp.Solids
|
||||
public int Resolution { get; set; } = 0;
|
||||
#endregion
|
||||
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("cylinder($fn = {0}, $fa = {1}, $fs = {2}, h = {3}, r1 = {4}, r2 = {5}, center = {6});",
|
||||
Resolution.ToString(), MinimumAngle.ToString(), MinimumCircumferentialLength.ToString(),
|
||||
Height.ToString(), Radius1.ToString(), Radius2.ToString(), Center.ToString().ToLower());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,7 +20,10 @@ namespace OSCADSharp.Solids
|
||||
/// <summary>
|
||||
/// This is the diameter of the sphere
|
||||
/// </summary>
|
||||
public double Diameter { get; set; }
|
||||
public double Diameter {
|
||||
get { return this.Radius * 2; }
|
||||
set { this.Radius = value / 2; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Minimum angle (in degrees) of each cylinder fragment.
|
||||
@ -29,10 +32,10 @@ namespace OSCADSharp.Solids
|
||||
public int MinimumAngle { get; set; } = 12;
|
||||
|
||||
/// <summary>
|
||||
/// Minimum circumferential length of each fragment.
|
||||
/// Fragment size in mm
|
||||
/// ($fs in OpenSCAD)
|
||||
/// </summary>
|
||||
public int MinimumCircumferentialLength { get; set; } = 2;
|
||||
public int MinimumFragmentSize { get; set; } = 2;
|
||||
|
||||
/// <summary>
|
||||
/// Number of fragments in 360 degrees. Values of 3 or more override MinimumAngle and MinimumCircumferentialLength
|
||||
@ -40,5 +43,12 @@ namespace OSCADSharp.Solids
|
||||
/// </summary>
|
||||
public int Resolution { get; set; } = 0;
|
||||
#endregion
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("sphere($fn = {0}, $fa = {1}, $fs = {2}, r = {3});",
|
||||
this.Resolution.ToString(), this.MinimumAngle.ToString(),
|
||||
this.MinimumFragmentSize.ToString(), this.Radius.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user