Open LeeFried opened 5 years ago
Progress made by changing BB Data from this:
# Copyright(c) 2016, David Mans, Konrad Sobon
# @arch_laboratory, http://archi-lab.net, http://neoarchaic.net
import clr
import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)
import System
assemblies = System.AppDomain.CurrentDomain.GetAssemblies()
path1 = [a.Location for a in assemblies if 'bumblebee,' in a.FullName][0]
path2 = System.IO.Path.GetDirectoryName(path1).rsplit('\\',1)[0]
bb_path = '%s\\extra\\' %path2
sys.path.append(bb_path)
import bumblebee as bb
#The inputs to this node will be stored as a list in the IN variable.
dataEnteringNode = IN
sheetName = IN[0]
origin = IN[1]
data = IN[2]
# Make BBData object if list or make multiple BBData objects if
# list depth == 3
if isinstance(sheetName, list):
if isinstance(origin, list):
dataObjectList = []
for i, j, k in zip(sheetName, origin, data):
dataObjectList.append(bb.MakeDataObject(i, j, k))
else:
dataObjectList = []
for i, j in zip(sheetName, data):
dataObjectList.append(bb.MakeDataObject(i,None,j))
else:
dataObjectList = bb.MakeDataObject(sheetName, origin, data)
#Assign your output to the OUT variable
OUT = dataObjectList
to this:
# Copyright(c) 2016, David Mans, Konrad Sobon
# @arch_laboratory, http://archi-lab.net, http://neoarchaic.net
import clr
import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)
import System
assemblies = System.AppDomain.CurrentDomain.GetAssemblies()
path1 = [a.Location for a in assemblies if 'bumblebee,' in a.FullName][0]
path2 = System.IO.Path.GetDirectoryName(path1).rsplit('\\',1)[0]
bb_path = '%s\\extra\\' %path2
sys.path.append(bb_path)
import bumblebee as bb
#The inputs to this node will be stored as a list in the IN variable.
dataEnteringNode = IN
sheetName = IN[0]
origin = IN[1]
data = IN[2]
# Make BBData object if list or make multiple BBData objects if
# list depth == 3
if isinstance(sheetName, list):
dataObjectList=[]
for i in range (len(sheetName)):
dataObjectList.append(bb.MakeDataObject(sheetName[i], origin[i], data[i]))
elif isinstance(origin, list):
dataObjectList=[]
for i in range (len(origin)):
dataObjectList.append(bb.MakeDataObject(sheetName, origin[i], data[i]))
# if isinstance(origin, list):
# dataObjectList = []
# for i, j, k in zip(sheetName, origin, data):
# dataObjectList.append(bb.MakeDataObject(i, j, k))
# else:
# dataObjectList = []
# for i, j in zip(sheetName, data):
# dataObjectList.append(bb.MakeDataObject(i,None,j))
else:
dataObjectList = bb.MakeDataObject(sheetName, origin, data)
#Assign your output to the OUT variable
OUT = dataObjectList
However now it starts the data in the correct cells, but then places one character per cell from left to right. I want all content from each parameter to populate each single cell.
Instead of writing "A1" into cell A1, it writes "A" to A1 and "1" to B1.
I've now solved my issue of separating characters 1 per cell. The changes are in the FillData operation of the WriteExcel node.
Change this:
def FillData(x, y, x1, y1, ws, data, origin):
if origin != None:
x = x + origin[1]
y = y + origin[0]
else:
x = x + 1
y = y + 1
if y1 != None:
ws.Cells[x, y] = data[x1][y1]
else:
ws.Cells[x, y] = data[x1]
return ws
To this:
def FillData(x, y, x1, y1, ws, data, origin):
if origin != None:
#x = x + origin[1]
#y = y + origin[0]
x = origin[1]
y = origin[0]
else:
x = x + 1
y = y + 1
if y1 != None:
ws.Cells[x, y] = data[x1][y1]
else:
#ws.Cells[x, y] = data[x1]
ws.Cells[x, y] = data
return ws
I haven't looked through what other repercussions this could have, but it did solve my issue.
The product page says multiple origin start points on a single sheet is possible, but this is the error I receive when trying.
When attempting to WriteExcel (after "import os" is added), I get the following error when using a list of cells as the "origin" input to the "BB Data" node.
The list is ["A1","C3","E5:F5"], should this be formatted differently? Changing "E5:F5" from a range to individual cells had no effect.
The ... in the file path is just me editing out user and path information.