- "KeepListStructure": false
- }
- ],
- "Outputs": [],
- "Replication": "Disabled",
- "Description": "Sortie de fonction, utiliser avec les noeuds personnalisés"
- },
- {
- "ConcreteType": "PythonNodeModels.PythonNode, PythonNodeModels",
- "NodeType": "PythonScriptNode",
- "Code": "#Alban de Chasteigner 2018\r\n#twitter : @geniusloci_bim\r\n#geniusloci.bim@gmail.com\r\n#Plan view code snippet by Cyril Poupin on Dynamo Forum\r\n\r\nimport clr\r\nclr.AddReference('RevitAPI')\r\nimport Autodesk\r\nfrom Autodesk.Revit.DB import *\r\n\r\nclr.AddReference('RevitServices')\r\nimport RevitServices\r\nfrom RevitServices.Persistence import DocumentManager\r\nfrom RevitServices.Transactions import TransactionManager\r\ndoc = DocumentManager.Instance.CurrentDBDocument\r\n\r\nclr.AddReference('RevitNodes')\r\nimport Revit\r\nclr.ImportExtensions(Revit.GeometryConversion)\r\n\r\nclr.AddReference('System')\r\nfrom System.Collections.Generic import List\r\n\r\ndef tolist(x):\r\n if hasattr(x,'__iter__'): return x\r\n else : return [x]\r\n\r\nviews = tolist(UnwrapElement(IN[0]))\r\ncats = tolist(UnwrapElement(IN[1]))\r\ninputdocs = tolist(UnwrapElement(IN[2]))\r\ntransforms,transf = [], []\r\n\r\nfor inputdoc in inputdocs :\r\n\tif inputdoc == None:\r\n\t\tdoclnk = DocumentManager.Instance.CurrentDBDocument\r\n\telif isinstance(inputdoc,Document):\r\n\t\tdoclnk = inputdoc\r\n\telif isinstance(inputdoc,RevitLinkInstance):\r\n\t\tdoclnk = inputdoc.GetLinkDocument()\r\n\t\ttry:\r\n\t\t\ttransf = inputdoc.GetTotalTransform()\r\n\t\t\ttransforms.append(transf.ToCoordinateSystem(1))\r\n\t\texcept: \r\n\t\t\ttransforms.append(None)\r\n\telse: doclnk = DocumentManager.Instance.CurrentDBDocument\r\n\r\nfor view in views:\r\n\tif view.ViewType == ViewType.ThreeD:\r\n\t\tsectionbox = view.GetSectionBox()\r\n\t\ttransform = sectionbox.Transform\r\n\t\tsboxoriginx = transform.Origin.X\r\n\t\tsboxoriginy = transform.Origin.Y\r\n\t\tsboxoriginz = transform.Origin.Z\r\n\t\tminx = sectionbox.Min.X + sboxoriginx\r\n\t\tmaxx = sectionbox.Max.X + sboxoriginx\r\n\t\tminy = sectionbox.Min.Y + sboxoriginy\r\n\t\tmaxy = sectionbox.Max.Y + sboxoriginy\r\n\t\tminz = sectionbox.Min.Z + sboxoriginz\r\n\t\tmaxz = sectionbox.Max.Z + sboxoriginz\r\n\t\toutLine = Outline(XYZ(minx, miny, minz), XYZ(maxx, maxy, maxz))\r\n\t\t\r\n\telif view.ViewType == ViewType.CeilingPlan or view.ViewType == ViewType.EngineeringPlan or view.ViewType == ViewType.FloorPlan :\r\n\t\tbbxView = view.CropBox\r\n\t\tif transf :\r\n\t\t\tbbxView.Transform = transf\r\n\t\tviewRange = view.GetViewRange() \r\n\t\ttopLevel = doc.GetElement(viewRange.GetLevelId(PlanViewPlane.TopClipPlane))\r\n\t\ttopOffset = viewRange.GetOffset(PlanViewPlane.TopClipPlane)\r\n\t\r\n\t\tbttmLevel = doc.GetElement(viewRange.GetLevelId(PlanViewPlane.BottomClipPlane))\r\n\t\tbttmOffset = viewRange.GetOffset(PlanViewPlane.BottomClipPlane)\r\n\r\n\t\tcutLevel = doc.GetElement(viewRange.GetLevelId(PlanViewPlane.CutPlane))\r\n\t\tcutOffset = viewRange.GetOffset(PlanViewPlane.CutPlane)\r\n\t\t\r\n\t\tif bttmLevel : bbxView.Min = XYZ(bbxView.Min.X, bbxView.Min.Y, bttmLevel.ProjectElevation + bttmOffset)\r\n\t\telse: bbxView.Min = XYZ(bbxView.Min.X, bbxView.Min.Y, cutLevel.ProjectElevation + bttmOffset)\r\n\t\tif topLevel : bbxView.Max = XYZ(bbxView.Max.X, bbxView.Max.Y, topLevel.ProjectElevation + topOffset)\r\n\t\telse: bbxView.Max = XYZ(bbxView.Max.X, bbxView.Max.Y, cutLevel.ProjectElevation + cutOffset)\r\n\t\t\r\n\t\toutLine = Outline(bbxView.Min, bbxView.Max) \t\t\r\n\t\t\r\n\telif view.ViewType == ViewType.Section :\r\n\t\trightDir = view.RightDirection;\r\n\t\tangleSec = XYZ.BasisX.AngleOnPlaneTo(rightDir, XYZ.BasisZ);\r\n\t\tsecOrigin = view.Origin;\r\n\t\tsecMarkId = ElementId(view.Id.IntegerValue - 1);\r\n\t\tlineSec = Line.CreateBound(secOrigin, XYZ(secOrigin.X, secOrigin.Y, secOrigin.Z + 1));\r\n\t\tTransactionManager.Instance.EnsureInTransaction(doc)\r\n\t\tsubTransaction = SubTransaction(doc);\r\n\t\tsubTransaction.Start();\r\n\t\tElementTransformUtils.RotateElement(doc, secMarkId, lineSec, -angleSec);\r\n\t\trotatedView = doc.GetElement(ElementId(secMarkId.IntegerValue + 1))\r\n\t\tBBox = rotatedView.CropBox;\r\n\t\tif transf :\r\n\t\t\tsecTransform = transf.Inverse.Multiply(BBox.Transform)\r\n\t\telse: secTransform = BBox.Transform\r\n\t\tsecMin = secTransform.OfPoint(BBox.Min);\r\n\t\tsecMax = secTransform.OfPoint(BBox.Max);\r\n\t\toutLine = Outline(XYZ(secMin.X, secMax.Y,secMin.Z),XYZ(secMax.X, secMin.Y,secMax.Z))\r\n\t\tsubTransaction.RollBack();\r\n\t\tTransactionManager.Instance.TransactionTaskDone()\t\t\r\n\t\t\t\r\ncatlist = [cat.Id for cat in cats]\r\nfiltercats = List[ElementId](catlist)\r\ncatfilter = ElementMulticategoryFilter(filtercats)\r\n\t\r\nfilterBbxInside = BoundingBoxIsInsideFilter(outLine)\r\nfilterBbxInters = BoundingBoxIntersectsFilter(outLine)\r\nfilterBbx = LogicalOrFilter(filterBbxInside, filterBbxInters)\r\nandfilter = LogicalAndFilter(catfilter,filterBbx)\r\n\r\ncollector = FilteredElementCollector(doclnk).WherePasses(andfilter).ToElements()\r\n\r\nOUT = collector, transforms",
- "Engine": "IronPython2",
- "VariableInputPorts": true,
- "Id": "46b4fa76c07f45bcbf14509d40395001",
- "Inputs": [
- {
- "Id": "69b6796fa3bf445f94efd6f55ef2c165",
- "Name": "IN[0]",
- "Description": "Input #0",
- "UsingDefaultValue": false,
- "Level": 2,
This file has been truncated. show original