Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CNX-9753: Add assembly and subassembly objects to Corridors #3475

Merged

Conversation

clairekuang
Copy link
Member

Description & motivation

This pr adds quite a few new civil classes and restructures how corridors are sent from Civil3D:

  • CivilBaseline
  • CivilBaselineRegion
  • CivilAppliedAssembly
  • CivilAppliedSubassembly
  • CivilCalculatedShape
  • CivilCalculatedLink
  • CivilCalculatedPoint
  • ICivilCalculatedObject interface

Closes #3265

Changes:

  • Objects
  • Civil converter

Screenshots:

sample corridor commit: https://app.speckle.systems/projects/bff55266ce/models/763d2dadb7

@clairekuang
Copy link
Member Author

@JR-Morgan could you review the abstract Baseline class?

Copy link
Member

@oguzhankoral oguzhankoral left a comment

Choose a reason for hiding this comment

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

LGTM! Seems like we combined alignments and profiles under baselines for corridor which is niiiice.

Copy link
Contributor

@jhdempsey86 jhdempsey86 left a comment

Choose a reason for hiding this comment

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

There are a couple more properties of the objects that we could do with adding.
If you could squeeze this in before the next connector update, that would be much appreciated :-)

{
// retrieve subassembly name
Subassembly subassembly = Trans.GetObject(appliedSubassembly.SubassemblyId, OpenMode.ForRead) as Subassembly;

Copy link
Contributor

Choose a reason for hiding this comment

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

Get another property from the subassembly
string SubassemblyMacroOrClassName = subassembly.GeometryGenerator.MacroOrClassName

https://help.autodesk.com/view/CIV3D/2024/ENU/?guid=d78fdeb6-75cc-dd5a-24db-5c67dc4e5f61

Copy link
Member Author

Choose a reason for hiding this comment

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

This one let's save for another issue to add subassembly objects, as this property should be on a new Subassembly class instead of the AppliedSubassembly class

this.shapes = shapes;
this.parameters = parameters;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Add in following property, and add a new parameter into the constructor to set it
public string SubassemblyMacroOrClassName { get; set; }

this.adjustedElevation = adjustedElevation;
this.units = units;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Add property to store the station of this AppliedAssembly and include in the constructor so the value can be set
public double station { get; set; }


// get the applied assemblies
List<CivilAppliedAssembly> speckleAppliedAssemblies = new();
foreach (AppliedAssembly appliedAssembly in region.AppliedAssemblies)
Copy link
Contributor

Choose a reason for hiding this comment

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

If possible, it would be helpful within the AppliedAssembly object to have the station at which it is applied.
The Civil API doesnt give you this directly, but if you use a for loop to loop through the SortedStations, you can get the station for each AppliedAssembly, You then just need to pass that in when creating the Speckle AppliedAssembly

for (int i = 0; i < sortedStations.Length; i++)
{
    var station = sortedStations[i];

    var appliedAssembly= region.AppliedAssemblies[i];

   CivilAppliedAssembly speckleAssembly = AppliedAssemblyToSpeckle(appliedAssembly, station);

   speckleAppliedAssemblies.Add(speckleAssembly);
}

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll add the station property dynamically, since it's not accessible on the appliedAssembly

return speckleAppliedSubassembly;
}

private CivilAppliedAssembly AppliedAssemblyToSpeckle(AppliedAssembly appliedAssembly)
Copy link
Contributor

Choose a reason for hiding this comment

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

Add in a station parameter
private CivilAppliedAssembly AppliedAssemblyToSpeckle(AppliedAssembly appliedAssembly, double station)

speckleSubassemblies.Add(speckleSubassembly);
}

CivilAppliedAssembly speckleAppliedAssembly = new(speckleSubassemblies, appliedAssembly.AdjustedElevation, ModelUnits);
Copy link
Contributor

Choose a reason for hiding this comment

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

Pass the station into the function that creates the SPeckle AppliedAssembly:
CivilAppliedAssembly speckleAppliedAssembly = new(speckleSubassemblies, appliedAssembly.AdjustedElevation, ModelUnits, double station);

@clairekuang clairekuang merged commit 460e9ac into dev Jun 7, 2024
1 of 2 checks passed
@clairekuang clairekuang deleted the CNX-9753-C3D-Add-assembly-and-subassembly-to-Corridors branch June 7, 2024 13:52
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.

4 participants