Punto de restauración.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import math
|
||||
import FreeCAD
|
||||
import Part
|
||||
from Utils.PVPlantUtils import findObjects
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
@@ -259,15 +260,60 @@ class exportDXF:
|
||||
'rotation': rotation
|
||||
})
|
||||
|
||||
def createPolyline(self, wire):
|
||||
def createPolyline(self, wire, layer=""):
|
||||
try:
|
||||
data = getWire(wire.Shape)
|
||||
lwp = self.msp.add_lwpolyline(data)
|
||||
if layer:
|
||||
lwp.dxf.layer = layer
|
||||
return lwp
|
||||
except Exception as e:
|
||||
print("Error creating polyline:", e)
|
||||
return None
|
||||
|
||||
def createHatch(self, wire, pattern="SOLID", scale=1.0, angle=0, layer=None):
|
||||
"""Crea un sombreado (hatch) para un área"""
|
||||
try:
|
||||
# Obtener los puntos en metros
|
||||
points = [(x, y) for (x, y, *_) in wire]
|
||||
|
||||
# Crear el hatch
|
||||
hatch = self.msp.add_hatch(color=7, dxfattribs={'layer': layer})
|
||||
|
||||
if pattern == "SOLID":
|
||||
# Sombreado sólido
|
||||
hatch.set_solid_fill()
|
||||
else:
|
||||
# Patrón de sombreado
|
||||
hatch.set_pattern_fill(name=pattern, scale=scale, angle=angle)
|
||||
|
||||
# Añadir el contorno
|
||||
hatch.paths.add_polyline_path(points, is_closed=True)
|
||||
return hatch
|
||||
except Exception as e:
|
||||
print("Error creating hatch:", e)
|
||||
return None
|
||||
|
||||
def export_feature_image(self, feature, layer_name):
|
||||
"""Exporta una imagen del GeoFeature y la añade al DXF"""
|
||||
try:
|
||||
# Añadir la imagen al DXF
|
||||
image_def = self.doc.add_image_def(feature.ImageFile, size_in_pixel=(feature.XSize, feature.YSize))
|
||||
self.msp.add_image(image_def,
|
||||
insert=(0, 0, 0),
|
||||
size_in_units=(feature.XSize,
|
||||
feature.YSize),
|
||||
rotation=0,
|
||||
dxfattribs={'layer': layer_name})
|
||||
|
||||
print(f"Imagen exportada para {feature.Label}")
|
||||
|
||||
# Eliminar el archivo temporal
|
||||
import os
|
||||
os.unlink(temp_img.name)
|
||||
except Exception as e:
|
||||
print(f"Error en exportación de imagen: {e}")
|
||||
|
||||
# =================================================================================
|
||||
# INTERFAZ DE USUARIO
|
||||
# =================================================================================
|
||||
@@ -575,6 +621,58 @@ class LineTypeComboBox(QtWidgets.QComboBox):
|
||||
finally:
|
||||
painter.end() # Asegurar que el painter se cierre correctamente
|
||||
|
||||
layers = [
|
||||
("Available area", QtGui.QColor(0, 204, 153), "Continuous", "1", True),
|
||||
("Available area Names", QtGui.QColor(255, 255, 255), "Continuous", "1", True),
|
||||
|
||||
("Areas Exclusion", QtGui.QColor(255, 85, 0), "Continuous", "1", True),
|
||||
("Areas Exclusion Name", QtGui.QColor(255, 85, 0), "Continuous", "1", True),
|
||||
("Areas Cadastral Plot", QtGui.QColor(255, 255, 255), "Continuous", "1", True),
|
||||
("Areas Cadastral Plot Name", QtGui.QColor(255, 255, 255), "Continuous", "1", True),
|
||||
("Areas Offset", QtGui.QColor(255, 255, 255), "Continuous", "1", True),
|
||||
|
||||
("Cable codes LV AC inverter", QtGui.QColor(255, 255, 255), "Continuous", "1", True),
|
||||
("Cable codes LV string", QtGui.QColor(255, 255, 255), "Continuous", "1", True),
|
||||
("Cable codes MV System", QtGui.QColor(255, 255, 255), "Continuous", "1", True),
|
||||
("CABLES LV AC inverter 120 mm2", QtGui.QColor(255, 204, 0), "Continuous", "1", True),
|
||||
("CABLES LV AC inverter 185 mm2", QtGui.QColor(204, 153, 0), "Continuous", "1", True),
|
||||
("CABLES LV string 4 mm2", QtGui.QColor(255, 255, 0), "Continuous", "1", True),
|
||||
("CABLES LV string 10 mm2", QtGui.QColor(255, 255, 102), "Continuous", "1", True),
|
||||
("CABLES MV system 300 mm2", QtGui.QColor(102, 51, 0), "Continuous", "1", True),
|
||||
|
||||
("CIVIL Fence", QtGui.QColor(102, 102, 102), "FENCELINE1", "1", True),
|
||||
("CIVIL External Roads", QtGui.QColor(91, 91, 91), "Continuous", "1", True),
|
||||
("CIVIL External Roads Axis", QtGui.QColor(255, 255, 192), "Dashed", "1", True),
|
||||
("CIVIL External Roads Text", QtGui.QColor(255, 255, 192), "Continuous", "1", True),
|
||||
("CIVIL Internal Roads", QtGui.QColor(153, 95, 76), "Continuous", "1", True),
|
||||
("CIVIL Internal Roads Axis", QtGui.QColor(192, 192, 192), "Dashed", "1", True),
|
||||
("CIVIL External Roads Text", QtGui.QColor(192, 192, 192), "Continuous", "1", True),
|
||||
|
||||
("Contour Line Legend text", QtGui.QColor(255, 255, 255), "Continuous", "1", True),
|
||||
("Major contour line", QtGui.QColor(0, 0, 0), "Continuous", "1", True),
|
||||
("Major contour value", QtGui.QColor(0, 0, 0), "Continuous", "1", True),
|
||||
("Minor contour line", QtGui.QColor(128, 128, 128), "Continuous", "1", True),
|
||||
("Minor contour value", QtGui.QColor(128, 128, 128), "Continuous", "1", True),
|
||||
("Power Stations", QtGui.QColor(255, 0, 0), "Continuous", "1", True),
|
||||
("Power Stations Names", QtGui.QColor(255, 255, 255), "Continuous", "1", True),
|
||||
("ST", QtGui.QColor(255, 255, 255), "Continuous", "1", True),
|
||||
("ST Names", QtGui.QColor(255, 255, 0), "Continuous", "1", True),
|
||||
("String Inv", QtGui.QColor(255, 255, 255), "Continuous", "1", True),
|
||||
("STRUC Structure 1", QtGui.QColor(0, 0, 255), "Continuous", "1", True),
|
||||
("STRUC Structure 2", QtGui.QColor(0, 0, 204), "Continuous", "1", True),
|
||||
("STRUC Structure 3", QtGui.QColor(0, 0, 153), "Continuous", "1", True),
|
||||
("STRUC Structure 4", QtGui.QColor(0, 0, 128), "Continuous", "1", True),
|
||||
("STRUC Structure 5", QtGui.QColor(0, 0, 102), "Continuous", "1", True),
|
||||
("STRUC Structure 6", QtGui.QColor(0, 0, 76), "Continuous", "1", True),
|
||||
("STRUC Structure 7", QtGui.QColor(0, 0, 51), "Continuous", "1", True),
|
||||
("STRUC Structure 8", QtGui.QColor(0, 0, 25), "Continuous", "1", True),
|
||||
("Structure Codes", QtGui.QColor(255, 255, 255), "Continuous", "1", True),
|
||||
("TRENCHES Low voltage 400.0 x 1000.0 m", QtGui.QColor(128, 128, 128), "Continuous", "1", True),
|
||||
("TRENCHES Medium voltage 400.0 x 1000.", QtGui.QColor(255, 255, 255), "Continuous", "1", True),
|
||||
("TRENCHES Medium voltage 800.0 x 1000.", QtGui.QColor(255, 255, 255), "Continuous", "1", True),
|
||||
("TRENCHES Medium voltage 800.0 x 1500.", QtGui.QColor(255, 255, 255), "Continuous", "1", True),
|
||||
]
|
||||
|
||||
|
||||
class _PVPlantExportDXF(QtGui.QWidget):
|
||||
'''The editmode TaskPanel to select what you want to export'''
|
||||
@@ -610,10 +708,8 @@ class _PVPlantExportDXF(QtGui.QWidget):
|
||||
self.form.tableLayers.removeRow(row)
|
||||
|
||||
# Configuración de las capas por defecto
|
||||
self.add_row("Areas_Boundary", QtGui.QColor(0, 125, 125), "FENCELINE1", "1", True)
|
||||
self.add_row("Areas_Exclusion", QtGui.QColor(255, 0, 0), "CONTINUOUS", "1", True)
|
||||
self.add_row("Internal_Roads", QtGui.QColor(128, 128, 128), "CONTINUOUS", "1", True)
|
||||
self.add_row("Frames", QtGui.QColor(0, 255, 0), "CONTINUOUS", "1", True)
|
||||
for row in layers:
|
||||
self.add_row(*row)
|
||||
|
||||
def save_project_settings(self):
|
||||
"""Guarda la configuración actual en el proyecto de FreeCAD"""
|
||||
@@ -778,25 +874,25 @@ class _PVPlantExportDXF(QtGui.QWidget):
|
||||
)
|
||||
|
||||
def writeArea(self, exporter):
|
||||
exporter.createPolyline(FreeCAD.ActiveDocument.Site.Boundary, "boundary")
|
||||
|
||||
areas_types = ["Boundaries", "Exclusions", "Offsets"]
|
||||
exporter.createPolyline(FreeCAD.ActiveDocument.Site.Boundary, "Available area")
|
||||
areas_types = [("Boundaries", "Available area"),
|
||||
("CadastralPlots", "Areas Cadastral Plot"),
|
||||
("Exclusions", "Areas Exclusion"),
|
||||
("Offsets", "Areas Offset")]
|
||||
for area_type in areas_types:
|
||||
if hasattr(FreeCAD.ActiveDocument, area_type):
|
||||
for area in FreeCAD.ActiveDocument.Boundaries.Group:
|
||||
exporter.createPolyline(area, "Areas_Boundary")
|
||||
|
||||
'''for area in FreeCAD.ActiveDocument.Boundaries.Group:
|
||||
pol = exporter.createPolyline(area)
|
||||
pol.dxf.layer = "Areas_Boundary"
|
||||
|
||||
for area in FreeCAD.ActiveDocument.Exclusions.Group:
|
||||
pol = exporter.createPolyline(area)
|
||||
pol.dxf.layer = "Areas_Exclusion"
|
||||
|
||||
for area in FreeCAD.ActiveDocument.Offsets.Group:
|
||||
pol = exporter.createPolyline(area)
|
||||
pol.dxf.layer = "Areas_Offsets"'''
|
||||
if hasattr(FreeCAD.ActiveDocument, area_type[0]):
|
||||
area_group = FreeCAD.ActiveDocument.getObjectsByLabel(area_type[0])
|
||||
if len(area_group):
|
||||
for area in area_group[0].Group:
|
||||
tmp = exporter.createPolyline(area, area_type[1])
|
||||
if area_type[0] == "Exclusions":
|
||||
exporter.createHatch(
|
||||
tmp,
|
||||
pattern="ANSI37",
|
||||
scale=0.3,
|
||||
angle=0,
|
||||
layer=area_type[1]
|
||||
)
|
||||
|
||||
def writeFrameSetups(self, exporter):
|
||||
if not hasattr(FreeCAD.ActiveDocument, "Site"):
|
||||
@@ -811,11 +907,11 @@ class _PVPlantExportDXF(QtGui.QWidget):
|
||||
w.Placement.Base = w.Placement.Base.sub(center)
|
||||
block.add_lwpolyline(getWire(w))
|
||||
|
||||
block.add_circle((0, 0), 0.2, dxfattribs={'color': 2})
|
||||
block.add_circle((0, 0), 0.2, dxfattribs={'layer': 'Structure Posts'}) #'color': 2,
|
||||
p = math.sin(math.radians(45)) * 0.2
|
||||
|
||||
block.add_line((-p, -p), (p, p), dxfattribs={"layer": "MyLines"})
|
||||
block.add_line((-p, p), (p, -p), dxfattribs={"layer": "MyLines"})
|
||||
block.add_line((-p, -p), (p, p), dxfattribs={'layer': 'Structure Posts'})
|
||||
block.add_line((-p, p), (p, -p), dxfattribs={'layer': 'Structure Posts'})
|
||||
|
||||
# 2. Frames
|
||||
for ts in FreeCAD.ActiveDocument.Site.Frames:
|
||||
@@ -868,10 +964,10 @@ class _PVPlantExportDXF(QtGui.QWidget):
|
||||
|
||||
if FreeCAD.ActiveDocument.Transport:
|
||||
for road in FreeCAD.ActiveDocument.Transport.Group:
|
||||
base = exporter.createPolyline(road, "External_Roads")
|
||||
base = exporter.createPolyline(road, "CIVIL External Roads")
|
||||
base.dxf.const_width = road.Width
|
||||
|
||||
axis = exporter.createPolyline(road.Base, "External_Roads_Axis")
|
||||
axis = exporter.createPolyline(road, "CIVIL External Roads Axis")
|
||||
axis.dxf.const_width = .2
|
||||
|
||||
def writeTrenches(self, exporter):
|
||||
@@ -976,8 +1072,12 @@ class _PVPlantExportDXF(QtGui.QWidget):
|
||||
self.writeTrenches(exporter)
|
||||
|
||||
# Crear espacios de papel
|
||||
self.setup_layout4(exporter.doc)
|
||||
self.createPaperSpaces(exporter)
|
||||
#self.setup_layout4(exporter.doc)
|
||||
#self.createPaperSpaces(exporter)
|
||||
|
||||
if hasattr(FreeCAD.ActiveDocument, "Background"):
|
||||
# Exportar como imagen en lugar de polilínea
|
||||
exporter.export_feature_image(FreeCAD.ActiveDocument.Background, "Site_Image")
|
||||
|
||||
# Guardar archivo
|
||||
exporter.save()
|
||||
|
||||
@@ -42,11 +42,10 @@ class OSMImporter:
|
||||
}
|
||||
self.ssl_context = ssl.create_default_context(cafile=certifi.where())
|
||||
|
||||
def transform_from_latlon(self, lat, lon):
|
||||
point = ImportElevation.getElevationFromOE([[lat, lon], ])
|
||||
return FreeCAD.Vector(point[0].x, point[0].y, point[0].z) * scale - self.Origin
|
||||
'''x, y, _, _ = utm.from_latlon(lat, lon)
|
||||
return FreeCAD.Vector(x, y, .0) * scale - self.Origin'''
|
||||
def transform_from_latlon(self, coordinates):
|
||||
points = ImportElevation.getElevationFromOE(coordinates)
|
||||
pts = [FreeCAD.Vector(p.x, p.y, p.z).sub(self.Origin) for p in points]
|
||||
return pts
|
||||
|
||||
def get_osm_data(self, bbox):
|
||||
query = f"""
|
||||
@@ -81,11 +80,16 @@ class OSMImporter:
|
||||
root = ET.fromstring(osm_data)
|
||||
|
||||
# Almacenar nodos transformados
|
||||
coordinates = [[float(node.attrib['lat']), float(node.attrib['lon'])] for node in root.findall('node')]
|
||||
coordinates = self.transform_from_latlon(coordinates)
|
||||
for i, node in enumerate(root.findall('node')):
|
||||
self. nodes[node.attrib['id']] = coordinates[i]
|
||||
'''return
|
||||
for node in root.findall('node'):
|
||||
self.nodes[node.attrib['id']] = self.transform_from_latlon(
|
||||
float(node.attrib['lat']),
|
||||
float(node.attrib['lon'])
|
||||
)
|
||||
)'''
|
||||
|
||||
# Procesar ways
|
||||
for way in root.findall('way'):
|
||||
@@ -162,11 +166,10 @@ class OSMImporter:
|
||||
def create_buildings(self):
|
||||
building_layer = self.create_layer("Buildings")
|
||||
for way_id, data in self.ways_data.items():
|
||||
print(data)
|
||||
if 'building' not in data['tags']:
|
||||
continue
|
||||
|
||||
print(data)
|
||||
|
||||
tags = data['tags']
|
||||
nodes = [self.nodes[ref] for ref in data['nodes'] if ref in self.nodes]
|
||||
|
||||
|
||||
@@ -376,8 +376,7 @@ class _Fence(ArchComponent.Component):
|
||||
site = PVPlantSite.get()
|
||||
if True: # prueba
|
||||
import MeshPart as mp
|
||||
land = FreeCAD.ActiveDocument.Terrain.Mesh
|
||||
segments = mp.projectShapeOnMesh(pathwire, land, FreeCAD.Vector(0, 0, 1))
|
||||
segments = mp.projectShapeOnMesh(pathwire, site.Terrain.Mesh, FreeCAD.Vector(0, 0, 1))
|
||||
points=[]
|
||||
for segment in segments:
|
||||
points.extend(segment)
|
||||
|
||||
@@ -256,7 +256,9 @@ class _CommandPVPlantGate:
|
||||
gate = makePVPlantFence()
|
||||
try:
|
||||
import MeshPart as mp
|
||||
point1 = mp.projectPointsOnMesh([point1,], FreeCAD.ActiveDocument.Terrain.Mesh, FreeCAD.Vector(0, 0, 1))[0]
|
||||
import PVPlantSite
|
||||
site = PVPlantSite.get()
|
||||
point1 = mp.projectPointsOnMesh([point1,], site.Terrain.Mesh, FreeCAD.Vector(0, 0, 1))[0]
|
||||
|
||||
except:
|
||||
FreeCAD.Console.PrintError("No se puede encontrar punto 3D.." + "\n")
|
||||
|
||||
@@ -122,6 +122,7 @@ def getElevationFromOE(coordinates):
|
||||
try:
|
||||
r = get(query, timeout=20, verify=certifi.where()) # <-- Corrección aquí
|
||||
except RequestException as e:
|
||||
print(f"Error en la solicitud: {str(e)}")
|
||||
points = []
|
||||
for i, point in enumerate(coordinates):
|
||||
c = utm.from_latlon(point[0], point[1])
|
||||
|
||||
@@ -26,6 +26,7 @@ import Part
|
||||
if FreeCAD.GuiUp:
|
||||
import FreeCADGui, os
|
||||
from PySide import QtCore, QtGui
|
||||
from PySide.QtGui import QListWidgetItem
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
else:
|
||||
# \cond
|
||||
@@ -62,7 +63,8 @@ class _PVPlantPlacementTaskPanel:
|
||||
'''The editmode TaskPanel for Schedules'''
|
||||
|
||||
def __init__(self, obj=None):
|
||||
self.Terrain = PVPlantSite.get().Terrain
|
||||
self.site = PVPlantSite.get()
|
||||
self.Terrain = self.site.Terrain
|
||||
self.FrameSetups = None
|
||||
self.PVArea = None
|
||||
self.Area = None
|
||||
@@ -77,8 +79,10 @@ class _PVPlantPlacementTaskPanel:
|
||||
self.form.setWindowIcon(QtGui.QIcon(os.path.join(PVPlantResources.DirIcons, "way.svg")))
|
||||
|
||||
self.form.buttonPVArea.clicked.connect(self.addPVArea)
|
||||
self.form.buttonAddFrame.clicked.connect(self.addFrame)
|
||||
self.form.buttonRemoveFrame.clicked.connect(self.removeFrame)
|
||||
#self.form.buttonAddFrame.clicked.connect(self.addFrames)
|
||||
#self.form.buttonRemoveFrame.clicked.connect(self.removeFrame)
|
||||
|
||||
self.addFrames()
|
||||
|
||||
def addPVArea(self):
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
@@ -86,21 +90,10 @@ class _PVPlantPlacementTaskPanel:
|
||||
self.PVArea = sel[0]
|
||||
self.form.editPVArea.setText(self.PVArea.Label)
|
||||
|
||||
def addFrame(self):
|
||||
from Mechanical.Frame import PVPlantFrame
|
||||
selection = FreeCADGui.Selection.getSelection()
|
||||
self.FrameSetup = selectionFilter(selection, PVPlantFrame.TrackerSetup)
|
||||
|
||||
if len(selection) > 0:
|
||||
items = []
|
||||
for x in range(self.form.listFrameSetups.count()):
|
||||
items.append(self.form.listFrameSetups.item(x).text())
|
||||
if not (selection[0].Name in items):
|
||||
self.form.listFrameSetups.addItem(selection[0].Name)
|
||||
|
||||
def removeFrame(self):
|
||||
''' remove select item from list '''
|
||||
self.form.listFrameSetups.takeItem(self.form.listFrameSetups.currentRow())
|
||||
def addFrames(self):
|
||||
for frame_setup in self.site.Frames:
|
||||
list_item = QListWidgetItem(frame_setup.Name, self.form.listFrameSetups)
|
||||
list_item.setCheckState(QtCore.Qt.Checked)
|
||||
|
||||
def createFrameFromPoints(self, dataframe):
|
||||
from Mechanical.Frame import PVPlantFrame
|
||||
@@ -111,6 +104,12 @@ class _PVPlantPlacementTaskPanel:
|
||||
MechanicalGroup.Label = "Frames"
|
||||
FreeCAD.ActiveDocument.MechanicalGroup.addObject(MechanicalGroup)
|
||||
|
||||
if self.form.cbSubfolders.checked:
|
||||
group = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroup", self.PVArea.Label)
|
||||
group.Label = self.PVArea.Label
|
||||
MechanicalGroup.addObject(group)
|
||||
MechanicalGroup = group
|
||||
|
||||
placements = dataframe["placement"].tolist()
|
||||
types = dataframe["type"].tolist()
|
||||
frames = []
|
||||
@@ -121,33 +120,30 @@ class _PVPlantPlacementTaskPanel:
|
||||
newrack.Placement = placements[idx]
|
||||
MechanicalGroup.addObject(newrack)
|
||||
frames.append(newrack)
|
||||
|
||||
if self.PVArea.Name.startswith("FrameArea"):
|
||||
self.PVArea.Frames = frames
|
||||
# TODO: else
|
||||
|
||||
def getProjected(self, shape):
|
||||
""" returns projected edges from a shape and a direction """
|
||||
|
||||
if shape.BoundBox.ZLength == 0:
|
||||
edges = shape.Edges
|
||||
return Part.Face(Part.Wire(edges))
|
||||
else:
|
||||
from Utils import PVPlantUtils as utils
|
||||
wire = utils.simplifyWire(utils.getProjected(shape))
|
||||
if wire.isClosed():
|
||||
wire = wire.removeSplitter()
|
||||
return Part.Face(wire)
|
||||
return Part.Face(Part.Wire(shape.Edges))
|
||||
|
||||
from Utils import PVPlantUtils as utils
|
||||
wire = utils.simplifyWire(utils.getProjected(shape))
|
||||
return Part.Face(wire.removeSplitter()) if wire.isClosed() else Part.Face(wire)
|
||||
|
||||
def calculateWorkingArea(self):
|
||||
self.Area = self.getProjected(self.PVArea.Shape)
|
||||
tmp = FreeCAD.ActiveDocument.findObjects(Name="ExclusionArea")
|
||||
if len(tmp):
|
||||
ProhibitedAreas = list()
|
||||
for obj in tmp:
|
||||
exclusion_areas = FreeCAD.ActiveDocument.findObjects(Name="ExclusionArea")
|
||||
|
||||
if exclusion_areas:
|
||||
prohibited_faces = []
|
||||
for obj in exclusion_areas:
|
||||
face = self.getProjected(obj.Base.Shape)
|
||||
if face.isValid():
|
||||
ProhibitedAreas.append(face)
|
||||
self.Area = self.Area.cut(ProhibitedAreas)
|
||||
prohibited_faces.append(face)
|
||||
self.Area = self.Area.cut(prohibited_faces)
|
||||
|
||||
def getAligments(self):
|
||||
# TODO: revisar todo esto: -----------------------------------------------------------------
|
||||
@@ -280,104 +276,6 @@ class _PVPlantPlacementTaskPanel:
|
||||
placeRegion(df)
|
||||
return df
|
||||
|
||||
"""def placeonregion_old(frames): # old
|
||||
for colnum, col in enumerate(frames):
|
||||
groups = list()
|
||||
groups.append([col[0]])
|
||||
for i in range(1, len(col)):
|
||||
group = groups[-1]
|
||||
long = (col[i].sub(group[-1])).Length
|
||||
long -= width
|
||||
if long <= dist:
|
||||
group.append(col[i])
|
||||
else:
|
||||
groups.append([col[i]])
|
||||
for group in groups:
|
||||
points = list()
|
||||
points.append(group[0].sub(vec1))
|
||||
for ind in range(0, len(group) - 1):
|
||||
points.append((group[ind].sub(vec1) + group[ind + 1].add(vec1)) / 2)
|
||||
points.append(group[-1].add(vec1))
|
||||
points3D = list()
|
||||
'''
|
||||
# v0
|
||||
for ind in range(len(points) - 1):
|
||||
line = Part.LineSegment(points[ind], points[ind + 1])
|
||||
tmp = terrain.makeParallelProjection(line.toShape(), FreeCAD.Vector(0, 0, 1))
|
||||
if len(tmp.Vertexes) > 0:
|
||||
if ind == 0:
|
||||
points3D.append(tmp.Vertexes[0].Point)
|
||||
points3D.append(tmp.Vertexes[-1].Point)
|
||||
'''
|
||||
# V1
|
||||
if type == 0: # Mesh:
|
||||
import MeshPart as mp
|
||||
for point in points:
|
||||
point3D = mp.projectPointsOnMesh([point, ], terrain, FreeCAD.Vector(0, 0, 1))
|
||||
if len(point3D) > 0:
|
||||
points3D.append(point3D[0])
|
||||
|
||||
else: # Shape:
|
||||
line = Part.LineSegment(points[0], points[-1])
|
||||
tmp = terrain.makeParallelProjection(line.toShape(), FreeCAD.Vector(0, 0, 1))
|
||||
if len(tmp.Vertexes) > 0:
|
||||
tmppoints = [ver.Point for ver in tmp.Vertexes]
|
||||
if mode == 1: # mode = normal
|
||||
for point in points:
|
||||
'''# OPTION 1:
|
||||
line = Part.Line(point, point + FreeCAD.Vector(0, 0, 10))
|
||||
for i in range(len(tmppoints) - 1):
|
||||
seg = Part.LineSegment(tmppoints[i], tmppoints[i + 1])
|
||||
inter = line.intersect(seg)
|
||||
print(inter)
|
||||
if len(inter) > 0:
|
||||
points3D.append(FreeCAD.Vector(inter[0].X, inter[0].Y, inter[0].Z))
|
||||
'''
|
||||
# OPTION 2:
|
||||
plane = Part.Plane(point, self.Dir)
|
||||
for i in range(len(tmppoints) - 1):
|
||||
seg = Part.LineSegment(tmppoints[i], tmppoints[i + 1])
|
||||
inter = plane.intersect(seg)
|
||||
if len(inter) > 0:
|
||||
if len(inter[0]):
|
||||
inter = inter[0]
|
||||
points3D.append(FreeCAD.Vector(inter[0].X, inter[0].Y, inter[0].Z))
|
||||
break
|
||||
else: # TODO: mode = Trend
|
||||
# TODO: check:
|
||||
from scipy import stats
|
||||
xx = list()
|
||||
yy = list()
|
||||
zz = list()
|
||||
|
||||
for pts in tmppoints:
|
||||
xx.append(pts.x)
|
||||
yy.append(pts.y)
|
||||
zz.append(pts.z)
|
||||
|
||||
slope, intercept, r, p, std_err = stats.linregress(yy, zz)
|
||||
|
||||
def myfunc(x):
|
||||
return slope * x + intercept
|
||||
|
||||
x = list()
|
||||
x.append(yy[0])
|
||||
x.append(yy[-1])
|
||||
newzz = list(map(myfunc, x))
|
||||
points3D.append(FreeCAD.Vector(xx[0], yy[0], newzz[0]))
|
||||
points3D.append(FreeCAD.Vector(xx[-1], yy[-1], newzz[1]))
|
||||
|
||||
for ind in range(0, len(points3D) - 1):
|
||||
pl = FreeCAD.Placement()
|
||||
vec = points3D[ind] - points3D[ind + 1]
|
||||
pl.Base = FreeCAD.Vector(group[ind])
|
||||
p = (points3D[ind] + points3D[ind + 1]) / 2
|
||||
pl.Base.z = p.z
|
||||
rot = FreeCAD.Rotation(FreeCAD.Vector(-1, 0, 0), vec)
|
||||
pl.Rotation = FreeCAD.Rotation(rot.toEuler()[0], rot.toEuler()[1], 0)
|
||||
placements.append(pl)
|
||||
return placements"""
|
||||
|
||||
def isInside(self, frame, point):
|
||||
if self.Area.isInside(point, 10, True):
|
||||
frame.Placement.Base = point
|
||||
@@ -542,23 +440,32 @@ class _PVPlantPlacementTaskPanel:
|
||||
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()))
|
||||
tmpframes = list()
|
||||
items = [
|
||||
FreeCAD.ActiveDocument.getObject(item.text())
|
||||
for i in range(self.form.listFrameSetups.count())
|
||||
if (item := self.form.listFrameSetups.item(i)).checkState() == QtCore.Qt.Checked
|
||||
]
|
||||
|
||||
"""seen_lengths = set()
|
||||
tmpframes = []
|
||||
for frame in sorted(items, key=lambda rack: rack.Length, reverse=True):
|
||||
found = False
|
||||
if frame.Length not in seen_lengths:
|
||||
seen_lengths.add(frame.Length)
|
||||
tmpframes.append(frame)
|
||||
'''found = False
|
||||
for tmp in tmpframes:
|
||||
if tmp.Length == frame.Length:
|
||||
found = True
|
||||
break
|
||||
if not found:
|
||||
tmpframes.append(frame)
|
||||
self.FrameSetups = tmpframes.copy()
|
||||
longerFrame = self.FrameSetups[0]
|
||||
tmpframes.append(frame)'''
|
||||
self.FrameSetups = tmpframes.copy()"""
|
||||
|
||||
unique_frames = {frame.Length.Value: frame for frame in items}
|
||||
self.FrameSetups = sorted(list(unique_frames.values()), key=lambda rack: rack.Length, reverse=True)
|
||||
|
||||
self.gap_col = FreeCAD.Units.Quantity(self.form.editGapCols.text()).Value
|
||||
self.gap_row = FreeCAD.Units.Quantity(self.form.editGapRows.text()).Value + longerFrame.Length.Value
|
||||
self.gap_row = FreeCAD.Units.Quantity(self.form.editGapRows.text()).Value + self.FrameSetups[0].Length.Value
|
||||
self.offsetX = FreeCAD.Units.Quantity(self.form.editOffsetHorizontal.text()).Value
|
||||
self.offsetY = FreeCAD.Units.Quantity(self.form.editOffsetVertical.text()).Value
|
||||
|
||||
@@ -581,8 +488,6 @@ class _PVPlantPlacementTaskPanel:
|
||||
print(" -- Tiempo tardado:", total_time)
|
||||
FreeCADGui.Control.closeDialog()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
#return True
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------------
|
||||
# function AdjustToTerrain
|
||||
|
||||
@@ -15,6 +15,338 @@
|
||||
<string>Park Settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" alignment="Qt::AlignmentFlag::AlignTop">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Estructura:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QListWidget" name="listFrameSetups">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>54</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QWidget" name="widget_2" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonAddFrame">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonRemoveFrame">
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="buttonPVArea">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="3">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Configuración</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="horizontalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="8" column="1">
|
||||
<widget class="QComboBox" name="comboDirV">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>De arriba a abajo</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>De abajo a arriba</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Del centro a los lados</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Dirección Horizontal</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QComboBox" name="comboDirH">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>De izquierda a derecha</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>De derecha a izquiera</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>De centro a los lados</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QCheckBox" name="cbAlignFrames">
|
||||
<property name="text">
|
||||
<string>Alinear estructuras</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QSpinBox" name="editGapRows">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::ButtonSymbols::NoButtons</enum>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> mm</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>500</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Pitch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QDoubleSpinBox" name="editOffsetHorizontal">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::ButtonSymbols::NoButtons</enum>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> m</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-10000.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>10000.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Orientación</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Offset Horizontal</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Offset Vertical</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QDoubleSpinBox" name="editOffsetVertical">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::ButtonSymbols::NoButtons</enum>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> m</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-10000.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>10000.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QDoubleSpinBox" name="editGapCols">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::ButtonSymbols::NoButtons</enum>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> m</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>100.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>5.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboOrientation">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Norte - Sur</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Este - Oeste</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Dirección Vertical</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Espacio entre filas</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="editInnerSpacing"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string> - Inner Spacing</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="3">
|
||||
<widget class="QGroupBox" name="groupCorridor">
|
||||
<property name="title">
|
||||
@@ -59,10 +391,10 @@
|
||||
<item row="3" column="1">
|
||||
<widget class="QDoubleSpinBox" name="editRowGap">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
<enum>QAbstractSpinBox::ButtonSymbols::NoButtons</enum>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string/>
|
||||
@@ -110,10 +442,10 @@
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="editColGap">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
<enum>QAbstractSpinBox::ButtonSymbols::NoButtons</enum>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string/>
|
||||
@@ -135,10 +467,10 @@
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="editRowCount">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
<enum>QAbstractSpinBox::ButtonSymbols::NoButtons</enum>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>4</number>
|
||||
@@ -148,10 +480,10 @@
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="editColCount">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
<enum>QAbstractSpinBox::ButtonSymbols::NoButtons</enum>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>8</number>
|
||||
@@ -161,45 +493,6 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="buttonPVArea">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QWidget" name="widget_2" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonAddFrame">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonRemoveFrame">
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
@@ -207,292 +500,9 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="editPVArea"/>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="3">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Configuración</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="horizontalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Offset Vertical</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Orientación</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QCheckBox" name="cbAlignFrames">
|
||||
<property name="text">
|
||||
<string>Alinear estructuras</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Espacio entre filas</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Dirección Horizontal</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Offset Horizontal</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Pitch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Dirección Vertical</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboOrientation">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Norte - Sur</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Este - Oeste</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QDoubleSpinBox" name="editGapCols">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> m</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>100.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>5.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="comboDirH">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>De izquierda a derecha</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>De derecha a izquiera</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>De centro a los lados</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QComboBox" name="comboDirV">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>De arriba a abajo</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>De abajo a arriba</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Del centro a los lados</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QDoubleSpinBox" name="editOffsetHorizontal">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> m</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-10000.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>10000.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QDoubleSpinBox" name="editOffsetVertical">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> m</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-10000.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>10000.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QSpinBox" name="editGapRows">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> mm</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>500</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" alignment="Qt::AlignTop">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Estructura:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QListWidget" name="listFrameSetups">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>54</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
|
||||
@@ -771,12 +771,12 @@ class _PVPlantSite(ArchSite._Site):
|
||||
import PVPlantImportGrid
|
||||
x, y, zone_number, zone_letter = utm.from_latlon(lat, lon)
|
||||
self.obj.UtmZone = zone_list[zone_number - 1]
|
||||
zz = PVPlantImportGrid.getElevationFromOE([[lat, lon]])
|
||||
self.obj.Origin = FreeCAD.Vector(x * 1000, y * 1000, zz[0].z)
|
||||
#self.obj.OriginOffset = FreeCAD.Vector(x * 1000, y * 1000, 0) #??
|
||||
|
||||
point = PVPlantImportGrid.getElevationFromOE([[lat, lon]])
|
||||
self.obj.Origin = FreeCAD.Vector(point[0].x, point[0].y, point[0].z)
|
||||
self.obj.Latitude = lat
|
||||
self.obj.Longitude = lon
|
||||
self.obj.Elevation = zz[0].z
|
||||
self.obj.Elevation = point[0].z
|
||||
|
||||
|
||||
class _ViewProviderSite(ArchSite._ViewProviderSite):
|
||||
|
||||
@@ -39,6 +39,16 @@
|
||||
<property name="spacing">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Maximum west-east slope:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QWidget" name="widget_2" native="true"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
@@ -46,17 +56,20 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Frame coloring:</string>
|
||||
<string>South facing</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -66,71 +79,20 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Maximum west-east slope:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QDoubleSpinBox" name="editWETL">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> º</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>90.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>8.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QDoubleSpinBox" name="editSFTL">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> º</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>90.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>2.800000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QWidget" name="widget_2" native="true"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>South facing</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
<string>Frame coloring:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="editNFTL">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
<enum>QAbstractSpinBox::ButtonSymbols::NoButtons</enum>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> º</string>
|
||||
@@ -149,7 +111,45 @@
|
||||
<string>North Facing</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QDoubleSpinBox" name="editSFTL">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::ButtonSymbols::NoButtons</enum>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> º</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>90.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>2.800000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QDoubleSpinBox" name="editWETL">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::ButtonSymbols::NoButtons</enum>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> º</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>90.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>8.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user