Skip to content

BB Style does not work with a list of CellRange #34

@alexberd

Description

@alexberd

BB Style Python Code:

# 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 'bbIcons,' 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]
cellRange = IN[1]
graphicStyle = IN[2]

# Make BBStyle object if list or make multiple BBStyle objects if
# list depth == 3
if isinstance(sheetName, list):
	if isinstance(cellRange, list):
		dataObjectList = []
		for i, j, k in zip(sheetName, cellRange, graphicStyle):
			dataObjectList.append(bb.MakeStyleObject(i, j, k))
	else:
		dataObjectList = []
		for i, j in zip(sheetName, graphicStyle):
			dataObjectList.append(bb.MakeStyleObject(i,None,j))
else:
	dataObjectList = bb.MakeStyleObject(sheetName, cellRange, graphicStyle)

#Assign your output to the OUT variable
OUT = dataObjectList

Should be replaced by:

# 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 'bbIcons,' 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]
cellRange = IN[1]
graphicStyle = IN[2]

# Make BBStyle object if list or make multiple BBStyle objects if
# list depth == 3
if isinstance(sheetName, list):
	dataObjectList=[]
	for i in range (len(sheetName)):
			dataObjectList.append(bb.MakeStyleObject(sheetName[i], cellRange[i], graphicStyle[i]))
#	if isinstance(cellRange, list):
#		dataObjectList = []
#		for i, j, k in zip(sheetName, cellRange, graphicStyle):
#			dataObjectList.append(bb.MakeStyleObject(i, j, k))
#	else:
#		dataObjectList = []
#		for i, j in zip(sheetName, graphicStyle):
#			dataObjectList.append(bb.MakeStyleObject(i,None,j))
else:
	dataObjectList = bb.MakeStyleObject(sheetName, cellRange, graphicStyle)

#Assign your output to the OUT variable
OUT = dataObjectList

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions