py3: adapt scripts to work with Python3
This commit is contained in:
parent
1591601654
commit
4f43cfac50
|
@ -265,13 +265,13 @@ PyObject *PropertyVectorList::getPyObject(void)
|
|||
|
||||
void PropertyVectorList::setPyObject(PyObject *value)
|
||||
{
|
||||
if (PyList_Check(value)) {
|
||||
Py_ssize_t nSize = PyList_Size(value);
|
||||
if (PySequence_Check(value)) {
|
||||
Py_ssize_t nSize = PySequence_Size(value);
|
||||
std::vector<Base::Vector3d> values;
|
||||
values.resize(nSize);
|
||||
|
||||
for (Py_ssize_t i=0; i<nSize;++i) {
|
||||
PyObject* item = PyList_GetItem(value, i);
|
||||
PyObject* item = PySequence_GetItem(value, i);
|
||||
PropertyVector val;
|
||||
val.setPyObject( item );
|
||||
values[i] = val.getValue();
|
||||
|
|
|
@ -27,7 +27,8 @@ __title__="FreeCAD Equipment"
|
|||
__author__ = "Yorik van Havre"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
import FreeCAD,Draft,ArchComponent,DraftVecUtils,ArchCommands,Units
|
||||
import FreeCAD,Draft,ArchComponent,DraftVecUtils,ArchCommands
|
||||
from FreeCAD import Units
|
||||
from FreeCAD import Vector
|
||||
if FreeCAD.GuiUp:
|
||||
import FreeCADGui
|
||||
|
|
|
@ -59,7 +59,7 @@ def readPresets():
|
|||
for profilefile in profilefiles:
|
||||
if os.path.exists(profilefile):
|
||||
try:
|
||||
with open(profilefile, 'rb') as csvfile:
|
||||
with open(profilefile, 'r') as csvfile:
|
||||
beamreader = csv.reader(csvfile)
|
||||
bid=1 #Unique index
|
||||
for row in beamreader:
|
||||
|
|
|
@ -490,7 +490,6 @@ class _Stairs(ArchComponent.Component):
|
|||
print("Not yet implemented!")
|
||||
|
||||
|
||||
|
||||
class _ViewProviderStairs(ArchComponent.ViewProviderComponent):
|
||||
"A View Provider for Stairs"
|
||||
def __init__(self,vobj):
|
||||
|
|
|
@ -21,7 +21,8 @@
|
|||
#* *
|
||||
#***************************************************************************
|
||||
|
||||
import FreeCAD,Draft,ArchComponent,DraftVecUtils,ArchCommands,Units
|
||||
import FreeCAD,Draft,ArchComponent,DraftVecUtils,ArchCommands
|
||||
from FreeCAD import Units
|
||||
from FreeCAD import Vector
|
||||
if FreeCAD.GuiUp:
|
||||
import FreeCADGui
|
||||
|
|
|
@ -354,9 +354,12 @@ def insert(filename,docname,skip=[],only=[],root=None):
|
|||
if DEBUG: print("done.")
|
||||
|
||||
global ROOT_ELEMENT
|
||||
|
||||
if root:
|
||||
ROOT_ELEMENT = root
|
||||
|
||||
if DEBUG: print ("done.")
|
||||
|
||||
#global ifcfile # keeping global for debugging purposes
|
||||
filename = decode(filename,utf=True)
|
||||
ifcfile = ifcopenshell.open(filename)
|
||||
|
@ -513,6 +516,7 @@ def insert(filename,docname,skip=[],only=[],root=None):
|
|||
except:
|
||||
if DEBUG: print(" ERROR unable to get object representation",)
|
||||
if prepr and (MERGE_MODE_ARCH == 0) and archobj and CREATE_CLONES:
|
||||
|
||||
for s in prepr.Representations:
|
||||
if s.RepresentationIdentifier.upper() == "BODY":
|
||||
if s.Items[0].is_a("IfcMappedItem"):
|
||||
|
|
|
@ -413,7 +413,7 @@ def importFrd(filename, analysis=None, result_name_prefix=None):
|
|||
|
||||
if 'Nodes' in m:
|
||||
positions = []
|
||||
for k, v in m['Nodes'].iteritems():
|
||||
for k, v in m['Nodes'].items():
|
||||
positions.append(v)
|
||||
p_x_max, p_y_max, p_z_max = map(max, zip(*positions))
|
||||
p_x_min, p_y_min, p_z_min = map(min, zip(*positions))
|
||||
|
@ -454,7 +454,7 @@ def importFrd(filename, analysis=None, result_name_prefix=None):
|
|||
strainv = result_set['strainv']
|
||||
no_of_values = len(disp)
|
||||
displacement = []
|
||||
for k, v in disp.iteritems():
|
||||
for k, v in disp.items():
|
||||
displacement.append(v)
|
||||
|
||||
x_max, y_max, z_max = map(max, zip(*displacement))
|
||||
|
|
|
@ -41,10 +41,10 @@ def translate(context,text):
|
|||
|
||||
s = cStringIO.StringIO()
|
||||
for i in u:
|
||||
if ord(i) == 39:
|
||||
if i == 39:
|
||||
s.write("\\'")
|
||||
else:
|
||||
s.write(i)
|
||||
s.write(chr(i))
|
||||
t = s.getvalue()
|
||||
s.close()
|
||||
return t
|
||||
|
@ -638,7 +638,7 @@ def setColors(html):
|
|||
defaults["#textcolor"] = palette.text().color().name()
|
||||
defaults["#windowcolor"] = palette.window().color().name()
|
||||
defaults["#windowtextcolor"] = palette.windowText().color().name()
|
||||
for k,v in defaults.iteritems():
|
||||
for k,v in defaults.items():
|
||||
html = html.replace(k,str(v))
|
||||
return html
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user