def __init__(self, positionVector: Vector3D, directionVectorOne: Vector3D, directionVectorTwo: Vector3D, normalVector: Vector3D, scalarParameter: float, name=None, color=None): """The init method of the plane class. Takes positionVector and directionVectorOne and directionVectorTwo as Vector3D, parameter as int or float, name as string and color as tuple of format: (Red, Green, Blue)(Valuerange = 0 to 256).""" self.__positionVector = positionVector self.__directionVectorOne = directionVectorOne self.__directionVectorTwo = directionVectorTwo self.__normalVector = normalVector # Following code checks if a normalVector was passed. If not: generates normalVector from directionVectors. try: self.__scalarParameter = scalarParameter except Exception: pass if name is None: self.__name = NameAssign.getNewName() else: self.__name = name if color is None: self.__color = ColorAssign.getNewColor() else: self.__color = color Plane.__idCount += 1 self.__id = str(self.__idTag) + str(self.__idCount) ObjectLists.appendObjDict({str(self.__id): self}) ObjectLists.appendPlaList(self)
def makeListFrame(self): #self.listScrollbar = tk.Scrollbar(self.mainframe) #self.listScrollbar.grid(column = 1, row = 1, rowspan = 2) self.listFrame = tk.Frame(self.mainframe, borderwidth=1, height=self.mainframe.winfo_height()) self.listFrame.grid(column=0, row=1, sticky="NES") for element, index in zip(ObjectLists.getObjDict(), range(ObjectLists.getObjDictLen())): self.objButton = tk.Button( self.listFrame, text=str(element) + str(ObjectLists.getObjDict()[element]), width=50, command=self.funktion ) # funktion placeholder for future function self.objButton.grid(ipady=10, column=0, row=index, columnspan=2) self.addVecButton = tk.Button( self.listFrame, text="Add new Object +", width=25, command=self.funktion) # funktion placeholder for future function self.addVecButton.grid(ipady=10, column=0, row=ObjectLists.getObjDictLen()) self.addCalcButton = tk.Button( self.listFrame, text="Add new Calculation +", width=25, command=self.funktion) # funktion placeholder for future function self.addCalcButton.grid(ipady=10, column=1, row=ObjectLists.getObjDictLen())
def __del__(self): ColorAssign.removeColor(self.__color) NameAssign.removeName(self.__name) try: ObjectLists.removeFromPoiList(self) ObjectLists.removeFromObjDict(str(self.__id)) except ValueError: pass
def __init__(self, x=0, y=0, z=0, name=None, color=None): self.__x = float(x) self.__y = float(y) self.__z = float(z) Point.__idCount += 1 self.__id = str(self.__idTag + str(self.__idCount)) if name is None: self.__name = NameAssign.getNewName() else: self.__name = name if color is None: self.__color = ColorAssign.getNewColor() else: self.__color = color ObjectLists.appendObjDict({str(self.__id): self}) ObjectLists.appendPoiList(self)
def __init__(self, x=0.0, y=0.0, z=0.0, name=None, color=None): """The init function for the Vector3D class. Takes x, y and z values as int or float. Name has to be a string.""" self.__x = float(x) self.__y = float(y) self.__z = float(z) if name is None: self.__name = NameAssign.getNewName() else: self.__name = name if color is None: self.__color = ColorAssign.getNewColor() else: self.__color = color Vector3D.__idCount += 1 self.__id = str(self.__idTag + str(self.__idCount)) ObjectLists.appendObjDict({str(self.__id): self}) ObjectLists.appendVecList(self)
def __init__(self, positionVector: Vector3D, directionVector: Vector3D, name=None, color=None): """The init method of the line class. Takes positionVector and directionVector as Vector3D, parameter as int or float, name as string and color as tuple of format: (Red, Green, Blue)(Valuerange = 0 to 256). Pass dtype None for color or name for it to be automatically assigned.""" self.__positionVector = positionVector self.__directionVector = directionVector if name is None: self.__name = NameAssign.getNewName() else: self.__name = name if color is None: self.__color = ColorAssign.getNewColor() else: self.__color = color Line.__idCount += 1 self.__id = str(self.__idTag) + str(self.__idCount) ObjectLists.appendObjDict({str(self.__id): self}) ObjectLists.appendLinList(self)
pass from lineclass import Line from planeclass import Plane from colorAssignclass import ColorAssign from nameAssignclass import NameAssign from listclass import ObjectLists VecList = [] PoiList = [] LinList = [] PlaList = [] running = True while running: for element in ObjectLists.getObjDict(): print(" --- "+str(element)) UserInput = input( """Nächste Operation [NewVec;AddVec;ScalMultVec;VecMultVecScal;VecMultVecCro;NewPoi;NewLin;NewPla;ConvertPlaToHess;X]: """ ) if UserInput == "NewVec": VecList.append(Vector3D(input("x = "), input("y = "), input("z = "), input("Name = "))) print(str(VecList[-1])) elif UserInput == "AddVec": Vec1 = Vector3D(input("x = "), input("y = "), input("z = "), input("Name = ")) Vec2 = Vector3D(input("x = "), input("y = "), input("z = "), input("Name = ")) print("Ergebnis: " + str(Vec1.add(Vec2))) elif UserInput == "ScalMultVec": Vec1 = Vector3D(input("x = "), input("y = "), input("z = "), input("Name = ")) scal = float(input("Scalar: "))