mejoras
This commit is contained in:
@@ -22,7 +22,6 @@
|
||||
|
||||
import FreeCAD
|
||||
import Part
|
||||
import numpy as np
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
import FreeCADGui, os
|
||||
@@ -47,6 +46,8 @@ except AttributeError:
|
||||
import PVPlantResources
|
||||
import PVPlantSite
|
||||
|
||||
version = "0.1.0"
|
||||
|
||||
|
||||
def selectionFilter(sel, objtype):
|
||||
print("type: ", objtype)
|
||||
@@ -119,8 +120,8 @@ class _PVPlantPlacementTaskPanel:
|
||||
for idx in range(len(placements)):
|
||||
newrack = PVPlantFrame.makeTracker(setup=types[idx])
|
||||
newrack.Label = "Tracker"
|
||||
newrack.Visibility = False
|
||||
newrack.Placement = placements[idx]
|
||||
newrack.Visibility = True
|
||||
MechanicalGroup.addObject(newrack)
|
||||
frames.append(newrack)
|
||||
if self.PVArea.Name.startswith("FrameArea"):
|
||||
@@ -136,6 +137,8 @@ class _PVPlantPlacementTaskPanel:
|
||||
else:
|
||||
from Utils import PVPlantUtils as utils
|
||||
wire = utils.simplifyWire(utils.getProjected(shape))
|
||||
if wire.isClosed():
|
||||
wire = wire.removeSplitter()
|
||||
return Part.Face(wire)
|
||||
|
||||
def calculateWorkingArea(self):
|
||||
@@ -180,8 +183,8 @@ class _PVPlantPlacementTaskPanel:
|
||||
starty = int(refh.BoundBox.YMin + self.offsetY + self.gap_row * steps)
|
||||
# todo end ----------------------------------------------------------------------------------
|
||||
|
||||
return np.arange(startx, self.Area.BoundBox.XMax, self.gap_col, dtype=int), \
|
||||
np.arange(starty, self.Area.BoundBox.YMin, -self.gap_row, dtype=int)
|
||||
return np.arange(startx, self.Area.BoundBox.XMax, self.gap_col, dtype=np.int64), \
|
||||
np.arange(starty, self.Area.BoundBox.YMin, -self.gap_row, dtype=np.int64)
|
||||
|
||||
def adjustToTerrain(self, coordinates):
|
||||
mode = 1
|
||||
@@ -241,7 +244,7 @@ class _PVPlantPlacementTaskPanel:
|
||||
df["regression"] = linregression
|
||||
|
||||
# 01. Grouping:
|
||||
from scipy.ndimage import sclabel
|
||||
from scipy.ndimage import label as sclabel
|
||||
import pandas as pd
|
||||
tmp = []
|
||||
for c, col in enumerate(coordinates):
|
||||
@@ -389,6 +392,7 @@ class _PVPlantPlacementTaskPanel:
|
||||
return False
|
||||
|
||||
def calculateAlignedArray(self):
|
||||
import FreeCAD
|
||||
pointsx, pointsy = self.getAligments()
|
||||
|
||||
footprints = []
|
||||
@@ -536,6 +540,11 @@ class _PVPlantPlacementTaskPanel:
|
||||
from datetime import datetime
|
||||
starttime = datetime.now()
|
||||
|
||||
params = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Document")
|
||||
auto_save_enabled = params.GetBool("AutoSaveEnabled")
|
||||
params.SetBool("AutoSaveEnabled", False)
|
||||
FreeCAD.ActiveDocument.RecomputesFrozen = True
|
||||
|
||||
items = []
|
||||
for x in range(self.form.listFrameSetups.count()):
|
||||
items.append(FreeCAD.ActiveDocument.getObject(self.form.listFrameSetups.item(x).text()))
|
||||
@@ -565,15 +574,16 @@ class _PVPlantPlacementTaskPanel:
|
||||
dataframe = self.calculateNonAlignedArray()
|
||||
|
||||
# last step: ------------------------------
|
||||
FreeCAD.ActiveDocument.RecomputesFrozen = True
|
||||
self.createFrameFromPoints(dataframe)
|
||||
FreeCAD.ActiveDocument.RecomputesFrozen = False
|
||||
params.SetBool("AutoSaveEnabled", auto_save_enabled)
|
||||
|
||||
self.createFrameFromPoints(dataframe)
|
||||
|
||||
total_time = datetime.now() - starttime
|
||||
print(" -- Tiempo tardado:", total_time)
|
||||
FreeCADGui.Control.closeDialog()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
return True
|
||||
#return True
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------------
|
||||
@@ -1066,7 +1076,7 @@ def ConvertObjectsTo(sel, objTo):
|
||||
|
||||
|
||||
## Comandos: -----------------------------------------------------------------------------------------------------------
|
||||
class _CommandPVPlantPlacement:
|
||||
class CommandPVPlantPlacement:
|
||||
|
||||
def GetResources(self):
|
||||
return {'Pixmap': str(os.path.join(PVPlantResources.DirIcons, "way.svg")),
|
||||
@@ -1085,7 +1095,7 @@ class _CommandPVPlantPlacement:
|
||||
return False
|
||||
|
||||
|
||||
class _CommandAdjustToTerrain:
|
||||
class CommandAdjustToTerrain:
|
||||
|
||||
def GetResources(self):
|
||||
return {'Pixmap': str(os.path.join(PVPlantResources.DirIcons, "adjust.svg")),
|
||||
@@ -1108,7 +1118,7 @@ class _CommandAdjustToTerrain:
|
||||
return False
|
||||
|
||||
|
||||
class _CommandConvert:
|
||||
class CommandConvert:
|
||||
def GetResources(self):
|
||||
return {'Pixmap': str(os.path.join(PVPlantResources.DirIcons, "convert.svg")),
|
||||
'Accel': "P, C",
|
||||
@@ -1126,7 +1136,7 @@ class _CommandConvert:
|
||||
FreeCADGui.Control.showDialog(taskd)
|
||||
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
'''if FreeCAD.GuiUp:
|
||||
FreeCADGui.addCommand('PVPlantPlacement', _CommandPVPlantPlacement())
|
||||
FreeCADGui.addCommand('PVPlantAdjustToTerrain', _CommandAdjustToTerrain())
|
||||
FreeCADGui.addCommand('PVPlantConvertTo', _CommandConvert())
|
||||
FreeCADGui.addCommand('PVPlantConvertTo', _CommandConvert())'''
|
||||
|
||||
Reference in New Issue
Block a user