update
This commit is contained in:
@@ -224,7 +224,6 @@ def spreadsheetBOQPoles(sheet: Worksheet, selection: List[FreeCAD.DocumentObject
|
||||
# Write data to sheet
|
||||
row = 3
|
||||
group_from = row
|
||||
print(poles_data[0])
|
||||
f = poles_data[0]['frame']
|
||||
for i, data in enumerate(poles_data):
|
||||
if f != data["frame"]:
|
||||
@@ -255,6 +254,7 @@ def spreadsheetBOQPoles(sheet: Worksheet, selection: List[FreeCAD.DocumentObject
|
||||
sheet['F{0}'.format(row)].number_format = "0.000"
|
||||
except:
|
||||
pass
|
||||
|
||||
sheet['G{0}'.format(row)] = round(data['head_z']) * scale
|
||||
sheet['G{0}'.format(row)].number_format = "0.000"
|
||||
sheet['H{0}'.format(row)] = data["length"] * scale
|
||||
|
||||
@@ -268,9 +268,13 @@ class exportDXF:
|
||||
})
|
||||
|
||||
def createPolyline(self, wire):
|
||||
data = getWire(wire.Shape)
|
||||
lwp = self.msp.add_lwpolyline(data)
|
||||
return lwp
|
||||
try:
|
||||
data = getWire(wire.Shape)
|
||||
lwp = self.msp.add_lwpolyline(data)
|
||||
return lwp
|
||||
except Exception as e:
|
||||
print("Error creating polyline:", e)
|
||||
return None
|
||||
|
||||
|
||||
def getWire(wire, nospline=False, width=.0):
|
||||
@@ -519,7 +523,8 @@ class _PVPlantExportDXF(QtGui.QWidget):
|
||||
|
||||
def writeArea(self):
|
||||
pol = self.exporter.createPolyline(FreeCAD.ActiveDocument.Site.Boundary)
|
||||
pol.dxf.layer = "boundary"
|
||||
if pol:
|
||||
pol.dxf.layer = "boundary"
|
||||
|
||||
for area in FreeCAD.ActiveDocument.Boundaries.Group:
|
||||
pol = self.exporter.createPolyline(area)
|
||||
|
||||
@@ -44,32 +44,24 @@ except AttributeError:
|
||||
def _fromUtf8(s):
|
||||
return s
|
||||
|
||||
from PVPlantResources import DirIcons as DirIcons
|
||||
|
||||
try:
|
||||
import collada
|
||||
COLLADA_AVAILABLE = True
|
||||
except ImportError:
|
||||
COLLADA_AVAILABLE = False
|
||||
|
||||
__title__ = "FreeCAD PVSyst importer"
|
||||
__author__ = "Javier"
|
||||
__author__ = "Javier Braña"
|
||||
#__url__ = "http://www.freecadweb.org"
|
||||
|
||||
try:
|
||||
# Python 2 forward compatibility
|
||||
range = xrange
|
||||
except NameError:
|
||||
pass
|
||||
scale = 0.001 # from millimeters (FreeCAD) to meters (Collada)
|
||||
|
||||
|
||||
def checkCollada():
|
||||
"checks if collada if available"
|
||||
|
||||
global collada
|
||||
COLLADA = None
|
||||
try:
|
||||
import collada
|
||||
except ImportError:
|
||||
FreeCAD.Console.PrintError(translate("Arch", "pycollada not found, collada support is disabled.") + "\n")
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
def check_collada():
|
||||
"""Verifica la disponibilidad de pycollada"""
|
||||
if not COLLADA_AVAILABLE:
|
||||
FreeCAD.Console.PrintError(translate("PVPlant", "pycollada no encontrado, soporte Collada desactivado.") + "\n")
|
||||
return COLLADA_AVAILABLE
|
||||
|
||||
|
||||
# from ARCH:
|
||||
@@ -79,6 +71,7 @@ def triangulate(shape):
|
||||
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
|
||||
mesher = p.GetInt("ColladaMesher", 0)
|
||||
tessellation = p.GetFloat("ColladaTessellation", 1.0)
|
||||
|
||||
grading = p.GetFloat("ColladaGrading", 0.3)
|
||||
segsperedge = p.GetInt("ColladaSegsPerEdge", 1)
|
||||
segsperradius = p.GetInt("ColladaSegsPerRadius", 2)
|
||||
@@ -91,9 +84,15 @@ def triangulate(shape):
|
||||
elif mesher == 1:
|
||||
return MeshPart.meshFromShape(Shape=shape, MaxLength=tessellation).Topology
|
||||
else:
|
||||
return MeshPart.meshFromShape(Shape=shape, GrowthRate=grading, SegPerEdge=segsperedge,
|
||||
SegPerRadius=segsperradius, SecondOrder=secondorder, Optimize=optimize,
|
||||
AllowQuad=allowquads).Topology
|
||||
return MeshPart.meshFromShape(Shape=shape,
|
||||
GrowthRate=grading,
|
||||
SegPerEdge=segsperedge,
|
||||
SegPerRadius=segsperradius,
|
||||
SecondOrder=secondorder,
|
||||
Optimize=optimize,
|
||||
AllowQuad=allowquads
|
||||
).Topology
|
||||
|
||||
|
||||
def export(exportList, filename, tessellation=1, colors=None):
|
||||
"""export(exportList,filename,tessellation=1,colors=None) -- exports FreeCAD contents to a DAE file.
|
||||
@@ -249,12 +248,9 @@ def export(exportList, filename, tessellation=1, colors=None):
|
||||
|
||||
FreeCAD.Console.PrintMessage(translate("Arch", "file %s successfully created.") % filename)
|
||||
|
||||
def exportToDAE(path):
|
||||
filename = path + ".dae"
|
||||
|
||||
def exportToPVC(path, exportTerrain = False):
|
||||
filename = path + ".pvc"
|
||||
scale = 0.001 # from millimeters (FreeCAD) to meters (Collada)
|
||||
filename = f"{path}.pvc"
|
||||
|
||||
from xml.etree.ElementTree import Element, SubElement
|
||||
import datetime
|
||||
@@ -818,8 +814,6 @@ class PVSystTaskPanel:
|
||||
name = date + "-" + name
|
||||
filename = os.path.join(path, name)
|
||||
|
||||
#if self.form.cbDAE.isChecked():
|
||||
# exportToDAE(filename)
|
||||
|
||||
if self.form.cbPVC.isChecked():
|
||||
exportToPVC(filename, self.form.cbTerrain.isChecked())
|
||||
|
||||
Reference in New Issue
Block a user