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

fix(tekla): openings as curves #440

Closed

Conversation

dogukankaratas
Copy link
Contributor

Description

We were failing to send proper openings to viewer. After some discussion, we decided to represent the openings with curves. I added the OpeningsToSpeckleConverter to detect openings which are represented as BooleanPart in Tekla.

image

There are two parts of cuts mainly: polygon cut and part cut. Polygon cut was working fine, but with the part cut, my logic was adding lines to whole cutting part.

image

Therefore I added logic matching with the plane coordinates.

image

Checklist:

  • My pull request follows the guidelines in the Contributing guide?
  • My pull request does not duplicate any other open Pull Requests for the same update/change?
  • My commits are related to the pull request and do not amend unrelated code or documentation.
  • My code follows a similar style to existing code.
  • I have added appropriate tests.
  • I have updated or added relevant documentation.

Copy link

linear bot commented Dec 9, 2024

Copy link

codecov bot commented Dec 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 9.43%. Comparing base (0e0dd81) to head (a45489e).
Report is 2 commits behind head on dev.

Additional details and impacted files
@@          Coverage Diff          @@
##             dev    #440   +/-   ##
=====================================
  Coverage   9.43%   9.43%           
=====================================
  Files        223     223           
  Lines       4209    4209           
  Branches     487     487           
=====================================
  Hits         397     397           
  Misses      3796    3796           
  Partials      16      16           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

Lets do a live PR session tomorrow, maybe we can cleanup/improve nested while loops

@@ -28,6 +31,8 @@ public static IServiceCollection AddTeklaConverters(this IServiceCollection serv
ConverterSettingsStore<TeklaConversionSettings>
>();

serviceCollection.AddTransient<ITypedConverter<TSM.BooleanPart, IEnumerable<Base>>, OpeningToSpeckleConverter>();
Copy link
Member

Choose a reason for hiding this comment

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

AFAIK you do not need to register ITypedConverters explicitly. Some magic (serviceCollection.AddMatchingInterfacesAsTransient(converterAssembly)) can handle them. Did you have a problem before with that?

yield return line;
}
break;

default:
yield break;
Copy link
Member

Choose a reason for hiding this comment

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

regardles we can log here instead swallowing. pre-existing problem

else if (parent is TSM.BooleanPart boolPart)
{
solid = boolPart.OperativePart?.GetSolid();
}
Copy link
Member

Choose a reason for hiding this comment

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

do we have else case somehow. smells a bit

}

var vertexEnum = loop.GetVertexEnumerator();
while (vertexEnum.MoveNext())
Copy link
Member

Choose a reason for hiding this comment

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

OMG. 3 nested while loop, how crazy we are ( ͡°( ͡° ͜ʖ( ͡° ͜ʖ ͡°)ʖ ͡°) ͡°)
at least this converter deserves inline comments/notes. hard to understand from first look. also wanna know why we need that while loops, seems like API thing but some explanation around structure would be good

return new TG.Point(point.X, point.Y, Math.Max(minZ, Math.Min(maxZ, point.Z)));
}

public IEnumerable<Base> Convert(TSM.BooleanPart target)
Copy link
Member

Choose a reason for hiding this comment

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

i would put public methods above always, but it is QoL...


var vertices = new List<TG.Point>();
var vertexEnum = loop.GetVertexEnumerator();
while (vertexEnum.MoveNext())
Copy link
Member

Choose a reason for hiding this comment

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

i am hesitant with these dudes, but happy to do live PR review together with you on this

@oguzhankoral
Copy link
Member

Lets not merge this to target proper ear cut implementation. Closing it

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