primera subida
This commit is contained in:
333
Electrical/Cable/PVPlantCable.py
Normal file
333
Electrical/Cable/PVPlantCable.py
Normal file
@@ -0,0 +1,333 @@
|
||||
# /**********************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2021 Javier Braña <javier.branagutierrez@gmail.com> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify*
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307*
|
||||
# * USA *
|
||||
# * *
|
||||
# ***********************************************************************
|
||||
|
||||
|
||||
import ArchComponent
|
||||
import FreeCAD
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
import FreeCADGui, os
|
||||
from PySide import QtCore
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
else:
|
||||
# \cond
|
||||
def translate(ctxt, txt):
|
||||
return txt
|
||||
|
||||
|
||||
def QT_TRANSLATE_NOOP(ctxt, txt):
|
||||
return txt
|
||||
# \endcond
|
||||
|
||||
try:
|
||||
_fromUtf8 = QtCore.QString.fromUtf8
|
||||
except AttributeError:
|
||||
def _fromUtf8(s):
|
||||
return s
|
||||
|
||||
import PVPlantResources
|
||||
|
||||
|
||||
def makeCable(base = None):
|
||||
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython", "Cable")
|
||||
Cable(obj)
|
||||
ViewProviderCable(obj.ViewObject)
|
||||
if base:
|
||||
obj.Base = base
|
||||
return obj
|
||||
|
||||
class Cable(ArchComponent.Component):
|
||||
"A Base Frame Obcject - Class"
|
||||
|
||||
def __init__(self, obj):
|
||||
ArchComponent.Component.__init__(self, obj)
|
||||
self.setProperties(obj)
|
||||
|
||||
def setProperties(self, obj):
|
||||
pl = obj.PropertiesList
|
||||
|
||||
# General:
|
||||
if not ("Manufacturer" in pl):
|
||||
obj.addProperty("App::PropertyString",
|
||||
"Manufacturer",
|
||||
"General",
|
||||
"Connection")
|
||||
|
||||
if not ("Factory" in pl):
|
||||
obj.addProperty("App::PropertyString",
|
||||
"Factory",
|
||||
"General",
|
||||
"Connection ")
|
||||
|
||||
if not ("DesignStandard" in pl):
|
||||
obj.addProperty("App::PropertyString",
|
||||
"DesignStandard",
|
||||
"General",
|
||||
"Connection ")
|
||||
|
||||
if not ("CableDesignation" in pl):
|
||||
obj.addProperty("App::PropertyString",
|
||||
"CableDesignation",
|
||||
"General",
|
||||
"Connection ").CableDesignation="RH5Z1-OL"
|
||||
|
||||
if not ("MaximumVoltage" in pl):
|
||||
obj.addProperty("App::PropertyElectricPotential",
|
||||
"MaximumVoltage",
|
||||
"General",
|
||||
"Connection ").MaximumVoltage="30kV"
|
||||
|
||||
if not ("MaxTemperatureForContinuousOperation" in pl):
|
||||
obj.addProperty("App::PropertyInteger",
|
||||
"MaxTemperatureForContinuousOperation",
|
||||
"General",
|
||||
"Connection ").MaxTemperatureForContinuousOperation=95
|
||||
|
||||
if not ("MaxTemperatureDuringEmergencyConditions" in pl):
|
||||
obj.addProperty("App::PropertyInteger",
|
||||
"MaxTemperatureDuringEmergencyConditions",
|
||||
"General",
|
||||
"Connection ").MaxTemperatureDuringEmergencyConditions=105
|
||||
|
||||
if not ("MaxTemperatureDuringShortCircuit" in pl):
|
||||
obj.addProperty("App::PropertyInteger",
|
||||
"MaxTemperatureDuringShortCircuit",
|
||||
"General",
|
||||
"Connection ").MaxTemperatureDuringShortCircuit=250
|
||||
|
||||
|
||||
# Conductor:
|
||||
if not ("Material" in pl):
|
||||
obj.addProperty("App::PropertyEnumeration",
|
||||
"Material",
|
||||
"Conductor",
|
||||
"Connection ").Material=["Copper", "Aluminium"]
|
||||
|
||||
if not ("Standard" in pl):
|
||||
obj.addProperty("App::PropertyString",
|
||||
"Standard",
|
||||
"Conductor",
|
||||
"Connection ").Standard = "IEC 60228"
|
||||
|
||||
if not ("CrossSection" in pl):
|
||||
obj.addProperty("App::PropertyArea",
|
||||
"CrossSection",
|
||||
"Conductor",
|
||||
"Connection ").CrossSection = 95
|
||||
|
||||
if not ("MaximumConductorDiameter" in pl):
|
||||
obj.addProperty("App::PropertyLength",
|
||||
"MaximumConductorDiameter",
|
||||
"Conductor",
|
||||
"Connection ")
|
||||
|
||||
if not ("MinimumConductorDiameter" in pl):
|
||||
obj.addProperty("App::PropertyLength",
|
||||
"MinimumConductorDiameter",
|
||||
"Conductor",
|
||||
"Connection ")
|
||||
|
||||
if not ("MaximumResistance" in pl):
|
||||
obj.addProperty("App::PropertyInteger",
|
||||
"MaximumResistance",
|
||||
"Conductor",
|
||||
"Connection ")
|
||||
|
||||
# Insulation:
|
||||
if not ("InsulationMaterial" in pl):
|
||||
obj.addProperty("App::PropertyEnumeration",
|
||||
"InsulationMaterial",
|
||||
"Insulation",
|
||||
"Connection ").InsulationMaterial=["HEPR", "XLPE"]
|
||||
|
||||
if not ("InsulationStandard" in pl):
|
||||
obj.addProperty("App::PropertyString",
|
||||
"InsulationStandard",
|
||||
"Insulation",
|
||||
"Connection ").InsulationStandard = "IEC 60502-2"
|
||||
|
||||
if not ("InsulationNominalThickness" in pl):
|
||||
obj.addProperty("App::PropertyLength",
|
||||
"InsulationNominalThickness",
|
||||
"Insulation",
|
||||
"Sección").InsulationNominalThickness = 7.25
|
||||
|
||||
if not ("InsulationMinimumThickness" in pl):
|
||||
obj.addProperty("App::PropertyLength",
|
||||
"InsulationMinimumThickness",
|
||||
"Insulation",
|
||||
"Sección").InsulationMinimumThickness = 6.43
|
||||
|
||||
if not ("InsulationResistance" in pl):
|
||||
obj.addProperty("App::PropertyInteger",
|
||||
"InsulationResistance",
|
||||
"Insulation",
|
||||
"Sección").InsulationResistance = 3670000
|
||||
|
||||
# Outer semi-conductive layer:
|
||||
if not ("OuterMaterial" in pl):
|
||||
obj.addProperty("App::PropertyString",
|
||||
"OuterMaterial",
|
||||
"OuterLayer",
|
||||
"Connection ").OuterMaterial = "Semicon. compound"
|
||||
|
||||
if not ("OuterNominalThickness" in pl):
|
||||
obj.addProperty("App::PropertyLength",
|
||||
"OuterNominalThickness",
|
||||
"OuterLayer",
|
||||
"Sección").OuterNominalThickness = 0.5
|
||||
|
||||
if not ("OuterMinimumThickness" in pl):
|
||||
obj.addProperty("App::PropertyLength",
|
||||
"OuterMinimumThickness",
|
||||
"OuterLayer",
|
||||
"Sección").OuterMinimumThickness = 0.5
|
||||
|
||||
# algo
|
||||
if not ("ExternalDiameter" in pl):
|
||||
obj.addProperty("App::PropertyDistance",
|
||||
"ExternalDiameter",
|
||||
"Cable",
|
||||
QT_TRANSLATE_NOOP("App::Property", "Diameter")).ExternalDiameter = 6.6
|
||||
|
||||
if not ("Section" in pl):
|
||||
obj.addProperty("App::PropertyArea",
|
||||
"Section",
|
||||
"Cable",
|
||||
QT_TRANSLATE_NOOP("App::Property", "Sección"))
|
||||
|
||||
if not ("Core" in pl):
|
||||
obj.addProperty("App::PropertyEnumeration",
|
||||
"Core",
|
||||
"Cable",
|
||||
"Core").Core = ["1", "2", "3", ]
|
||||
|
||||
if not ("RadiusOfCurvature" in pl):
|
||||
obj.addProperty("App::PropertyDistance",
|
||||
"RadiusOfCurvature",
|
||||
"Cable",
|
||||
QT_TRANSLATE_NOOP("App::Property", "Diameter")).RadiusOfCurvature = 100
|
||||
|
||||
self.Type = "Cable"
|
||||
|
||||
obj.Proxy = self
|
||||
obj.IfcType = "Cable Segment"
|
||||
obj.setEditorMode("IfcType", 1)
|
||||
|
||||
def onDocumentRestored(self, obj):
|
||||
"""Method run when the document is restored.
|
||||
Re-adds the Arch component, and object properties."""
|
||||
|
||||
ArchComponent.Component.onDocumentRestored(self, obj)
|
||||
self.setProperties(obj)
|
||||
obj.Proxy = self
|
||||
|
||||
def onChanged(self, obj, prop):
|
||||
''' Do something when a property has changed '''
|
||||
|
||||
def getPoint(self, val):
|
||||
if val.Proxy.Type == 'String':
|
||||
return val.StringPoles[0]
|
||||
elif val.Proxy.Type == 'StringBox':
|
||||
input = val.Shape.SubShapes[2].SubShapes[0]
|
||||
return input.CenterOfMass
|
||||
else:
|
||||
return val.Placement.Base
|
||||
|
||||
def execute(self, obj):
|
||||
import Part, DraftGeomUtils
|
||||
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):
|
||||
def __init__(self, vobj):
|
||||
ArchComponent.ViewProviderComponent.__init__(self, vobj)
|
||||
|
||||
def getIcon(self):
|
||||
return str(os.path.join(PVPlantResources.DirIcons, "cable.svg"))
|
||||
|
||||
|
||||
class CommandCable:
|
||||
def GetResources(self):
|
||||
return {'Pixmap': str(os.path.join(PVPlantResources.DirIcons, "cable.svg")),
|
||||
'Accel': "E, C",
|
||||
'MenuText': QT_TRANSLATE_NOOP("Placement", "Cable"),
|
||||
'ToolTip': QT_TRANSLATE_NOOP("Placement", "Calcular el BOQ de la")}
|
||||
|
||||
def Activated(self):
|
||||
import Draft
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
wire = None
|
||||
for obj in sel:
|
||||
if Draft.getType(obj) == "Wire":
|
||||
wire = obj
|
||||
break
|
||||
|
||||
makeCable(wire)
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
def IsActive(self):
|
||||
if FreeCAD.ActiveDocument:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
FreeCADGui.addCommand('PVPlantCable', CommandCable())
|
||||
308
Electrical/Cable/PVPlantElectricalLine.py
Normal file
308
Electrical/Cable/PVPlantElectricalLine.py
Normal file
@@ -0,0 +1,308 @@
|
||||
# /**********************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2021 Javier Braña <javier.branagutierrez@gmail.com> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify*
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307*
|
||||
# * USA *
|
||||
# * *
|
||||
# ***********************************************************************
|
||||
|
||||
|
||||
import ArchComponent
|
||||
import FreeCAD
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
import FreeCADGui, os
|
||||
from PySide import QtCore
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
else:
|
||||
# \cond
|
||||
def translate(ctxt, txt):
|
||||
return txt
|
||||
|
||||
|
||||
def QT_TRANSLATE_NOOP(ctxt, txt):
|
||||
return txt
|
||||
# \endcond
|
||||
|
||||
try:
|
||||
_fromUtf8 = QtCore.QString.fromUtf8
|
||||
except AttributeError:
|
||||
def _fromUtf8(s):
|
||||
return s
|
||||
|
||||
import PVPlantResources
|
||||
__dir__ = os.path.join(PVPlantResources.__dir__, "Electrical", "Cable")
|
||||
|
||||
|
||||
def makeElectricalLine(base = None):
|
||||
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython", "ElectricalLine")
|
||||
ElectricalLine(obj)
|
||||
ViewProviderElectricalLine(obj.ViewObject)
|
||||
if base:
|
||||
obj.Base = base
|
||||
|
||||
'''try:
|
||||
folder = FreeCAD.ActiveDocument.Trenches
|
||||
except:
|
||||
folder = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroup", 'Trenches')
|
||||
folder.Label = "Trenches"
|
||||
folder.addObject(obj)'''
|
||||
return obj
|
||||
|
||||
|
||||
class ElectricalLine(ArchComponent.Component):
|
||||
|
||||
def __init__(self, obj):
|
||||
ArchComponent.Component.__init__(self, obj)
|
||||
self.setProperties(obj)
|
||||
|
||||
def setProperties(self, obj):
|
||||
pl = obj.PropertiesList
|
||||
|
||||
if not ("Paths" in pl):
|
||||
obj.addProperty("App::PropertyLinkSubList",
|
||||
"Paths",
|
||||
"General",
|
||||
"Connection")
|
||||
|
||||
if not ("offset" in pl):
|
||||
obj.addProperty("App::PropertyVector",
|
||||
"offset",
|
||||
"General",
|
||||
"Connection")
|
||||
|
||||
if not ("From" in pl):
|
||||
obj.addProperty("App::PropertyLink",
|
||||
"From",
|
||||
"Connections",
|
||||
QT_TRANSLATE_NOOP("App::Property", "Connection "))
|
||||
|
||||
if not ("To" in pl):
|
||||
obj.addProperty("App::PropertyLink",
|
||||
"To",
|
||||
"Connections",
|
||||
QT_TRANSLATE_NOOP("App::Property", "Connection "))
|
||||
|
||||
if not ("Cable" in pl):
|
||||
obj.addProperty("App::PropertyLink",
|
||||
"Cable",
|
||||
"Line",
|
||||
QT_TRANSLATE_NOOP("App::Property", "Connection "))
|
||||
|
||||
if not ("Phases" in pl):
|
||||
obj.addProperty("App::PropertyEnumeration",
|
||||
"Phases",
|
||||
"Line",
|
||||
"Connection").Phases = ["2", "3"]
|
||||
obj.Phases = "3"
|
||||
|
||||
if not ("LineType" in pl):
|
||||
obj.addProperty("App::PropertyEnumeration",
|
||||
"LineType",
|
||||
"Line",
|
||||
"Connection").LineType = ["AC", "DC"]
|
||||
|
||||
if not ("Setup" in pl):
|
||||
obj.addProperty("App::PropertyEnumeration",
|
||||
"Setup",
|
||||
"Line",
|
||||
"Connection").Setup = ["Trifoil", "Parallel"]
|
||||
|
||||
obj.Proxy = self
|
||||
obj.IfcType = "Cable Segment"
|
||||
obj.setEditorMode("IfcType", 1)
|
||||
|
||||
def onDocumentRestored(self, obj):
|
||||
"""Method run when the document is restored.
|
||||
Re-adds the Arch component, and object properties."""
|
||||
|
||||
ArchComponent.Component.onDocumentRestored(self, obj)
|
||||
self.setProperties(obj)
|
||||
|
||||
def updateOutputProperties(self, obj):
|
||||
''' '''
|
||||
|
||||
def onChanged(self, obj, prop):
|
||||
'''Do something when a property has changed'''
|
||||
|
||||
if prop == "Cable":
|
||||
''' '''
|
||||
if hasattr(obj.Cable, "Proxy") and (obj.Cable.Proxy.Type == "Cable"):
|
||||
''' '''
|
||||
else:
|
||||
obj.Cable = None
|
||||
|
||||
if prop == "LineType":
|
||||
obj.Phases = "2" if obj.LineType == "DC" else "3"
|
||||
obj.setEditorMode("Phases", obj.LineType == "DC")
|
||||
self.updateOutputProperties(self, obj)
|
||||
|
||||
def execute(self, obj):
|
||||
import Part, DraftGeomUtils
|
||||
|
||||
w = self.generatePath(obj)
|
||||
if (not w) and (not obj.Cable):
|
||||
return
|
||||
|
||||
r = obj.Cable.ExternalDiameter.Value / 2
|
||||
sh = Part.makeCompound([])
|
||||
cnt = int(obj.Phases)
|
||||
if obj.Phases == "3" and obj.Setup == "Parallel":
|
||||
offsets = [FreeCAD.Vector(-2 * r, 0, r),
|
||||
FreeCAD.Vector(2 * r, 0, r),
|
||||
FreeCAD.Vector(0, 0, r)]
|
||||
else:
|
||||
offsets = [FreeCAD.Vector(-r, 0, r),
|
||||
FreeCAD.Vector(r, 0, r),
|
||||
FreeCAD.Vector(0, 0, r * (1 + 3 ** 0.5))]
|
||||
|
||||
for i in range(cnt):
|
||||
ph = Part.Wire([Part.Circle(offsets[i] + obj.offset,
|
||||
FreeCAD.Vector(0, 1, 0),
|
||||
r).toShape()])
|
||||
v1 = w.Vertexes[1].Point - w.Vertexes[0].Point
|
||||
if v1.y < 0:
|
||||
v1 = -v1
|
||||
v2 = DraftGeomUtils.getNormal(ph)
|
||||
ph.Placement.Base = w.Vertexes[0].Point
|
||||
ph.Placement.Rotation = FreeCAD.Rotation(v2, v1)
|
||||
sh.add(w.makePipeShell([ph, ], True, False, 0))
|
||||
|
||||
obj.Shape = sh
|
||||
|
||||
def generatePath(self, obj):
|
||||
import Utils.PVPlantFillets as fillets
|
||||
|
||||
result = None
|
||||
# 1. sort
|
||||
if not obj.Base:
|
||||
return None
|
||||
|
||||
print(obj.Paths)
|
||||
|
||||
w = obj.Base.Shape.SubShapes[1].SubShapes[0]
|
||||
w = fillets.filletWire(w, obj.Cable.RadiusOfCurvature)
|
||||
return w
|
||||
|
||||
|
||||
class ViewProviderElectricalLine(ArchComponent.ViewProviderComponent):
|
||||
def __init__(self, vobj):
|
||||
ArchComponent.ViewProviderComponent.__init__(self, vobj)
|
||||
self.Object = None
|
||||
vobj.Proxy = self
|
||||
|
||||
def attach(self, vobj):
|
||||
''' Create Object visuals in 3D view. '''
|
||||
self.Object = vobj.Object
|
||||
|
||||
def getIcon(self):
|
||||
return str(os.path.join(PVPlantResources.DirIcons, "electricalline.png"))
|
||||
|
||||
def claimChildren(self):
|
||||
""" Provides object grouping """
|
||||
children = []
|
||||
if self.Object.Cable:
|
||||
children.append(self.Object.Cable)
|
||||
return children
|
||||
|
||||
|
||||
class ElectricalLineTaskPanel:
|
||||
def __init__(self, obj=None):
|
||||
self.new = False
|
||||
self.selection = None
|
||||
self.selectionViewObject = None
|
||||
self.obj = obj
|
||||
|
||||
if obj is None:
|
||||
self.new = True
|
||||
|
||||
self.form = FreeCADGui.PySideUic.loadUi(os.path.join(__dir__, "PVPlantElectricalLine.ui"))
|
||||
'''self.form.buttonAddLayer.clicked.connect(self.addLayer)
|
||||
self.form.buttonDeleteLayer.clicked.connect(self.removeLayer)
|
||||
self.form.buttonUp.clicked.connect(self.moveUp)
|
||||
self.form.buttonDown.clicked.connect(self.moveDown)'''
|
||||
|
||||
|
||||
#self.observer = SelectionObserver.SelObserver()
|
||||
FreeCADGui.Selection.addObserver(self)
|
||||
|
||||
def addSelection(self, document, object, element, position): # Selection
|
||||
''' '''
|
||||
obj = FreeCAD.getDocument(document).getObject(object)
|
||||
if hasattr(obj, "Proxy"):
|
||||
if obj.Proxy.Type == "Trench":
|
||||
self.selection = obj
|
||||
self.selectionViewObject = obj.ViewObject.DisplayMode
|
||||
obj.ViewObject.DisplayMode = "Wireframe"
|
||||
self.TrechDialog = FreeCADGui.PySideUic.loadUi(os.path.join(__dir__, "PVPlantElectricalLineDialog.ui"))
|
||||
self.TrechDialog.labelTitle.setText(obj.Name)
|
||||
self.TrechDialog.spinBox.setMaximum(obj.Cables)
|
||||
self.TrechDialog.buttonAccept.clicked.connect(self.addTrenchRoute)
|
||||
self.TrechDialog.show()
|
||||
|
||||
def clearSelection(self, doc):
|
||||
''' '''
|
||||
if self.selectionViewObject:
|
||||
self.selection.ViewObject.DisplayMode = self.selectionViewObject
|
||||
self.selectionViewObject = None
|
||||
pass
|
||||
|
||||
def addTrenchRoute(self):
|
||||
val = self.TrechDialog.spinBox.value
|
||||
FreeCADGui.Selection.clearSelection()
|
||||
self.TrechDialog.close()
|
||||
|
||||
def accept(self):
|
||||
FreeCAD.ActiveDocument.openTransaction("Create Electrical Line")
|
||||
makeElectricalLine()
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
self.closeForm()
|
||||
return True
|
||||
|
||||
def reject(self):
|
||||
self.closeForm()
|
||||
return False
|
||||
|
||||
def closeForm(self):
|
||||
FreeCADGui.Selection.removeObserver(self)
|
||||
FreeCADGui.Control.closeDialog()
|
||||
|
||||
|
||||
class CommandElectricalLine:
|
||||
def GetResources(self):
|
||||
return {'Pixmap': str(os.path.join(PVPlantResources.DirIcons, "electricalline.png")),
|
||||
'Accel': "E, L",
|
||||
'MenuText': "Línea eléctrica",
|
||||
'ToolTip': "Crea una línea electríca en AC o DC.\n Selecciona la configuración de cable."}
|
||||
|
||||
def Activated(self):
|
||||
TaskPanel = ElectricalLineTaskPanel()
|
||||
FreeCADGui.Control.showDialog(TaskPanel)
|
||||
|
||||
def IsActive(self):
|
||||
if FreeCAD.ActiveDocument:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
active = not (FreeCAD.ActiveDocument is None)
|
||||
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
FreeCADGui.addCommand('PVPlanElectricalLine', CommandElectricalLine())
|
||||
|
||||
218
Electrical/Cable/PVPlantElectricalLine.ui
Normal file
218
Electrical/Cable/PVPlantElectricalLine.ui
Normal file
@@ -0,0 +1,218 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>formRack</class>
|
||||
<widget class="QDialog" name="formRack">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>332</width>
|
||||
<height>157</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Fixed Frame:</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Dimensions</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Heigth (m)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="editModuleHeight">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>140</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>10000.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.010000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1000.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="editModuleLenght">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>140</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>10000.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.010000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>2000.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Anchura (m)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Largura (m)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="editModuleWidth">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>140</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>10000.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.010000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1000.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QDoubleSpinBox" name="editModuleWidth_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>140</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>10000.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.010000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1000.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
71
Electrical/Cable/PVPlantElectricalLineDialog.ui
Normal file
71
Electrical/Cable/PVPlantElectricalLineDialog.ui
Normal file
@@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>formTrechPathSelector</class>
|
||||
<widget class="QDialog" name="formTrechPathSelector">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>178</width>
|
||||
<height>79</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Fixed Frame:</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Seleccionar ruta</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="labelTitle">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(180, 180, 180);
|
||||
border-color: rgb(129, 129, 129);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="spinBox">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QPushButton" name="buttonAccept">
|
||||
<property name="text">
|
||||
<string>Aceptar</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user