Skip to content

Fix for issues #5422, #3411, and #5443 -- DXF insert scaling fix and colour fix - #5426

Merged
kimkulling merged 6 commits into
assimp:masterfrom
seanth:master
Jan 27, 2024
Merged

kimkulling merged 6 commits into
assimp:masterfrom
seanth:master

Conversation

@seanth

@seanth seanth commented Jan 17, 2024 •

Copy link
Copy Markdown
Contributor

This is a very simple one line change.

In the previous version, if a dfx had multiple inserts that had different scales, assimp would place the insert in xyz space in locations that were incorrect. Outputs from assimp would have files that would be very different from what apps like sketchup or the online autodesk viewer would produce.

The bug was because scaling of the insert was being done before placement, resulting in the placement being placement•scale. For example, the insert would be placed at (pos.x•scale.x),(pos.y•scale.y),(pos.z•scale.z) instead of pos.x, pos.y, pos.z

Moving the line of code responsible for determining placement to before the line of code dealing with scaling fixes this.

I suspect this was an edge-case as the code has been in use for 10 or 12 years now and there hasn't been a bug report, but I suspect it explains why a subset of dxf viewers/converters out there mangle my files in exactly the same way. I think they relied on code from assimp

Edited out line suspected to be causing changes in position when changes in scale are made to inserted BLOCKS
Changed order of operations for insert positioning and scaling. Need to position the inserts before scaling it, otherwise the position ends up up being position*scale
@seanth seanth changed the title Fix for issue #5422 -- DXF conversions no longer incorrectly place inserts incorrectly when scale changes Fix for issue #5422 -- DXF conversions no longer incorrectly place inserts when scale changes Jan 18, 2024
The previous table was in an incorrect order, leading to index references in DXF producing the wrong colours when converted.

Also added other entries to bring the total number of ACI colours up  to the number that can be used in DXF files
@seanth

seanth commented Jan 26, 2024

Copy link
Copy Markdown
Contributor Author

Updated AIC table resolves issues #3411 and #5443

Image in sketchup:
Screenshot 2024-01-26 at 15 42 36

Image of resulting .obj made with assimp using the changes in this pr:

Screenshot 2024-01-26 at 16 22 41

@seanth seanth changed the title Fix for issue #5422 -- DXF conversions no longer incorrectly place inserts when scale changes Fix for issues #5422, #3411, and #5443 -- DXF insert scaling fix and colour fix Jan 26, 2024
- Use constexpr instead of const.
@kimkulling
kimkulling self-requested a review January 27, 2024 10:14
@kimkulling kimkulling added Bug Global flag to mark a deviation from expected behaviour DXF Bugs related to the DXF format. labels Jan 27, 2024

@kimkulling kimkulling left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks fine.

@kimkulling
kimkulling merged commit a8d30f7 into assimp:master Jan 27, 2024
@kimkulling

Copy link
Copy Markdown
Member

Merged, thanks a lot for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Global flag to mark a deviation from expected behaviour DXF Bugs related to the DXF format.

Projects

Development

Successfully merging this pull request may close these issues.

2 participants