Skip to content

Commit

Permalink
fixed #428
Browse files Browse the repository at this point in the history
  • Loading branch information
andydandy74 committed Oct 3, 2024
1 parent aa52c90 commit ab5e323
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 44 deletions.
78 changes: 40 additions & 38 deletions nodes/2.x/Document.ProjectParameters.dyf
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@
{
"ConcreteType": "PythonNodeModels.PythonNode, PythonNodeModels",
"NodeType": "PythonScriptNode",
"Code": "import System\r\nimport clr\r\nclr.AddReference('RevitAPI')\r\nfrom Autodesk.Revit.DB import *\r\nimport Autodesk\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\n\r\ninputdoc = UnwrapElement(IN[1])\r\nif inputdoc == None:\r\n\tdoc = DocumentManager.Instance.CurrentDBDocument\r\nelif inputdoc.GetType().ToString() == \"Autodesk.Revit.DB.RevitLinkInstance\":\r\n\tdoc = inputdoc.GetLinkDocument()\r\nelif inputdoc.GetType().ToString() == \"Autodesk.Revit.DB.Document\":\r\n\tdoc = inputdoc\r\nelse: doc = None\r\nversion = IN[2]\r\n\r\nnames = []\r\ncats = []\r\nvag = []\r\npgs = []\r\npts = []\r\nuts = []\r\nisvis = []\r\nelems = []\r\nguids = []\r\nisinst = []\r\nbics = []\r\niterator = doc.ParameterBindings.ForwardIterator()\r\nwhile iterator.MoveNext():\r\n\tvag.append(iterator.Key.VariesAcrossGroups)\r\n\tnames.append(iterator.Key.Name)\r\n\tpgs.append(iterator.Key.ParameterGroup)\r\n\tif version > 2021: \r\n\t\tpts.append(iterator.Key.GetDataType())\r\n\t\tuts.append(iterator.Key.GetDataType())\r\n\telse: \r\n\t\tpts.append(iterator.Key.ParameterType)\r\n\t\tuts.append(iterator.Key.UnitType)\r\n\tisvis.append(iterator.Key.Visible)\r\n\telem = doc.GetElement(iterator.Key.Id)\r\n\telems.append(elem)\r\n\tif elem.GetType().ToString() == 'Autodesk.Revit.DB.SharedParameterElement':\r\n\t\tguids.append(elem.GuidValue)\r\n\telse: guids.append(None)\r\n\tif iterator.Current.GetType().ToString() == 'Autodesk.Revit.DB.InstanceBinding':\r\n\t\tisinst.append(True)\r\n\telse:\r\n\t\tisinst.append(False)\r\n\tthesecats = []\r\n\tbuiltincats = []\r\n\tfor cat in iterator.Current.Categories:\r\n\t\ttry:\r\n\t\t\tthesecats.append(Revit.Elements.Category.ById(cat.Id.IntegerValue))\r\n\t\texcept:\r\n\t\t\t# Return null if category is not supported by Dynamo\r\n\t\t\t# This way the user knows there are unsupported categories assigned\r\n\t\t\tthesecats.append(None)\r\n\t\tbuiltincats.append(System.Enum.ToObject(BuiltInCategory, cat.Id.IntegerValue))\r\n\tcats.append(thesecats)\r\n\tbics.append(builtincats)\r\nOUT = (names,cats,vag, pgs, pts, uts, isvis, elems, guids, isinst, bics)",
"Code": "import System\r\nimport clr\r\nclr.AddReference('RevitAPI')\r\nfrom Autodesk.Revit.DB import *\r\nimport Autodesk\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\n\r\ninputdoc = UnwrapElement(IN[1])\r\nif inputdoc == None:\r\n\tdoc = DocumentManager.Instance.CurrentDBDocument\r\nelif inputdoc.GetType().ToString() == \"Autodesk.Revit.DB.RevitLinkInstance\":\r\n\tdoc = inputdoc.GetLinkDocument()\r\nelif inputdoc.GetType().ToString() == \"Autodesk.Revit.DB.Document\":\r\n\tdoc = inputdoc\r\nelse: doc = None\r\nversion = IN[2]\r\n\r\nnames = []\r\ncats = []\r\nvag = []\r\npgs = []\r\npts = []\r\nuts = []\r\nisvis = []\r\nelems = []\r\nguids = []\r\nisinst = []\r\nbics = []\r\niterator = doc.ParameterBindings.ForwardIterator()\r\nwhile iterator.MoveNext():\r\n\tvag.append(iterator.Key.VariesAcrossGroups)\r\n\tnames.append(iterator.Key.Name)\r\n\tif version > 2021: \r\n\t\tpts.append(iterator.Key.GetDataType())\r\n\t\tuts.append(iterator.Key.GetDataType())\r\n\t\tpgs.append(iterator.Key.GetGroupTypeId())\r\n\telse: \r\n\t\tpts.append(iterator.Key.ParameterType)\r\n\t\tuts.append(iterator.Key.UnitType)\r\n\t\tpgs.append(iterator.Key.ParameterGroup)\r\n\tisvis.append(iterator.Key.Visible)\r\n\telem = doc.GetElement(iterator.Key.Id)\r\n\telems.append(elem)\r\n\tif elem.GetType().ToString() == 'Autodesk.Revit.DB.SharedParameterElement':\r\n\t\tguids.append(elem.GuidValue)\r\n\telse: guids.append(None)\r\n\tif iterator.Current.GetType().ToString() == 'Autodesk.Revit.DB.InstanceBinding':\r\n\t\tisinst.append(True)\r\n\telse:\r\n\t\tisinst.append(False)\r\n\tthesecats = []\r\n\tbuiltincats = []\r\n\tfor cat in iterator.Current.Categories:\r\n\t\ttry:\r\n\t\t\tthesecats.append(Revit.Elements.Category.ById(cat.Id.IntegerValue))\r\n\t\texcept:\r\n\t\t\t# Return null if category is not supported by Dynamo\r\n\t\t\t# This way the user knows there are unsupported categories assigned\r\n\t\t\tthesecats.append(None)\r\n\t\tbuiltincats.append(System.Enum.ToObject(BuiltInCategory, cat.Id.IntegerValue))\r\n\tcats.append(thesecats)\r\n\tbics.append(builtincats)\r\nOUT = (names,cats,vag, pgs, pts, uts, isvis, elems, guids, isinst, bics)",
"Engine": "IronPython2",
"VariableInputPorts": true,
"Id": "146117d840fa492a9a4c4c722866e3a0",
"Inputs": [
Expand Down Expand Up @@ -182,7 +183,7 @@
}
],
"Replication": "Disabled",
"Description": "Führt ein eingebettetes IronPython-Skript aus."
"Description": "Führt ein eingebettetes Python-Skript aus."
},
{
"ConcreteType": "Dynamo.Graph.Nodes.CustomNodes.Symbol, DynamoCore",
Expand Down Expand Up @@ -615,13 +616,14 @@
]
}
],
"Author": "None provided",
"Bindings": [],
"View": {
"Dynamo": {
"ScaleFactor": 1.0,
"HasRunWithoutCrash": false,
"IsVisibleInDynamoLibrary": true,
"Version": "2.6.2.15705",
"Version": "2.12.1.8246",
"RunType": "Manual",
"RunPeriod": "1000"
},
Expand All @@ -645,8 +647,8 @@
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
"X": 487.182624049574,
"Y": 50.6589962713291
"X": 491.08262404957389,
"Y": 124.18494592998678
},
{
"ShowGeometry": true,
Expand All @@ -655,8 +657,8 @@
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
"X": 263.182624049574,
"Y": 46.445662937995792
"X": 266.28262404957394,
"Y": 119.97161259665342
},
{
"ShowGeometry": true,
Expand All @@ -665,8 +667,8 @@
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
"X": -254.817375950426,
"Y": 17.4456629379958
"X": -289.71737595042606,
"Y": 50.971612596653415
},
{
"ShowGeometry": true,
Expand All @@ -675,8 +677,8 @@
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
"X": 708.182624049574,
"Y": -215.261003728671
"X": 743.082624049574,
"Y": -217.16172073667991
},
{
"ShowGeometry": true,
Expand All @@ -685,8 +687,8 @@
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
"X": 708.182624049574,
"Y": -132.261003728671
"X": 743.082624049574,
"Y": -134.16172073667991
},
{
"ShowGeometry": true,
Expand All @@ -695,8 +697,8 @@
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
"X": -254.817375950426,
"Y": 101.445662937996
"X": -289.71737595042606,
"Y": 133.97161259665342
},
{
"ShowGeometry": true,
Expand All @@ -705,8 +707,8 @@
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
"X": 708.182624049574,
"Y": -49.2610037286709
"X": 743.082624049574,
"Y": -51.161720736679911
},
{
"ShowGeometry": true,
Expand All @@ -715,8 +717,8 @@
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
"X": 708.182624049574,
"Y": 33.7389962713291
"X": 743.082624049574,
"Y": 31.838279263320089
},
{
"ShowGeometry": true,
Expand All @@ -725,8 +727,8 @@
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
"X": 708.182624049574,
"Y": 116.738996271329
"X": 743.082624049574,
"Y": 114.83827926332009
},
{
"ShowGeometry": true,
Expand All @@ -735,8 +737,8 @@
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
"X": 711.06922949247235,
"Y": 191.80083130335854
"X": 743.082624049574,
"Y": 207.83827926332009
},
{
"ShowGeometry": true,
Expand All @@ -745,8 +747,8 @@
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
"X": 708.182624049574,
"Y": 282.738996271329
"X": 743.082624049574,
"Y": 300.83827926332009
},
{
"ShowGeometry": true,
Expand All @@ -755,8 +757,8 @@
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
"X": 708.182624049574,
"Y": 365.738996271329
"X": 743.082624049574,
"Y": 383.83827926332009
},
{
"ShowGeometry": true,
Expand All @@ -765,8 +767,8 @@
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
"X": 708.182624049574,
"Y": 448.738996271329
"X": 743.082624049574,
"Y": 466.83827926332009
},
{
"ShowGeometry": true,
Expand All @@ -775,8 +777,8 @@
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
"X": 701.470926093767,
"Y": 530.415788615946
"X": 743.082624049574,
"Y": 549.83827926332015
},
{
"ShowGeometry": true,
Expand All @@ -785,8 +787,8 @@
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
"X": 680.32590078223245,
"Y": 630.93756225531115
"X": 743.082624049574,
"Y": 632.83827926332015
},
{
"ShowGeometry": true,
Expand All @@ -795,13 +797,13 @@
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
"X": 68.00651445859512,
"Y": 199.42294936583576
"X": -289.71737595042606,
"Y": 226.97161259665342
}
],
"Annotations": [],
"X": 362.42243353522736,
"Y": 188.06684385980356,
"Zoom": 1.2299395571190197
"X": 183.87025196801159,
"Y": 82.09090397340168,
"Zoom": 0.65248940168757075
}
}
8 changes: 4 additions & 4 deletions nodes/2.x/Document.ProjectParametersByCategory.dyf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
{
"ConcreteType": "PythonNodeModels.PythonNode, PythonNodeModels",
"NodeType": "PythonScriptNode",
"Code": "import clr\r\nclr.AddReference('RevitAPI')\r\nfrom Autodesk.Revit.DB import *\r\nimport Autodesk\r\n\r\nclr.AddReference(\"RevitServices\")\r\nimport RevitServices\r\nfrom RevitServices.Persistence import DocumentManager\r\n\r\nsearch_cats = UnwrapElement(IN[0])\r\nsearch_ids = []\r\nnames = []\r\nvag = []\r\npgs = []\r\npts = []\r\nuts = []\r\nisvis = []\r\nelems = []\r\nguids = []\r\nisinst = []\r\n\r\nif not isinstance(IN[0], list): search_cats = [search_cats]\r\nfor search_cat in search_cats:\r\n\tsearch_ids.append(search_cat.Id.IntegerValue)\r\n\tnames.append(list())\r\n\tvag.append(list())\r\n\tpgs.append(list())\r\n\tpts.append(list())\r\n\tuts.append(list())\r\n\tisvis.append(list())\r\n\telems.append(list())\r\n\tguids.append(list())\r\n\tisinst.append(list())\r\n\r\ninputdoc = UnwrapElement(IN[2])\r\nif inputdoc == None:\r\n\tdoc = DocumentManager.Instance.CurrentDBDocument\r\nelif inputdoc.GetType().ToString() == \"Autodesk.Revit.DB.RevitLinkInstance\":\r\n\tdoc = inputdoc.GetLinkDocument()\r\nelif inputdoc.GetType().ToString() == \"Autodesk.Revit.DB.Document\":\r\n\tdoc = inputdoc\r\nelse: doc = None\r\nversion = IN[3]\r\n\r\niterator = doc.ParameterBindings.ForwardIterator()\r\nwhile iterator.MoveNext():\r\n\tfor cat in iterator.Current.Categories:\r\n\t\ti = 0\r\n\t\tfor search_id in search_ids:\r\n\t\t\tif cat.Id.IntegerValue == search_id:\r\n\t\t\t\tnames[i].append(iterator.Key.Name)\r\n\t\t\t\tvag[i].append(iterator.Key.VariesAcrossGroups)\r\n\t\t\t\tpgs[i].append(iterator.Key.ParameterGroup)\r\n\t\t\t\tif version > 2021: \r\n\t\t\t\t\tpts[i].append(iterator.Key.GetDataType())\r\n\t\t\t\t\tuts[i].append(iterator.Key.GetDataType())\r\n\t\t\t\telse: \r\n\t\t\t\t\tpts[i].append(iterator.Key.ParameterType)\r\n\t\t\t\t\tuts[i].append(iterator.Key.UnitType)\r\n\t\t\t\tisvis[i].append(iterator.Key.Visible)\r\n\t\t\t\telem = doc.GetElement(iterator.Key.Id)\r\n\t\t\t\telems[i].append(elem)\r\n\t\t\t\tif elem.GetType().ToString() == 'Autodesk.Revit.DB.SharedParameterElement':\r\n\t\t\t\t\tguids[i].append(elem.GuidValue)\r\n\t\t\t\telse: guids[i].append(None)\r\n\t\t\t\tif iterator.Current.GetType().ToString() == 'Autodesk.Revit.DB.InstanceBinding':\r\n\t\t\t\t\tisinst[i].append(True)\r\n\t\t\t\telse: isinst[i].append(False)\r\n\t\t\ti += 1\r\nif isinstance(IN[0], list): OUT = (names, vag, pgs, pts, uts, isvis, elems, guids, isinst)\r\nelse: OUT = (names[0], vag[0], pgs[0], pts[0], uts[0], isvis[0], elems[0], guids[0], isinst[0])",
"Code": "import clr\r\nclr.AddReference('RevitAPI')\r\nfrom Autodesk.Revit.DB import *\r\nimport Autodesk\r\n\r\nclr.AddReference(\"RevitServices\")\r\nimport RevitServices\r\nfrom RevitServices.Persistence import DocumentManager\r\n\r\nsearch_cats = UnwrapElement(IN[0])\r\nsearch_ids = []\r\nnames = []\r\nvag = []\r\npgs = []\r\npts = []\r\nuts = []\r\nisvis = []\r\nelems = []\r\nguids = []\r\nisinst = []\r\n\r\nif not isinstance(IN[0], list): search_cats = [search_cats]\r\nfor search_cat in search_cats:\r\n\tsearch_ids.append(search_cat.Id.IntegerValue)\r\n\tnames.append(list())\r\n\tvag.append(list())\r\n\tpgs.append(list())\r\n\tpts.append(list())\r\n\tuts.append(list())\r\n\tisvis.append(list())\r\n\telems.append(list())\r\n\tguids.append(list())\r\n\tisinst.append(list())\r\n\r\ninputdoc = UnwrapElement(IN[2])\r\nif inputdoc == None:\r\n\tdoc = DocumentManager.Instance.CurrentDBDocument\r\nelif inputdoc.GetType().ToString() == \"Autodesk.Revit.DB.RevitLinkInstance\":\r\n\tdoc = inputdoc.GetLinkDocument()\r\nelif inputdoc.GetType().ToString() == \"Autodesk.Revit.DB.Document\":\r\n\tdoc = inputdoc\r\nelse: doc = None\r\nversion = IN[3]\r\n\r\niterator = doc.ParameterBindings.ForwardIterator()\r\nwhile iterator.MoveNext():\r\n\tfor cat in iterator.Current.Categories:\r\n\t\ti = 0\r\n\t\tfor search_id in search_ids:\r\n\t\t\tif cat.Id.IntegerValue == search_id:\r\n\t\t\t\tnames[i].append(iterator.Key.Name)\r\n\t\t\t\tvag[i].append(iterator.Key.VariesAcrossGroups)\r\n\t\t\t\tif version > 2021: \r\n\t\t\t\t\tpts[i].append(iterator.Key.GetDataType())\r\n\t\t\t\t\tuts[i].append(iterator.Key.GetDataType())\r\n\t\t\t\t\tpgs[i].append(iterator.Key.GetGroupTypeId())\r\n\t\t\t\telse: \r\n\t\t\t\t\tpts[i].append(iterator.Key.ParameterType)\r\n\t\t\t\t\tuts[i].append(iterator.Key.UnitType)\r\n\t\t\t\t\tpgs[i].append(iterator.Key.ParameterGroup)\r\n\t\t\t\tisvis[i].append(iterator.Key.Visible)\r\n\t\t\t\telem = doc.GetElement(iterator.Key.Id)\r\n\t\t\t\telems[i].append(elem)\r\n\t\t\t\tif elem.GetType().ToString() == 'Autodesk.Revit.DB.SharedParameterElement':\r\n\t\t\t\t\tguids[i].append(elem.GuidValue)\r\n\t\t\t\telse: guids[i].append(None)\r\n\t\t\t\tif iterator.Current.GetType().ToString() == 'Autodesk.Revit.DB.InstanceBinding':\r\n\t\t\t\t\tisinst[i].append(True)\r\n\t\t\t\telse: isinst[i].append(False)\r\n\t\t\ti += 1\r\nif isinstance(IN[0], list): OUT = (names, vag, pgs, pts, uts, isvis, elems, guids, isinst)\r\nelse: OUT = (names[0], vag[0], pgs[0], pts[0], uts[0], isvis[0], elems[0], guids[0], isinst[0])",
"Engine": "IronPython2",
"VariableInputPorts": true,
"Id": "1668f7c6d9374c59bd7d635fb9213ec8",
Expand Down Expand Up @@ -810,8 +810,8 @@
}
],
"Annotations": [],
"X": -200.13628039421872,
"Y": -357.78007551764983,
"Zoom": 1.2934796932966468
"X": 136.57472873579502,
"Y": 154.42052036429641,
"Zoom": 0.360886474813896
}
}
3 changes: 2 additions & 1 deletion nodes/2.x/python/Document.ProjectParameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,14 @@
while iterator.MoveNext():
vag.append(iterator.Key.VariesAcrossGroups)
names.append(iterator.Key.Name)
pgs.append(iterator.Key.ParameterGroup)
if version > 2021:
pts.append(iterator.Key.GetDataType())
uts.append(iterator.Key.GetDataType())
pgs.append(iterator.Key.GetGroupTypeId())
else:
pts.append(iterator.Key.ParameterType)
uts.append(iterator.Key.UnitType)
pgs.append(iterator.Key.ParameterGroup)
isvis.append(iterator.Key.Visible)
elem = doc.GetElement(iterator.Key.Id)
elems.append(elem)
Expand Down
3 changes: 2 additions & 1 deletion nodes/2.x/python/Document.ProjectParametersByCategory.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,14 @@
if cat.Id.IntegerValue == search_id:
names[i].append(iterator.Key.Name)
vag[i].append(iterator.Key.VariesAcrossGroups)
pgs[i].append(iterator.Key.ParameterGroup)
if version > 2021:
pts[i].append(iterator.Key.GetDataType())
uts[i].append(iterator.Key.GetDataType())
pgs[i].append(iterator.Key.GetGroupTypeId())
else:
pts[i].append(iterator.Key.ParameterType)
uts[i].append(iterator.Key.UnitType)
pgs[i].append(iterator.Key.ParameterGroup)
isvis[i].append(iterator.Key.Visible)
elem = doc.GetElement(iterator.Key.Id)
elems[i].append(elem)
Expand Down

0 comments on commit ab5e323

Please sign in to comment.