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

@@ -47,16 +47,16 @@ except AttributeError:
import PVPlantResources import PVPlantResources
def makeCable(base = None): def makeCable(name="Cable"):
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython", "Cable") obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython", name)
obj.Label = name
Cable(obj) Cable(obj)
ViewProviderCable(obj.ViewObject) ViewProviderCable(obj.ViewObject)
if base:
obj.Base = base
return obj return obj
class Cable(ArchComponent.Component): class Cable(ArchComponent.Component):
"A Base Frame Obcject - Class" "A Cable Obcject - Class"
def __init__(self, obj): def __init__(self, obj):
ArchComponent.Component.__init__(self, obj) ArchComponent.Component.__init__(self, obj)
@@ -254,48 +254,10 @@ class Cable(ArchComponent.Component):
return val.Placement.Base return val.Placement.Base
def execute(self, obj): def execute(self, obj):
import Part, DraftGeomUtils ''' No hacer nada. Es un componente sin shape'''
import Draft
if obj.Base:
w = obj.Base.Shape.SubShapes[1].SubShapes[0]
w = DraftGeomUtils.filletWire(w, 150)
else:
return
"""if obj.Base:
# Si tiene ruta, dibujar ruteado
import PVPlantTrench as trench
if isinstance(obj.Base, trench.Trench):
w = obj.Base.Shape.SubShapes[0]
else:
w = obj.Base.Shape
elif obj.From and obj.Name:
'''line = Part.LineSegment()
line.StartPoint = getPoint(obj.From)
line.EndPoint = getPoint(obj.To)
w = Part.Wire(line.toShape())'''
w = Part.makePolygon([self.getPoint(obj.From), self.getPoint(obj.To)])
else:
return"""
r = obj.ExternalDiameter.Value / 2
p = Part.Wire([Part.Circle(FreeCAD.Vector(0, 0, 0),
FreeCAD.Vector(0, 1, 0),
r).toShape()])
c = obj.Offset
c.x -= r
c.z += r
v1 = w.Vertexes[1].Point - w.Vertexes[0].Point
v2 = DraftGeomUtils.getNormal(p)
p.Placement.Base = w.Vertexes[0].Point + c
p.Placement.Rotation = FreeCAD.Rotation(v2, v1)
obj.Shape = w.makePipeShell([p], True, False, 0)
obj.Distance = w.Length
class ViewProviderCable(ArchComponent.ViewProviderComponent): class ViewProviderCable(ArchComponent.ViewProviderComponent): #hace falta??
def __init__(self, vobj): def __init__(self, vobj):
ArchComponent.ViewProviderComponent.__init__(self, vobj) ArchComponent.ViewProviderComponent.__init__(self, vobj)
@@ -311,15 +273,7 @@ class CommandCable:
'ToolTip': QT_TRANSLATE_NOOP("Placement", "Calcular el BOQ de la")} 'ToolTip': QT_TRANSLATE_NOOP("Placement", "Calcular el BOQ de la")}
def Activated(self): def Activated(self):
import Draft makeCable()
sel = FreeCADGui.Selection.getSelection()
wire = None
for obj in sel:
if Draft.getType(obj) == "Wire":
wire = obj
break
makeCable(wire)
FreeCAD.ActiveDocument.recompute() FreeCAD.ActiveDocument.recompute()
def IsActive(self): def IsActive(self):

View File

@@ -59,7 +59,7 @@ def makeBOQCivil():
class _CommandBOQCivil: class CommandBOQCivil:
def GetResources(self): def GetResources(self):
return {'Pixmap': str(os.path.join(DirIcons, "boqc.svg")), return {'Pixmap': str(os.path.join(DirIcons, "boqc.svg")),
@@ -76,5 +76,5 @@ class _CommandBOQCivil:
else: else:
return False return False
if FreeCAD.GuiUp: '''if FreeCAD.GuiUp:
FreeCADGui.addCommand('BOQCivil', _CommandBOQCivil()) FreeCADGui.addCommand('BOQCivil', _CommandBOQCivil())'''

View File

@@ -83,7 +83,8 @@ def makeBOQElectrical():
b = mgb.get_boundary(m) b = mgb.get_boundary(m)
Part.show(b) Part.show(b)
class _CommandBOQElectrical:
class CommandBOQElectrical:
def GetResources(self): def GetResources(self):
return {'Pixmap': str(os.path.join(DirIcons, "boqe.svg")), return {'Pixmap': str(os.path.join(DirIcons, "boqe.svg")),
'Accel': "R, E", 'Accel': "R, E",
@@ -100,5 +101,5 @@ class _CommandBOQElectrical:
return False return False
if FreeCAD.GuiUp: '''if FreeCAD.GuiUp:
FreeCADGui.addCommand('BOQElectrical', _CommandBOQElectrical()) FreeCADGui.addCommand('BOQElectrical', _CommandBOQElectrical())'''

View File

@@ -294,7 +294,7 @@ def spreadsheetBOQPanelCollision(sheet, sel):
sheet['G{0}'.format(ind + 2)] = sel[ind].Placement.Rotation.toEuler()[1] sheet['G{0}'.format(ind + 2)] = sel[ind].Placement.Rotation.toEuler()[1]
sheet['H{0}'.format(ind + 2)] = sel[ind].NumberPole.Value sheet['H{0}'.format(ind + 2)] = sel[ind].NumberPole.Value
class _CommandBOQMechanical: class CommandBOQMechanical:
def GetResources(self): def GetResources(self):
return {'Pixmap': str(os.path.join(PVPlantResources.DirIcons, "boqm.svg")), return {'Pixmap': str(os.path.join(PVPlantResources.DirIcons, "boqm.svg")),
'Accel': "R, M", 'Accel': "R, M",
@@ -340,5 +340,5 @@ class _CommandBOQMechanical:
else: else:
return False return False
if FreeCAD.GuiUp: '''if FreeCAD.GuiUp:
FreeCADGui.addCommand('BOQMechanical', _CommandBOQMechanical()) FreeCADGui.addCommand('BOQMechanical', CommandBOQMechanical())'''

View File

@@ -186,8 +186,8 @@ def createPVPanel(name):
typpvpanel.noct = 45.0 # SINTC (double) (Cº) typpvpanel.noct = 45.0 # SINTC (double) (Cº)
typpvpanel.manuf = "" # Fabricante typpvpanel.manuf = "" # Fabricante
typpypanel.chr_name = "" # Nombre característico typpvpanel.chr_name = "" # Nombre característico
typpypanel.appr_status = 1 # Estado: 0: No aprobado, 1: aprobado typpvpanel.appr_status = 1 # Estado: 0: No aprobado, 1: aprobado
return typpvpanel return typpvpanel

View File

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

View File

@@ -28,33 +28,10 @@ from pathlib import Path
import sys import sys
import os import os
import FreeCADGui import FreeCADGui
import FreeCAD
FreeCADGui.updateLocale() FreeCADGui.updateLocale()
try:
import PVPlantGeoreferencing, PVPlantPlacement, \
PVPlantTerrainAnalisys, PVPlantSite, PVPlantImportGrid, PVPlantFence, \
PVPlantFoundation, PVPlantCreateTerrainMesh, \
PVPlantTreeGenerator, PVPlantBuilding, PVPlantTrench, PVPlantEarthWorks, \
PVPlantStringing, \
PVPlantPad, PVPlantRoad, PVPlantTerrain, PVPlantManhole, \
GraphProfile, Utils.PVPlantTrace, \
reload
import PVPlantRackChecking
from Project.Area import PVPlantArea, PVPlantAreaUtils
from Project import ProjectSetup
from Importer import importDXF
from Mechanical.Frame import PVPlantFrame
from Electrical.Cable import PVPlantCable, PVPlantElectricalLine
from Electrical.CombinerBox import PVPlantStringBox
from Electrical.Inverter import PVPlantInverter
except ImportError as e:
print(f"Error importing modules: {e}")
class PVPlantWorkbench(Workbench): class PVPlantWorkbench(Workbench):
from PVPlantResources import DirIcons as DirIcons from PVPlantResources import DirIcons as DirIcons
@@ -66,49 +43,22 @@ class PVPlantWorkbench(Workbench):
#sys.path.append(r"C:\Users\javie\AppData\Roaming\FreeCAD\Mod") #sys.path.append(r"C:\Users\javie\AppData\Roaming\FreeCAD\Mod")
sys.path.append(os.path.join(FreeCAD.getUserAppDataDir(), 'Mod')) sys.path.append(os.path.join(FreeCAD.getUserAppDataDir(), 'Mod'))
import PVPlantTools import PVPlantTools, reload
self.projectlist = PVPlantTools.projectlist self.projectlist = PVPlantTools.projectlist
self.projectlist.insert(0, 'Reload')
self.projectlist.insert(1, 'Separator')
self.framelist = PVPlantTools.pv_list
from Export import ExporterCommands
self.inportExportlist = ExporterCommands.Exportlist
# A list of command names created in the line above
'''self.projectlist = ["Reload",
"PVPlantSite",
"PVPlantGeoreferencing",
"ProjectSetup",
# "ImportGrid",
"Terrain",
"PointsGroup",
"PVPlantCreateTerrainMesh",
"PVPlantAreas",
"SplitArea",
"TerrainAnalisys",
"Trenches",
"PVPlantEarthworks",
"PVPlantPad",
"PVPlantRoad",
"PVPlantManhole",
# "PVPlantFoundation"
"GraphTerrainProfile",
"Trace",
]'''
self.framelist = [
"RackType",
"PVPlantRackCheck",
"Separator",
"PVPlantPlacement",
"PVPlantAdjustToTerrain",
"PVPlantConvertTo",
"PVArea"
]
self.objectlist = [ self.objectlist = [
"PVPlantTree", "PVPlantTree",
"PVPlantBuilding", "PVPlantBuilding",
"PVPlantFenceGroup", "PVPlantFenceGroup",
] ]
from Export import ExporterCommands
self.inportExportlist = ExporterCommands.Exportlist
self.electricalList = ["PVPlantStringBox", self.electricalList = ["PVPlantStringBox",
"PVPlantCable", "PVPlantCable",
"PVPlanElectricalLine", "PVPlanElectricalLine",
@@ -119,7 +69,6 @@ class PVPlantWorkbench(Workbench):
] ]
self.roads = ["PVPlantRoad", self.roads = ["PVPlantRoad",
] ]
self.pads = ["PVPlantPad", self.pads = ["PVPlantPad",

View File

@@ -33,7 +33,7 @@ except AttributeError:
import os, math import os, math
from PVPlantResources import DirIcons as DirIcons from PVPlantResources import DirIcons as DirIcons
class _TaskPanel: class TaskPanel:
def __init__(self, obj = None): def __init__(self, obj = None):
self.obj = None self.obj = None
self.select = 0 self.select = 0
@@ -251,7 +251,7 @@ def Open3DTriangle(point_cloud):
#p_mesh_crop = mesh.crop(bbox) #p_mesh_crop = mesh.crop(bbox)
return mesh return mesh
class _PVPlantCreateTerrainMesh: '''class _PVPlantCreateTerrainMesh:
def GetResources(self): def GetResources(self):
return {'Pixmap': str(os.path.join(DirIcons, "surface.svg")), return {'Pixmap': str(os.path.join(DirIcons, "surface.svg")),
@@ -268,4 +268,4 @@ class _PVPlantCreateTerrainMesh:
if FreeCAD.GuiUp: if FreeCAD.GuiUp:
FreeCADGui.addCommand('PVPlantCreateTerrainMesh', _PVPlantCreateTerrainMesh()) FreeCADGui.addCommand('PVPlantCreateTerrainMesh', _PVPlantCreateTerrainMesh())'''

View File

@@ -488,7 +488,7 @@ class ViewProviderEarthWorksVolume:
return None return None
class _EarthWorksTaskPanel: class EarthWorksTaskPanel:
def __init__(self): def __init__(self):
self.To = None self.To = None
@@ -827,7 +827,7 @@ def searchTool(obj, tools):
return tool return tool
class _CommandCalculateEarthworks: '''class _CommandCalculateEarthworks:
def GetResources(self): def GetResources(self):
return {'Pixmap': str(os.path.join(PVPlantResources.DirIcons, "pico.svg")), return {'Pixmap': str(os.path.join(PVPlantResources.DirIcons, "pico.svg")),
@@ -846,7 +846,7 @@ class _CommandCalculateEarthworks:
return active return active
if FreeCAD.GuiUp: if FreeCAD.GuiUp:
FreeCADGui.addCommand('PVPlantEarthworks', _CommandCalculateEarthworks()) FreeCADGui.addCommand('PVPlantEarthworks', _CommandCalculateEarthworks())'''
def accept(): def accept():

View File

@@ -27,8 +27,7 @@ if FreeCAD.GuiUp:
import FreeCADGui import FreeCADGui
from PySide import QtCore, QtGui from PySide import QtCore, QtGui
from PySide.QtCore import QT_TRANSLATE_NOOP from PySide.QtCore import QT_TRANSLATE_NOOP
from PySide2.QtWebEngineWidgets import QWebEngineView
from PySide2.QtWebChannel import QWebChannel
import os import os
else: else:
# \cond # \cond
@@ -47,13 +46,19 @@ class MapWindow(QtGui.QWidget):
def __init__(self, WinTitle="MapWindow"): def __init__(self, WinTitle="MapWindow"):
super(MapWindow, self).__init__() super(MapWindow, self).__init__()
self.raise_() self.raise_()
self.lat = 0 self.lat = None
self.lon = 0 self.lon = None
self.minLat = None
self.maxLat = None
self.minLon = None
self.maxLon = None
self.WinTitle = WinTitle self.WinTitle = WinTitle
self.setupUi() self.setupUi()
def setupUi(self): def setupUi(self):
from PySide2.QtWebEngineWidgets import QWebEngineView
from PySide2.QtWebChannel import QWebChannel
self.ui = FreeCADGui.PySideUic.loadUi(PVPlantResources.__dir__ + "/PVPlantGeoreferencing.ui", self) self.ui = FreeCADGui.PySideUic.loadUi(PVPlantResources.__dir__ + "/PVPlantGeoreferencing.ui", self)
self.resize(1200, 800) self.resize(1200, 800)
@@ -144,6 +149,9 @@ class MapWindow(QtGui.QWidget):
RightLayout.addWidget(self.groupbox) RightLayout.addWidget(self.groupbox)
# ------------------------ # ------------------------
self.checkboxImportGis = QtGui.QCheckBox("Importar datos GIS")
RightLayout.addWidget(self.checkboxImportGis)
verticalSpacer = QtGui.QSpacerItem(20, 48, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) verticalSpacer = QtGui.QSpacerItem(20, 48, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
RightLayout.addItem(verticalSpacer) RightLayout.addItem(verticalSpacer)
@@ -169,7 +177,6 @@ class MapWindow(QtGui.QWidget):
geolocator = Nominatim(user_agent="http") geolocator = Nominatim(user_agent="http")
location = geolocator.geocode(self.valueSearch.text()) location = geolocator.geocode(self.valueSearch.text())
print(location.raw)
self.valueSearch.setText(location.address) self.valueSearch.setText(location.address)
self.panMap(location.longitude, location.latitude, location.raw['boundingbox']) self.panMap(location.longitude, location.latitude, location.raw['boundingbox'])
@@ -196,6 +203,13 @@ class MapWindow(QtGui.QWidget):
' | UTM: ' + str(zone_number) + zone_letter + ' | UTM: ' + str(zone_number) + zone_letter +
', {:.5f}m E, {:.5f}m N'.format(x, y)) ', {:.5f}m E, {:.5f}m N'.format(x, y))
@QtCore.Slot(float, float, float, float)
def onMapZoom(self, minLat, minLon, maxLat, maxLon):
self.minLat = min([minLat, maxLat])
self.maxLat = max([minLat, maxLat])
self.minLon = min([minLon, maxLon])
self.maxLon = max([minLon, maxLon])
@QtCore.Slot(float, float) @QtCore.Slot(float, float)
def georeference(self, lat, lng): def georeference(self, lat, lng):
import PVPlantSite import PVPlantSite
@@ -228,13 +242,20 @@ class MapWindow(QtGui.QWidget):
import geojson import geojson
import PVPlantImportGrid as ImportElevation import PVPlantImportGrid as ImportElevation
import Draft import Draft
import PVPlantSite
Site = PVPlantSite.get()
offset = FreeCAD.Vector(0, 0, 0)
if not (self.lat is None or self.lon is None):
offset = FreeCAD.Vector(Site.Origin)
offset.z = 0
items = geojson.loads(drawnItems) items = geojson.loads(drawnItems)
for item in items['features']: for item in items['features']:
if item['geometry']['type'] == "Point": # 1. if the feature is a Point or Circle: if item['geometry']['type'] == "Point": # 1. if the feature is a Point or Circle:
coord = item['geometry']['coordinates'] coord = item['geometry']['coordinates']
point = ImportElevation.getElevationFromOE([[coord[0], coord[1]],]) point = ImportElevation.getElevationFromOE([[coord[0], coord[1]],])
c = FreeCAD.Vector(point[0][0], point[0][1], point[0][2]) c = FreeCAD.Vector(point[0][0], point[0][1], point[0][2]).sub(offset)
if item['properties'].get('radius'): if item['properties'].get('radius'):
r = round(item['properties']['radius'] * 1000, 0) r = round(item['properties']['radius'] * 1000, 0)
p = FreeCAD.Placement() p = FreeCAD.Placement()
@@ -252,34 +273,67 @@ class MapWindow(QtGui.QWidget):
name = "Area" name = "Area"
lp = item['geometry']['coordinates'][0] lp = item['geometry']['coordinates'][0]
pts = [] pts = [[cords[1], cords[0]] for cords in lp]
for cords in lp:
pts.append([cords[1], cords[0]])
tmp = ImportElevation.getElevationFromOE(pts) tmp = ImportElevation.getElevationFromOE(pts)
pts = [] pts = [p.sub(offset) for p in tmp]
for p in tmp:
pts.append(p.sub(FreeCAD.ActiveDocument.Site.Origin))
obj = Draft.makeWire(pts, closed=cw, face=False) obj = Draft.makeWire(pts, closed=cw, face=False)
obj.Placement.Base = FreeCAD.ActiveDocument.Site.Origin #obj.Placement.Base = offset
obj.Label = name obj.Label = name
Draft.autogroup(obj) Draft.autogroup(obj)
if item['properties'].get('name'): if item['properties'].get('name'):
obj.Label = item['properties']['name'] obj.Label = item['properties']['name']
FreeCAD.activeDocument().recompute() if self.checkboxImportGis.isChecked():
FreeCADGui.updateGui() self.getDataFromOSM(self.minLat, self.minLon, self.maxLat, self.maxLon)
FreeCADGui.SendMsgToActiveView("ViewFit")
def panMap(self, lng, lat, geometry=""): def getDataFromOSM(self, min_lat, min_lon, max_lat, max_lon):
import Importer.importOSM as importOSM
import PVPlantSite
site = PVPlantSite.get()
offset = FreeCAD.Vector(0, 0, 0)
if not (self.lat is None or self.lon is None):
offset = FreeCAD.Vector(site.Origin)
offset.z = 0
importer = importOSM.OSMImporter(offset)
osm_data = importer.get_osm_data(f"{min_lat},{min_lon},{max_lat},{max_lon}")
importer.process_osm_data(osm_data)
'''FreeCAD.activeDocument().recompute()
FreeCADGui.updateGui()
FreeCADGui.SendMsgToActiveView("ViewFit")'''
def panMap_old(self, lng, lat, geometry=""):
frame = self.view.page() frame = self.view.page()
bbox = "[{0}, {1}], [{2}, {3}]".format(float(geometry[0]), float(geometry[2]), bbox = "[{0}, {1}], [{2}, {3}]".format(float(geometry[0]), float(geometry[2]),
float(geometry[1]), float(geometry[3])) float(geometry[1]), float(geometry[3]))
command = 'map.panTo(L.latLng({lt}, {lg}));'.format(lt=lat, lg=lng) command = 'map.panTo(L.latLng({lt}, {lg}));'.format(lt=lat, lg=lng)
command += 'map.fitBounds([{box}]);'.format(box=bbox) command += 'map.fitBounds([{box}]);'.format(box=bbox)
frame.runJavaScript(command) frame.runJavaScript(command)
# deepseek
def panMap(self, lng, lat, geometry=None):
frame = self.view.page()
# 1. Validación del parámetro geometry
if not geometry or len(geometry) < 4:
# Pan básico sin ajuste de bounds
command = f'map.panTo(L.latLng({lat}, {lng}));'
else:
try:
# 2. Mejor manejo de coordenadas (Leaflet usa [lat, lng])
# Asumiendo que geometry es [min_lng, min_lat, max_lng, max_lat]
southwest = f"{float(geometry[1])}, {float(geometry[0])}" # min_lat, min_lng
northeast = f"{float(geometry[3])}, {float(geometry[2])}" # max_lat, max_lng
command = f'map.panTo(L.latLng({lat}, {lng}));'
command += f'map.fitBounds(L.latLngBounds([{southwest}], [{northeast}]));'
except (IndexError, ValueError, TypeError) as e:
print(f"Error en geometry: {str(e)}")
command = f'map.panTo(L.latLng({lat}, {lng}));'
frame.runJavaScript(command)
def importKML(self): def importKML(self):
file = QtGui.QFileDialog.getOpenFileName(None, "FileDialog", "", "Google Earth (*.kml *.kmz)")[0] file = QtGui.QFileDialog.getOpenFileName(None, "FileDialog", "", "Google Earth (*.kml *.kmz)")[0]
@@ -287,11 +341,11 @@ class MapWindow(QtGui.QWidget):
layers = kmz_convert(file, "", ) layers = kmz_convert(file, "", )
frame = self.view.page() frame = self.view.page()
for layer in layers: for layer in layers:
command = "drawnItems.addLayer(L.geoJSON({0}));".format(layer) command = "var geoJsonLayer = L.geoJSON({0}); drawnItems.addLayer(geoJsonLayer); map.fitBounds(geoJsonLayer.getBounds());".format( layer)
frame.runJavaScript(command) frame.runJavaScript(command)
class _CommandPVPlantGeoreferencing: class CommandPVPlantGeoreferencing:
def GetResources(self): def GetResources(self):
return {'Pixmap': str(os.path.join(DirIcons, "Location.svg")), return {'Pixmap': str(os.path.join(DirIcons, "Location.svg")),
@@ -309,6 +363,6 @@ class _CommandPVPlantGeoreferencing:
else: else:
return False return False
if FreeCAD.GuiUp: '''if FreeCAD.GuiUp:
FreeCADGui.addCommand('PVPlantGeoreferencing',_CommandPVPlantGeoreferencing()) FreeCADGui.addCommand('PVPlantGeoreferencing',_CommandPVPlantGeoreferencing())
'''

View File

@@ -57,14 +57,14 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QLineEdit" name="lineEdit"> <widget class="QLineEdit" name="search_bar">
<property name="placeholderText"> <property name="placeholderText">
<string>Search...</string> <string>Search...</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="pushButton"> <widget class="QPushButton" name="search_button">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@@ -80,10 +80,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QWebEngineView" name="widget_4" native="true"/> <widget class="QLabel" name="coordinates_label">
</item>
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@@ -91,7 +88,7 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>TextLabel</string> <string>coordenadas:</string>
</property> </property>
</widget> </widget>
</item> </item>
@@ -111,7 +108,7 @@
<widget class="QWidget" name="widget_5" native="true"> <widget class="QWidget" name="widget_5" native="true">
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="1" column="1"> <item row="1" column="1">
<widget class="QPushButton" name="pushButton_4"> <widget class="QPushButton" name="kmz_button">
<property name="text"> <property name="text">
<string>PushButton</string> <string>PushButton</string>
</property> </property>
@@ -124,20 +121,27 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0">
<widget class="QCheckBox" name="checkBox">
<property name="text">
<string>Georeferenciar</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="checkBoxGeoreference">
<property name="text">
<string>Georeferenciar</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxImportGis">
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
<item> <item>
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Orientation::Vertical</enum>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
@@ -164,7 +168,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="pushButton_3"> <widget class="QPushButton" name="accept_button">
<property name="text"> <property name="text">
<string>Aceptar</string> <string>Aceptar</string>
</property> </property>
@@ -178,14 +182,6 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>QWebEngineView</class>
<extends>QWidget</extends>
<header>qwebengineview.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>

View File

@@ -1,213 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Georeferencing</class>
<widget class="QDialog" name="Georeferencing">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>574</width>
<height>350</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Create Surface</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QWidget" name="widgetLeft" native="true">
<layout class="QVBoxLayout" name="verticalLayout">
<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="QWidget" name="widgetSearch" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<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="QLineEdit" name="lineEdit">
<property name="placeholderText">
<string>Search...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Search</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWebEngineView" name="widget_4" native="true"/>
</item>
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="widgetRight" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Configuraciones:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox">
<property name="text">
<string>Georeferenciar</string>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="widget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Cargar un archivo KMZ/KML:</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_4">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QListWidget" name="listWidget">
<item>
<property name="text">
<string>New Item</string>
</property>
<property name="checkState">
<enum>Unchecked</enum>
</property>
</item>
</widget>
</item>
<item>
<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>
<widget class="QWidget" name="widget_6" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="text">
<string>Cancelar</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_3">
<property name="text">
<string>Aceptar</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QWebEngineView</class>
<extends>QWidget</extends>
<header>qwebengineview.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@@ -40,7 +40,70 @@ from PVPlantResources import DirIcons as DirIcons
import PVPlantSite import PVPlantSite
def get_elevation_from_oe(coordinates): # v1 deepseek
"""Obtiene elevaciones de Open-Elevation API y devuelve vectores FreeCAD en coordenadas UTM.
Args:
coordinates (list): Lista de tuplas con coordenadas (latitud, longitud)
Returns:
list: Lista de vectores FreeCAD con coordenadas UTM y elevación (en milímetros)
o lista vacía en caso de error.
"""
if not coordinates:
return []
import requests
import utm
from requests.exceptions import RequestException
# Construcción más eficiente de parámetros
locations = "|".join([f"{lat:.6f},{lon:.6f}" for lat, lon in coordinates])
try:
response = requests.get(
url="https://api.open-elevation.com/api/v1/lookup",
params={'locations': locations},
timeout=20,
verify=True
)
response.raise_for_status() # Lanza excepción para códigos 4xx/5xx
except RequestException as e:
print(f"Error en la solicitud: {str(e)}")
return []
try:
data = response.json()
except ValueError:
print("Respuesta JSON inválida")
return []
if "results" not in data or len(data["results"]) != len(coordinates):
print("Formato de respuesta inesperado")
return []
points = []
for result in data["results"]:
try:
# Conversión UTM con manejo de errores
easting, northing, _, _ = utm.from_latlon(
result["latitude"],
result["longitude"]
)
points.append(FreeCAD.Vector(round(easting), # Convertir metros a milímetros
round(northing),
round(result["elevation"])) * 1000)
except Exception as e:
print(f"Error procesando coordenadas: {str(e)}")
continue
return points
def getElevationFromOE(coordinates): def getElevationFromOE(coordinates):
"""Obtiene elevaciones de Open-Elevation API y devuelve vectores FreeCAD en coordenadas UTM."""
from requests.exceptions import RequestException
if len(coordinates) == 0: if len(coordinates) == 0:
return None return None
@@ -54,7 +117,16 @@ def getElevationFromOE(coordinates):
if i != total: if i != total:
str += '|' str += '|'
query = 'https://api.open-elevation.com/api/v1/lookup?locations=' + str query = 'https://api.open-elevation.com/api/v1/lookup?locations=' + str
r = get(query, timeout=20) try:
r = get(query, timeout=20, verify=False)
except RequestException as e:
points = []
for i, point in enumerate(coordinates):
c = utm.from_latlon(point[0], point[1])
points.append(FreeCAD.Vector(round(c[0] * 1000, 0),
round(c[1] * 1000, 0),
0))
return points
# Only get the json response in case of 200 or 201 # Only get the json response in case of 200 or 201
points = [] points = []
@@ -82,7 +154,7 @@ def getSinglePointElevationFromBing(lat, lng):
# +# to do: error handling - wait and try again # +# to do: error handling - wait and try again
s = json.loads(ans) s = json.loads(ans)
res = s['resourceSets'][0]['resources'][0]['elevations'] res = s['resourceSets'][0]['resources'][0]['elevations']
import utm import utm
for elevation in res: for elevation in res:
c = utm.from_latlon(lat, lng) c = utm.from_latlon(lat, lng)

View File

@@ -180,7 +180,7 @@ class _ViewProviderManhole(ArchComponent.ViewProviderComponent):
import draftguitools.gui_tool_utils as gui_tool_utils import draftguitools.gui_tool_utils as gui_tool_utils
class _ManholeTaskPanel: class ManholeTaskPanel:
def __init__(self, obj=None): def __init__(self, obj=None):
self.new = False self.new = False
if obj is None: if obj is None:
@@ -249,7 +249,7 @@ class _ManholeTaskPanel:
self.view.removeEventCallback("SoEvent", self.call) self.view.removeEventCallback("SoEvent", self.call)
class _CommandManhole: '''class _CommandManhole:
"the Arch Building command definition" "the Arch Building command definition"
def GetResources(self): def GetResources(self):
@@ -274,5 +274,5 @@ class _CommandManhole:
if FreeCAD.GuiUp: if FreeCAD.GuiUp:
FreeCADGui.addCommand('PVPlantManhole', _CommandManhole()) FreeCADGui.addCommand('PVPlantManhole', _CommandManhole())'''

View File

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

View File

@@ -1171,7 +1171,7 @@ class _ViewProviderSite:
''' '''
class _CommandPVPlantSite: '''class _CommandPVPlantSite:
"the Arch Site command definition" "the Arch Site command definition"
def GetResources(self): def GetResources(self):
@@ -1189,4 +1189,4 @@ class _CommandPVPlantSite:
return return
if FreeCAD.GuiUp: if FreeCAD.GuiUp:
FreeCADGui.addCommand('PVPlantSite', _CommandPVPlantSite()) FreeCADGui.addCommand('PVPlantSite', _CommandPVPlantSite())'''

View File

@@ -670,7 +670,7 @@ class ViewProviderTerrain:
return None return None
class _CommandTerrain: '''class _CommandTerrain:
"the PVPlant Terrain command definition" "the PVPlant Terrain command definition"
def GetResources(self): def GetResources(self):
@@ -692,4 +692,4 @@ class _CommandTerrain:
if FreeCAD.GuiUp: if FreeCAD.GuiUp:
FreeCADGui.addCommand('Terrain', _CommandTerrain()) FreeCADGui.addCommand('Terrain', _CommandTerrain())'''

View File

@@ -23,6 +23,7 @@ except AttributeError:
import os import os
from PVPlantResources import DirIcons as DirIcons from PVPlantResources import DirIcons as DirIcons
def Mest2FemMesh(obj): def Mest2FemMesh(obj):
import Fem import Fem
@@ -44,6 +45,7 @@ def Mest2FemMesh(obj):
FreeCAD.activeDocument().recompute() FreeCAD.activeDocument().recompute()
return obj2 return obj2
def makeContours(land, minor = 1000, mayor = 5000, def makeContours(land, minor = 1000, mayor = 5000,
minorColor=(0.0, 0.00, 0.80), mayorColor=(0.00, 0.00, 1.00), minorColor=(0.0, 0.00, 0.80), mayorColor=(0.00, 0.00, 1.00),
minorThickness = 2, mayorThickness = 5, minorThickness = 2, mayorThickness = 5,
@@ -58,6 +60,7 @@ def makeContours(land, minor = 1000, mayor = 5000,
FreeCAD.ActiveDocument.recompute() FreeCAD.ActiveDocument.recompute()
def Contours_Mesh(Mesh, minor, mayor, def Contours_Mesh(Mesh, minor, mayor,
minorColor, mayorColor, minorColor, mayorColor,
minorLineWidth, mayorLineWidth, minorLineWidth, mayorLineWidth,
@@ -144,6 +147,7 @@ def Contours_Mesh(Mesh, minor, mayor,
calculateSection(minor_array) calculateSection(minor_array)
calculateSection(mayor_array) calculateSection(mayor_array)
def Contours_Part(Terrain, minor, mayor, def Contours_Part(Terrain, minor, mayor,
minorColor, mayorColor, minorColor, mayorColor,
minorLineWidth, mayorLineWidth, minorLineWidth, mayorLineWidth,
@@ -235,6 +239,8 @@ def Contours_Part(Terrain, minor, mayor,
calculateSection(mayor_array) calculateSection(mayor_array)
# Base widget for task panel terrain analisys # Base widget for task panel terrain analisys
class _generalTaskPanel: class _generalTaskPanel:
'''The TaskPanel for Slope setup''' '''The TaskPanel for Slope setup'''
@@ -324,7 +330,7 @@ class _generalTaskPanel:
self.ranges[curentIndex.row()][2] = (color.red()/255, color.green()/255, color.blue()/255) self.ranges[curentIndex.row()][2] = (color.red()/255, color.green()/255, color.blue()/255)
# Contours Analisys: --------------------------------------------------------------------------------- # Contours Analisys: ---------------------------------------------------------------------------------
class _ContourTaskPanel(): class ContourTaskPanel():
'''The editmode TaskPanel for contours generator''' '''The editmode TaskPanel for contours generator'''
def __init__(self): def __init__(self):
@@ -480,7 +486,7 @@ class _ContourTaskPanel():
return True return True
# Height Analisys: --------------------------------------------------------------------------------- # Height Analisys: ---------------------------------------------------------------------------------
class _HeightTaskPanel(_generalTaskPanel): class HeightTaskPanel(_generalTaskPanel):
'''The TaskPanel for Slope setup''' '''The TaskPanel for Slope setup'''
def __init__(self): def __init__(self):
@@ -513,7 +519,7 @@ class _HeightTaskPanel(_generalTaskPanel):
return True return True
# Slope Analisys: --------------------------------------------------------------------------------- # Slope Analisys: ---------------------------------------------------------------------------------
class _SlopeTaskPanel(_generalTaskPanel): class SlopeTaskPanel(_generalTaskPanel):
'''The TaskPanel for Slope setup''' '''The TaskPanel for Slope setup'''
def __init__(self): def __init__(self):
@@ -603,7 +609,7 @@ class _SlopeTaskPanel(_generalTaskPanel):
return True return True
# Orientation Analisys: --------------------------------------------------------------------------------- # Orientation Analisys: ---------------------------------------------------------------------------------
class _OrientationTaskPanel(_generalTaskPanel): class OrientationTaskPanel(_generalTaskPanel):
'''The TaskPanel for Orientation setup''' '''The TaskPanel for Orientation setup'''
def __init__(self): def __init__(self):
@@ -707,7 +713,7 @@ class _OrientationTaskPanel(_generalTaskPanel):
## Commands ---------------------------------------------------------------------------------------------------------- ## Commands ----------------------------------------------------------------------------------------------------------
## 1. Contours: ## 1. Contours:
class _CommandContours: '''class _CommandContours:
def GetResources(self): def GetResources(self):
return {'Pixmap': str(os.path.join(DirIcons, "TerrainContours.svg")), return {'Pixmap': str(os.path.join(DirIcons, "TerrainContours.svg")),
'Accel': "T, C", 'Accel': "T, C",
@@ -803,4 +809,4 @@ if FreeCAD.GuiUp:
FreeCADGui.addCommand('SlopeAnalisys', _CommandSlopeAnalisys()) FreeCADGui.addCommand('SlopeAnalisys', _CommandSlopeAnalisys())
FreeCADGui.addCommand('HeightAnalisys', _CommandHeightAnalisys()) FreeCADGui.addCommand('HeightAnalisys', _CommandHeightAnalisys())
FreeCADGui.addCommand('OrientationAnalisys', _CommandOrientationAnalisys()) FreeCADGui.addCommand('OrientationAnalisys', _CommandOrientationAnalisys())
FreeCADGui.addCommand('TerrainAnalisys', CommandTerrainAnalisysGroup()) FreeCADGui.addCommand('TerrainAnalisys', CommandTerrainAnalisysGroup())'''

View File

@@ -56,7 +56,7 @@ class CommandPVPlantSite:
return return
class CommandPVPlantGeoreferencing: '''class CommandPVPlantGeoreferencing:
@staticmethod @staticmethod
def GetResources(): def GetResources():
return {'Pixmap': str(os.path.join(DirIcons, "Location.svg")), return {'Pixmap': str(os.path.join(DirIcons, "Location.svg")),
@@ -74,8 +74,10 @@ class CommandPVPlantGeoreferencing:
@staticmethod @staticmethod
def Activated(): def Activated():
import PVPlantGeoreferencing import PVPlantGeoreferencing
form = PVPlantGeoreferencing.MapWindow() taskd = PVPlantGeoreferencing.MapWindow()
form.show() #taskd.setParent(FreeCADGui.getMainWindow())
#taskd.setWindowFlags(QtCore.Qt.Window)
taskd.show()#exec_()'''
class CommandProjectSetup: class CommandProjectSetup:
@@ -187,8 +189,8 @@ class CommandBoundary:
from Project.Area import PVPlantArea from Project.Area import PVPlantArea
sel = FreeCADGui.Selection.getSelection()[0] sel = FreeCADGui.Selection.getSelection()[0]
obj = PVPlantArea.makeArea([ver.Point for ver in sel.Shape.Vertexes]) obj = PVPlantArea.makeArea([ver.Point for ver in sel.Shape.Vertexes])
#taskd = _PVPlantPlacementTaskPanel() # taskd = _PVPlantPlacementTaskPanel()
#FreeCADGui.Control.showDialog(taskd) # FreeCADGui.Control.showDialog(taskd)
class CommandFrameArea: class CommandFrameArea:
@@ -249,6 +251,7 @@ class CommandPVSubplant:
return True return True
else: else:
return False return False
@staticmethod @staticmethod
def Activated(): def Activated():
from Project.Area import PVPlantArea from Project.Area import PVPlantArea
@@ -524,7 +527,7 @@ class CommandManhole:
@staticmethod @staticmethod
def IsActive(): def IsActive():
return not FreeCAD.ActiveDocument is None return not (FreeCAD.ActiveDocument is None)
if FreeCAD.ActiveDocument is not None: if FreeCAD.ActiveDocument is not None:
if FreeCADGui.Selection.getCompleteSelection(): if FreeCADGui.Selection.getCompleteSelection():
for ob in FreeCAD.ActiveDocument.Objects: for ob in FreeCAD.ActiveDocument.Objects:
@@ -534,29 +537,30 @@ class CommandManhole:
@staticmethod @staticmethod
def Activated(): def Activated():
import PVPlantManhole import PVPlantManhole
TaskPanel = PVPlantManhole._ManholeTaskPanel() task_panel = PVPlantManhole._ManholeTaskPanel()
FreeCADGui.Control.showDialog(TaskPanel) FreeCADGui.Control.showDialog(task_panel)
return return
if FreeCAD.GuiUp: if FreeCAD.GuiUp:
FreeCADGui.addCommand('PVPlantSite', CommandPVPlantSite()) FreeCADGui.addCommand('PVPlantSite', CommandPVPlantSite())
FreeCADGui.addCommand('PVPlantGeoreferencing', CommandPVPlantGeoreferencing()) import PVPlantGeoreferencing
FreeCADGui.addCommand('PVPlantGeoreferencing', PVPlantGeoreferencing.CommandPVPlantGeoreferencing())
FreeCADGui.addCommand('ProjectSetup', CommandProjectSetup()) FreeCADGui.addCommand('ProjectSetup', CommandProjectSetup())
FreeCADGui.addCommand('Terrain', CommandTerrain()) FreeCADGui.addCommand('Terrain', CommandTerrain())
FreeCADGui.addCommand('PVPlantCreateTerrainMesh', CommandCreateTerrainMesh()) FreeCADGui.addCommand('PVPlantCreateTerrainMesh', CommandCreateTerrainMesh())
class CommandAreaGroup: class CommandAreaGroup:
@staticmethod @staticmethod
def GetCommands(): def GetCommands():
return tuple([#'Area', return tuple([ # 'Area',
'FrameArea', 'FrameArea',
'ForbiddenArea', 'ForbiddenArea',
'PVSubplant', 'PVSubplant',
'OffsetArea' 'OffsetArea'
]) ])
@staticmethod @staticmethod
def GetResources(): def GetResources():
@@ -568,7 +572,8 @@ if FreeCAD.GuiUp:
def IsActive(): def IsActive():
return not FreeCAD.ActiveDocument is None return not FreeCAD.ActiveDocument is None
#FreeCADGui.addCommand('Area', CommandBoundary())
# FreeCADGui.addCommand('Area', CommandBoundary())
FreeCADGui.addCommand('FrameArea', CommandFrameArea()) FreeCADGui.addCommand('FrameArea', CommandFrameArea())
FreeCADGui.addCommand('ForbiddenArea', CommandProhibitedArea()) FreeCADGui.addCommand('ForbiddenArea', CommandProhibitedArea())
FreeCADGui.addCommand('PVSubplant', CommandPVSubplant()) FreeCADGui.addCommand('PVSubplant', CommandPVSubplant())
@@ -578,6 +583,7 @@ if FreeCAD.GuiUp:
FreeCADGui.addCommand('SplitArea', CommandSplitArea()) FreeCADGui.addCommand('SplitArea', CommandSplitArea())
FreeCADGui.addCommand('JoinAreas', CommandJoinAreas()) FreeCADGui.addCommand('JoinAreas', CommandJoinAreas())
class CommandTerrainAnalisysGroup: class CommandTerrainAnalisysGroup:
@staticmethod @staticmethod
def GetCommands(): def GetCommands():
@@ -589,20 +595,22 @@ if FreeCAD.GuiUp:
@staticmethod @staticmethod
def GetResources(): def GetResources():
return { 'MenuText': QT_TRANSLATE_NOOP("",'Terrain Analisys'), return {'MenuText': QT_TRANSLATE_NOOP("", 'Terrain Analisys'),
'ToolTip': QT_TRANSLATE_NOOP("",'Terrain Analisys') 'ToolTip': QT_TRANSLATE_NOOP("", 'Terrain Analisys')
} }
@staticmethod @staticmethod
def IsActive(): def IsActive():
return not FreeCAD.ActiveDocument is None return not FreeCAD.ActiveDocument is None
FreeCADGui.addCommand('Contours', CommandContours()) FreeCADGui.addCommand('Contours', CommandContours())
FreeCADGui.addCommand('SlopeAnalisys', CommandSlopeAnalisys()) FreeCADGui.addCommand('SlopeAnalisys', CommandSlopeAnalisys())
FreeCADGui.addCommand('HeightAnalisys', CommandHeightAnalisys()) FreeCADGui.addCommand('HeightAnalisys', CommandHeightAnalisys())
FreeCADGui.addCommand('OrientationAnalisys', CommandOrientationAnalisys()) FreeCADGui.addCommand('OrientationAnalisys', CommandOrientationAnalisys())
FreeCADGui.addCommand('TerrainAnalisys', CommandTerrainAnalisysGroup()) FreeCADGui.addCommand('TerrainAnalisys', CommandTerrainAnalisysGroup())
class CommandTrenchGroup: class CommandTrenchGroup:
@staticmethod @staticmethod
def GetCommands(): def GetCommands():
@@ -625,33 +633,48 @@ if FreeCAD.GuiUp:
active = active and not (FreeCAD.ActiveDocument.getObject("Terrain").Mesh is None) active = active and not (FreeCAD.ActiveDocument.getObject("Terrain").Mesh is None)
return active return active
FreeCADGui.addCommand('PVPlantTrench', CommandTrench()) FreeCADGui.addCommand('PVPlantTrench', CommandTrench())
FreeCADGui.addCommand('PVPlantSemiAutomaticTrench', CommandSemiAutomaticTrench()) FreeCADGui.addCommand('PVPlantSemiAutomaticTrench', CommandSemiAutomaticTrench())
FreeCADGui.addCommand('Trenches', CommandTrenchGroup()) FreeCADGui.addCommand('Trenches', CommandTrenchGroup())
FreeCADGui.addCommand('PVPlantEarthworks', CommandCalculateEarthworks()) FreeCADGui.addCommand('PVPlantEarthworks', CommandCalculateEarthworks())
FreeCADGui.addCommand('PVPlantManhole', _ommandManhole()) FreeCADGui.addCommand('PVPlantManhole', CommandManhole())
projectlist = [ #"Reload", import PVPlantPlacement
"PVPlantSite", FreeCADGui.addCommand('PVPlantPlacement', PVPlantPlacement.CommandPVPlantPlacement())
"ProjectSetup", FreeCADGui.addCommand('PVPlantAdjustToTerrain', PVPlantPlacement.CommandAdjustToTerrain())
"PVPlantGeoreferencing", FreeCADGui.addCommand('PVPlantConvertTo', PVPlantPlacement.CommandConvert())
"Separator",
# "ImportGrid", projectlist = [ # "Reload",
"Terrain", "PVPlantSite",
"TerrainAnalisys", "ProjectSetup",
"PVPlantCreateTerrainMesh", "PVPlantGeoreferencing",
"Separator", "Separator",
#"PointsGroup", # "ImportGrid",
"PVPlantAreas", "Terrain",
"SplitArea", "TerrainAnalisys",
"Separator", "PVPlantCreateTerrainMesh",
"Trenches", "Separator",
"PVPlantEarthworks", # "PointsGroup",
#"PVPlantPad", "PVPlantAreas",
#"PVPlantRoad", "SplitArea",
#"PVPlantManhole", "Separator",
#"PVPlantFoundation" "Trenches",
#"GraphTerrainProfile", "PVPlantEarthworks",
#"Trace", # "PVPlantPad",
] # "PVPlantRoad",
"PVPlantManhole",
# "PVPlantFoundation"
# "GraphTerrainProfile",
# "Trace",
]
pv_list = [
# "RackType",
# "PVPlantRackCheck",
# "Separator",
"PVPlantPlacement",
"PVPlantAdjustToTerrain",
"PVPlantConvertTo",
# "PVArea"
]

View File

@@ -1018,7 +1018,7 @@ class semiAutomaticTrench:
self.unregister_editing_callbacks() self.unregister_editing_callbacks()
class CommandTrench: # V1: '''class CommandTrench: # V1:
"""Gui command for the Line tool.""" """Gui command for the Line tool."""
def GetResources(self): def GetResources(self):
@@ -1107,5 +1107,5 @@ if FreeCAD.GuiUp:
FreeCADGui.addCommand('PVPlantTrench', CommandTrench()) FreeCADGui.addCommand('PVPlantTrench', CommandTrench())
FreeCADGui.addCommand('PVPlantSemiAutomaticTrench', CommandSemiAutomaticTrench()) FreeCADGui.addCommand('PVPlantSemiAutomaticTrench', CommandSemiAutomaticTrench())
FreeCADGui.addCommand('Trenches', CommandTrenchGroup()) FreeCADGui.addCommand('Trenches', CommandTrenchGroup())'''

View File

@@ -372,7 +372,7 @@ class ViewProviderOffsetArea(_ViewProviderArea):
def makeProhibitedArea(base = None): def makeProhibitedArea(base = None):
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython", "ProhibitedArea") obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython", "Exclusions")
ProhibitedArea(obj) ProhibitedArea(obj)
ViewProviderForbiddenArea(obj.ViewObject) ViewProviderForbiddenArea(obj.ViewObject)
if base: if base:
@@ -702,8 +702,8 @@ class CommandFrameArea:
'ToolTip': "Frame Area"} 'ToolTip': "Frame Area"}
def Activated(self): def Activated(self):
sel = FreeCADGui.Selection.getSelection() for base in FreeCADGui.Selection.getSelection():
makeFramedArea(None, sel) makeFramedArea(None, base)
def IsActive(self): def IsActive(self):
if FreeCAD.ActiveDocument: if FreeCAD.ActiveDocument:
@@ -720,8 +720,8 @@ class CommandProhibitedArea:
'ToolTip': "Prohibited Area"} 'ToolTip': "Prohibited Area"}
def Activated(self): def Activated(self):
sel = FreeCADGui.Selection.getSelection() for base in FreeCADGui.Selection.getSelection():
makeProhibitedArea(sel[0]) makeProhibitedArea(base)
def IsActive(self): def IsActive(self):
if FreeCAD.ActiveDocument: if FreeCAD.ActiveDocument:
@@ -763,11 +763,8 @@ class CommandOffsetArea:
'ToolTip': "OffsetArea"} 'ToolTip': "OffsetArea"}
def Activated(self): def Activated(self):
sel = FreeCADGui.Selection.getSelection() for base in FreeCADGui.Selection.getSelection():
base = None makeOffsetArea(base)
if sel:
base = sel[0]
obj = makeOffsetArea(base)
def IsActive(self): def IsActive(self):
if FreeCAD.ActiveDocument: if FreeCAD.ActiveDocument:
@@ -776,7 +773,7 @@ class CommandOffsetArea:
return False return False
if FreeCAD.GuiUp: '''if FreeCAD.GuiUp:
class CommandAreaGroup: class CommandAreaGroup:
def GetCommands(self): def GetCommands(self):
@@ -800,4 +797,4 @@ if FreeCAD.GuiUp:
FreeCADGui.addCommand('ForbiddenArea', CommandProhibitedArea()) FreeCADGui.addCommand('ForbiddenArea', CommandProhibitedArea())
FreeCADGui.addCommand('PVSubplant', CommandPVSubplant()) FreeCADGui.addCommand('PVSubplant', CommandPVSubplant())
FreeCADGui.addCommand('OffsetArea', CommandOffsetArea()) FreeCADGui.addCommand('OffsetArea', CommandOffsetArea())
FreeCADGui.addCommand('PVPlantAreas', CommandAreaGroup()) FreeCADGui.addCommand('PVPlantAreas', CommandAreaGroup())'''

View File

@@ -128,7 +128,7 @@ def joinAreas(areas):
shape.fuse(shapes) shape.fuse(shapes)
return shape return shape
class CommandSplitArea: '''class CommandSplitArea:
def GetResources(self): def GetResources(self):
return {'Pixmap': str(os.path.join(PVPlantResources.DirIcons, "split_area.svg")), return {'Pixmap': str(os.path.join(PVPlantResources.DirIcons, "split_area.svg")),
'Accel': "A, S", 'Accel': "A, S",
@@ -162,6 +162,6 @@ class CommandJoinAreas:
if FreeCAD.GuiUp: if FreeCAD.GuiUp:
FreeCADGui.addCommand('SplitArea', CommandSplitArea()) FreeCADGui.addCommand('SplitArea', CommandSplitArea())
FreeCADGui.addCommand('JoinAreas', CommandJoinAreas()) FreeCADGui.addCommand('JoinAreas', CommandJoinAreas())'''

View File

@@ -138,7 +138,7 @@ class ProjectSetupDialog(QtGui.QWidget):
def closeForm(self): def closeForm(self):
self.close() self.close()
class CommandProjectSetup: '''class CommandProjectSetup:
def GetResources(self): def GetResources(self):
return {'Pixmap': str(os.path.join(DirIcons, "flash.svg")), return {'Pixmap': str(os.path.join(DirIcons, "flash.svg")),
'Accel': "P, S", 'Accel': "P, S",
@@ -159,5 +159,5 @@ class CommandProjectSetup:
if FreeCAD.GuiUp: if FreeCAD.GuiUp:
FreeCADGui.addCommand('ProjectSetup', CommandProjectSetup()) FreeCADGui.addCommand('ProjectSetup', CommandProjectSetup())'''

View File

@@ -38,7 +38,10 @@ new QWebChannel(qt.webChannelTransport, function (channel)
map.on('mousemove', function(e) map.on('mousemove', function(e)
{ {
MyApp.onMapMove(e.latlng.lat, e.latlng.lng) MyApp.onMapMove(e.latlng.lat, e.latlng.lng);
const bounds = map.getBounds();
MyApp.onMapZoom(bounds.getSouth(), bounds.getWest(), bounds.getNorth(), bounds.getEast());
}); });
var DrawShapes; var DrawShapes;

View File

@@ -201,8 +201,8 @@ def simplifyWire(wire):
else: else:
i += 1 i += 1
if closed: #if closed:
points.append(FreeCAD.Vector(points[0])) points.append(FreeCAD.Vector(points[0]))
pol = Part.makePolygon(points) pol = Part.makePolygon(points)
return pol return pol