Skip to content
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

Documentation for PWS File Format #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

robfitz273k
Copy link

Here's the beginning of documentation for the PWS File Format reverse engineered from the R_E_R_F.pws file.

@X3msnake
Copy link
Member

Greetings Master @robfitz273k thanks for the commit

We have the official source code for the file type from anycubic here:
https://github.com/Photonsters/anycubic-photon-docs/blob/dev/Temp-resources/2019-03-05%20photons%202.0%20file%20format.pdf

What is your FB name so we can talk

@gcarret
Copy link

gcarret commented Oct 29, 2019

Hi @robfitz273k I would be interested by the Java programs you wrote to read the images. I'm currently working on a PCB gerber -> PWS converter and I don't fully understand the Layers format.

@Ordenritterlein
Copy link
Collaborator

@gcarret It basically works the same as the "old" .photon/cbddlp format.
its run length encoding, so it counts down lengths of same-colored pixels up to a max of 125, last bit is color and the rest are how many pixels of that color are encoded by that byte. (if you look at a file in a hex-editor, they limit to 125, even though they could encode 127...) for Antialiasing, which you probably won't use, just count down 1440 * 2560 px and then the new sub-layer starts, no extra header or anything. Hope that helps.

I'm working on a converter between the three file types the photons use (->https://github.com/Ordenritterlein/PhotonsFileConverter) pws support will be up there in a few days hopefully)

@gcarret
Copy link

gcarret commented Oct 29, 2019

@Ordenritterlein Thanks a lot. I couldn't understand why they stopped at 125. I didn't see the link with the antialiasing, since there is also a global parameter for that ... Much clearer now !

@dStruct
Copy link

dStruct commented Apr 24, 2020

Have you guys considered maybe exploring ways to pull the software from the controller board? It might actually be very easy and possible and then you could evaluate the other side of the equation. What the controller is expecting from the file(s).

I would very much like to see this evolve since the latest Photon Workshop is complete garbage, first time I used it on Windows 10 it crashed twice manually adding supports.

Fusion 360 now fully supports 3D printing, slicing, and supports. I would really really love to see a module to Fusion 360 based on what you guys are doing here for the Photon S.

@X3msnake
Copy link
Member

@dStruct use chitubox or prusaslicer with the tool to convert sl1 to your machine.

Extracting the firmware from teh controller will lead nowhere you cannot get source from a binary file that is on the FPGA or the STM32

@dStruct
Copy link

dStruct commented Apr 27, 2020

@dStruct use chitubox or prusaslicer with the tool to convert sl1 to your machine.

Extracting the firmware from teh controller will lead nowhere you cannot get source from a binary file that is on the FPGA or the STM32

Thanks for the reply @X3msnake, yeah currently I just use Chitubox. On the latest AnyCubic firmware they re-added support for .photon files, so I'm just doing supports and slicing in Chitubox and using the .photon format. I did notice Chitubox is missing some of the parameters for a few things relating to machine setup like Anti-alias I think was one of them, when compared to Photon Workshop.

I see you have some experience working with Fusion 360 Post Processing modules, that is exactly what I'm hoping someone develops for the AnyCubic line of SLA printers, from initial glance it looks like Fusion has the ability to do a much better job at supports and slicing then even Chitubox (not that it's not great). Given the fact that a lot of information is out there relating to the .photon format which is now supported again, I hope a Fusion post module becomes a reality at some point.

@X3msnake
Copy link
Member

@dStruct actually i was not aware that F360 had 3D printing untill i read your comments. a quick search on the web and it seems like it only has path based slicing at the moment and that is no good for our cause...

Did you find a way to output to any kind of image based SLA printer like zip?

@dStruct
Copy link

dStruct commented Apr 27, 2020

I didn't dive into it too deeply, but I'll poke around and see if I can find any kind of SLA style post module, they have specifically Additive type slicing but most of what I saw was all FDM modules.

@X3msnake
Copy link
Member

@dStruct as for the AA in Chitubox, you probably need to create a new default printer so it has access to all feautures and make sure you are using the latest version.

Anycubic S board type uses the same type of AA faking as Chitubox Cbddlp and .photon. it is a series of monochrome pictures slightly different. so the results are not that great and it is mostly just a bloated file.

AA s only good for shallow vertical wall too. so for most part youa re better off using monochrome

There are community tools to convert sl1 format to pws so you can slice directly from prusaslicer and covert the file too

@dStruct
Copy link

dStruct commented Apr 28, 2020

@X3msnake, so I did some digging around and the closest support I could find for something like this in the Autodesk ecosystem is to use MeshMixer and using Open Photon Slicer as a sort of plugin/module. Which brings up some questions, first given that the .photon format is now supported again, is Open Photon Slicer still a viable/compatible option to use with the “new” boards. And second question is more of a comment, but I think it would be extremely useful to be able to export the STL similar to how MeshMixer is doing it into Open Photon Slicer from within Fusion 360 as some kind of a Plugin/Addon, or possibly a Post Processor in the Machining tab. Having a GUI interface within Fusion 360 to setup the various OPS command-line options would be really great. I’ve never worked on a module/addon for Fusion 360 so I am not familiar with creating something like this, but I am happy to do some leg work if someone can point me in a starting direction.

@X3msnake
Copy link
Member

X3msnake commented Apr 29, 2020 via email

@jimberg98
Copy link

jimberg98 commented Feb 13, 2021

I whipped up a very basic C# app for reading the PWS file. It's pretty ugly, but can get you to the point of reading PWS files. It's a Windows Forms app that can walk through the slices. I did nothing with preview. I also wasn't sure how AA is supposed to work.

[Edit]

Anti-aliasing is done at the printer so the value just needs to be passed.

This is how you would convert the preview to a bitmap:

private void Load()
{
. . .
_previewData = new byte[_preview.Width * _preview.Height * 2];
_stream.Read(_previewData, 0, _previewData.Length);
Preview = new Bitmap(_preview.Width, _preview.Height, _preview.Width * 2,
PixelFormat.Format16bppArgb1555,
Marshal.UnsafeAddrOfPinnedArrayElement(_previewData, 0));
. . .
}

The document on the format is incorrect in a couple places. It says that the preview image data is Length * 2 bytes. It's actually Width * Height * 2 bytes. I'm not sure about the pixel format, but what I have above does produce a recognizable image.

Have fun.

ReadPWS.zip

@DSchndr DSchndr mentioned this pull request Apr 30, 2021
@FireDeveloper
Copy link

FireDeveloper commented Sep 19, 2021

I whipped up a very basic C# app for reading the PWS file. It's pretty ugly, but can get you to the point of reading PWS files. It's a Windows Forms app that can walk through the slices. I did nothing with preview. I also wasn't sure how AA is supposed to work.

[Edit]

Anti-aliasing is done at the printer so the value just needs to be passed.

This is how you would convert the preview to a bitmap:

private void Load()
{
. . .
_previewData = new byte[_preview.Width * _preview.Height * 2];
_stream.Read(_previewData, 0, _previewData.Length);
Preview = new Bitmap(_preview.Width, _preview.Height, _preview.Width * 2,
PixelFormat.Format16bppArgb1555,
Marshal.UnsafeAddrOfPinnedArrayElement(_previewData, 0));
. . .
}

The document on the format is incorrect in a couple places. It says that the preview image data is Length * 2 bytes. It's actually Width * Height * 2 bytes. I'm not sure about the pixel format, but what I have above does produce a recognizable image.

Have fun.

ReadPWS.zip

I was trying to do a similar software but without drawing graphics and I was getting an out of bounds exception when decompressing the pixels.
It looks like with 4 AA levels it renders 4 times the picture. Chitubox export.
I tried this line in your code and the same picture appears 4 times.
var result = new Bitmap(_header.XResolution, _header.YResolution * 4);
If you put a counter on var run you can see it draws x4 the pixel of the bitmap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants