Page 1 of 1
Save As 3mf macro
Posted: Thu Jun 01, 2023 3:21 pm
by SPerman
I have a macro that I wrote several years ago that saves the model as a .3mf file. It worked fine until I upgraded to windows 11. Now, if I try and open the .3mf file, the slicing software (multiple) says the file does not contain any geometry. I went to my macro and changed the extension from .3mf to .stl and it works fine. Does anyone have any idea what might have changed, or how to fix it? (2022 SP5)
Code: Select all
' Save As
longstatus = Part.SaveAs3(sModelFullName, 0, 2)
SHAddToRecentDocs 2, sModelFullName
End Sub
Re: Save As 3mf macro
Posted: Thu Jun 01, 2023 3:26 pm
by AlexLachance
SPerman wrote: ↑Thu Jun 01, 2023 3:21 pm
I have a macro that I wrote several years ago that saves the model as a .3mf file. It worked fine until I upgraded to windows 11. Now, if I try and open the .3mf file, the slicing software (multiple) says the file does not contain any geometry. I went to my macro and changed the extension from .3mf to .stl and it works fine. Does anyone have any idea what might have changed, or how to fix it? (2022 SP5)
Code: Select all
' Save As
longstatus = Part.SaveAs3(sModelFullName, 0, 2)
SHAddToRecentDocs 2, sModelFullName
End Sub
Sounds like Windows 11 reads the data differently then Windows 10. Maybe you're missing an extension?
Re: Save As 3mf macro
Posted: Fri Jun 02, 2023 8:01 am
by mario malic
I would suggest to record a macro yourself in which you will save as .3mf format and see if there are any differences between recorded one and yours.
Re: Save As 3mf macro
Posted: Tue Jun 20, 2023 7:53 am
by Stefan Sterk
Does using the SaveAs3 method from IModelDocExtension give a different result?
Re: Save As 3mf macro
Posted: Tue Jun 20, 2023 8:03 am
by JSculley
SPerman wrote: ↑Thu Jun 01, 2023 3:21 pm
I have a macro that I wrote several years ago that saves the model as a .3mf file. It worked fine until I upgraded to windows 11. Now, if I try and open the .3mf file, the slicing software (multiple) says the file does not contain any geometry. I went to my macro and changed the extension from .3mf to .stl and it works fine. Does anyone have any idea what might have changed, or how to fix it? (2022 SP5)
Code: Select all
' Save As
longstatus = Part.SaveAs3(sModelFullName, 0, 2)
SHAddToRecentDocs 2, sModelFullName
End Sub
Can you upload a sample 3mf file that fails to open?
Re: Save As 3mf macro
Posted: Tue Jun 20, 2023 9:39 am
by SPerman
Fails to load:
Bambulab
simplify3d
Windows built in 3dviewer
Successfully loads:
Raise3d Ideamaker
Solidworks
I moved back to the STL format for a couple of reasons. Bambulab saves its files in the 3mf format. So now the 3mf no longer represents the geometry, but the entire build plate. Saving as an STL means I can always go back to the geometry of the part.
Re: Save As 3mf macro
Posted: Tue Jun 20, 2023 1:44 pm
by JSculley
When I try to open this file in Windows10, the BambuStudio error log has this to say:
Code: Select all
2023-06-20 12:06:30.679563[Thread 0x00005778]:Slic3r::_BBS_3MF_Importer::_load_model_from_file:1505extract 4th file Metadata/model_settings.config, total=14
2023-06-20 12:06:30.679563[Thread 0x00005778]:can not find object for assemble item, id= 2
2023-06-20 12:06:30.679563[Thread 0x00005778]:Error (parsing aborted) while parsing xml file at line 31
2023-06-20 12:06:30.679563[Thread 0x00005778]:Archive does not contain a valid model config
The 3MF file format is juts a zip file with various folders/files inside. The model_settings.config file looks like this:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<config>
<object id="2">
<metadata key="name" value="CTW-6C-015-000"/>
<metadata key="extruder" value="1"/>
<part id="1" subtype="normal_part">
<metadata key="name" value="CTW-6C-015-000"/>
<metadata key="matrix" value="1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1"/>
<metadata key="source_file" value="CTW-6C-015-000.3mf"/>
<metadata key="source_object_id" value="0"/>
<metadata key="source_volume_id" value="0"/>
<metadata key="source_offset_x" value="0"/>
<metadata key="source_offset_y" value="-18.033938050270081"/>
<metadata key="source_offset_z" value="1.9049999713897701"/>
<mesh_stat edges_fixed="0" degenerate_facets="0" facets_removed="0" facets_reversed="0" backwards_edges="0"/>
</part>
</object>
<plate>
<metadata key="plater_id" value="1"/>
<metadata key="locked" value="false"/>
<metadata key="thumbnail_file" value="Metadata/plate_1.png"/>
<metadata key="top_file" value="Metadata/top_1.png"/>
<metadata key="pick_file" value="Metadata/pick_1.png"/>
<model_instance>
<metadata key="object_id" value="2"/>
<metadata key="instance_id" value="0"/>
<metadata key="identify_id" value="331"/>
</model_instance>
</plate>
<assemble>
<assemble_item object_id="2" instance_id="0" transform="1 0 0 0 1 0 0 0 1 1 -17.033938050270081 1.9049999713897705" offset="0 0 0" />
</assemble>
</config>
Line 31 is the
assemble_item tag.
The interesting thing is that when I save a part or assembly file to 3MF format using SOLIDWORKS (2022 SP5) directly or via the API, there is no modle_settings.config file generated in the 3MF archive. What is the story of the file you are exporting? Is it a part, assembly, component in an assembly? Was it created in SW or imported from something else? What 3D printer do you have selected in SW?
Re: Save As 3mf macro
Posted: Tue Jun 20, 2023 2:13 pm
by SPerman
It is a part created in solidworks, exported from the file ( not an assembly.)
This is what is exported out of solidworks.
- image.png (52.7 KiB) Viewed 1716 times
This is what appears in Ideamaker (the only software other than solidworks which will open the file.)
- image.png (22.27 KiB) Viewed 1716 times
I just duplicated the entire process to make sure I didn't do something along the way to cause the problem.
The attached folder contains 2 files. One opens, the other doesn't. I've also included the 2 solidworks files in case you want to check them out.
Re: Save As 3mf macro
Posted: Wed Jun 21, 2023 8:49 am
by JSculley
SPerman wrote: ↑Tue Jun 20, 2023 2:13 pm
It is a part created in solidworks, exported from the file ( not an assembly.)
This is what is exported out of solidworks.
image.png
This is what appears in Ideamaker (the only software other than solidworks which will open the file.)
image.png
I just duplicated the entire process to make sure I didn't do something along the way to cause the problem.
The attached folder contains 2 files. One opens, the other doesn't. I've also included the 2 solidworks files in case you want to check them out.
Looking at the the files in your 3mf2.zip, the two 3MF files are very different. Specifically the
Metadata folder. Here they are side by side:
The file on the left is typical of a 3MF file exported from SW. Just a thumbnail in the
Metadata folder. The file on the right has a lot more information, including G-code, printer specific info, etc. It looks like it has been saved from Bambu studio. If I delete everything inside the Metadata folder, Bambu will load the 3MF file with no problem.
The fact that Ideamaker shows two instances of the part is another strange thing.
Now, my original thought was that Windows 11 had somehow messed up the file encoding. This is still a possibility. My tests are on a Windows 10 machine, so when I alter the 3MF file, it might be saving it with the correct encoding again. As a test, I edited a file in each 3MF file by adding a couple of new line characters in the [Content_Types].xml file. Then I saved them and attached them below. If you can open them with no problems then this may be an encoding issue. Try it and report back.