forked from dlubal-software/RFEM_Python_Client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMFE_ZoekNode.py
More file actions
45 lines (37 loc) · 1.33 KB
/
MFE_ZoekNode.py
File metadata and controls
45 lines (37 loc) · 1.33 KB
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
from RFEM.enums import *
from RFEM.initModel import Model
from RFEM.BasicObjects.node import Node
def ZoekNode(
X : float = 0.0,
Y : float = 0.0,
Z : float = 0.0,
model = Model,
nodes = []):
Xd = X
Yd = Y
Zd = Z
afw = 6 #=toelaatbare afwijking van coordinaat in meters
fNodes = [] #=lijst voor gevonden knopen waarvan de coordinaten overeenkomen
while True:
fNodes.clear()
min_afwi = 100
for node in nodes:
noi = node["no"]
Xi = node["X"]
Yi = node["Y"]
Zi = node["Z"]
if Xi >= Xd-afw and Xi <= Xd+afw:
if Yi >= Yd-afw and Yi <= Yd+afw:
if Zi >= Zd-afw and Zi <= Zd+afw:
afwi = ((Xi-Xd)**2+(Yi-Yd)**2+(Zi-Zd)**2)**(1/2)
if (afwi <= afw):
fNodes.append(node)
min_afwi = min(min_afwi,afwi)
if len(fNodes)==1: break
afw = min_afwi
# time2 = time.time() #Eindtijd van het gedeelte van de code waarvan ik wil weten hoe lang het duurt
# dtime = time2 - time1 #Tijd die het gedeelte van de code heeft geduurd in seconde
# print(str(dtime) + " s") #Afdrukken benodigde tijd
# print(fNodes[0].no)
# print("afw" + str(afw))
return fNodes[0]