[Gmsh] IDs of points forming a copy of entity (in python API)

Christophe Geuzaine cgeuzaine at uliege.be
Tue Oct 16 06:53:50 CEST 2018



> On 16 Oct 2018, at 03:44, Marek Wojciechowski <mwojc at p.lodz.pl> wrote:
> 
> Dnia poniedziałek, 15 października 2018 18:04:13 CEST Christophe Geuzaine 
> pisze:
>>> On 15 Oct 2018, at 10:20, Marek Wojciechowski <mwojc at p.lodz.pl> wrote:
>>> 
>>> Hi!
>>> 
>>> I have a python script:
>>> 
>>> 
>>> 
>>> import gmsh
>>> import math
>>> 
>>> model = gmsh.model
>>> factory = model.occ
>>> 
>>> gmsh.initialize()
>>> gmsh.option.setNumber("General.Terminal", 1)
>>> 
>>> model.add("spline")
>>> 
>>> factory.addPoint(0.2,-1.6,0,0.1, 101)
>>> factory.addPoint(1.2,-1.6,0,0.1, 102)
>>> factory.addPoint(1.2,-1.1,0,0.1, 103)
>>> factory.addPoint(0.3,-1.1,0,0.1, 104)
>>> factory.addPoint(0.7,-1,0,0.1, 105)
>>> 
>>> # periodic bspline through the control points
>>> factory.addSpline([103,102,101,104,105,103], 100)
>>> 
>>> # COPY SPLINE HERE
>>> dimTag = factory.copy([(1, 100)])
>>> 
>>> 
>>> 
>>> My question is how can i get a list of points forming copied spline?
>> 
>> That's not possible, as the copy of the spline will actually only create a
>> single point. The initial points used to construct the first spline are
>> actually not used in its topological description: only their coordinates
>> are needed internally by OpenCASCADE. If you look at the copy by adding
>> e.g.
>> 
>> factory.synchronize()
>> gmsh.fltk.run()
>> 
>> at the end of your script, and if you select the new curve (101) in
>> Tools->Visibility, you will see that it only depends on a single
>> geometrical point (it is periodic). You can access that point with
>> gmsh.model.getBoundary().
>> 
>> We could access, for each particular curve/surface type, the underlying
>> parameters. In the case of a bspline like curve 101, we could access the
>> poles, knots and multiplicities. Or for a circle, you could access the
>> center. But there is no "general" way to access that data (unless we
>> convert all curves to nurbs and give access to the parameters - which is
>> probably not what you want).
> 
> Thank you very much for clarifications. getBoundary() semms to be what i was 
> looking for. However for the closed spline, as in the example, getBoundary 
> returns for me an empty list instead of a single point (gmsh-4.0.2). When the 
> spline is open two points are returned as expected...

set 'combined = False' in getBoundary()

(For the periodic spline the end point is returned twice, and thus gets eliminated with 'combined = True')


> 
> 
> Regards,
> -- 
> Marek
> 
> 
> 
> 
> --- 
> Politechnika Łódzka 
> Lodz University of Technology 
> 
> Treść tej wiadomości zawiera informacje przeznaczone tylko dla adresata. 
> Jeżeli nie jesteście Państwo jej adresatem, bądź otrzymaliście ją przez pomyłkę 
> prosimy o powiadomienie o tym nadawcy oraz trwałe jej usunięcie. 
> 
> This email contains information intended solely for the use of the individual to whom it is addressed. 
> If you are not the intended recipient or if you have received this message in error, 
> please notify the sender and delete it from your system. 
> 
> 
> 
> _______________________________________________
> gmsh mailing list
> gmsh at onelab.info
> http://onelab.info/mailman/listinfo/gmsh

— 
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science 
http://www.montefiore.ulg.ac.be/~geuzaine

Free software: http://gmsh.info | http://getdp.info | http://onelab.info




More information about the gmsh mailing list