MrKl
April 30, 2024, 12:01pm
1
Hello,
I am trying to get the location of a category within a linked model. When using the Element.GetLocation node i recieve this error:
Warning: Element.GetLocation operation failed.
Unable to create Line. Points are likely coincident
When i tried to run in a sample model it went smooth, but when used within my main model the error occures.
1 Like
@MrKl
try bimorphnodes
or do it yourself
import clr
import sys
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *
clr.AddReference('System')
from System.Collections.Generic import List
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
#🌈 links
linked_docs = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_RvtLinks).WhereElementIsNotElementType().ToElements()
lnkInstance = [i for i in linked_docs if i.Name.Contains("Projekt2")]
doclnk = lnkInstance[0].GetLinkDocument()
# 🛒 collect
walls = FilteredElementCollector(doclnk).OfCategory(BuiltInCategory.OST_Walls).WhereElementIsNotElementType().ToElements()
OUT = walls
MrKl
April 30, 2024, 12:45pm
3
I tried with Bimorph with the same result.
The code is made to handle just “Walls” in your example and i would like to be able to handle all categories once it works. Not sure how that would be done with code, but i would like to avoid using it if possible
@MrKl ,
right category OST_PipeCurves
import clr
import sys
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference('System')
from System.Collections.Generic import List
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
#🌈 links
linked_docs = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_RvtLinks).WhereElementIsNotElementType().ToElements()
lnkInstance = [i for i in linked_docs if i.Name.Contains("Nugget")]
doclnk = lnkInstance[0].GetLinkDocument()
# 🛒 collect
pipe = FilteredElementCollector(doclnk).OfCategory(BuiltInCategory.OST_PipeCurves).WhereElementIsNotElementType().ToElements()
pipes = UnwrapElement(pipe)
# get curves
curves = [ i.Location.Curve.ToProtoType() for i in pipes]
OUT = pipes, curves
check out this
What does the output of the element list look like? What does the output of the GetLocation
list look like? Do either have nulls? It sounds like you either have elements that aren’t pipes or you have corrupt instances.
You need to show us the actual objects in your graph if you want more than guesses.
MrKl
April 30, 2024, 1:44pm
6
This is what the output looks like, i tried filtering both for nulls and by your suggestion i tried to filter the list of pipes to see if there were any that were none pipe elements?
I hope i understood you correctly when you said “actual objects” with my new photo.
@MrKl ,
seems to be you have null (None) values… you can scip them easily with a codeblock
x == null ? dummy : x # 🚫 gate keeper
1 Like
You need to find the instance that’s causing your problem and fix it. This is not a Dynamo issue, it’s an issue with an element in your model. You can always filter out the problems if you want, but your graph logic is correct.
1 Like
MrKl
October 17, 2024, 5:32am
9
Sorry for the late response…
How did you find those Null values? i tried finding the area and the volume of my solids but they all seem fine?
@MrKl
when you work with values you can change the codeblock f.e.
x <= 0.00 ? false : true # 🎣 gate keeper