Hi Yuting,
if you have meshed your geometry with SMESH then you can easily extract a
submesh for any subshape of your geometry, e.g.
from OCC.Utils.Topology import Topo
...
for edge in Topo(box).edges():
submesh = mesh.GetSubMesh(edge)
submeshds = submesh.GetSubMeshDS()
for ielem in range(submeshds .NbElements()):
elem = submeshds.elemValue(ielem)
n1 = elem.GetNode(0).GetID(); n2 = elem.GetNode(1).GetID();
...
To find out which one of your shape edges you need to consider you can - for
example - check the location of the points of it's vertices.
Regards,
Mark
Am 25.09.2012 um 15:06 schrieb 张玉婷:
> Hi Jelle,
>
> Thanks for quick reply.
>
> Yes, I am talking about FEM meshing. May I re-explain my question. I have a
> big modeling, I have meshed it already. What I want right now is: only to get
> the nodes index of one end of the partial modeling (just the node on one
> edge). I am wondering is there any commands to get the specific edge index
> and the nodes index belonging to that edge, after meshing?
>
> Regards,
> Yuting
>
> On Tue, Sep 25, 2012 at 2:46 PM, jelle feringa <[email protected]> wrote:
>
> I am trying to find the node indices belong to some wires, edges or surfaces
> (which are at some given locations). I am wondering is there such commands
> available in pythonocc?
>
>
> Hi Yuting,
>
> Do you mean by nodes, vertices [ a bit FEM speak.. ]?
> I think what you aim at is topology traversal.
>
> Sure, try this:
>
> In [13]: from OCC.BRepPrimAPI import BRepPrimAPI_MakeBox
>
> In [14]: box = BRepPrimAPI_MakeBox(1,1,1).Shape()
>
> In [15]: box
> Out[15]: <OCC.TopoDS.TopoDS_Shape; proxy of <Swig Object of type
> 'TopoDS_Shape *' at 0x10f13a570> >
>
> In [16]: from OCC.Utils.Topology import Topo
>
> In [17]: from OCC.Utils.Construct import vertex2pnt
>
> In [18]: for vert in Topo(box).vertices(): print vertex2pnt(vert).Coord()
>
>
>
>
> (1.0, 1.0, 0.0)
>
>
>
>
>
> _______________________________________________
> Pythonocc-users mailing list
> [email protected]
> https://mail.gna.org/listinfo/pythonocc-users
>
>
> _______________________________________________
> Pythonocc-users mailing list
> [email protected]
> https://mail.gna.org/listinfo/pythonocc-users
_______________________________________________
Pythonocc-users mailing list
[email protected]
https://mail.gna.org/listinfo/pythonocc-users