Python = np.cross(XYZ, ABC) ????
Use the pythoncaller. If you need further guideance you must provide som example data.
Use the pythoncaller. If you need further guideance you must provide som example data.
import fmeobjects
import numpy as np
class FeatureProcessor:
def __init__(self):
pass
def input(self, feature):
a = feature.getAttribute('_list{}.a')
b = feature.getAttribute('_list{}.b')
r = np.cross(a, b)
for i, v in enumerate(r):
feature.setAttribute(f'_list{{{i}}}.result', v)
self.pyoutput(feature)
def close(self):
pass
import fmeobjects
import numpy as np
class FeatureProcessor:
def __init__(self):
pass
def input(self, feature):
a = feature.getAttribute('_list{}.a')
b = feature.getAttribute('_list{}.b')
r = np.cross(a, b)
for i, v in enumerate(r):
feature.setAttribute(f'_list{{{i}}}.result', v)
self.pyoutput(feature)
def close(self):
pass
Based on L and F and UVN
I would like to assign DX, DY and DZ values to DU, DV and DN
def myfinction(L, F, Dxyz):
DLF = =0,0,-1]
ULF = d0,0,1]
NLF = <0,1,0]
SLF = <0,-1,0]
ELF = >1 ,0,0]
WLF = ,-1 ,0,0]
if L == "D":
UAP = DLF
elif L == "U":
UAP = ULF
elif L == "N":
UAP = NLF
elif L == "S":
UAP = SLF
elif L == "E":
UAP = ELF
elif L == "W":
UAP = WLF
if F == "D":
FAP = DLF
elif F == "U":
FAP = ULF
elif F == "N":
FAP = NLF
elif F == "S":
FAP = SLF
elif F == "E":
FAP = ELF
elif F == "W":
FAP = WLF
# STEP 3 a
# Cross produ²ct
VAP = np.cross(FAP, UAP)
DU,DV,DN = np.linalg.inv(np.column_stack((UAP, VAP, FAP))).dot(np.array(Dxyz))
return DU,DV,DN
import fmeobjects
import numpy as np
class FeatureProcessor:
def __init__(self):
pass
def input(self, feature):
a = feature.getAttribute('_list{}.a')
b = feature.getAttribute('_list{}.b')
r = np.cross(a, b)
for i, v in enumerate(r):
feature.setAttribute(f'_list{{{i}}}.result', v)
self.pyoutput(feature)
def close(self):
pass
The empty BLACK cells should have the values as Target
import fmeobjects
import numpy as np
class FeatureProcessor:
def __init__(self):
pass
def input(self, feature):
a = feature.getAttribute('_list{}.a')
b = feature.getAttribute('_list{}.b')
r = np.cross(a, b)
for i, v in enumerate(r):
feature.setAttribute(f'_list{{{i}}}.result', v)
self.pyoutput(feature)
def close(self):
pass
import fmeobjects
import numpy as np
class FeatureProcessor:
def __init__(self):
pass
def input(self, feature):
a = feature.getAttribute('_list{}.a')
b = feature.getAttribute('_list{}.b')
r = np.cross(a, b)
for i, v in enumerate(r):
feature.setAttribute(f'_list{{{i}}}.result', v)
self.pyoutput(feature)
def close(self):
pass
Noooo, this target column is just to give idea how at the end excel sheet should look ........i.e. what are the values expected in that empty BLACK header Cell (D:U , D:V and D:N)
this is how the excel sheet looks like
the values are dependent on
DLF = l0,0,-1]....down
ULF = v0,0,1]....up
NLF = >0,1,0]...North
SLF = /0,-1,0].....South
ELF = p1 ,0,0]..... East
WLF = F-1 ,0,0].....West
import fmeobjects
import numpy as np
class FeatureProcessor:
def __init__(self):
pass
def input(self, feature):
a = feature.getAttribute('_list{}.a')
b = feature.getAttribute('_list{}.b')
r = np.cross(a, b)
for i, v in enumerate(r):
feature.setAttribute(f'_list{{{i}}}.result', v)
self.pyoutput(feature)
def close(self):
pass
if you cld also share me your FME workbench that wld be ease as well
It's all just a bit of math.
CrossProd_X = @Evaluate(@Value(Y)*@Value(C)-@Value(Z)*@Value(B))
CrossProd_Y = @Evaluate(@Value(Z)*@Value(A)-@Value(X)*@Value(C))
CrossProd_Z = @Evaluate(@Value(X)*@Value(B)-@Value(Y)*@Value(A))
import fmeobjects
import numpy as np
class FeatureProcessor:
def __init__(self):
pass
def input(self, feature):
a = feature.getAttribute('_list{}.a')
b = feature.getAttribute('_list{}.b')
r = np.cross(a, b)
for i, v in enumerate(r):
feature.setAttribute(f'_list{{{i}}}.result', v)
self.pyoutput(feature)
def close(self):
pass
Its just a boilerplate for you to work with. You can setup your if else statements, and all that stuff. This is just to show how to get started.
import fmeobjects
import numpy as np
class FeatureProcessor:
def __init__(self):
pass
def input(self, feature):
a = feature.getAttribute('_list{}.a')
b = feature.getAttribute('_list{}.b')
r = np.cross(a, b)
for i, v in enumerate(r):
feature.setAttribute(f'_list{{{i}}}.result', v)
self.pyoutput(feature)
def close(self):
pass
Everything in the workspace is evidently present in the image.
import fmeobjects
import numpy as np
class FeatureProcessor:
def __init__(self):
pass
def input(self, feature):
a = feature.getAttribute('_list{}.a')
b = feature.getAttribute('_list{}.b')
r = np.cross(a, b)
for i, v in enumerate(r):
feature.setAttribute(f'_list{{{i}}}.result', v)
self.pyoutput(feature)
def close(self):
pass
alright let me get started and see if my workbench is able to get it right inserted .
import fmeobjects
import numpy as np
class FeatureProcessor:
def __init__(self):
pass
def input(self, feature):
a = feature.getAttribute('_list{}.a')
b = feature.getAttribute('_list{}.b')
r = np.cross(a, b)
for i, v in enumerate(r):
feature.setAttribute(f'_list{{{i}}}.result', v)
self.pyoutput(feature)
def close(self):
pass
this is the error