← Back to team overview

yade-users team mailing list archive

Re: [Question #660999]: How to fill inside a gts file with spheres

 

Question #660999 on Yade changed:
https://answers.launchpad.net/yade/+question/660999

Jan Stránský proposed the following answer:
Hi Felipe,

thanks for the gts file. The surface has wrong orientation. Just change
it by reversing order of edges of faces (i.e. switch 2nd and 3rd number
lines 1340-2007) and it works as expected.

 what I used to switch the numbers:
#####
with open("felipe.gts") as f:
   lines = f.readlines()
flag = 0
for i,l in enumerate(lines):
   ls = l.split()
   if flag == 0 and len(ls)==2:
      flag = 1
   if flag == 1 and len(ls)==3:
      flag = 2
   if flag != 2:
      continue
   lines[i] = "{} {} {}\n".format(ls[0],ls[2],ls[1])
with open("felipe2.gts","w") as f:
   f.writelines(lines)
######

cheers
Jan

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.