Dear Forum,
I am retrieving warning messages for quality and reviewing purposes using the API.
The problem I currently have is that "GetFailingElements" Methods does not provide the parent element when warning related to a sketch line. similar to the Revit Warning List using the "Review Warnings" Revit Command. This is quite important to know, because element id of sketch lines are not possible to select by id if not being in the sketch mode receiving the error below:
For Example:
I have a "Line in Sketch is slightly off axis.." error message. Going to the "Review Warnings" Command I see the sketch model line Id and the parent Floor element Id.
However, when tracking this warning element by Revit API, it seems that parent element id is missing from the Warning list.
Could you please confirm that Revit API functionality is currently limited on getting the parent element Id of a Warning sketch model line?
Any help would be much appreciated.
Kind Regards,
Alexandros
Dear Forum,
I am retrieving warning messages for quality and reviewing purposes using the API.
The problem I currently have is that "GetFailingElements" Methods does not provide the parent element when warning related to a sketch line. similar to the Revit Warning List using the "Review Warnings" Revit Command. This is quite important to know, because element id of sketch lines are not possible to select by id if not being in the sketch mode receiving the error below:
For Example:
I have a "Line in Sketch is slightly off axis.." error message. Going to the "Review Warnings" Command I see the sketch model line Id and the parent Floor element Id.
However, when tracking this warning element by Revit API, it seems that parent element id is missing from the Warning list.
Could you please confirm that Revit API functionality is currently limited on getting the parent element Id of a Warning sketch model line?
Any help would be much appreciated.
Kind Regards,
Alexandros
i use the API directly, and it usually give you the warning message and both of the faulty elements.
dont know why the dynamo node only gets one of them.
i use the API directly, and it usually give you the warning message and both of the faulty elements.
dont know why the dynamo node only gets one of them.
Can you confirm if you test it in a "Line in Sketch is slightly off axis.." warning?
I am wondering what method and which environment you use ?
I also implemented the same using python and still getting the same problem.
Below is the code I am using:
import clr
clr.AddReference('ProtoGeometry') from Autodesk.DesignScript.Geometry import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
# Get the document
doc = DocumentManager.Instance.CurrentDBDocument data = IN
Warnings=doc.GetWarnings() output=[] description=[] elements=[] severity=[] failureDefinitionId =[]
for i in Warnings: description.append(i.GetDescriptionText ()) elements.append(i.GetFailingElements()) severity.append(i.GetSeverity()) failureDefinitionId .append(i.GetFailureDefinitionId ()) OUT = [description,elements,severity,failureDefinitionId]
None of the GetDescriptionText, GetFailingElements, GetSeverity and GetFailureDefinitionId methods provide the Parent Element of the sketch model line.
Thanks
Alexandros
Can you confirm if you test it in a "Line in Sketch is slightly off axis.." warning?
I am wondering what method and which environment you use ?
I also implemented the same using python and still getting the same problem.
Below is the code I am using:
import clr
clr.AddReference('ProtoGeometry') from Autodesk.DesignScript.Geometry import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
# Get the document
doc = DocumentManager.Instance.CurrentDBDocument data = IN
Warnings=doc.GetWarnings() output=[] description=[] elements=[] severity=[] failureDefinitionId =[]
for i in Warnings: description.append(i.GetDescriptionText ()) elements.append(i.GetFailingElements()) severity.append(i.GetSeverity()) failureDefinitionId .append(i.GetFailureDefinitionId ()) OUT = [description,elements,severity,failureDefinitionId]
None of the GetDescriptionText, GetFailingElements, GetSeverity and GetFailureDefinitionId methods provide the Parent Element of the sketch model line.
Thanks
Alexandros
works fine here...
you have to add the GetElement() method:
ex:
List=[]
for i in warn.GetFailingElements():
List.append(doc.GetElement(i))
works fine here...
you have to add the GetElement() method:
ex:
List=[]
for i in warn.GetFailingElements():
List.append(doc.GetElement(i))
import clr # Import DocumentManager and TransactionManager clr.AddReference("RevitServices") import RevitServices from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager # Import ToDSType(bool) extension method clr.AddReference("RevitNodes") import Revit clr.ImportExtensions(Revit.Elements) clr.ImportExtensions(Revit.GeometryConversion) # Import RevitAPI clr.AddReference("RevitAPI") import Autodesk doc = DocumentManager.Instance.CurrentDBDocument data = IN Warnings=doc.GetWarnings() description=[] elements=[] for i in Warnings: description.append(i.GetDescriptionText ()) x = i.GetFailingElements() for j in x: elements.append(doc.GetElement(j)) OUT = [description,elements]
i just modified your code a little bit. 🙂
import clr # Import DocumentManager and TransactionManager clr.AddReference("RevitServices") import RevitServices from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager # Import ToDSType(bool) extension method clr.AddReference("RevitNodes") import Revit clr.ImportExtensions(Revit.Elements) clr.ImportExtensions(Revit.GeometryConversion) # Import RevitAPI clr.AddReference("RevitAPI") import Autodesk doc = DocumentManager.Instance.CurrentDBDocument data = IN Warnings=doc.GetWarnings() description=[] elements=[] for i in Warnings: description.append(i.GetDescriptionText ()) x = i.GetFailingElements() for j in x: elements.append(doc.GetElement(j)) OUT = [description,elements]
i just modified your code a little bit. 🙂
Many thanks for the code and for your help!
I slightly modified your code adding the sub group of element in order to show all elements per warning.
However, I still cannot get it working.
My results below show that the "Line in Sketch is Slightly off Axis.." Warning does not output the parent element using the GetFailingElements and the GetElement methods.
I am attaching also a Revit model with few floor elements which I am currently having trouble. Could you please check if you can get both failing sketch model line it and its parent floor element? Currently I can only get the model curve element and not the parent floor.
https://1drv.ms/u/s!Aq7EhA3iEgyJnj1kzgVlDKaDh3s0?e=kZvERL
import clr # Import DocumentManager and TransactionManager clr.AddReference("RevitServices") import RevitServices from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager # Import ToDSType(bool) extension method clr.AddReference("RevitNodes") import Revit clr.ImportExtensions(Revit.Elements) clr.ImportExtensions(Revit.GeometryConversion) # Import RevitAPI clr.AddReference("RevitAPI") import Autodesk doc = DocumentManager.Instance.CurrentDBDocument data = IN Warnings=doc.GetWarnings() description=[] elements=[] for i in Warnings: description.append(i.GetDescriptionText ()) x = i.GetFailingElements() sub=[] for j in x: sub.append(doc.GetElement(j)) elements.append(sub) OUT = [description,elements]
Many thanks for the code and for your help!
I slightly modified your code adding the sub group of element in order to show all elements per warning.
However, I still cannot get it working.
My results below show that the "Line in Sketch is Slightly off Axis.." Warning does not output the parent element using the GetFailingElements and the GetElement methods.
I am attaching also a Revit model with few floor elements which I am currently having trouble. Could you please check if you can get both failing sketch model line it and its parent floor element? Currently I can only get the model curve element and not the parent floor.
https://1drv.ms/u/s!Aq7EhA3iEgyJnj1kzgVlDKaDh3s0?e=kZvERL
import clr # Import DocumentManager and TransactionManager clr.AddReference("RevitServices") import RevitServices from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager # Import ToDSType(bool) extension method clr.AddReference("RevitNodes") import Revit clr.ImportExtensions(Revit.Elements) clr.ImportExtensions(Revit.GeometryConversion) # Import RevitAPI clr.AddReference("RevitAPI") import Autodesk doc = DocumentManager.Instance.CurrentDBDocument data = IN Warnings=doc.GetWarnings() description=[] elements=[] for i in Warnings: description.append(i.GetDescriptionText ()) x = i.GetFailingElements() sub=[] for j in x: sub.append(doc.GetElement(j)) elements.append(sub) OUT = [description,elements]
strange! it works here with your file!
strange! it works here with your file!
Hi Yien_Chao,
Many thanks for taking the time to reply.
The same script operates completely different between your and mine computer.
Could you please confirm what Dynamo and Revit Version you are using?
It seems that there is something else I need to look at.
Hi Yien_Chao,
Many thanks for taking the time to reply.
The same script operates completely different between your and mine computer.
Could you please confirm what Dynamo and Revit Version you are using?
It seems that there is something else I need to look at.
Same version here.
Did you try on another computer ?
I also trid on 2020, works fine too.
Same version here.
Did you try on another computer ?
I also trid on 2020, works fine too.
Hi Yien_Chao,
I just tried from another computer with a different user and no Dynamo packages installed (in case this was the issue) however, I had no luck. the same issue appears
As previously mentioned I am using Revit 2019.2 and Dynamo
What else would it be worth testing?
There are still no Floor Parent elements included at my warning list.
Python script as noted above.
Many thanks
Hi Yien_Chao,
I just tried from another computer with a different user and no Dynamo packages installed (in case this was the issue) however, I had no luck. the same issue appears
As previously mentioned I am using Revit 2019.2 and Dynamo
What else would it be worth testing?
There are still no Floor Parent elements included at my warning list.
Python script as noted above.
Many thanks
I meant Dynamo Core version 2.0.3.8810 and Dynamo Revit version 2.0.3.8811
I meant Dynamo Core version 2.0.3.8810 and Dynamo Revit version 2.0.3.8811
Hi Yien_Chao,
I just I tried Revit 2020 and warnings work ok.
However, I cannot make this working neither in Revit 2019 nor in Revit 2018.
Would it be possible to send me your exact version of Dynamo and Revit?
Also could you please try the above script in Revit 2018 and share any results?
Any feedback would be really appreciated as we currently work mainly in 2018 and 2019.
Kind regards,
Alexandros
Hi Yien_Chao,
I just I tried Revit 2020 and warnings work ok.
However, I cannot make this working neither in Revit 2019 nor in Revit 2018.
Would it be possible to send me your exact version of Dynamo and Revit?
Also could you please try the above script in Revit 2018 and share any results?
Any feedback would be really appreciated as we currently work mainly in 2018 and 2019.
Kind regards,
Alexandros
sorry for the late reply, i was on vacation.
i dont have 2018 version on my pc.
but can assure you it works for 2019 and 2020.
best
sorry for the late reply, i was on vacation.
i dont have 2018 version on my pc.
but can assure you it works for 2019 and 2020.
best
I was actually able to reproduce the issue in 2019 as well.
I ended up adding some redundancy to my Dynamo package, Bang! to account for it. I know it could be done better, but it seems to work for now.
and how I heard about this issue, https://github.com/johnpierson/BangForDynamo/issues/2
I was actually able to reproduce the issue in 2019 as well.
I ended up adding some redundancy to my Dynamo package, Bang! to account for it. I know it could be done better, but it seems to work for now.
and how I heard about this issue, https://github.com/johnpierson/BangForDynamo/issues/2
linked the wrong code, here is the correct code https://github.com/johnpierson/BangForDynamo/blob/683407407302ddedca79b1f547fb73713b209073/src/Bang/...
linked the wrong code, here is the correct code https://github.com/johnpierson/BangForDynamo/blob/683407407302ddedca79b1f547fb73713b209073/src/Bang/...
Can't find what you're looking for? Ask the community or share your knowledge.