CadQuery / cadquery

A python parametric CAD scripting framework based on OCCT
https://cadquery.readthedocs.io
Other
3.25k stars 294 forks source link

Import file from AWS bucket #1389

Open michaelnicol opened 1 year ago

michaelnicol commented 1 year ago

I am using cadquery to convert files from STEP to STL.

For this, the files are stored on an AWS server with public-read.

To import, I use the following statement:

afile = cq.importers.importStep("https://company_bucket_name.region.amazonaws.com/file.step") # (mock link)

The file does exist in the real link, as going to it downloads the file. However, when attempting to import via cadquery, I get:

ValueError: STEP File could not be loaded
jmwright commented 1 year ago

The importer does not have a web client built into it. You'll have to use something like the requests module in Python or wrap your CadQuery script in a shell script that uses wget, curl, etc to download the file first.

michaelnicol commented 1 year ago

Could CadQuery in an AWS lambda convert the file on the AWS cloud without downloading it to a separate server?

jmwright commented 1 year ago

I'm only somewhat familiar with AWS lambdas. I think it's possible, but I can't provide provide any guidance on how to do it. If the lambda will let you import the requests module, you might be able to do this:

https://www.w3schools.com/python/module_requests.asp