mirror of
https://github.com/eliasstepanik/OSCADSharpDotnet7.git
synced 2026-01-23 11:18:27 +00:00
Added "Name" as an optional identifier for OSCADObjects
This commit is contained in:
parent
135ab5072a
commit
847652a9c7
@ -16,7 +16,7 @@ namespace OSCADSharp
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class OSCADObject
|
public abstract class OSCADObject
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Attributes
|
||||||
private uint id = Ids.Get();
|
private uint id = Ids.Get();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -24,6 +24,11 @@ namespace OSCADSharp
|
|||||||
/// these values auto-increment
|
/// these values auto-increment
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public uint Id { get { return this.id; } }
|
public uint Id { get { return this.id; } }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Name of this OSCADObject
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; set; } = null;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Transforms
|
#region Transforms
|
||||||
@ -288,6 +293,16 @@ namespace OSCADSharp
|
|||||||
return allChildren;
|
return allChildren;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves children that match the filtering predicate
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="predicate">An expression like Linq's .Where() clause</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IEnumerable<OSCADObject> Children(Func<OSCADObject, bool> predicate)
|
||||||
|
{
|
||||||
|
return this.Children().Where(predicate);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Copies the transforms that have been applied to another OSCADObject, and applies
|
/// Copies the transforms that have been applied to another OSCADObject, and applies
|
||||||
/// the same transforms to this object. (Only pure transforms, like Translate, Rotate, Scale, Color)
|
/// the same transforms to this object. (Only pure transforms, like Translate, Rotate, Scale, Color)
|
||||||
|
|||||||
@ -42,7 +42,10 @@ namespace OSCADSharp.Scripting
|
|||||||
childClones.Add(child.Clone());
|
childClones.Add(child.Clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
return new MultiBlockStatementObject(this.outerStatement, childClones);
|
return new MultiBlockStatementObject(this.outerStatement, childClones)
|
||||||
|
{
|
||||||
|
Name = this.Name
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Vector3 Position()
|
public override Vector3 Position()
|
||||||
|
|||||||
@ -82,6 +82,7 @@ namespace OSCADSharp.Solids
|
|||||||
{
|
{
|
||||||
return new Cube()
|
return new Cube()
|
||||||
{
|
{
|
||||||
|
Name = this.Name,
|
||||||
Size = this.Size,
|
Size = this.Size,
|
||||||
Center = this.Center
|
Center = this.Center
|
||||||
};
|
};
|
||||||
|
|||||||
@ -138,6 +138,7 @@ namespace OSCADSharp.Solids
|
|||||||
{
|
{
|
||||||
return new Cylinder()
|
return new Cylinder()
|
||||||
{
|
{
|
||||||
|
Name = this.Name,
|
||||||
Height = this.Height,
|
Height = this.Height,
|
||||||
Radius1 = this.Radius1,
|
Radius1 = this.Radius1,
|
||||||
Radius2 = this.Radius2,
|
Radius2 = this.Radius2,
|
||||||
|
|||||||
@ -83,6 +83,7 @@ namespace OSCADSharp.Solids
|
|||||||
{
|
{
|
||||||
return new Sphere()
|
return new Sphere()
|
||||||
{
|
{
|
||||||
|
Name = this.Name,
|
||||||
Resolution = this.Resolution,
|
Resolution = this.Resolution,
|
||||||
MinimumAngle = this.MinimumAngle,
|
MinimumAngle = this.MinimumAngle,
|
||||||
MinimumFragmentSize = this.MinimumFragmentSize,
|
MinimumFragmentSize = this.MinimumFragmentSize,
|
||||||
|
|||||||
@ -80,6 +80,7 @@ namespace OSCADSharp.Solids
|
|||||||
{
|
{
|
||||||
return new Text3D()
|
return new Text3D()
|
||||||
{
|
{
|
||||||
|
Name = this.Name,
|
||||||
Text = this.Text,
|
Text = this.Text,
|
||||||
Size = this.Size,
|
Size = this.Size,
|
||||||
Font = this.Font,
|
Font = this.Font,
|
||||||
|
|||||||
@ -44,7 +44,10 @@ namespace OSCADSharp.Transforms
|
|||||||
|
|
||||||
public override OSCADObject Clone()
|
public override OSCADObject Clone()
|
||||||
{
|
{
|
||||||
return new ColoredObject(this.obj.Clone(), this.ColorName, this.Opacity);
|
return new ColoredObject(this.obj.Clone(), this.ColorName, this.Opacity)
|
||||||
|
{
|
||||||
|
Name = this.Name
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public OSCADObject MimicObject(OSCADObject obj)
|
public OSCADObject MimicObject(OSCADObject obj)
|
||||||
|
|||||||
@ -39,7 +39,10 @@ namespace OSCADSharp.Transforms
|
|||||||
|
|
||||||
public override OSCADObject Clone()
|
public override OSCADObject Clone()
|
||||||
{
|
{
|
||||||
return new LinearExtrudedObject(this.obj.Clone(), this.Height);
|
return new LinearExtrudedObject(this.obj.Clone(), this.Height)
|
||||||
|
{
|
||||||
|
Name = this.Name
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
|
|||||||
@ -43,7 +43,10 @@ namespace OSCADSharp.Transforms
|
|||||||
|
|
||||||
public override OSCADObject Clone()
|
public override OSCADObject Clone()
|
||||||
{
|
{
|
||||||
return new MirroredObject(this.obj.Clone(), this.Normal);
|
return new MirroredObject(this.obj.Clone(), this.Normal)
|
||||||
|
{
|
||||||
|
Name = this.Name
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public OSCADObject MimicObject(OSCADObject obj)
|
public OSCADObject MimicObject(OSCADObject obj)
|
||||||
|
|||||||
@ -42,7 +42,10 @@ namespace OSCADSharp.Transforms
|
|||||||
|
|
||||||
public override OSCADObject Clone()
|
public override OSCADObject Clone()
|
||||||
{
|
{
|
||||||
return new ResizedObject(this.obj.Clone(), this.Size);
|
return new ResizedObject(this.obj.Clone(), this.Size)
|
||||||
|
{
|
||||||
|
Name = this.Name
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public OSCADObject MimicObject(OSCADObject obj)
|
public OSCADObject MimicObject(OSCADObject obj)
|
||||||
|
|||||||
@ -42,7 +42,10 @@ namespace OSCADSharp.Transforms
|
|||||||
|
|
||||||
public override OSCADObject Clone()
|
public override OSCADObject Clone()
|
||||||
{
|
{
|
||||||
return new RotatedObject(this.obj.Clone(), this.Angle);
|
return new RotatedObject(this.obj.Clone(), this.Angle)
|
||||||
|
{
|
||||||
|
Name = this.Name
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public OSCADObject MimicObject(OSCADObject obj)
|
public OSCADObject MimicObject(OSCADObject obj)
|
||||||
|
|||||||
@ -42,7 +42,10 @@ namespace OSCADSharp.Transforms
|
|||||||
|
|
||||||
public override OSCADObject Clone()
|
public override OSCADObject Clone()
|
||||||
{
|
{
|
||||||
return new ScaledObject(this.obj.Clone(), this.ScaleFactor);
|
return new ScaledObject(this.obj.Clone(), this.ScaleFactor)
|
||||||
|
{
|
||||||
|
Name = this.Name
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public OSCADObject MimicObject(OSCADObject obj)
|
public OSCADObject MimicObject(OSCADObject obj)
|
||||||
|
|||||||
@ -39,7 +39,10 @@ namespace OSCADSharp.Transforms
|
|||||||
|
|
||||||
public override OSCADObject Clone()
|
public override OSCADObject Clone()
|
||||||
{
|
{
|
||||||
return new TranslatedObject(this.obj.Clone(), this.Vector);
|
return new TranslatedObject(this.obj.Clone(), this.Vector)
|
||||||
|
{
|
||||||
|
Name = this.Name
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public OSCADObject MimicObject(OSCADObject obj)
|
public OSCADObject MimicObject(OSCADObject obj)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user