- Thank you received: 0
Working with imported geometry
- rajeevdubey
- Topic Author
- Offline
- New Member
Less
More
6 years 3 months ago #638
by rajeevdubey
Working with imported geometry was created 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.
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.
Attachments:
- rajeevdubey
- Topic Author
- Offline
- New Member
Less
More
- Thank you received: 0
6 years 3 months ago #641
by rajeevdubey
Replied by rajeevdubey on topic Working with imported geometry
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.
####################
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.
6 years 3 months ago #642
by ddrake
Replied by ddrake on topic Working with imported geometry
Hi,
To generate a mesh from your geometry and see the mesh and geometry in Netgen, you can do something like this:
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
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()
msg = geo.GenerateMesh(maxh=0.5)
Hope that helps!
Best,
Dow
- rajeevdubey
- Topic Author
- Offline
- New Member
Less
More
- Thank you received: 0
6 years 3 months ago #651
by rajeevdubey
Replied by rajeevdubey on topic Working with imported geometry
Hi Dow,
Thanks. This works.
Regards...
Thanks. This works.
Regards...
6 years 3 months ago #652
by cwinters
Replied by cwinters on topic Working with imported geometry
Hi,
the Draw function is just available for a CSGeometry an not for a OCCGeometry by now.
Best,
Christoph
the Draw function is just available for a CSGeometry an not for a OCCGeometry by now.
Best,
Christoph
- rajeevdubey
- Topic Author
- Offline
- New Member
Less
More
- Thank you received: 0
6 years 3 months ago #656
by rajeevdubey
Replied by rajeevdubey on topic Working with imported geometry
Thanks Christoph. That clears the doubt...
Regards,
RD
Regards,
RD
Time to create page: 0.103 seconds