Skip to content

Add Features: Export as Batch / Name objects after filenames#38

Open
TheTiEr wants to merge 7 commits intoGhostkeeper:masterfrom
TheTiEr:master
Open

Add Features: Export as Batch / Name objects after filenames#38
TheTiEr wants to merge 7 commits intoGhostkeeper:masterfrom
TheTiEr:master

Conversation

@TheTiEr
Copy link

@TheTiEr TheTiEr commented May 27, 2021

There are 3 essential and very helpful changes in this pull request:

  1. The imported models are named after the file name. This permits an easier identification when importing more than one model at a time
  2. The export is extended with the ability to export objects as a batch. Just like the feature while exporting STL files.
  3. there was a Scaling issue when the length unit was set to mm and the scaling factor to 0.001. Only with these settings the measurements are correct. If one has imported an STL and a 3mf at the same time one of those was out of scale. With this fix both have the correct measurements

Copy link
Owner

@Ghostkeeper Ghostkeeper left a comment

Choose a reason for hiding this comment

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

The automated tests are failing at the moment, due to these changes.

except EnvironmentError as e:
log.error(f"Unable to complete writing to 3MF archive: {e}")
return {'CANCELLED'}
elif self.batch_mode == 'OBJECT':
Copy link
Owner

Choose a reason for hiding this comment

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

We're going to need some tests for this mode.

archive.close()
except EnvironmentError as e:
log.error(f"Unable to complete writing to 3MF archive: {e}")
return {'CANCELLED'}
Copy link
Owner

Choose a reason for hiding this comment

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

Can we do something about the code duplication in this section?

if context.scene.unit_settings.scale_length != 0:
scale *= context.scene.unit_settings.scale_length # Apply the global scale of the units in Blender.
#if context.scene.unit_settings.scale_length != 0:
# scale *= context.scene.unit_settings.scale_length # Apply the global scale of the units in Blender.
Copy link
Owner

Choose a reason for hiding this comment

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

This means that the unit scale in Blender has no effect any more on how big the model becomes that gets imported. That is a bug.

3MF specifies that the model coordinates are always in millimetres. So the actual size of the model is known and should be loaded in correctly. STL has no such specification. The units are units. Pretty much all STL files assume that the unit is millimetres, although some STL files are generated in inches as well. For STL then it is important that the unit and/or scale is set correctly when importing the STL. Sadly, Blender defaults to using metres as units, which is almost always wrong. That is an issue with the STL importer though and should be fixed there.

Making STL and 3MF import at the same scale by removing the scaling from 3MF effectively makes both the STL and the 3MF files import wrongly (STL semi-wrong since it doesn't specify the unit length, and 3MF definitely wrong).

@Ghostkeeper Ghostkeeper added the Needs Info Needs more information from the issue reporter. label Sep 4, 2021
@Ghostkeeper Ghostkeeper added Needs Work This pull request is incomplete, and needs further changes before it will be considered. and removed Needs Info Needs more information from the issue reporter. labels Nov 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Work This pull request is incomplete, and needs further changes before it will be considered.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants