trevorsandy / lpub3d

An LDraw™ editor for LEGO® style digital building instructions.
https://trevorsandy.github.io/lpub3d/
130 stars 19 forks source link

Submodels shown in BOM when using INSERT DISPLAY_MODEL #739

Closed trevorsandy closed 10 months ago

trevorsandy commented 10 months ago

Subject

Submodels are shown as parts in the BOM when using INSERT DISPLAY_MODEL meta command.

Environment

Version of LPub3D - 2.4.7 Operating system - All

Expected behaviour

Submodels should not be present in the BOM.

Actual behaviour

Submodels are present in the BOM

LPub3D - 2.4.7r52: Rock Crawler_300_DPI_page_2 Rock Crawler_300_DPI_page_3

LPub3D - 2.4.7r53 and 2.4.7r52 2023-08-30 21_32_07-Rock Crawler ldr - LPub3D v2 4 7 r52 (Dev-release) 2023-08-30 21_32_48-Rock Crawler ldr - LPub3D v2 4 7 r52 (Dev-release)

Solution

Fix it.

Cheers,

trevorsandy commented 10 months ago

This behaviour was introduced by #704.

With #704, lines are parsed for the INSERT DISPLAY_MODEL command during model load. A 'display model' flag is set when this command is encountered and, incorrectly, was only reset after encountering a type 1-5 line or end of file. As a result, when a STEP containing this command does not have any type 1-5 lines defined (the behaviour before #704), the first submodel encountered after the display model STEP would be flagged as a display model. Consequently, this erroneous submodel setting would trigger a false positive for the 'is part' condition when the submodel is encountered during BOM creation.

This behaviour has been corrected.

Before correction: BOM_Parts_01

After correction: BOM_Parts_02

Cheers,

technicbasics commented 10 months ago

Amazing! Thank you very much Trevor. 👍🏻