cadquery icon indicating copy to clipboard operation
cadquery copied to clipboard

Import file from AWS bucket

Open michaelnicol opened this issue 2 years ago • 3 comments
trafficstars

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

michaelnicol avatar Aug 19 '23 21:08 michaelnicol

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.

jmwright avatar Aug 19 '23 21:08 jmwright

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

michaelnicol avatar Aug 19 '23 21:08 michaelnicol

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

jmwright avatar Aug 20 '23 01:08 jmwright