-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rhino.compute throws an exception when evaluating grasshopper definition file (.ghx) #591
Comments
Anyone on this one? would really help a lot. Seems there is no similar issue on the web either. |
Do you have an output "RH_OUT:myresponse" type object in your file? |
I have a grasshopper file that generates a pdf of the given .dwg file. Now I am passing the grasshopper file through the Rhino App server. I am getting a different error this time, From GrasshopperDefinition.cs file
|
Try just putting a notional output in your script, I've had issues before trying to do something similar and not actually having an output. |
Hi there I am trying to convert a .dwg file into a .pdf file using Rhino-compute and Grasshopper in Node Js. I am using the compute-rhino3d npm package.
I am passing the path of a grasshopper definition file (.ghx) to rhinoCompute.Grasshopper.evaluateDefinition() function. But the rhino.compute throws the following exception.
System.Xml.XmlException: 'Data at the root level is invalid. Line 1, position 1.'
Here is my node js code.
`const rhinoCompute = require('compute-rhino3d');
rhinoCompute.url = 'http://localhost:8081/';
exports.rhino = async (req, res) => {
console.log(req.body);
try {
const dwgFilePath = req.file.path;
console.log(dwgFilePath);
const definition =
'C:\Users\Sohaib\Documents\gh\Planometric_GH_tester_xml_version.ghx';
const outputPath = 'C:\Users\Sohaib\Documents';
const trees = [
{
data: {
FilePath: 'C:\Users\Sohaib\Documents\gh\file-1686857280276.dwg',
},
},
{ data: { outputPath } },
];
// Convert the .dwg file to .pdf using Grasshopper and Rhino.Compute
const result = await rhinoCompute.Grasshopper.evaluateDefinition(
definition,
trees
);
// Send the converted .pdf file as a response
res.send(result);
} catch (error) {
console.error(error);
res.status(500).send('An error occurred during the conversion.');
}
};
`
The text was updated successfully, but these errors were encountered: