TerrainAnalisys: fix hardcode i=2, var obj undefined, remove threading innecesario

This commit is contained in:
2026-05-02 22:50:10 +02:00
parent 0b13a8c5f1
commit 9d65323052
+7 -27
View File
@@ -450,35 +450,18 @@ class ContourTaskPanel():
starttime = datetime.now() starttime = datetime.now()
if self.land is None: if self.land is None:
print("No hay objetos para procesar") FreeCAD.Console.PrintWarning("No hay objetos para procesar\n")
return False return False
else: else:
minor = FreeCAD.Units.Quantity(self.inputMinorContourMargin.currentText()).Value minor = FreeCAD.Units.Quantity(self.inputMinorContourMargin.currentText()).Value
mayor = FreeCAD.Units.Quantity(self.inputMayorContourMargin.currentText()).Value mayor = FreeCAD.Units.Quantity(self.inputMayorContourMargin.currentText()).Value
i = 2 makeContours(
if i == 0: self.land, minor, mayor,
makeContours(self.land, minor, mayor, self.MinorColor, self.MayorColor,
self.inputMinorContourThickness.value(), self.inputMayorContourThickness.value())
elif i == 1:
import multiprocessing
p = multiprocessing.Process(target=makeContours,
args=(self.land, minor, mayor,
self.MinorColor, self.MayorColor, self.MinorColor, self.MayorColor,
self.inputMinorContourThickness.value(), self.inputMinorContourThickness.value(),
self.inputMayorContourThickness.value(), )) self.inputMayorContourThickness.value()
p.start() )
p.join()
else:
import threading
hilo = threading.Thread(target = makeContours,
args = (self.land, minor, mayor,
self.MinorColor, self.MayorColor,
self.inputMinorContourThickness.value(),
self.inputMayorContourThickness.value()))
hilo.daemon = True
hilo.start()
total_time = datetime.now() - starttime total_time = datetime.now() - starttime
print(" -- Tiempo tardado:", total_time) print(" -- Tiempo tardado:", total_time)
@@ -569,7 +552,7 @@ class SlopeTaskPanel(_generalTaskPanel):
land.ViewObject.DiffuseColor = colorlist land.ViewObject.DiffuseColor = colorlist
# TODO: check this code: # TODO: check this code:
elif obj.isDerivedFrom("Mesh::Feature"): elif hasattr(land, 'Mesh') and land.isDerivedFrom("Mesh::Feature"):
fMesh = Mest2FemMesh(land) fMesh = Mest2FemMesh(land)
import math import math
setColors = [] setColors = []
@@ -602,10 +585,7 @@ class SlopeTaskPanel(_generalTaskPanel):
print("Everything OK (", datetime.now() - starttime, ")") print("Everything OK (", datetime.now() - starttime, ")")
def accept(self): def accept(self):
# self.getPointSlope() self.getPointSlope(self.ranges)
import threading
hilo = threading.Thread(target=self.getPointSlope(self.ranges))
hilo.start()
return True return True
# Orientation Analisys: --------------------------------------------------------------------------------- # Orientation Analisys: ---------------------------------------------------------------------------------