Skip to content

Commit

Permalink
#416 #417 units, finally!
Browse files Browse the repository at this point in the history
  • Loading branch information
andydandy74 committed Oct 28, 2024
1 parent 903dea8 commit d035b69
Show file tree
Hide file tree
Showing 5 changed files with 303 additions and 727 deletions.
116 changes: 13 additions & 103 deletions nodes/3.x/DisplayUnit.ToInternalUnit.dyf
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"Parameter": {
"Name": "displayUnitType",
"TypeName": "var",
"TypeRank": -1,
"TypeRank": 0,
"DefaultValue": null,
"Description": ""
},
Expand All @@ -86,7 +86,8 @@
{
"ConcreteType": "PythonNodeModels.PythonNode, PythonNodeModels",
"NodeType": "PythonScriptNode",
"Code": "import clr\r\nclr.AddReference('RevitAPI')\r\nfrom Autodesk.Revit.DB import *\r\n\r\ndef ToInternalUnits(val, unittype):\r\n\tif (version > 2021 and str(dispunit.GetType()) == \"Autodesk.Revit.DB.ForgeTypeId\") or (version < 2022 and str(dispunit.GetType()) == \"Autodesk.Revit.DB.DisplayUnitType\"):\r\n\t\treturn UnitUtils.ConvertToInternalUnits(val,unittype)\r\n\telse: return None\r\n\r\nvals = IN[0]\r\ndispunit = IN[1]\r\nversion = IN[2]\r\n\r\nif isinstance(IN[0], list): OUT = [ToInternalUnits(x, dispunit) for x in vals]\r\nelse: OUT = ToInternalUnits(vals, dispunit)",
"Code": "import clr\r\nclr.AddReference('RevitAPI')\r\nfrom Autodesk.Revit.DB import *\r\n\r\ndef ToInternalUnits(val, unittype):\r\n\tif str(dispunit.GetType() == \"Autodesk.Revit.DB.ForgeTypeId\"):\r\n\t\treturn UnitUtils.ConvertToInternalUnits(val,unittype)\r\n\telse: return None\r\n\r\nvals = IN[0]\r\ndispunit = IN[1]\r\n\r\nif isinstance(IN[0], list): OUT = [ToInternalUnits(x, dispunit) for x in vals]\r\nelse: OUT = ToInternalUnits(vals, dispunit)",
"Engine": "CPython3",
"VariableInputPorts": true,
"Id": "f0162f3dbe0f411494a2b3b4413bef36",
"Inputs": [
Expand All @@ -107,15 +108,6 @@
"Level": 2,
"UseLevels": false,
"KeepListStructure": false
},
{
"Id": "a5d7599ea1314ebdaef10dd303ca913c",
"Name": "IN[2]",
"Description": "Input #2",
"UsingDefaultValue": false,
"Level": 2,
"UseLevels": false,
"KeepListStructure": false
}
],
"Outputs": [
Expand All @@ -131,63 +123,6 @@
],
"Replication": "Disabled",
"Description": "Führt ein eingebettetes Python-Skript aus."
},
{
"ConcreteType": "Dynamo.Graph.Nodes.CustomNodes.Function, DynamoCore",
"FunctionSignature": "3df0961d-9d46-464f-9175-0a74eeb61bc1",
"FunctionType": "Graph",
"NodeType": "FunctionNode",
"Id": "25b99941f3ee4ef9bfa87858b4471622",
"Inputs": [],
"Outputs": [
{
"Id": "e4fccb3bcec9401292a68661e743bed1",
"Name": "Name",
"Description": "return value",
"UsingDefaultValue": false,
"Level": 2,
"UseLevels": false,
"KeepListStructure": false
},
{
"Id": "d60716cb46b74c3f95cd6c66f5430d7b",
"Name": "Version",
"Description": "return value",
"UsingDefaultValue": false,
"Level": 2,
"UseLevels": false,
"KeepListStructure": false
},
{
"Id": "ba21a6996d0746bc8fcc81b1c571ecc4",
"Name": "Build",
"Description": "return value",
"UsingDefaultValue": false,
"Level": 2,
"UseLevels": false,
"KeepListStructure": false
},
{
"Id": "f8cba61052414eb1a08396cb224b8407",
"Name": "Language",
"Description": "return value",
"UsingDefaultValue": false,
"Level": 2,
"UseLevels": false,
"KeepListStructure": false
},
{
"Id": "ae914c909b4049c0b4a26b94db272bce",
"Name": "fullVersion",
"Description": "return value",
"UsingDefaultValue": false,
"Level": 2,
"UseLevels": false,
"KeepListStructure": false
}
],
"Replication": "Auto",
"Description": "Retrieves the name, version and build of the current Revit application."
}
],
"Connectors": [
Expand All @@ -205,38 +140,23 @@
"Start": "ff162f06acfd4865896f7e9bbfaedec7",
"End": "ee6f96a7eb6543a1aef30d9ac75ad771",
"Id": "827c1e20b2204602ae4b30431486a144"
},
{
"Start": "d60716cb46b74c3f95cd6c66f5430d7b",
"End": "a5d7599ea1314ebdaef10dd303ca913c",
"Id": "ba48636cc35d443bb6cf7d1c2d4c890d"
}
],
"Dependencies": [
"3df0961d-9d46-464f-9175-0a74eeb61bc1"
],
"NodeLibraryDependencies": [
{
"Name": "Clockwork for Dynamo 2.x",
"Version": "2.3.0",
"ReferenceType": "Package",
"Nodes": [
"25b99941f3ee4ef9bfa87858b4471622"
]
}
],
"Dependencies": [],
"NodeLibraryDependencies": [],
"Author": "None provided",
"Bindings": [],
"View": {
"Dynamo": {
"ScaleFactor": 1.0,
"HasRunWithoutCrash": false,
"IsVisibleInDynamoLibrary": true,
"Version": "2.3.1.11775",
"Version": "2.12.1.8246",
"RunType": "Manual",
"RunPeriod": "1000"
},
"Camera": {
"Name": "Background Preview",
"Name": "Hintergrundvorschau",
"EyeX": -17.0,
"EyeY": 24.0,
"EyeZ": 50.0,
Expand Down Expand Up @@ -285,23 +205,13 @@
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
"X": 451.21949681716058,
"Y": 141.13297640407455
},
{
"ShowGeometry": true,
"Name": "Application.Version",
"Id": "25b99941f3ee4ef9bfa87858b4471622",
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
"X": 86.219496817160575,
"Y": 242.13297640407455
"X": 452.63468964750643,
"Y": 140.53517239972177
}
],
"Annotations": [],
"X": 56.9656705588553,
"Y": 282.523205264579,
"Zoom": 1.33823125
"X": 174.61303281699642,
"Y": 140.03743212523923,
"Zoom": 0.565293988808902
}
}
Loading

0 comments on commit d035b69

Please sign in to comment.