New Section Box View By Elements (Archi-Lab)

Hi guys

I am using the archi-lab node, New section view by elements, and want it to make more than one view for different elements as the picture below. I have tried list.Map but didn’t work can any body help.

Thank you

Hi @Mohammad_Nawar

Try using Lists

Did not work with me, but I am trying to manipulate the python code.

Show complete graph. Are you using proper view name.

Thank you kulkul for ur suggestion, just I changed the python code and it’s worked !.

@Mohammad_Nawar can you share the changes you made to the python code?

1 Like

Here you go, if didn’t work let me know.

#Copyright(c) 2014, Konrad Sobon
# @arch_laboratory,
import clr
from Autodesk.DesignScript.Geometry import *

# Import ToDSType(bool) extension method
import Revit

# Import DocumentManager and TransactionManager
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

from System.Collections.Generic import *

# Import RevitAPI
import Autodesk
from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

#The inputs to this node will be stored as a list in the IN variable.
dataEnteringNode = IN

d = []
v = IN[1]
s = 0
for k in IN[0]:
	elements = []
	for i in k:
	viewName = v[s]
	offset = float(IN[2])
	s = 1+s
	#get ViewFamilyType for a 3D View
	collector = FilteredElementCollector(doc)
	viewTypeColl = collector.OfClass(ViewFamilyType)
	for i in viewTypeColl:
		if i.ViewFamily == ViewFamily.ThreeDimensional:
			viewType = i
	# "Start" the transaction
	#define bounding box enclosing all elements
	bboxMin, bboxMax = [], []
	i = elements[0]
	minX, minY, minZ, maxX, maxY, maxZ = [], [], [], [], [], []
	for i, j in zip(bboxMin, bboxMax):
	bboxMinX = min(minX)
	bboxMinY = min(minY)
	bboxMinZ = min(minZ)
	bboxMaxX = max(maxX)
	bboxMaxY = max(maxY)
	bboxMaxZ = max(maxZ)
	#create a bounding box
	bbox = BoundingBoxXYZ()
	bbox.Min = XYZ((bboxMinX - offset), (bboxMinY - offset), (bboxMinZ - offset))
	bbox.Max = XYZ((bboxMaxX + offset), (bboxMaxY + offset), (bboxMaxZ + offset))
	#create 3d View
	view = View3D.CreateIsometric(doc, viewType.Id)
	view.Name = viewName

# "End" the transaction

#Assign your output to the OUT variable
OUT = d

I only added for loop and it’s woking perfectly with my case which take the first element from each list as the picture below…


@Mohammad_Nawar Thank you that was very helpful.

I have one last thing perplexing me. the section box size appears to not be set by multiple elements, but by the element on the 0 index. So where I would like the section dbox to be sized around the three elements 2459,2793 & 2906 it is only setting the section box based on element 2459.

Not too sure if you can get the boundingbox of a group of elements but one thing you could do is take the minimum x, y, z and all of the elements bounding boxes’ minpoint and the maximum x y z of all of the boundingboxes’ maxpoint and create a bounding box using that. Will be a small amount of extra code though.

Ignore the part in the grey, that is just me setting up the rest of the script to work. The part in orange takes boundingboxes (from multiple elements) and takes it apart, finds the min and max of x y and z and makes a new box that encompasses all of the elements.I’d imagine this is similar to what Revit actually does.