Reonarudo / pcb2photon

Image converter to .photon files used by the Anycubic's 3D UV Photon enabling it to produce UV PCB masks.
39 stars 4 forks source link

Tips on building from mac #3

Open a7u7a opened 6 years ago

a7u7a commented 6 years ago

On mac, both $ swift build and building from xcode fail. On xcode I am using swift 4.1.2 toolchain

Error from $ swift build:

pcb2photon/Package.swift:13:5: error: argument 'targets' must precede argument 'dependencies'
    targets: [
    ^
Can't parse Package.swift manifest file because it contains invalid format. Fix Package.swift file format and try again.
error: invalid manifest format

and error from xcode:

CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
    cd /Users/user/Documents/pcb2photon
    export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
    export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
    export TOOLCHAINS=org.swift.41220180531a
    /Library/Developer/Toolchains/swift-4.1.2-RELEASE.xctoolchain/usr/bin/swiftc -incremental -module-name SGLImage -Onone -DSWIFT_PACKAGE -DXcode -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -target x86_64-apple-macosx10.10 -g -module-cache-path /Users/user/Library/Developer/Xcode/DerivedData/ModuleCache -Xfrontend -serialize-debugging-options -enable-testing -I /Users/user/Library/Developer/Xcode/DerivedData/pcb2photon-hcfysdbhqryaiofxfesvanakfsej/Build/Products/Debug -F /Users/user/Library/Developer/Xcode/DerivedData/pcb2photon-hcfysdbhqryaiofxfesvanakfsej/Build/Products/Debug -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -c -j8 /Users/user/Documents/pcb2photon/.build/checkouts/Image.git--6271664722653506445/Sources/SGLImage/Image.swift /Users/user/Documents/pcb2photon/.build/checkouts/Image.git--6271664722653506445/Sources/SGLImage/ImageBMP.swift /Users/user/Documents/pcb2photon/.build/checkouts/Image.git--6271664722653506445/Sources/SGLImage/ImageGIF.swift /Users/user/Documents/pcb2photon/.build/checkouts/Image.git--6271664722653506445/Sources/SGLImage/ImageLoader.swift /Users/user/Documents/pcb2photon/.build/checkouts/Image.git--6271664722653506445/Sources/SGLImage/ImagePNG.swift /Users/user/Documents/pcb2photon/.build/checkouts/Image.git--6271664722653506445/Sources/SGLImage/Inflate.swift -output-file-map /Users/user/Library/Developer/Xcode/DerivedData/pcb2photon-hcfysdbhqryaiofxfesvanakfsej/Build/Intermediates/pcb2photon.build/Debug/SGLImage.build/Objects-normal/x86_64/SGLImage-OutputFileMap.json -parseable-output -serialize-diagnostics -emit-dependencies -emit-module -emit-module-path /Users/user/Library/Developer/Xcode/DerivedData/pcb2photon-hcfysdbhqryaiofxfesvanakfsej/Build/Intermediates/pcb2photon.build/Debug/SGLImage.build/Objects-normal/x86_64/SGLImage.swiftmodule -Xcc -I/Users/user/Library/Developer/Xcode/DerivedData/pcb2photon-hcfysdbhqryaiofxfesvanakfsej/Build/Intermediates/pcb2photon.build/Debug/SGLImage.build/swift-overrides.hmap -Xcc -I/Users/user/Library/Developer/Xcode/DerivedData/pcb2photon-hcfysdbhqryaiofxfesvanakfsej/Build/Products/Debug/include -Xcc -I/Users/user/Library/Developer/Xcode/DerivedData/pcb2photon-hcfysdbhqryaiofxfesvanakfsej/Build/Intermediates/pcb2photon.build/Debug/SGLImage.build/DerivedSources/x86_64 -Xcc -I/Users/user/Library/Developer/Xcode/DerivedData/pcb2photon-hcfysdbhqryaiofxfesvanakfsej/Build/Intermediates/pcb2photon.build/Debug/SGLImage.build/DerivedSources -emit-objc-header -emit-objc-header-path /Users/user/Library/Developer/Xcode/DerivedData/pcb2photon-hcfysdbhqryaiofxfesvanakfsej/Build/Intermediates/pcb2photon.build/Debug/SGLImage.build/Objects-normal/x86_64/SGLImage-Swift.h -Xcc -working-directory/Users/user/Documents/pcb2photon

<unknown>:0: error: no such file or directory: '/Users/user/Documents/pcb2photon/.build/checkouts/Image.git--6271664722653506445/Sources/SGLImage/Image.swift'
<unknown>:0: error: no such file or directory: '/Users/user/Documents/pcb2photon/.build/checkouts/Image.git--6271664722653506445/Sources/SGLImage/ImageBMP.swift'
<unknown>:0: error: no such file or directory: '/Users/user/Documents/pcb2photon/.build/checkouts/Image.git--6271664722653506445/Sources/SGLImage/ImageGIF.swift'
<unknown>:0: error: no such file or directory: '/Users/user/Documents/pcb2photon/.build/checkouts/Image.git--6271664722653506445/Sources/SGLImage/ImageLoader.swift'
<unknown>:0: error: no such file or directory: '/Users/user/Documents/pcb2photon/.build/checkouts/Image.git--6271664722653506445/Sources/SGLImage/ImagePNG.swift'
<unknown>:0: error: no such file or directory: '/Users/user/Documents/pcb2photon/.build/checkouts/Image.git--6271664722653506445/Sources/SGLImage/Inflate.swift'
Command /Library/Developer/Toolchains/swift-4.1.2-RELEASE.xctoolchain/usr/bin/swiftc failed with exit code 1
a7u7a commented 6 years ago

I realized I was using the wrong version of swift when attempting swift build, now using with Swift 4.1.2 I get:

/Users/user/Documents/pcb2photon: error: manifest parse error(s):
<unknown>:0: error: Swift does not support the SDK 'MacOSX10.12.sdk'

This is probably a very newbie question, this is my first time using swift and really want to try your code for building PCBs. Thanks!

Reonarudo commented 6 years ago

Hello, If you are running from macOS try to run like this first:

swift build
swift package generate-xcodeproj

then you should be able to run it from XCode if that is what you are looking for. If you just want to create the executable and run it then you have to run the executable created after building it with swift build.

Give it a go and tell me if you still have issues.

a7u7a commented 6 years ago

Thanks for your comment. I dont mind building from xcode or directly from Swift. However, when I do swift build I get:

/Users/User/Documents/pcb2photon: error: manifest parse error(s):
<unknown>:0: error: Swift does not support the SDK 'MacOSX10.12.sdk'

can't get past that :(

Reonarudo commented 6 years ago

That is very strange indeed. Can you tell me what version of macOS and XCode you are using?

a7u7a commented 6 years ago

I'm using osx 10.11.6 (El Capitan) and xcode 8.2.1 hope this helps!

Reonarudo commented 6 years ago

Just curious, did you manually install/compile swift?

a7u7a commented 6 years ago

I downloaded the latest release from https://swift.org/download/#releases. So maybe I can't build it because I am using Xcode 8.2.1 and swift 4 requires Xcode 9.4.1? That would require me to upgrade to OSX 10.13.2 or later.. Am I right?

Reonarudo commented 6 years ago

Unfortunately, it might be so. I will look into how much effort it would be to make it swift 3 compatible but I make no promises.

a7u7a commented 6 years ago

I was able to upgrade to latest OSX and Xcode and could build. Even made my first DIY 2 layer PCB. Took some trial and error because I had to figure a suitable reference point and orientation to make the layers match. Still have some alignment issues but nothing too bad. Just for the record I tried making a PCB with the machine before running into your code. For this I had to go through a bunch of programs(EAGLE, Illustrator, Rhino3D and finally Anycubic's software) in order to turn the 2D vector PCB data into a 3D solid. Came out fine but the whole process took me a like 4 hours just to put the files in the machine. This is so much better. Thank you.

Reonarudo commented 6 years ago

Those are great news! It is very rewarding to get this feedback. I think you will be pleased with the future functionality to use gerber files. Maybe you have a suggestion to mitigate the alignment issues.

a7u7a commented 6 years ago

Yes! gerber files would be great because I still have to use Illustrator to export the file aligned correctly. I will quickly summarize my experience so far:

This is all work in progress so dont take my measurements too seriously!

Reonarudo commented 6 years ago

Those measurements would be very useful since I don't own a photon to test myself. Especially the border between the actual area of exposure and the effective area of exposure. Currently, the 1440x2560px are defined for an area of 68.04x120.96mm. I actually have no idea what movements the printer is doing all the time, I might be able to stop them.

a7u7a commented 6 years ago

Yes, I started with 68.04x120.96mm at first but my 5mm grid was not matching. My current measurements say it is actually 116.56x66 mm but that might vary from machine to machine. We will be using the machine for PCB stuff for the next couple of weeks so I can hopefully provide better measurements that you can use.

Reonarudo commented 6 years ago

That difference is severe! Especially for 3D prints that suffer from shrinkage... If you have the opportunity to re-check it would be great.

X3msnake commented 6 years ago

@Hallulla

Masking is a known "issue" on the photon, if you look closely at the anouced specs here and here it's smaller than the LCD image size.

The way we are doing it in Photon File Validator is warn the user if the file has details in the known safe margins.

The pixel resolution of the machine is 47u and that means that that is the modular unit of the machine 0.047mm so it would be great to have pixel alignment and dimension fitting to that unit.

My idea for the registration is to make a template from the alan screws that ppl can cut out and make notches in the PCB so that you can use the screws to align front and back. if you do make the acrylic please share it here or in the Photonsters organization on github ;)

As for not moving the platform you can use the config.gcode file to stop the peeling action like I do for the resin exposure range project. Basically have 2 Gcodes, one that put it into PCB mode and the other that returns the machine to it's original settings.

You can check the project here

X3msnake commented 6 years ago

@Hallulla can you post some of your results for me to share on the fb photon owner group?