<commit_before>#!/usr/bin/env python
import numpy as np
from onshape_api.client import Client
from copy import copy
from robot import Robot
import sys
import os
import json
import csg

# DOFs should be named "dof..."

# Loading configuration
robots = 'robots/demo/'
if len(sys.argv) > 1:
    robot = sys.argv[1]

configFile = robot+'/config.json'
client = Client(logging=False, creds=configFile)
config = json.load(open(configFile))

documentId = config['documentId']
drawFrames = config['drawFrames']
drawCollisions = config['drawCollisions']
useScads = config['useScads']
assemblyName = config['assemblyName']
outputDirectory = robot

try:
    os.makedirs(outputDirectory)
except OSError:
    pass

print('* Retrieving workspace ID ...')
document = client.get_document(documentId).json()
workspaceId = document['defaultWorkspace']['id']
print('- Workspace id: '+workspaceId)

print('* Retrieving elements in the document, searching for the assembly...')
elements = client.list_elements(documentId).json()
assemblyId = None
for element in elements:
    if element['type'] == 'Assembly' and element['name'].lower() == assemblyName:
        print("- Found assembly, id: "+element['id']+', name: "'+element['name']+'"')
        assemblyId = element['id']<commit_msg>Default value<commit_after>#!/usr/bin/env python
import numpy as np
from onshape_api.client import Client
from copy import copy
from robot import Robot
import sys
import os
import json
import csg

# DOFs should be named "dof..."

# Loading configuration
robot = 'robots/demo/'
if len(sys.argv) > 1:
    robot = sys.argv[1]

configFile = robot+'/config.json'
client = Client(logging=False, creds=configFile)
config = json.load(open(configFile))

documentId = config['documentId']
drawFrames = config['drawFrames']
drawCollisions = config['drawCollisions']
useScads = config['useScads']
assemblyName = config['assemblyName']
outputDirectory = robot

try:
    os.makedirs(outputDirectory)
except OSError:
    pass

print('* Retrieving workspace ID ...')
document = client.get_document(documentId).json()
workspaceId = document['defaultWorkspace']['id']
print('- Workspace id: '+workspaceId)

print('* Retrieving elements in the document, searching for the assembly...')
elements = client.list_elements(documentId).json()
assemblyId = None
for element in elements:
    if element['type'] == 'Assembly' and element['name'].lower() == assemblyName:
        print("- Found assembly, id: "+element['id']+', name: "'+element['name']+'"')
        assemblyId = element['id']
{'fraction_non_alphanumeric': 0.1408785120696478, 'fraction_numerical': 0.0015829046299960427, 'mean_word_length': 5.383838383838384, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '385445', 'n_tokens_mistral': 766, 'n_tokens_neox': 755, 'n_words': 218}