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

Marek Wojciechowski mwojc at p.lodz.pl
Tue Oct 16 03:50:33 CEST 2018


Dnia poniedziałek, 15 października 2018 14:08:01 CEST Max Orok pisze:
> Hi Marek,
> 
> I would use the getEntities function. By specifying a dimension, you can
> only ask for points, lines, etc.
> You could compare the lists of entities before and after the copy to get
> the dimTags of the copied points.

Thanks for tip. The working example with this approach is below:


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) 

# create closed bspline and synchronize
factory.addSpline([103,102,101,104,105, 103], 100)
factory.synchronize()

# get all points before  copy
before_copy = zip(*model.getEntities(0))[1]

# COPY SPLINE HERE and synchronize
dimTag = factory.copy([(1, 100)])
factory.synchronize()

# get all points after copy
after_copy = zip(*model.getEntities(0))[1]

# compare and get list of added points
import numpy as np
added_points = np.setdiff1d(after_copy, before_copy)




 

--- 
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. 





More information about the gmsh mailing list