Hi Mark,

Thanks for the hints of SMESH for submesh, it is really inspiring to know I
can extract submesh for any subshape of geometry.

Well, I tried your code, I have one problem right now is PythonOCC seems
have no function of "*submeshds.elemValue()*". I even check the
SMESHDS_SubMesh Class Reference (
http://docs.salome-platform.org/salome_6_4_0/tui/SMESH/classSMESHDS__SubMesh.html),
there is no such function.

I am wondering is there any command that I can replace or I should import
some other package? I've already imported *from OCC.Utils.Topology import
*, but still did not work.*
*
*
Thanks in advance.

Regards,
Yuting

On Tue, Sep 25, 2012 at 6:46 PM, Mark Blome <bl...@zib.de> wrote:

>
> 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 <jelleferi...@gmail.com>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
>> Pythonocc-users@gna.org
>> https://mail.gna.org/listinfo/pythonocc-users
>>
>>
> _______________________________________________
> Pythonocc-users mailing list
> Pythonocc-users@gna.org
> https://mail.gna.org/listinfo/pythonocc-users
>
>
>
> _______________________________________________
> Pythonocc-users mailing list
> Pythonocc-users@gna.org
> https://mail.gna.org/listinfo/pythonocc-users
>
>
_______________________________________________
Pythonocc-users mailing list
Pythonocc-users@gna.org
https://mail.gna.org/listinfo/pythonocc-users

Reply via email to