Skip to content

Commit

Permalink
transformation methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Tilman Reinhardt committed Nov 28, 2022
1 parent 667c080 commit 296bd13
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 32 deletions.
28 changes: 28 additions & 0 deletions GsaGH/Parameters/2_Geometry/GsaElement1d.cs
Original file line number Diff line number Diff line change
Expand Up @@ -405,5 +405,33 @@ internal void UpdatePreview()
previewPointEnd = this._line.PointAtEnd;
}
#endregion

#region transformation methods
public GsaElement1d Transform(Transform xform)
{
GsaElement1d elem = this.Duplicate(true);
elem.Id = 0;
elem.LocalAxes = null;

LineCurve xLn = elem.Line;
xLn.Transform(xform);
elem.Line = xLn;

return elem;
}

public GsaElement1d Morph(SpaceMorph xmorph)
{
GsaElement1d elem = this.Duplicate(true);
elem.Id = 0;
elem.LocalAxes = null;

LineCurve xLn = this.Line;
xmorph.Morph(xLn);
elem.Line = xLn;

return elem;
}
#endregion
}
}
42 changes: 12 additions & 30 deletions GsaGH/Parameters/2_Geometry/GsaElement1dGoo.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Grasshopper.Kernel;
using Grasshopper.Kernel.Types;
using GsaAPI;
using OasysGH;
using Rhino.Geometry;
using OasysGH.Parameters;
Expand Down Expand Up @@ -114,35 +113,6 @@ public override bool CastFrom(object source)
}
#endregion

#region transformation methods
public override IGH_GeometricGoo Transform(Transform xform)
{
if (Value == null) { return null; }
if (Value.Line == null) { return null; }

GsaElement1d elem = Value.Duplicate(true);
elem.Id = 0;
LineCurve xLn = elem.Line;
xLn.Transform(xform);
elem.Line = xLn;

return new GsaElement1dGoo(elem);
}

public override IGH_GeometricGoo Morph(SpaceMorph xmorph)
{
if (Value == null) { return null; }
if (Value.Line == null) { return null; }

GsaElement1d elem = Value.Duplicate(true);
LineCurve xLn = Value.Line;
xmorph.Morph(xLn);
elem.Line = xLn;

return new GsaElement1dGoo(elem);
}
#endregion

#region drawing methods
public override void DrawViewportMeshes(GH_PreviewMeshArgs args)
{
Expand Down Expand Up @@ -198,5 +168,17 @@ public override void DrawViewportWires(GH_PreviewWireArgs args)
}
}
#endregion

#region transformation methods
public override IGH_GeometricGoo Transform(Transform xform)
{
return new GsaElement1dGoo(Value.Transform(xform));
}

public override IGH_GeometricGoo Morph(SpaceMorph xmorph)
{
return new GsaElement1dGoo(Value.Morph(xmorph));
}
#endregion
}
}
1 change: 0 additions & 1 deletion GsaGH/Parameters/2_Geometry/GsaElement2d.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using OasysUnits;
using OasysUnits.Units;
using Rhino.Geometry;
using Grasshopper.Kernel.Types;

namespace GsaGH.Parameters
{
Expand Down
2 changes: 2 additions & 0 deletions GsaGH/Parameters/2_Geometry/GsaMember1d.cs
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ public GsaMember1d Transform(Transform xform)
{
GsaMember1d dup = this.Duplicate(true);
dup.Id = 0;
dup.LocalAxes = null;

List<Point3d> pts = this._topo.ToList();
Point3dList xpts = new Point3dList(pts);
Expand All @@ -374,6 +375,7 @@ public GsaMember1d Morph(SpaceMorph xmorph)
{
GsaMember1d dup = this.Duplicate(true);
dup.Id = 0;
dup.LocalAxes = null;

List<Point3d> pts = this._topo.ToList();
for (int i = 0; i < pts.Count; i++)
Expand Down
1 change: 0 additions & 1 deletion GsaGH/Parameters/2_Geometry/GsaMember1dGoo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ public override IGH_GeometricGoo Morph(SpaceMorph xmorph)
{
return new GsaMember1dGoo(Value.Morph(xmorph));
}

#endregion

#region drawing methods
Expand Down

0 comments on commit 296bd13

Please sign in to comment.