Skip to content

fix: cog calc#174

Merged
Krande merged 25 commits intoKrande:mainfrom
oleandor:2026_januar_cog_calc
Jan 28, 2026
Merged

fix: cog calc#174
Krande merged 25 commits intoKrande:mainfrom
oleandor:2026_januar_cog_calc

Conversation

@oleandor
Copy link
Copy Markdown
Contributor

@oleandor oleandor commented Jan 23, 2026

fix part cog and mass calc and genie xml write so it gives matching results! (issue #173)

added section properties; section centroid Cgy and Cgy (not to be confused with neither Cy, Cz, Shceny nor Shcenz which are shear center properties)

when creating a beam, added parameter to choose if wanting to use the offset flush option in genie when writing xml. if it is set to True it will use the flush option, if not it will set a constant offset. both will be the same in genie, however, if updating to a new section in genie later on, it will will update automatically if the genie flush is enabled.

@oleandor
Copy link
Copy Markdown
Contributor Author

@Krande could you do a code review, change the label to release-auto, and squash and merge if all looks good? I see the codspeed-benchmark test fail at "tests/profiling/test_instancing.py ::error::Error: failed to execute the benchmark process, exit code: 1 Error: Process completed with exit code 1." However, when I run the test locally it seems to be no issues.

@Krande
Copy link
Copy Markdown
Owner

Krande commented Jan 24, 2026

@oleandor yes, will do it later today. The codspeed.io error can be disregarded. Will remove that test in an upcoming release

@Krande
Copy link
Copy Markdown
Owner

Krande commented Jan 24, 2026

This looks good! I'll finish a more detailed review of it soon.

I do believe that there needs to be created a relevant test in https://github.com/Krande/adapy/tree/main/tests/core/api which captures the missing offset beam COG calculation you are fixing in this PR. That way we prevent regressions in the future. if you want I can make the test, but it will probably take me some time.

Copy link
Copy Markdown
Owner

@Krande Krande left a comment

Choose a reason for hiding this comment

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

Great stuff! I added comments on a few key items. If you want me to implement some of the suggestions I have proposed, it would really help if you can create a good unit-test that captures the updated COG calculations you are applying here end-to-end.

Comment thread src/ada/api/beams/base_bm.py Outdated
Comment thread src/ada/api/beams/base_bm.py Outdated
Comment thread src/ada/api/plates/base_pl.py Outdated
Comment thread src/ada/cadit/gxml/write/write_beams.py Outdated
Comment on lines +57 to +61
# abs_place = plate.placement.get_absolute_placement()
# origin = abs_place.origin
# for pt in plate.poly.points3d:
# p_tra = origin + pt.copy()
# ET.SubElement(polygon, "position", {"x": str(p_tra[0]), "y": str(p_tra[1]), "z": str(p_tra[2])})
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

comments like these must be removed

Comment thread src/ada/api/beams/base_bm.py Outdated
Comment thread src/ada/api/beams/base_bm.py Outdated
Comment thread src/ada/api/beams/base_bm.py Outdated
Comment thread src/ada/api/beams/base_bm.py Outdated
Comment thread src/ada/api/beams/base_bm.py Outdated
@oleandor
Copy link
Copy Markdown
Contributor Author

oleandor commented Jan 24, 2026

We might wanna fix the glb export also to be consistent with the genie xml export and cog calc? Cannel and angular profile is not matching.

image image image

oleandor and others added 5 commits January 25, 2026 00:27
…one for beams that are set with genie flush option
…januar_cog_calc

# Conflicts:
#	tests/core/api/cog/files/beams_constant_offset.xml
#	tests/core/api/cog/test_cog_beam_offsets.py
…one for beams that are set with genie flush option
@oleandor
Copy link
Copy Markdown
Contributor Author

ok, so i updated some things and made some tests. they all pass except for one beam, it has the genie flush option (IPROFILE). this beam was made in param model where it exist as a TPROFILE before being exported to gnx. Since genie does not have Tprofiles (only unsymmetrical I profile) - the failing test seem to have something to do with cadit/gxml/read/read_beams.js. If you have time to look into this and the rest of the reorganization you commented on, please let me know.

@Krande
Copy link
Copy Markdown
Owner

Krande commented Jan 26, 2026

Yup, have started looking into how the reorganised code should be. Hopefully have it ready tomorrow

@Krande
Copy link
Copy Markdown
Owner

Krande commented Jan 26, 2026

I moved the test files to where the rest of the test files are located and also removed the <rules> and <palette> XML elements from the genie test files. That reduces the file size by >50%. I also wrapped the test code in a test function, so that now it is part of the test suite (before it ran before the test suite as separate code).

@Krande
Copy link
Copy Markdown
Owner

Krande commented Jan 27, 2026

@oleandor, I have added the OffsetHandler class and implemented the redesign. I also added "get_volume" and "get_mass" functions to the Beam object. The tests are passing.

Is there anything else you'd like to add to this PR or should I start the process of merging this? I noticed some todo's. Ideally these should be fixed/removed before merging the PR

@oleandor
Copy link
Copy Markdown
Contributor Author

Great! Let me do a quick check

@oleandor, I have added the OffsetHandler class and implemented the redesign. I also added "get_volume" and "get_mass" functions to the Beam object. The tests are passing.

Is there anything else you'd like to add to this PR or should I start the process of merging this? I noticed some todo's. Ideally these should be fixed/removed before merging the PR

@oleandor
Copy link
Copy Markdown
Contributor Author

I found some cog calc issues (probably unrelated to the test) that i need to fix before we merge. I'll keep you updated. Its related to equipments and and point mass (solved). And plates (working on it)

…e cog calculation (not sure what is does but it fixed the cog issue related to para model SPACES that have EQUIPMENTS(!): removed this: and self.placement.is_identity() is False:). So now it is only # Apply plate placement the same way as solid_geom

        if self.placement is not None:
@oleandor
Copy link
Copy Markdown
Contributor Author

alright! so i fixed the issues with the cog calc for plates and equipments. i also tested the justification in param models and now it all seems to work as wanted! @Krande could you have a final check on the latest updates, and if it seems good please go ahead with the merge

@oleandor
Copy link
Copy Markdown
Contributor Author

ok, so i found another issue that i think i have fixed. i will check some more before i push the solution

Comment thread tests/core/api/cog/test_cog_beam_offsets.py
…ted to is_identity()). why the curret commit fixes the issue is not understood; however, it fixes it
@Krande
Copy link
Copy Markdown
Owner

Krande commented Jan 28, 2026

Let me know when you are done. I will fix the failing test and merge this later today if you are finished

@oleandor
Copy link
Copy Markdown
Contributor Author

Let me know when you are done. I will fix the failing test and merge this later today if you are finished

Great! Thx! I'm finished now.

@github-actions
Copy link
Copy Markdown

👋 Hi there! I have checked your PR and found no issues. Thanks for your contribution!

PR Review:

I found no pr-related issues.

  • ✅ PR title is ok
  • ✅ Release label is ok
  • ✅ SOURCE_KEY is set as a secret
  • ✅ Calculated next version: "0.7.11"

Python Review:

I found no python-related issues.

Python Linting results:

  • ✅ Isort
  • ✅ Black
  • ✅ Ruff

Python Packaging results:

  • ✅ I found the PYPI_API_TOKEN secret.
Packaging Type Package Name Version
pyproject.toml ada-py 0.7.10
pypi ada-py 0.7.10

@Krande Krande merged commit 8ef0a67 into Krande:main Jan 28, 2026
31 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants