Hello everyone, I try to create script for spot coordinate at adaptive placement point but it error and i don’t know what i wrong.
I have created script spot coordinate for structural framing and it work.
Thank you for your recommend.
Hello everyone, I try to create script for spot coordinate at adaptive placement point but it error and i don’t know what i wrong.
I have created script spot coordinate for structural framing and it work.
Thank you for your recommend.
i would start from here:
“If the reference is not valid or the point cannot be projected to reference correctly, an exception will be thrown.” - revit doc
I try doing it for a while i still don’t know how to make it work. can you help me for find correct way? please.
im away from rvt these days but to get more help, i suggest u post a sample test case here, or a copy of the adaptive component at least. and there’s actually a posting option for formatted code which would be nice to gain more help.
op’s script, for copy-n-paste:
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
#Preparing input from dynamo to revit
element = UnwrapElement(IN[0])
result = []
#Do some action in a Transaction TransactionManager.Instance.EnsureInTransaction(doc)
for e in element:
refPoint = AdaptiveComponentInstanceUtils.GetInstancePointElementRefIds(e)
for rep in refPoint:
rp = doc.GetElement(rep)
ref = Reference(rp)
sp = rp.Position
x = sp.X
y = sp.Y
z = sp.Z
bend = XYZ(x+5, y+5, z)
end = XYZ(x+10, y+10, z)
spc = doc.Create.NewSpotCoordinate(doc.ActiveView, ref, sp, bend, end, sp, False)
result.append(spc)
TransactionManager.Instance.TransactionTaskDone()
OUT = result