I am trying to access an external graph through the following code in c#, but there is an error with doc.Load(test); system.Xml.XmlException: ‘Data at the root level is invalid. Line 1, position 1.’
public static NodeGraph GetFromFilePath(string test)
XmlDocument doc = new XmlDocument();
NodeFactory nF = new NodeFactory();
nG = NodeGraph.LoadGraphFromXml(doc, nF);
Is there any other way to access an external graph and its nodes?
Thanks @Michael_Kirschner2 ! We will give it a try. We are trying to access them from a C# Revit Add-In to modify the input values and return them to Dynamo for execution. We achieved the execution through JournalPaths and we wondered it there would be an easy way to do this without implementing everything for a Dynamo extension.
ahh, well it’s possible, but Dynamo is not designed to have multiple DynamoModels (applications) existing at the current time in the same process. Weird things will happen, like double backup save etc.
So - you may want to attach to the currently loaded DynamoModel - thats why an extension is nice.
Alternatively, to be safe you could try starting a new process, create your DynamoModel there, open the workspace, make modifications, save.
Or, just modify the json directly, - this is not a great idea, but it has pros as well if you make very constrained modifications where you know exactly what you’re doing.