Added GridBubbleOffset-DP.dyn, not finished

This commit is contained in:
2021-03-16 14:07:01 +01:00
parent 7f9365ad5d
commit 2476fd4a25
2 changed files with 323 additions and 0 deletions

View File

@@ -0,0 +1,319 @@
{
"Uuid": "fc35d717-a0b3-48d1-8161-84209cc1f7c4",
"IsCustomNode": false,
"Description": null,
"Name": "GridBubbleOffset-DP",
"ElementResolver": {
"ResolutionMap": {}
},
"Inputs": [
{
"Id": "8da88da1be2d4807b9a03a938bcd15db",
"Name": "X distance",
"Type": "number",
"Value": "-10",
"NumberType": "Double",
"Description": "Creates a number."
},
{
"Id": "fd46b9ea0a3c4180950b264ea894f089",
"Name": "Y distance",
"Type": "number",
"Value": "-10",
"NumberType": "Double",
"Description": "Creates a number."
}
],
"Outputs": [],
"Nodes": [
{
"ConcreteType": "PythonNodeModels.PythonNode, PythonNodeModels",
"NodeType": "PythonScriptNode",
"Code": "# Load the Python Standard and DesignScript Libraries\r\nimport sys\r\nimport clr\r\nclr.AddReference('ProtoGeometry')\r\nfrom Autodesk.DesignScript.Geometry import *\r\n\r\n# Import RevitAPI\r\nclr.AddReference('RevitAPI')\r\nfrom Autodesk.Revit.DB import *\r\n\r\n# Import RevitAPIUI\r\nclr.AddReference('RevitAPIUI')\r\n\r\n# Import DocumentManager and TransactionManager\r\nclr.AddReference('RevitServices')\r\nimport RevitServices\r\nfrom RevitServices.Persistence import DocumentManager\r\nfrom RevitServices.Transactions import TransactionManager\r\n\r\n# Import RevitNodes\r\nclr.AddReference('RevitNodes')\r\n\r\n# Assign Labels to Revit Document and Application\r\ndoc = DocumentManager.Instance.CurrentDBDocument\r\napp = DocumentManager.Instance.CurrentUIApplication.Application\r\nuiapp = DocumentManager.Instance.CurrentUIApplication\r\n\r\n# Input\r\ngrid = UnwrapElement(IN[0])\r\ncurView = UnwrapElement(IN[1])\r\noffsetX = IN[2]\r\noffsetY = IN[3]\r\n\r\noutput = []\r\n\r\n\r\ntry:\r\n\terrorReport = None\r\n\tTransactionManager.Instance.EnsureInTransaction(doc)\r\n\t\r\n\tgridLeader0 = grid.GetLeader(DatumEnds.End0,curView)\r\n\tgridLeader1 = grid.GetLeader(DatumEnds.End1,curView)\r\n\t\r\n\t# [0]: Datumend, [1]: leader\r\n\tgridends = [[DatumEnds.End0,gridLeader0],[DatumEnds.End1,gridLeader1]]\r\n\t\r\n\tfor i in gridends:\r\n\t\tif i[1] is None and grid.HasBubbleInView(i[0], curView):\r\n\t\t\t#output.append(grid.HasBubbleInView(i[0], curView))\r\n\t\t\tgrid.AddLeader(i[0],curView)\r\n\t\r\n\t\r\n\tfor i in gridends:\r\n\t\tif i[1] is not None:\r\n\t\t\t\r\n\t\t\toutput.append(['anchor',i[1].Anchor.X,i[1].Anchor.Y,i[1].Anchor.Z])\r\n\t\t\toutput.append(['elbow',i[1].Elbow.X,i[1].Elbow.Y,i[1].Elbow.Z])\r\n\t\t\toutput.append(['end',i[1].End.X,i[1].End.Y,i[1].End.Z])\r\n\t\t\t\r\n\t\t\tleader = i[1]\r\n\t\t\t\r\n\t\t\tdistX = i[1].Anchor.X - i[1].End.X\r\n\t\t\tdistY = i[1].Anchor.Y - i[1].End.Y\r\n\t\t\t\r\n\t\t\toutput.append(['distX',distX])\r\n\t\t\toutput.append(['distY',distY])\r\n\t\t\t\r\n\t\t\tif distX > 0:\r\n\t\t\t\tposX = 1\r\n\t\t\telse:\r\n\t\t\t\tposX = -1\r\n\t\t\t\t\r\n\t\t\tif distY > 0:\r\n\t\t\t\tposY = 1\r\n\t\t\telse: \r\n\t\t\t\tposY = -1\r\n\t\t\t\r\n\t\t\tleader.Elbow = XYZ(i[1].End.X + (offsetX * posX) ,i[1].End.Y + (offsetY * posY) ,i[1].Elbow.Z)\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\toutput.append(['anchor',leader.Anchor.X,leader.Anchor.Y,leader.Anchor.Z])\r\n\t\t\toutput.append(['elbow',leader.Elbow.X,leader.Elbow.Y,leader.Elbow.Z])\r\n\t\t\toutput.append(['end',leader.End.X,leader.End.Y,leader.End.Z])\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\tgrid.SetLeader(i[0],curView,leader)\r\n\t\t\r\n\t\t\t\r\n\t#for i in ele:\r\n\t#\ti.HideBubbleInView(DatumEnds.End1,curView)\r\n\t\t\r\n\tTransactionManager.Instance.TransactionTaskDone()\r\nexcept:\r\n\t# if error accurs anywhere in the process catch it\r\n\timport traceback\r\n\terrorReport = traceback.format_exc()\r\n\r\n\r\n\r\n# Define Output Based on If Statement\r\nif errorReport is None:\r\n\t#OUT = [gridend.Elbow, gridend.Anchor, dir(gridend)]\r\n\tOUT = output\r\nelse:\r\n\tOUT = errorReport\r\n\r\n\t\r\n\r\n",
"VariableInputPorts": true,
"Id": "a8799114d09b4b6d88b96eaac6614412",
"Inputs": [
{
"Id": "05acc577b04b428f95332758c1028c04",
"Name": "IN[0]",
"Description": "Input #0",
"UsingDefaultValue": false,
"Level": 2,
"UseLevels": false,
"KeepListStructure": false
},
{
"Id": "94ed730d77fc430394cf2722f4c2b423",
"Name": "IN[1]",
"Description": "Input #1",
"UsingDefaultValue": false,
"Level": 2,
"UseLevels": false,
"KeepListStructure": false
},
{
"Id": "12a782080fd24f788f0b974294eae997",
"Name": "IN[2]",
"Description": "Input #2",
"UsingDefaultValue": false,
"Level": 2,
"UseLevels": false,
"KeepListStructure": false
},
{
"Id": "06bd25dc3be94852a12d534865c2bae9",
"Name": "IN[3]",
"Description": "Input #3",
"UsingDefaultValue": false,
"Level": 2,
"UseLevels": false,
"KeepListStructure": false
}
],
"Outputs": [
{
"Id": "2e536a6c8d604a939afa7e202631ae0d",
"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": "Dynamo.Nodes.DSModelElementSelection, DSRevitNodesUI",
"NodeType": "ExtensionNode",
"InstanceId": [
"0fe1732c-90d6-40b4-b667-9ed43ba12023-0015caf5"
],
"Id": "414f7d3045aa4feba97c6371e23fae4c",
"Inputs": [],
"Outputs": [
{
"Id": "c3d54561064e47898f9603b0fc9f6f45",
"Name": "Element",
"Description": "The selected elements.",
"UsingDefaultValue": false,
"Level": 2,
"UseLevels": false,
"KeepListStructure": false
}
],
"Replication": "Disabled"
},
{
"ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore",
"NodeType": "FunctionNode",
"FunctionSignature": "Revit.Application.Document.ActiveView",
"Id": "b1715cd97b97409b82ead61aa85276e1",
"Inputs": [
{
"Id": "0d5f0dddb03b4b2b8ec9cafeda4c3bb8",
"Name": "document",
"Description": "Revit.Application.Document",
"UsingDefaultValue": false,
"Level": 2,
"UseLevels": false,
"KeepListStructure": false
}
],
"Outputs": [
{
"Id": "9d152dfd97514346a8cb5965638b75f7",
"Name": "View",
"Description": "View",
"UsingDefaultValue": false,
"Level": 2,
"UseLevels": false,
"KeepListStructure": false
}
],
"Replication": "Auto",
"Description": "Get the active view for the document\n\nDocument.ActiveView: View"
},
{
"ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore",
"NodeType": "FunctionNode",
"FunctionSignature": "Revit.Application.Document.Current",
"Id": "14d0cb161c754f54a2380b70580f8c06",
"Inputs": [],
"Outputs": [
{
"Id": "5ad64623c2284fedb85dcb251539c00d",
"Name": "Document",
"Description": "Document",
"UsingDefaultValue": false,
"Level": 2,
"UseLevels": false,
"KeepListStructure": false
}
],
"Replication": "Auto",
"Description": "Get the current document\n\nDocument.Current: Document"
},
{
"ConcreteType": "CoreNodeModels.Input.DoubleInput, CoreNodeModels",
"NodeType": "NumberInputNode",
"NumberType": "Double",
"InputValue": -10.0,
"Id": "8da88da1be2d4807b9a03a938bcd15db",
"Inputs": [],
"Outputs": [
{
"Id": "47ff90980fa44e96b3a7ffba04f12062",
"Name": "",
"Description": "Double",
"UsingDefaultValue": false,
"Level": 2,
"UseLevels": false,
"KeepListStructure": false
}
],
"Replication": "Disabled",
"Description": "Creates a number."
},
{
"ConcreteType": "CoreNodeModels.Input.DoubleInput, CoreNodeModels",
"NodeType": "NumberInputNode",
"NumberType": "Double",
"InputValue": -10.0,
"Id": "fd46b9ea0a3c4180950b264ea894f089",
"Inputs": [],
"Outputs": [
{
"Id": "5a88bc5a9607464dbe880721c84857de",
"Name": "",
"Description": "Double",
"UsingDefaultValue": false,
"Level": 2,
"UseLevels": false,
"KeepListStructure": false
}
],
"Replication": "Disabled",
"Description": "Creates a number."
}
],
"Connectors": [
{
"Start": "c3d54561064e47898f9603b0fc9f6f45",
"End": "05acc577b04b428f95332758c1028c04",
"Id": "7dca9c8896af4fd484a655c1fb46cee5"
},
{
"Start": "9d152dfd97514346a8cb5965638b75f7",
"End": "94ed730d77fc430394cf2722f4c2b423",
"Id": "4c45e6aac5764bde83008b2581c805d2"
},
{
"Start": "5ad64623c2284fedb85dcb251539c00d",
"End": "0d5f0dddb03b4b2b8ec9cafeda4c3bb8",
"Id": "73a8e51c0b2340e0a202e215f9cfebae"
},
{
"Start": "47ff90980fa44e96b3a7ffba04f12062",
"End": "12a782080fd24f788f0b974294eae997",
"Id": "167f81a72f7345b8ad5be9ec17cfba53"
},
{
"Start": "5a88bc5a9607464dbe880721c84857de",
"End": "06bd25dc3be94852a12d534865c2bae9",
"Id": "1306945c5d294e24a34f655321c9dbab"
}
],
"Dependencies": [],
"NodeLibraryDependencies": [],
"Bindings": [],
"View": {
"Dynamo": {
"ScaleFactor": 1.0,
"HasRunWithoutCrash": true,
"IsVisibleInDynamoLibrary": true,
"Version": "2.6.1.8786",
"RunType": "Manual",
"RunPeriod": "1000"
},
"Camera": {
"Name": "Background Preview",
"EyeX": -25.1837586830093,
"EyeY": 90.422890037793763,
"EyeZ": 46.019345005205423,
"LookX": 25.1837586830093,
"LookY": -90.422890037793763,
"LookZ": -46.019345005205423,
"UpX": 0.3539379045896523,
"UpY": 0.67559020761566135,
"UpZ": -0.64676566936450453
},
"NodeViews": [
{
"ShowGeometry": true,
"Name": "Python Script",
"Id": "a8799114d09b4b6d88b96eaac6614412",
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
"X": 503.0,
"Y": 237.69422614314067
},
{
"ShowGeometry": true,
"Name": "Select Grid",
"Id": "414f7d3045aa4feba97c6371e23fae4c",
"IsSetAsInput": true,
"IsSetAsOutput": false,
"Excluded": false,
"X": 122.5,
"Y": 302.5
},
{
"ShowGeometry": true,
"Name": "Document.ActiveView",
"Id": "b1715cd97b97409b82ead61aa85276e1",
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
"X": 135.05981249448382,
"Y": 732.20753491174651
},
{
"ShowGeometry": true,
"Name": "Document.Current",
"Id": "14d0cb161c754f54a2380b70580f8c06",
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
"X": -40.85874833022217,
"Y": 727.09642380063451
},
{
"ShowGeometry": true,
"Name": "X distance",
"Id": "8da88da1be2d4807b9a03a938bcd15db",
"IsSetAsInput": true,
"IsSetAsOutput": false,
"Excluded": false,
"X": -38.966208117462429,
"Y": 417.47973687113512
},
{
"ShowGeometry": true,
"Name": "Y distance",
"Id": "fd46b9ea0a3c4180950b264ea894f089",
"IsSetAsInput": true,
"IsSetAsOutput": false,
"Excluded": false,
"X": -44.287882806944879,
"Y": 530.7553838329768
}
],
"Annotations": [],
"X": 179.42681591392414,
"Y": 290.283464684991,
"Zoom": 0.687429564313341
}
}

View File

@@ -203,6 +203,10 @@ Change all grids in the current view to 2D extents.
</details>
### GridBubbleOffset-DP 🚧
Offset grid bubble heads.
### ImportDwgBatch ✅ 🚧
State: same as importobj, just with dwg