sketchgraphs.onshape.client.Client¶
-
class
sketchgraphs.onshape.client.
Client
(stack='https://cad.onshape.com', logging=True)¶ Defines methods for testing the Onshape API. Comes with several methods:
Create a document
Delete a document
Get a list of documents
-
- stack (str, default='https
//cad.onshape.com’): Base URL
-
- logging
Turn logging on or off
- Type
bool, default=True
-
__init__
(stack='https://cad.onshape.com', logging=True)¶ Instantiates a new Onshape client.
- Parameters
stack (str (-) – //cad.onshape.com’): Base URL
default='https – //cad.onshape.com’): Base URL
logging (-) – Turn logging on or off
-
add_feature
(did, wid, eid, payload)¶ Add feature for specified document / workspace / part studio.
- Parameters
did (-) – Document ID
wid (-) – Workspace ID
eid (-) – Element ID
- Returns
Onshape response data
- Return type
requests.Response
-
create_assembly
(did, wid, name='My Assembly')¶ Creates a new assembly element in the specified document / workspace.
- Parameters
did (-) – Document ID
wid (-) – Workspace ID
name (-) –
- Returns
Onshape response data
- Return type
requests.Response
-
delete_document
(did)¶ Delete the specified document.
- Parameters
did (-) – Document ID
- Returns
Onshape response data
- Return type
requests.Response
-
delete_feature
(did, wid, eid, fid)¶ Delete feature for specified document / workspace / part studio / feature.
- Parameters
did (-) – Document ID
wid (-) – Workspace ID
eid (-) – Element ID
fid (-) – Feature ID
- Returns
Onshape response data
- Return type
requests.Response
-
get_document
(did)¶ Get details for a specified document.
- Parameters
did (-) – Document ID
- Returns
Onshape response data
- Return type
requests.Response
-
get_features
(did, wid, eid, timeout=None)¶ Gets the feature list for specified document / workspace / part studio.
- Parameters
did (-) – Document ID
wid (-) – Workspace ID
eid (-) – Element ID
timeout (-) – Timeout passed to requests.request().
- Returns
Onshape response data
- Return type
requests.Response
-
get_partstudio_tessellatededges
(did, wid, eid)¶ Gets the tessellation of the edges of all parts in a part studio.
- Parameters
did (-) – Document ID
wid (-) – Workspace ID
eid (-) – Element ID
- Returns
Onshape response data
- Return type
requests.Response
-
get_tess_sketch_entities
(did, wid, eid, sid)¶ Gets the tessellations of the sketch entities in a sketch.
- Parameters
did (-) – Document ID
wid (-) – Workspace ID
eid (-) – Element ID
sid (-) – Sketch feature ID
- Returns
Onshape response data
- Return type
requests.Response
-
get_thumbnail_with_size
(did, wid, sz)¶ Gets the thumbnail image for specified document / workspace with size sz.
- Parameters
did (-) – Document ID
wid (-) – Workspace ID
sz (-) – Dimension of square image
- Returns
Onshape response data
- Return type
requests.Response
-
list_documents
()¶ Get list of documents for current user.
- Returns
Onshape response data
- Return type
requests.Response
-
new_document
(name='Test Document', owner_type=0, public=False)¶ Create a new document.
- Parameters
name (-) – The doc name
owner_type (-) – 0 for user, 1 for company, 2 for team
public (-) – Whether or not to make doc public
- Returns
Onshape response data
- Return type
requests.Response
-
part_studio_stl
(did, wid, eid)¶ Exports STL export from a part studio
- Parameters
did (-) – Document ID
wid (-) – Workspace ID
eid (-) – Element ID
- Returns
Onshape response data
- Return type
requests.Response
-
rename_document
(did, name)¶ Renames the specified document.
- Parameters
did (-) – Document ID
name (-) – New document name
- Returns
Onshape response data
- Return type
requests.Response
-
sketch_information
(did, wid, eid, payload=None)¶ Get information for sketches in a part studio.
- Parameters
did (-) – Document ID
wid (-) – Workspace ID
eid (-) – Element ID
- Returns
Onshape response data
- Return type
requests.Response
-
upload_blob
(did, wid, filepath='./blob.json')¶ Uploads a file to a new blob element in the specified doc.
- Parameters
did (-) – Document ID
wid (-) – Workspace ID
filepath (-) – Blob element location
- Returns
Onshape response data
- Return type
requests.Response