Esempio n. 1
0
'''
exportstl
===

Demos 307 redirects with the Onshape API
'''

from apikey.client import Client

# stacks to choose from
stacks = {
    'partner': 'https://partner.dev.onshape.com',
    'cad': 'https://cad.onshape.com'
}

# create instance of the onshape client; change key to test on another stack
c = Client(stack=stacks['partner'], logging=True)

# get features for doc
did = raw_input('Enter document ID: ')
wid = raw_input('Enter workspace ID: ')
eid = raw_input('Enter element ID: ')

# get the STL export
stl = c.part_studio_stl(did, wid, eid)

# print to the console
print stl.text
Esempio n. 2
0
    zLen = bounding_box_map.get('highZ', 0.0) - bounding_box_map.get(
        'lowZ', 0.0)

    volume = xLen * yLen * zLen
    max_planar_surface_area = max(xLen * yLen, xLen * zLen, yLen * zLen)

    return volume


# stacks to choose from
stacks = {'cad': 'https://cad.onshape.com'}

# create instance of the onshape client; change key to test on another stack
c = Client(
    stack=stacks['cad'],
    creds=
    '/Users/noaflaherty/Documents/Development/Repos/apikey/python/creds.json',
    logging=True)

# get the document details
parts = c.list_parts(DOCUMENT_ID, WORKSPACE_ID)

ordered_colors = read_color_palette(
    '/Users/noaflaherty/Documents/Development/Repos/apikey/python/color_palette.json'
)

part_dict = dict()

for part in parts:
    element_id = part.get('elementId')
    part_id = part.get('partId')
Esempio n. 3
0
'''
app
===

Demos basic usage of the Onshape API
'''

from apikey.client import Client

# stacks to choose from
stacks = {'cad': 'https://cad.onshape.com'}

# create instance of the onshape client; change key to test on another stack
c = Client(stack=stacks['cad'], logging=True)

# make a new document and grab the document ID and workspace ID
new_doc = c.new_document(public=True).json()
did = new_doc['id']
wid = new_doc['defaultWorkspace']['id']

# get the document details
details = c.get_document(did)
print 'Document name: ' + details.json()['name']

# create a new assembly
asm = c.create_assembly(did, wid)

if asm.json()['name'] == 'My Assembly':
    print 'Assembly created'
else:
    print 'Error: Assembly not created'
Esempio n. 4
0
You should give the following information:

	- did (str): Document ID
	- wid (str): Workspace ID
	- eid (str): Element ID

'''

from apikey.client import Client

# stacks to choose from
stacks = {'cad': 'https://cad.onshape.com'}

# create instance of the onshape client; change key to test on another stack
c = Client(stack=stacks['cad'], logging=True)

# get features for doc
#did = raw_input('Enter document ID: ')
#wid = raw_input('Enter workspace ID: ')
#eid = raw_input('Enter element ID: ')

did = 'a87bc0dccf9793fd588c9b5d'
wid = 'cb521c3ed58531b582af2110'
eid = '60f61aff8df2a1a52f5bf5d7'

configuration = {
    'units':
    'meter',
    'scale':
    1.0,
Esempio n. 5
0
'''
exportstl
===

Demos 307 redirects with the Onshape API
'''

from apikey.client import Client

# stacks to choose from
stacks = {'cad': 'https://cad.onshape.com'}

# create instance of the onshape client; change key to test on another stack
c = Client(stack=stacks['cad'], logging=True)

# get features for doc
did = raw_input('Enter document ID: ')
wid = raw_input('Enter workspace ID: ')
eid = raw_input('Enter element ID: ')

# get the STL export
stl = c.part_studio_stl(did, wid, eid)

# print to the console
print stl.text
Esempio n. 6
0
'''

from apikey.client import Client

from pyglet.gl import *
from pyglet.window import *
import pyglet

# stacks to choose from
stacks = {
    'partner': 'https://partner.dev.onshape.com',
    'cad': 'https://cad.onshape.com'
}

# create instance of the onshape client; change key to test on another stack
c = Client(stack=stacks['partner'], logging=True)

# get features for doc
did = raw_input('Enter document ID: ')
wid = raw_input('Enter workspace ID: ')
eid = raw_input('Enter element ID: ')

# grab feature list for doc
features = c.get_features(did, wid, eid).json()['features']

# read rollback data and display it using pyglet
edge_list = []
max_rollback = len(features) + 1
max_count = 100
stride = 1
Esempio n. 7
0
app
===

Demos basic usage of the Onshape API
'''

from apikey.client import Client

# stacks to choose from
stacks = {
    'partner': 'https://partner.dev.onshape.com',
    'cad': 'https://cad.onshape.com'
}

# create instance of the onshape client; change key to test on another stack
c = Client(stack=stacks['partner'], logging=True)

# make a new document and grab the document ID and workspace ID
new_doc = c.new_document(public=True).json()
did = new_doc['id']
wid = new_doc['defaultWorkspace']['id']

# get the document details
details = c.get_document(did)
print 'Document name: ' + details.json()['name']

# create a new assembly
asm = c.create_assembly(did, wid)

if asm.json()['name'] == 'My Assembly':
    print 'Assembly created'