-
Notifications
You must be signed in to change notification settings - Fork 19
-
Notifications
You must be signed in to change notification settings - Fork 19
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
Wrong instance count in subsubmodels with CONSOLIDATE_INSTANCE_COUNT AT_TOP #537
Comments
Thank you for reporting this behaviour. Indeed, there may be instance count edge cases that are not calculated as there are so many combinations of submodel inclusions possible. There are even cases where the correct number of modelled instances has to be overridden to reflect the actual physical build requirements. Untreated cases are precisely the reason for the count override command However, my approach is to add edge cases, if reasonable, as they are reported so I will take a look. Please provide the steps to reproduce or an example model file that reproduces this behaviour.
There is no attachment. Cheers, |
Damn I did not notice the file did not attach because .mpd is unknown extension. Sorry. Here it is now. |
By the way, I do not think this is particularly urgent and I'm happy to look at it when I manage to find some time. |
Very well. Cheers, |
The case presented in your example model file is not an edge case, the current LPub3D countInstances behaviour should produce 4 instances of test3.ldr. I’ll take a look. Cheers, |
I found the reason for this behaviour. When a submodel instance is encountered for the first time, I set a flag stating it has been counted, when the submodel is encountered again, its instance count is automatically incremented and the loop continues on to the next line. This approach optimizes performance by avoiding having to parse the same submodel every time it is encountered. However, if that submodel includes a submodel (as in your case), the included submodel instance will not be counted. Although this is not an edge case, enabling it in the current instance count call will have a significant impact on performance. If I can come up with a routine that preserves performance and captures included submodel instances on subsequent encounters, I'll update the count instance call. Otherwise, this case will simply have to use the override command. Performance is important for the count instance call as it is triggered at every page transition. Cheers, |
Thanks for the quick analysis. In case we stay with the override command, I would then suggest a small modification of a few lines, namely :
|
I'll add your suggestion as if the override value is > 1. I also decided to update the countInstance call with the following:
Result from your example file: Before update count elapsed time: 0.039 second Cheers, |
Excellent ! thanks a lot for the fast fix. |
I forgot to mention. This is all you need for your example file to be correct.
Cheers, |
Subject
When having a complex setup where a subsubmodle is included in different submodels and these submodels are inserted several times in the main model, the instance count for the subsubmodel is wrong.
Environment
Screenshots
Steps to reproduce
Just open the attached test.mpd file. First page shows a count of 3 when it should be 4.
Expected behaviour
Count on first page should be 4.
Actual behaviour
Count is 3, seems to be that it forgets that test2 is included twice at the top level, as including it only once still gives 3, which is correct in this case.
In other words, when having subsubmodels, it looks like the number of top level inclusions are not counted and multiplied by the number of lower level ones.
Workaround
Simply force the number by hand via "0 !LPUB PAGE SUBMODEL_INSTANCE_COUNT_OVERRIDE 4"
Solution suggestion
I can try to fix it in the code myself. Did not have time to look at it yet.
The text was updated successfully, but these errors were encountered: