This commit is contained in:
2025-03-28 19:40:11 +06:00
parent af559092bf
commit 1d062a087f
26 changed files with 360 additions and 514 deletions

View File

@@ -46,15 +46,10 @@ except AttributeError:
from PVPlantResources import DirIcons as DirIcons
## @package importDAE
# \ingroup ARCH
# \brief DAE (Collada) file format importer and exporter
#
# This module provides tools to import and export Collada (.dae) files.
__title__ = "FreeCAD Collada importer"
__author__ = "Yorik van Havre"
__url__ = "http://www.freecadweb.org"
__title__ = "FreeCAD PVSyst importer"
__author__ = "Javier"
#__url__ = "http://www.freecadweb.org"
try:
# Python 2 forward compatibility
@@ -453,7 +448,7 @@ def exportToPVC(path, exportTerrain = False):
array = SubElement(axis, 'float_array')
array.set('id', 'tracker{0}AxisFloatArray1'.format(ind))
array.set('count', '3')
array.text = '{0:.6f} {1:.6f} {2:.6f}'.format(centers[i].x, centers[i].y, centers[i].z)
array.text = '{0:.6f} {1:.6f} {2:.6f}'.format(centers[ind].x, centers[ind].y, centers[ind].z)
min_phi = SubElement(frame, 'min_phi')
min_phi.text = '{0}'.format(int(obj.Setup.MinPhi.Value))
@@ -529,11 +524,10 @@ def exportToPVC(path, exportTerrain = False):
frame_setup["footprint"] = ""
objind = 0
# TODO: revisar
for type in frameType:
isTracker = "tracker" in type.Proxy.Type.lower()
#TODO: Sólo para los proyectos de NAcho. Borrar
isTracker = False
for typ in frameType:
isTracker = "tracker" in typ.Proxy.Type.lower()
objectlist = FreeCAD.ActiveDocument.findObjects(Name="Tracker")
tmp = []
@@ -545,7 +539,7 @@ def exportToPVC(path, exportTerrain = False):
objectlist = tmp.copy()
for obj in objectlist:
if obj.Setup == type:
if obj.Setup == typ:
findex = numpy.array([])
modules = obj.Setup.Shape.SubShapes[0].SubShapes[0]
@@ -726,26 +720,26 @@ def exportToH2P(path): # sólo válido para mesas
#for obj in objects:
grouptype.append(objects[0])
for type in grouptype:
for typ in grouptype:
st += 'TABLE\n' \
'10\n'
st += f3.format(type.Width.Value) + ',' + f3.format(type.Length.Value) + ',' + \
st += f3.format(typ.Width.Value) + ',' + f3.format(typ.Length.Value) + ',' + \
f3.format(0) + ',' + f3.format(0) + ',' + f3.format(0) + ',' + f3.format(0) + "\n"
#'#{ f3 %pvsyst.ilb.to_mm },#{f3 %pvsyst.irb.to_mm},#{f3 %pvsyst.itb.to_mm},' \
#'#{f3 %pvsyst.ibb.to_mm}\n'
st += '20\n'
st += str(int(type.ModulesCols.Value)) + ',' + str(int(type.ModulesRows.Value)) + ',' + \
str(type.ModuleColGap.Value) + ',' + str(type.ModuleRowGap.Value) + ',' + '30\n'
st += str(int(typ.ModulesCols.Value)) + ',' + str(int(typ.ModulesRows.Value)) + ',' + \
str(typ.ModuleColGap.Value) + ',' + str(typ.ModuleRowGap.Value) + ',' + '30\n'
st += '30\n'
st += '1,' + f3.format(type.ModuleWidth.Value) + ',' + f3.format(type.ModuleHeight.Value) + ',' + \
f3.format(type.ModuleThick.Value) + ',' + f2.format(450) + '\n' #f2.format(type.ModulePower.Value) + '\n'
st += '1,' + f3.format(typ.ModuleWidth.Value) + ',' + f3.format(typ.ModuleHeight.Value) + ',' + \
f3.format(typ.ModuleThick.Value) + ',' + f2.format(450) + '\n' #f2.format(typ.ModulePower.Value) + '\n'
# cornerdown = find_component_sizes(group.cdef)[1]
# pvorigin = Geom::Point3d.new(cornerdown.x, cornerdown.y, 0)
# group.instances.each{ | ins | str += pvsyst_insert(ins, pvorigin)}
for obj in objects:
if obj.CloneOf == type:
if obj.CloneOf == typ:
st += H2PInsert(obj)
## TODO: Bucle para buscar objetos que den sombra y el terreno. Todos llaman a H2PMesh
@@ -778,12 +772,12 @@ def H2PInsert(obj):
return st
def H2PMesh(mesh, type):
def H2PMesh(mesh, typ):
scale = 0.001 ## ver como se puede hacer para que sea general. Pasar de mm a m
f3 = '{:.3f}'
st = ''
if type:
if typ:
st = 'ShadowObject\nFence\n'
else:
st = 'DGM\n'
@@ -799,7 +793,7 @@ def H2PMesh(mesh, type):
return st
class _PVSystTaskPanel:
class PVSystTaskPanel:
def __init__(self):
self.form = FreeCADGui.PySideUic.loadUi(os.path.dirname(__file__) + "/exportPVSyst.ui")
@@ -812,7 +806,7 @@ class _PVSystTaskPanel:
def accept(self):
import datetime
x = datetime.datetime.now()
date = x.strftime("%y%m%d%H%M%S")
date = x.strftime("%Y%m%d%H%M%S")
overwrite = True
path = os.path.join(os.path.dirname(FreeCAD.ActiveDocument.FileName), "outputs", "PVSyst")
@@ -820,8 +814,8 @@ class _PVSystTaskPanel:
os.makedirs(path)
name = FreeCAD.ActiveDocument.Label
if not overwrite:
name = date + "-" + name
#if not overwrite:
name = date + "-" + name
filename = os.path.join(path, name)
#if self.form.cbDAE.isChecked():
@@ -840,7 +834,7 @@ class _PVSystTaskPanel:
FreeCADGui.Control.closeDialog()
return True
class _CommandExportToPVSyst:
'''class _CommandExportToPVSyst:
"Export to PVSyst"
def GetResources(self):
@@ -861,4 +855,4 @@ class _CommandExportToPVSyst:
return False
if FreeCAD.GuiUp:
FreeCADGui.addCommand('ExportToPVSyst', _CommandExportToPVSyst())
FreeCADGui.addCommand('ExportToPVSyst', _CommandExportToPVSyst())'''