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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
|
* bolt.cad
* bolt.yaml
** list of ports
** xyz coords
** 4x4 matrix (homogeneous coordinate transformation)
** offset and coordinate rotations
list of ports
xyz coords
4x4 matrix
offset and coordinate rotations
global coordinate frame in the CAD file
"yellow globe" = "control point thingy"
exists at a particular xyz location in reference to the global coordinate frame
its local z direction is pointing this way "outwards" - how it must move in order to mate with the mating part
the x and y would be arbitrary off of this point.
there's another port on the back of this, say, its z is pointing backwards (it has to move in that basic direction)
if y is in the same direction, then x is now where the original z was
it's an extra unit vector (the blue stuff / yellow orbes)
collision detection might be the wrong board
algorithms:
- volume overlap algorithm
- normalize this volume that you find (you find the interference volume)
- the port specifies its volume (in the YAML file)
- average the two port's volumes together and you should never be higher than that (or add them together)
- "the interference volume"
- collision detection
-
up inside this hole, there is a corresponding blue dot that will mate with it
this blue dot is pointing in the z axis in the opposite direction of the other part
y is into the board now (if you will)
when they properly mate, the z values are in opposite directions
the x values must line up
y values are forced to be in opposite directions
the z has to be in the direction of "free movement"
"alignment vector" or something
xyz
rotation asimuth to put this z at that intersection
rotation from the global axis.
4x4 coordinate transformation
tau x tau y tau z == how far you have to transfer the global to get to the point (the blue dot)
the bottom row of the matrix is meaningless (zero)
the other three columns are the original three unit vectors for this blue dot
the z axis is pointing in the positive y, so this would be z, this would be x, this would be y
i -1 0 0 tx
j 0 0 1 ty
k 0 1 0 tz
0 0 0 1
tx = 50
ty = 50
tz = 0
i&x
j&y
k&z
translations
scewings
all sorts of other transformations
IGES over STEP
IGES volumetric & boundary yes/no? this determines what needs to exist in the port data (volumetric primitives & the operations that go)
IGES - add a point at a particular location? then tag it as a control point
ports in a yaml file
ports:
port 1:
- 4x4 location
#- list of faces (ID numbers)
- feature tag ("square") generic geometry
- allowed to be interfering?
# - list of rigid faces (later) (versus compliance)
# - list of flexible faces (later)
# - eventually other stuff
HeeksCAD coordinate transformations - set of axises floating in space where-ever you want (ask fenn)
public double [0 1] compatibility (URI to artifact 1 CAD, URI to artifact 2 CAD)
- this calls the second one
- checks all possible combinations of ports by calling the other overload
- return a giant matrix of the possibilities
public double [0 1] compatibility (URI to artifact 1 CAD, int p#, URI to artifact 2 CAD, int port number #2)
- returns a single value
- don't worry about rotation for starters
rotate and translate the CAD models so that the z's are opposite and the x's line up and so on (for two CAD parts that are being mated)
artifact 2:
[50]
[50]
[0]
artifact 1:
[100]
[10]
[10]
how much do you translate the second one to get to fifty?
move vector = artifact1.translation - artifact2.translation
B
0 0 1 100
-1 0 0 10
0 -1 0 10
0 0 0 1
we want that port to eventually be at:
A
-1 0 0 50
0 0 -1 50
0 -1 0 0
0 0 0 1
so it's just the same as the original 4x4 matrix except x is the same, and the directions on y and z are flipped
transform:
[
[i[0], j[0], k[0], point[0]],
[i[1], j[1], k[1], point[1]],
[i[2], j[2], k[2], point[2]],
[0, 0, 0, 1]
]
A = BT
find the matrix T
then apply this T to the whole part
AB^-1 = T
find the inverse of B
B dot B^-1 = identity matrix
Kramer's rule? (see Wikipedia)
http://stackoverflow.com/questions/211160/python-inverse-of-a-matrix
>>> import numpy
...
>>>
>>> import OCC.gp
>>> OCC.gp.gp_Ax3(
... )
<OCC.gp.gp_Ax3; proxy of <Swig Object of type 'gp_Ax3 *' at 0x20006600> >
>>> OCC.gp.gp_Ax3()
<OCC.gp.gp_Ax3; proxy of <Swig Object of type 'gp_Ax3 *' at 0x20006664> >
>>> OCC.gp.gp_Ax3(1)
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/usr/lib/python2.5/site-packages/OCC/gp.py", line 4726, in __init__
this = _gp.new_gp_Ax3(*args)
NotImplementedError: Wrong number of arguments for overloaded function 'new_gp_Ax3'.
Possible C/C++ prototypes are:
gp_Ax3()
gp_Ax3(gp_Ax2 const &)
gp_Ax3(gp_Pnt const &,gp_Dir const &,gp_Dir const &)
gp_Ax3(gp_Pnt const &,gp_Dir const &)
>>> OCC.gp.gp_Rotation(1)
Traceback (most recent call last):
File "<input>", line 1, in <module>
TypeError: 'int' object is not callable
>>> OCC.gp.gp_Rotation
1
>>> A = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 10], [0, 0, 0, 1]]
>>> B = [[1, 0, 0, 5], [0, 1, 0, 5], [0, 0, 1, -10], 0, 0, 0, 1]]
File "<input>", line 1
B = [[1, 0, 0, 5], [0, 1, 0, 5], [0, 0, 1, -10], 0, 0, 0, 1]]
^
SyntaxError: invalid syntax
>>> B = [[1, 0, 0, 5], [0, 1, 0, 5], [0, 0, 1, -10], [0, 0, 0, 1]]
>>> A = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 10], [0, 0, 0, 1]]
>>> B = [[1, 0, 0, 5], [0, 1, 0, 5], [0, 0, 1, -10], [0, 0, 0, 1]]
>>> Am = numpy.matrix(A)
>>> Bm = numpy.matrix(B)
>>> Am * Bm.I
matrix([[ 1., 0., 0., -5.],
[ 0., 1., 0., -5.],
[ 0., 0., 1., 20.],
[ 0., 0., 0., 1.]])
>>> B = [[1, 0, 0, 5], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]
>>> Bm = numpy.matrix(B)
>>> Am * Bm.I
matrix([[ 1., 0., 0., -5.],
[ 0., 1., 0., -5.],
[ 0., 0., 1., 10.],
[ 0., 0., 0., 1.]])
>>> A = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 10], [0, 0, 0, 1]]
>>> B = [[1, 0, 0, 5], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]
>>> B = [[1, 0, 0, 5], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]
>>> A = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 10], [0, 0, 0, 1]]
>>> B = [[1, 0, 0, 5], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]
>>> Am = numpy.matrix(A)
>>> Bm = numpy.matrix(B)
>>> T = Am * Bm.I
>>> Bprime = "" #swith the signs of the central two columns
>>> Aprime = "" #switch the signs of the central two columns
>>> #A * inverse of Bprime
>>> T = Am * Bm.inverse
Traceback (most recent call last):
File "<input>", line 1, in <module>
AttributeError: 'matrix' object has no attribute 'inverse'
>>> T = Am * Bm_prime
Traceback (most recent call last):
File "<input>", line 1, in <module>
NameError: name 'Bm_prime' is not defined
>>> Bm_prime = B(-y,-z)
Traceback (most recent call last):
File "<input>", line 1, in <module>
NameError: name 'y' is not defined
>>> T = A * Bm_prime.inverse
Traceback (most recent call last):
File "<input>", line 1, in <module>
NameError: name 'Bm_prime' is not defined
>>> #apply T to the part that "A" was on
>>> OCC.gp.gp_Trsf(1)
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/usr/lib/python2.5/site-packages/OCC/gp.py", line 3573, in __init__
this = _gp.new_gp_Trsf(*args)
NotImplementedError: Wrong number of arguments for overloaded function 'new_gp_Trsf'.
Possible C/C++ prototypes are:
gp_Trsf()
gp_Trsf(gp_Trsf2d const &)
>>> exit()
|