Add Point To topo

Hi

I’m trying to use dynamo to add points to a topo.
I have selected a model line in my file, and a topography.

I found the Method at revit API docs.
http://www.revitapidocs.com/2018.1/d918a387-2f34-5ed8-6b56-b690ca756320.htm

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

clr.AddReference("RevitAPI")
import Autodesk

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

#The inputs to this node will be stored as a list in the IN variables.
Topo = UnwrapElement(IN[0])
Points = UnwrapElement(IN[1])

output =
doc = DocumentManager.Instance.CurrentDBDocument
TransactionManager.Instance.EnsureInTransaction(doc)

try:
Topo.AddPoints(Points)
except Exception,e:
output.append(str(e))

TransactionManager.Instance.TransactionTaskDone()

#Assign your output to the OUT variable.
OUT = output

A managed exception is being thrown.
Can anyone assist with finding out what the error is?,
or better yet, tell me if what I’m doing wrong?.

Thanks

@Justin_Wright

Please format your python code.

You are adding dynamo points. You need to convert them.

Also the method requires an IList

image

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

clr.AddReference("RevitAPI")
import Autodesk

clr.AddReference("RevitNodes")
import Revit

clr.AddReference("System")
from System.Collections.Generic import List

#The inputs to this node will be stored as a list in the IN variables.
Topo = UnwrapElement(IN[0])
Points = UnwrapElement(IN[1])


output = []
doc = DocumentManager.Instance.CurrentDBDocument
TransactionManager.Instance.EnsureInTransaction(doc)

try:
	Topo.AddPoints(pyPoints)
except Exception,e:
	output.append(str(e))

TransactionManager.Instance.TransactionTaskDone()

#Assign your output to the OUT variable.
OUT = output

Thanks for your reply.
The image in the post you linked to won’t show in my browser, hence I was not able to understand what was changing.

I think I have to change the list of python points to another list format for c#?, but unsure what the code line would look like. Any help would be appreciated

Not good news I’m afraid…

As mentioned in the post lower down, recreating the topo with the new points included is your only likely way to go from Dynamo… This would need to recreate any edits such as regions.

Apologies,

Mark