Thanks in advance
full script:
Code: Select all
import FreeCAD
import Part
import DraftTools
import Draft
import Mesh
def myTetrahedronSld(P1x,P1y,P1z,P2x,P2y,P2z,P3x,P3y,P3z,P4x,P4y,P4z):
xDummy=0
yDummy=0
zDummy=0
a =[[xDummy,yDummy,zDummy], #dummy
[P1x,P1y,P1z],
[P2x,P2y,P2z],
[P3x,P3y,P3z],
[P4x,P4y,P4z]]
m1 = Mesh.Mesh([a[1],a[2],a[3]]) #4
m2 = Mesh.Mesh([a[1],a[2],a[4]]) #3
m3 = Mesh.Mesh([a[1],a[3],a[4]]) #2
m4 = Mesh.Mesh([a[2],a[3],a[4]]) #1
mesh=Mesh.Mesh()
mesh.addMesh(m1)
mesh.addMesh(m2)
mesh.addMesh(m3)
mesh.addMesh(m4)
shape = Part.Shape()
shape.makeShapeFromMesh(mesh.Topology,0.05)
solid = Part.makeSolid(shape).removeSplitter()
myWedgei='x' + str(P1x) + 'y' + str(P1y)+ 'z' + str(P1z)
f = App.activeDocument().addObject("Part::Feature",myWedgei)
f.Shape = solid
h=10
xDum=0
yDum=0
zDum=0
a =[[xDum,yDum,zDum],
[0,0,h],
[h,0,h],
[h,h,h],
[0,h,h],
[0,0,0],
[h,0,0],
[h,h,0],
[0,h,0]]
myTetrahedronSld(a[1,0],a[1,1],a[1,2],a[2,0],a[2,1],a[2,2],a[3,0],a[3,1],a[3,2],a[5,0],a[5,1],a[5,2])
App.ActiveDocument.recompute()
Gui.activeDocument().activeView().viewAxonometric()
Gui.SendMsgToActiveView("ViewFit")
#Traceback (most recent call last): File "C:/xxx/FreeCAD/001Tetrahedron.FCMacro",
#line 44, in myTetrahedronSld(a[1,0],a[1,1],a[1,2], a[2,0],a[2,1],a[2,2],
# a[3,0],a[3,1],a[3,2], a[5,0],a[5,1],a[5,2]) :
#list indices must be integers, not tuple