Closed xyont closed 1 year ago
The polygon.Triangulate(...)
methods are extension methods defined in Triangle/Geometry/ExtensionMethods.cs. I've never used IronPython, but you might need to do something like clr.ImportExtensions(TriangleNet.Geometry)
, see this stackoverflow question.
Alternatively, just use the GenericMesher
class, as done by the extension methods.
many thanks for such as guidance, it seems to be working now. Next is related to save mesh results, any example?
Next is related to save mesh results, any example?
It depends on what you actually want to do. You can use FileProcessor.Write(mesh, filename)
, which uses the original Triangle format. Or access the data of the IMesh
directly and write in any format you like using Python...
firstly, i need to save as default format (mesh file & SVG for viewing) but did not succeed in image format,
add commands,
IO.SvgImage.Save(mesh, "box.svg", 500)
shown a message,
AttributeError: 'TriangleNet.IO' object has no attribute 'SvgImage
thanks again, add command IO.FileProcessor.Write(mesh, "box.ele")
created output files of Triangle formats.
NameError: global name 'SvgImage' is not defined
Have you built and added a reference to the Triangle.Rendering assembly? Imported the TriangleNet.Rendering.Text
namespace?
add command,
clr.ImportExtensions(TriangleNet.Rendering.Text)
shown a message,
AttributeError: 'TriangleNet' object has no attribute 'Rendering'
Have you built and added a reference to the Triangle.Rendering assembly?
You seem to have a Triangle.dll
, since clr.AddReference("Triangle.dll")
is working. Now you also need to build the src/Triangle.Rendering/Triangle.Rendering.csproj project, which will give you a Triangle.Rendering.dll
. Then
clr.AddReference("Triangle.Rendering.dll")
import TriangleNet.Rendering # <- not sure if this one is needed
from TriangleNet.Rendering import *
Text.SvgImage.Save(mesh, "box.svg", 500)
As already mentioned, I don't use IronPython, so I haven't tested the code above, but that seems to be the way IronPython handles .NET assemblies...
hello again, i have some problem in saving .node file, were previously successful for .ele files. Request an output of *.node file did not show any error, but the file is not created or available in the directory.
any suggestion? thank you.
By default, you should get the .ele file containing the triangle indices and a .poly file, which contains both nodes and segment indices. Please check, if the .poly file is present.
hi,
interesting library to use, i'm call and loading from IronPyton but failed at triangulation. Any hints or suggestion?
regards,