Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

Problems visualizing mesh after importing and meshing a step file with netgengui

More
1 year 1 month ago - 1 year 1 month ago #4641 by haschmid
Hello,

I have a problem with the Netgen.gui() when importing and meshing a step file. I can import the geometry with OCCGeometry() and generate the mesh with GenerateMesh(), but when I use netgen.gui to look at the mesh and geometry, I can't see the mesh, only the geometry. If I use "Generate Mesh" from netgen.gui(), then the mesh is shown to me normally.

I also tested this with the webgui in a jupyternotebook and there are no problems. I am able to draw the mesh without any issues. 

The question is if it is a bug of the netgen.gui, because it works fine with the webgui, or do I do something wrong when creating geometry, mesh and Draw(mesh)?

Here is a minimal example where I use the netgen.gui which is called from a tkinter app:


import tkinter as tk
from tkinter import ttk


root = tk.Tk()
root.geometry("500x500+400+400")

main_frame = tk.Frame(master=root)
main_frame.pack(fill="both", expand=True)

button = ttk.Button(master=main_frame, command=lambda: mesh_and_draw(), text="netgen.gui")
button.pack(pady=200)

def mesh_and_draw():

    import netgen.occ
    
    geo = netgen.occ.OCCGeometry('path_to_file/file.stp')
    mesh = geo.GenerateMesh(maxh=2.0)

    from ngsolve import Draw, Mesh
    mesh_ = Mesh(mesh)
    Draw(mesh_)


    import netgen.gui

root.mainloop()


Here is a minimal example where I use the webgui:

import netgen.occ
from ngsolve import Mesh
from ngsolve.webgui import Draw

geo = netgen.occ.OCCGeometry('path_to_file/file.stp')
mesh = geo.GenerateMesh(maxh=2.0)

Draw(Mesh(mesh))



I hope someone can say something about this and thanks in advance.

Greetings 
Hagen
Last edit: 1 year 1 month ago by haschmid. Reason: title was to long
Time to create page: 0.100 seconds