Git Product home page Git Product logo

Comments (12)

rafaelhefele avatar rafaelhefele commented on July 16, 2024

Thanks!
Could you let me know how exactly you would download STEPs/ShadedViews of a part (not partstudio) if it worked (using the python client)?
I also asked about downloading drawings. Is that currently working? If so, could you please also tell me how to download a drawing based on document-id, version-id and element-id of an onshape-app/drawing element? I'm using drawings_api.translate_format4 which doesn't seem to work as I would expect.

I would appreciate any help, thanks!

from onshape-clients.

BubuPalmer avatar BubuPalmer commented on July 16, 2024

Hello,
I can download STEPS from the blob directly with that call:
https://cad-euw1.onshape.com:443/modelexport?workspaceId=1bcea4f3b9786f5e23662c06&microversion=ae91d6fe700e03305522a167&format=STL&mode=binary&grouping=true&scale=1.0&units=inch&_m=240af4f7&documentId=63d990e2dbf26fc0cff94e1c&elementId=628bdce768301ed4c26f20a3

This also works changing mode=text

I have no tried to download drawings.

I could upload the step using the online application. But my problem is that I can't upload any step using the API

from onshape-clients.

eak24 avatar eak24 commented on July 16, 2024

This is fixed... see this test, for instance: https://github.com/onshape-public/onshape-clients/blob/master/python/test/test_export.py#L6

from onshape-clients.

BubuPalmer avatar BubuPalmer commented on July 16, 2024

from onshape-clients.

BubuPalmer avatar BubuPalmer commented on July 16, 2024

from onshape-clients.

BubuPalmer avatar BubuPalmer commented on July 16, 2024

from onshape-clients.

eak24 avatar eak24 commented on July 16, 2024

Hi Victor,

The client code looks like it still needs a little tweaking in what it expects for the response. I'm working on that, but in the meantime, you can just pass in _preload_content=False to the endpoint call and the client won't attempt to deserialize the response. Also, as for the 'unverified' warning, that is just saying urlib doesn't have a mechanism to verify the ssl request, and you need to install one by doing something like this: https://urllib3.readthedocs.io/en/latest/user-guide.html#ssl

from onshape-clients.

BubuPalmer avatar BubuPalmer commented on July 16, 2024

Ok Ethan, thank you. The first issue is solved with in _preload_content=False. But for the second one I've been trying https://urllib3.readthedocs.io/en/latest/user-guide.html#ssl. But I don't know how to apply it to the client library. Do I have to modify the source code of the library? or can I set any static or singleton parameter to enable that mechanism of verification? Is it posible to disable it too? The problem is that I don't know where do I have to apply this in the client code: urllib3.PoolManager(cert_reqs='CERT_REQUIRED',ca_certs=certifi.where())

from onshape-clients.

BubuPalmer avatar BubuPalmer commented on July 16, 2024

Hello Ethan, with the first examples of api calls that I downloaded from Git hub it was so easy to connect. Now, since I am using the onshape_clientes 0.36, everything becomes more difficult, and I can not reuse the tests that I did before. The problem that I have now is that I can't create a new document. The client asks me for a parameter: BTDocumentParameters(). I've trying to initialize BTDocumentParameters with no arguments, as I have seen in DocumentsApi.md:

    bt_document_params = BTDocumentParams() 

    api_response = Client.get_client().documents_api.create_document(bt_document_params)

but I get this invalid empty argument error:

File "/Users/woocomerce/repos/proto-data-batch/venv/lib/python3.7/site-packages/onshape_client-0.0.36-py3.7.egg/onshape_client/oas/rest.py", line 268, in request
raise ApiException(http_resp=r)
onshape_client.oas.exceptions.ApiException: (400)
Reason: Bad Request
HTTP response headers: HTTPHeaderDict({'Server': 'nginx', 'Date': 'Wed, 11 Mar 2020 18:20:12 GMT', 'Content-Type': 'application/json;charset=utf-8', 'Content-Length': '97', 'Connection': 'keep-alive', 'On-Version': '1.110.25036.822859bf4713', 'On-Request-Id': '5d9066b22a9efc3d52a4b910', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block'})
HTTP response body: {
"moreInfoUrl" : "",
"message" : "Invalid empty argument.",
"status" : 400,
"code" : 0
}

The only think that I need is to create a new document. Please, can you tell me what is the missing parameter the I am not writing for BTDocumentParams?

Thank you

from onshape-clients.

BubuPalmer avatar BubuPalmer commented on July 16, 2024

done:
with those parameters por BTDocumentPArams:

bt_document_params=BTDocumentParams(
owner_type=0,
name="filename",
is_public=True
)

from onshape-clients.

eak24 avatar eak24 commented on July 16, 2024

You can request SSL certification through the configuration object: https://github.com/onshape-public/onshape-clients/blob/master/python/onshape_client/oas/rest.py#L64 . And that is actually set by default here to false: https://github.com/onshape-public/onshape-clients/blob/master/python/onshape_client/client.py#L198 . So for right now, you can't override that setting. I'll put that on the list of things to change for the next version. Thanks for pointing this out! For now, are you OK with making the unverified requests?

from onshape-clients.

BubuPalmer avatar BubuPalmer commented on July 16, 2024

yes, ok

from onshape-clients.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.