diff --git a/CopySectionBox-DP/CopySectionBox-DP.dyn b/CopySectionBox-DP/CopySectionBox-DP.dyn new file mode 100644 index 0000000..da9c4ea --- /dev/null +++ b/CopySectionBox-DP/CopySectionBox-DP.dyn @@ -0,0 +1,297 @@ +{ + "Uuid": "2596cccc-34fb-4dcf-92db-4a48aa7e91e7", + "IsCustomNode": false, + "Description": null, + "Name": "CopySectionBox-DP", + "ElementResolver": { + "ResolutionMap": {} + }, + "Inputs": [], + "Outputs": [], + "Nodes": [ + { + "ConcreteType": "PythonNodeModels.PythonNode, PythonNodeModels", + "NodeType": "PythonScriptNode", + "Code": "# https://forum.dynamobim.com/t/get-a-bounding-box-from-a-section-box/31134/5?u=infeeeee\r\nimport clr\r\nclr.AddReference('ProtoGeometry')\r\nfrom Autodesk.DesignScript.Geometry import *\r\n\r\nclr.AddReference(\"RevitNodes\")\r\nimport Revit\r\nclr.ImportExtensions(Revit.Elements)\r\n\r\nclr.AddReference(\"RevitServices\")\r\nimport RevitServices\r\nfrom RevitServices.Persistence import DocumentManager\r\nfrom RevitServices.Transactions import TransactionManager\r\n\r\nfrom System.Collections.Generic import *\r\n\r\nclr.AddReference(\"RevitAPI\")\r\nimport Autodesk\r\nfrom Autodesk.Revit.DB import *\r\n\r\nclr.ImportExtensions(Revit.GeometryConversion)\r\n\r\ndoc = DocumentManager.Instance.CurrentDBDocument\r\nuiapp = DocumentManager.Instance.CurrentUIApplication\r\napp = uiapp.Application\r\n\r\n\r\nif isinstance(IN[0], list):\r\n views = UnwrapElement(IN[0])\r\nelse:\r\n views = [UnwrapElement(IN[0])]\r\n\r\nTransactionManager.Instance.EnsureInTransaction(doc)\r\n\r\nviewlist = []\r\nsectionboxes = []\r\nfloors = []\r\nfloorboxes = []\r\n\r\nfor view in views:\r\n\tviewlist.append(view)\r\n\tsectionbox = view.GetSectionBox()\r\n\ttransform = sectionbox.Transform\r\n\tsboxoriginx = transform.Origin.X\r\n\tsboxoriginy = transform.Origin.Y\r\n\tsboxoriginz = transform.Origin.Z\r\n\tminx = sectionbox.Min.X + sboxoriginx\r\n\tmaxx = sectionbox.Max.X + sboxoriginx\r\n\tminy = sectionbox.Min.Y + sboxoriginy\r\n\tmaxy = sectionbox.Max.Y + sboxoriginy\r\n\tminz = sectionbox.Min.Z + sboxoriginz\r\n\tmaxz = sectionbox.Max.Z + sboxoriginz\r\n\tbbox = BoundingBoxXYZ()\r\n\tbbox.Min = XYZ((minx), (miny), (minz))\r\n\tbbox.Max = XYZ((maxx), (maxy), (maxz))\r\n\ttsectionbox = bbox.ToProtoType()\r\n\tsectionboxes.append(tsectionbox)\r\n\tcollector = FilteredElementCollector(doc, view.Id)\r\n\tfloor = collector.OfClass(Floor).ToElements()\r\n\tfloors.append(floor)\r\n\r\nTransactionManager.Instance.TransactionTaskDone()\r\n\r\nOUT = views, sectionboxes, floors", + "VariableInputPorts": true, + "Id": "b02dd40f5ada43708e91568eacee7e31", + "Inputs": [ + { + "Id": "8ebc1216ab0840ceba3fa3e339d289f2", + "Name": "IN[0]", + "Description": "Input #0", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "33c832cc88cf4b9cbffd0b3ac696d14b", + "Name": "OUT", + "Description": "Result of the python script", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "Runs an embedded IronPython script." + }, + { + "ConcreteType": "DSRevitNodesUI.Views, DSRevitNodesUI", + "SelectedIndex": 3, + "NodeType": "ExtensionNode", + "Id": "bb16b978cd084982aafc759aebdd7c9e", + "Inputs": [], + "Outputs": [ + { + "Id": "bc02a9de6e364b08b26ecc1e2ee160fb", + "Name": "Views", + "Description": "The selected Views", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "All views available in the current document." + }, + { + "ConcreteType": "Dynamo.Graph.Nodes.CodeBlockNodeModel, DynamoCore", + "NodeType": "CodeBlockNode", + "Code": "a[1];", + "Id": "a9b7f266a36d47e1bb5845d595519dcf", + "Inputs": [ + { + "Id": "0758aad6af2e4b07a901e309c062689a", + "Name": "a", + "Description": "a", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "d2ae0724f9ec4f94a99c929a078a0e5e", + "Name": "", + "Description": "Value of expression at line 1", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "Allows for DesignScript code to be authored directly" + }, + { + "ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore", + "NodeType": "FunctionNode", + "FunctionSignature": "Rhythm.Revit.Views.View3D.SetSectionBox@Revit.Elements.Element,Autodesk.DesignScript.Geometry.BoundingBox", + "Id": "1412b3565ed1467ea4f04d17ad7607e2", + "Inputs": [ + { + "Id": "932e8e554ebd41cd804e588e5735dec7", + "Name": "view3D", + "Description": "The 3D view to set the section box for.\n\nElement", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + }, + { + "Id": "ef5fd55cda6442019b1eb18770784d41", + "Name": "bBox", + "Description": "The boudning box to use.\n\nBoundingBox", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "76bab1c3a5cb4ce2871dd936532e33d2", + "Name": "success", + "Description": "The views that worked.", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + }, + { + "Id": "93ac60fadc284941963c21ce769426a7", + "Name": "failed", + "Description": "The views that failed.", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Auto", + "Description": "This node will set the given 3d view's section box.\n\nView3D.SetSectionBox (view3D: Element, bBox: BoundingBox): var[]..[]" + }, + { + "ConcreteType": "DSRevitNodesUI.Views, DSRevitNodesUI", + "SelectedIndex": 5, + "NodeType": "ExtensionNode", + "Id": "7fd8eb55905340ca9e65f132377ca524", + "Inputs": [], + "Outputs": [ + { + "Id": "158b075297c84adaba3108200e31f4c5", + "Name": "Views", + "Description": "The selected Views", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "All views available in the current document." + } + ], + "Connectors": [ + { + "Start": "33c832cc88cf4b9cbffd0b3ac696d14b", + "End": "0758aad6af2e4b07a901e309c062689a", + "Id": "a1a0d52482524014a202f6e0f5aff7e3" + }, + { + "Start": "bc02a9de6e364b08b26ecc1e2ee160fb", + "End": "8ebc1216ab0840ceba3fa3e339d289f2", + "Id": "40e64c6d1af84ea38423ed72839bb18c" + }, + { + "Start": "d2ae0724f9ec4f94a99c929a078a0e5e", + "End": "ef5fd55cda6442019b1eb18770784d41", + "Id": "81dc678b6a3845b48706fc53580a577f" + }, + { + "Start": "158b075297c84adaba3108200e31f4c5", + "End": "932e8e554ebd41cd804e588e5735dec7", + "Id": "5a7545b6fbce401885e95b3343332d46" + } + ], + "Dependencies": [], + "Bindings": [], + "View": { + "Dynamo": { + "ScaleFactor": 1.0, + "HasRunWithoutCrash": true, + "IsVisibleInDynamoLibrary": true, + "Version": "2.0.3.8810", + "RunType": "Manual", + "RunPeriod": "1000" + }, + "Camera": { + "Name": "Background Preview", + "EyeX": 13.770494710788689, + "EyeY": 24.321667103903724, + "EyeZ": 42.862743813097168, + "LookX": -13.770494710788689, + "LookY": -24.321667103903724, + "LookZ": -42.862743813097168, + "UpX": -0.084309738421825708, + "UpY": 0.96126169593831945, + "UpZ": -0.26242678965576371 + }, + "NodeViews": [ + { + "Id": "b02dd40f5ada43708e91568eacee7e31", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Name": "Python Script", + "ShowGeometry": true, + "Excluded": false, + "X": 1515.4181278999627, + "Y": 768.38778701452156 + }, + { + "Id": "bb16b978cd084982aafc759aebdd7c9e", + "IsSetAsInput": true, + "IsSetAsOutput": false, + "Name": "Source view", + "ShowGeometry": true, + "Excluded": false, + "X": 1268.4181278999627, + "Y": 768.38778701452156 + }, + { + "Id": "a9b7f266a36d47e1bb5845d595519dcf", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Name": "Code Block", + "ShowGeometry": true, + "Excluded": false, + "X": 1739.4181278999627, + "Y": 772.60112034785493 + }, + { + "Id": "1412b3565ed1467ea4f04d17ad7607e2", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Name": "ʳʰʸᵗʰᵐ|View3D.SetSectionBox", + "ShowGeometry": true, + "Excluded": false, + "X": 2051.14343863457, + "Y": 911.13914100728448 + }, + { + "Id": "7fd8eb55905340ca9e65f132377ca524", + "IsSetAsInput": true, + "IsSetAsOutput": false, + "Name": "Target view", + "ShowGeometry": true, + "Excluded": false, + "X": 1490.8543197952081, + "Y": 1057.2659583070476 + } + ], + "Annotations": [ + { + "Id": "ea20fb973d544d88ac58d3250a5c28a0", + "Title": "Get bounding box", + "Nodes": [ + "b02dd40f5ada43708e91568eacee7e31", + "bb16b978cd084982aafc759aebdd7c9e", + "a9b7f266a36d47e1bb5845d595519dcf" + ], + "Left": 1258.4181278999627, + "Top": 715.38778701452156, + "Width": 581.0, + "Height": 150.21333333333337, + "FontSize": 36.0, + "InitialTop": 768.38778701452156, + "InitialHeight": 149.21333333333337, + "TextblockHeight": 43.0, + "Background": "#FFC1D676" + }, + { + "Id": "2a50f393976245c9a665aa34f777f1ae", + "Title": "Script Name: SectionBoxToDetailLines-DP.dyn\n\nPackages used in this script: \nRhythm version: 2019.12.4\n\nTimeStamp : 2020/2/26 19:1", + "Nodes": [], + "Left": 1243.884711216122, + "Top": 578.12383442068415, + "Width": 0.0, + "Height": 0.0, + "FontSize": 36.0, + "InitialTop": 0.0, + "InitialHeight": 0.0, + "TextblockHeight": 0.0, + "Background": "#FFC1D676" + } + ], + "X": -653.01762431621626, + "Y": 35.650084447095878, + "Zoom": 0.5661159189870264 + } +} \ No newline at end of file diff --git a/README.md b/README.md index 121b8fd..2b7c7c4 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,17 @@ Copy parameter values of a selected family to another parameter of the same fami TODO: docs +### CopySectionBox-DP ✅ + +Copy a section box from one view to another + +
+ Required packages + +- Rhythm + +
+ ### DeleteAllRefPlanes ✅ Delete all reference planes from the project @@ -116,7 +127,7 @@ Delete all reference planes from the project
Required packages -- archi-lab +- Archi-lab