Working with imported geometry

More
6 years 3 months ago #638 by rajeevdubey
Hi,
I'm new to this forum and also learning NGSolve.

I had a very basic set of questions:

1. In examples that I have seen, one can create geometry by declaring an object and then add items to it. This object then can be referred to for meshing, etc. My query is if I import geometry from an external STEP file, with what name this geometry is available for further operations.

2. Similarly when I generate a mesh using the GUI, with what name I can access the mesh when writing python commands for further operations.

Please let me know if my query is clear enough. I tried to understand the above steps but could not find a resolution on my own. Many thanks for your help...

I've attached the sample geometry STEP file.

File Attachment:

File Name: 191_SD_Flat.zip
File Size:76 KB
Attachments:
More
6 years 3 months ago #641 by rajeevdubey
I tried below commands and received an error:
####################
import netgen.gui
%gui tk
from ngsolve.solve import Draw, Redraw # just for visualization

from netgen import NgOCC
geo = NgOCC.LoadOCCGeometry("191_SD_Flat.stp")

geo.Draw()
Redraw()

AttributeError Traceback (most recent call last)
<ipython-input-1-2398bb529de9> in <module>()
6 geo = NgOCC.LoadOCCGeometry("191_SD_Flat.stp")
7
----> 8 geo.Draw()
9 Redraw()

AttributeError: 'netgen.libngpy._NgOCC.OCCGeometry' object has no attribute 'Draw'
###################

What could be going wrong? Thanks.
More
6 years 3 months ago #642 by ddrake
Hi,

To generate a mesh from your geometry and see the mesh and geometry in Netgen, you can do something like this:
Code:
import netgen.gui %gui tk from netgen import NgOCC geo = NgOCC.LoadOCCGeometry("191_SD_Flat.stp") msh = geo.GenerateMesh()
It may take a couple minutes to generate the mesh. Once the mesh is complete, you can select Geometry or Mesh in the Netgen GUI to see the result. You can also control the maximum element dimension by
msg = geo.GenerateMesh(maxh=0.5)

Hope that helps!

Best,
Dow
More
6 years 3 months ago #651 by rajeevdubey
Hi Dow,
Thanks. This works.
Regards...
More
6 years 3 months ago #652 by cwinters
Hi,

the Draw function is just available for a CSGeometry an not for a OCCGeometry by now.

Best,
Christoph
More
6 years 3 months ago #656 by rajeevdubey
Thanks Christoph. That clears the doubt...
Regards,
RD
Time to create page: 0.103 seconds