I´m trying to use the superuseful Tool.CropViewfromRoomShape from SteamNodes. But instead of using for single room I want to use for a group of rooms. ¿Any ideas? I don´t know how to deal with. I had tried to créate a boundary of the diferrents polycurves of each rooms but I couldn´t.
thank you KulKul. I´ve read the link but I don´t understand how @listlevels can helpme. The Node just take the first room in the list. Do the work perfect, but just for one room. I need a selected rooms.
The nodes I boxed in red are getting the room boundaries and offsetting them to be a closed curve that will define the Crop Region. What you will want to do, between the Polycurve.Offset output and the Python IN[0] input, is to get the outer most boundary curves of all of the room boundaries combined. Take the contents of the Tool.CropViewfromRoomShape node into your workspace, freeze the Python node and try out getting the outer most boundary curves from the Polycurve.Offset output… something like this could work but there might be a better way:
Thank you awilliams, now I am close. It´s work fine to get the outline of complete groups of romos, but I don´t know why Python node doesn´t work with these inputs.
From the Surface.Perimeter curves output, you need to find the sublist of curves that only pertain to the bottom surface of the combined solid. Put a watch node after the Surface.Perimeter curves node and look at the sublists of curves; there will be two groups of curves that are the longest (top and bottom surfaces of the solid). Of those two longest groups of curves, look for the list that the curves z values are all zero, then use GetItemAtIndex to pull that sublist of curves to use as the boundary for crop region
I also tried to take planar curves (doing intersection with a plane) , but get this error:
““Advertencia: IronPythonEvaluator.Error en la operación EvaluateIronPythonScript.
Traceback (most recent call last):
File “”, line 41, in
TypeError: iteration over non-sequence of type Curve””
Oops - my apologies @Alejandro_Folgar_Era; I hadn’t realized that the Python code was written to expect a list of sublists of curves. Here is a revised Python code that should work, but it will not accept a list of views and curves the way that the original Steam Nodes does, it will only allow you to run it on one view with one set of curves at a time:
import clr
#python nodes in dynamo 1.2
#proposed by Julien Benoit @jbenoit44
#http://aecuandme.wordpress.com/
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import Element wrapper extension methods
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
# Import geometry conversion extension methods
clr.ImportExtensions(Revit.GeometryConversion)
# Import DocumentManager and TransactionManager
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
# Import RevitAPI
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import System
import math
from System import Array
from System.Collections.Generic import *
looplist=[]
rm=[]
curves = IN[0]
view = UnwrapElement(IN[1])
RunMe=IN[2]
loop = (UnwrapElement(curves).ToRevitType())
ILoop=List[Curve](loop)
CL=CurveLoop.Create(ILoop)
looplist.append(CL)
if RunMe:
# Start Transaction
for i in looplist:
TransactionManager.Instance.EnsureInTransaction(doc)
#assign CurveLoop to the CropBox of the view
view.CropBoxActive =True
cropManager = view.GetCropRegionShapeManager()
if cropManager.IsValidObject and cropManager.IsCropRegionShapeValid(i):
cropManager.SetCropShape(i)
# End Transaction
TransactionManager.Instance.TransactionTaskDone()
doc.Regenerate()
else:
OUT = 'Run Me set to False'
#Assign your output to the OUT variable.
OUT = view
IN[0] will be the polycurve from the joined room boundaries, IN[1] will be the view you want to crop, and IN[2] will be a boolean set to true to run the script, like so:
I should erase the #import RevitAPI?? , I´d a look and are the same. May be I´m confusing. You refeer to this part os the code:
The original:
Import RevitAPI
clr.AddReference(“RevitAPI”)
import Autodesk
from Autodesk.Revit.DB import *
import System
import math
from System import Array
from System.Collections.Generic import *
------- the modified by awilliams —
# Import RevitAPI
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import System
import math
from System import Array
from System.Collections.Generic import *
Oops I’m sorry about that! @Yna_Db is right, I made a mistake when I copy and pasted the code for you. I just edited the post so the code is correctly indented