-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path_morph.py
59 lines (46 loc) · 1.71 KB
/
_morph.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
'''
*
* _morph
* GEOVAR MORPH MODULE
*
* Module designed to delegate "onshape-specific" functions or operations
*
* VERSION: 0.0.1
* KNOWN ISSUES:
* - Nada atm.
*
*
* AUTHOR : Mohammad Odeh, Fluvio L. Lobo Fenoglietto
* DATE : Jan. 15th, 2019 Year of Our Lord
*
'''
# onshape modules and libraries
from onshapepy.play import * # Onshape API
# adapted onshape modules and libraries
import _onshape
# additional python modules and libraries
import re
import numpy as np
from itertools import product # Apply product rule on combinations
from time import sleep, time # Timers/delays
# ************************************************************************
# FUNCTIONS =============================================================*
# ************************************************************************
def simple_morph( self ):
'''
simple morph
'''
self.prog_time = time() - self.prog_start_time
print( "[{:0.6f}] Morphing Onshape doc. based on var. product".format(self.prog_time) )
variant_iter = self.variant_iter
var = self.var
arr = self.arr
prods = self.prods
Nprods = len(prods)
Nvars = var['nvar']
updates = []
for i in range(0, Nvars):
updates.append( arr[i][prods[variant_iter][i]] )
_onshape.update_configurations( self, updates )
# check if morph completed successfully...
# --------------------------