Skip to content

Update with assistance of AI to solve internalisable/savable data - #5

Merged
jjsolly merged 1 commit into
masterfrom
StorableData
Aug 6, 2026
Merged

Update with assistance of AI to solve internalisable/savable data#5
jjsolly merged 1 commit into
masterfrom
StorableData

Conversation

@jjsolly

@jjsolly jjsolly commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Primary change - Made the data types inherent from GH_Goo so that data from K2E can be internalised and accessed after .gh is saved and reopened. Also lets K2E data be stored and accessed with the native GH DataInput and DataOutput components.

All 7 custom data classes in DataTypes/ now inherit from Grasshopper.Kernel.Types.GH_Goo and implement GH_IO.Serialization

At the same time did a bit of data-type tidying to give more consistent naming.

None of this should affect backwards-compatibility of the plugin.

Copilot AI lite review requested due to automatic review settings August 6, 2026 15:38
@jjsolly
jjsolly merged commit 19b8133 into master Aug 6, 2026
1 check passed
@jjsolly
jjsolly deleted the StorableData branch August 6, 2026 15:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates K2Engineering’s custom Grasshopper data types so they can be properly internalised/serialised (persist through saving/reopening .gh files) by converting them to GH_Goo<T> types with explicit Write/Read implementations. It also refactors several Kangaroo GoalObject helper classes out of component classes into a dedicated K2Engineering.Goals namespace to support cleaner reuse and naming consistency.

Changes:

  • Converted 7 custom data containers in DataTypes/ to GH_Goo<T> with Write/Read, Duplicate, and casting support for Grasshopper persistence.
  • Refactored multiple GoalObject implementations into namespace K2Engineering.Goals and updated components to reference them via using K2Engineering.Goals;.
  • Performed minor tidying (including naming/structure reshuffles) alongside the persistence changes.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
K2Engineering/K2Engineering/Support6DOF.cs Moves Support6DOFGoal into K2Engineering.Goals and updates component to reference it.
K2Engineering/K2Engineering/Support.cs Moves SupportGoal into K2Engineering.Goals and updates component to reference it.
K2Engineering/K2Engineering/Rod.cs Moves RodGoal into K2Engineering.Goals and updates component to reference it.
K2Engineering/K2Engineering/Pressure.cs Moves PressureGoal into K2Engineering.Goals and updates component to reference it.
K2Engineering/K2Engineering/Load.cs Moves LoadGoal into K2Engineering.Goals and updates component to reference it.
K2Engineering/K2Engineering/Cable.cs Moves CableGoal into K2Engineering.Goals and updates component to reference it.
K2Engineering/K2Engineering/Beam.cs Moves BeamGoal into K2Engineering.Goals and updates component to reference it.
K2Engineering/K2Engineering/Bar.cs Moves BarGoal into K2Engineering.Goals and updates component to reference it.
K2Engineering/K2Engineering/DataTypes/SupportData.cs Converts SupportData to GH_Goo<SupportData> with persistence and casting.
K2Engineering/K2Engineering/DataTypes/Support6DOFData.cs Converts Support6DOFData to GH_Goo<Support6DOFData> with plane/force/moment persistence.
K2Engineering/K2Engineering/DataTypes/RodData.cs Converts RodData to GH_Goo<RodData> with plane + scalar persistence.
K2Engineering/K2Engineering/DataTypes/PressureData.cs Converts PressureData to GH_Goo<PressureData> and adds array serialisation logic.
K2Engineering/K2Engineering/DataTypes/PointLoadData.cs Converts PointLoadData to GH_Goo<PointLoadData> with persistence and casting.
K2Engineering/K2Engineering/DataTypes/BeamData.cs Converts BeamData to GH_Goo<BeamData> with plane + scalar persistence.
K2Engineering/K2Engineering/DataTypes/BarData.cs Converts BarData to GH_Goo<BarData> with line + scalar persistence and casting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +88 to +103
public class BarGoal : GoalObject
{
double restLenght;
bool isCompressionMember;
double area;

public BarGoal(Line L, double E, double A)
{
restLenght = L.From.DistanceTo(L.To);
isCompressionMember = true;
area = A;

PPos = new Point3d[2] { L.From, L.To };
Move = new Vector3d[2];
Weighting = new double[2] { (2 * E * A) / restLenght, (2 * E * A) / restLenght }; // Units: [N/m]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants