error in making the .gts file from .stl file

Asked by alma

Hi,
I've created a geometry using Autocad2013 software (.dwg format) and exported it to .stl in Rhinoceros5, and convert the file to .gts format using " stl2gts -r < fileName.stl > fileName.gts " method, but can't open the .gts file and it seems that the file hasn't been made correctly.
What can I do to get the correct .gts file for my work?Is any method for that?or I must use other method for that?
Best regards, Alma

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said :
#1

Hi Alma,
could you please put the .stl file to the internet and send a link to it
such that we can test it?
Also please send what system yo uuse and what version of stl2gts (on my
system, "man stl2gts" ends with June 2 2008)
cheers
Jan

2016-12-15 22:47 GMT+01:00 alma <email address hidden>:

> New question #406791 on Yade:
> https://answers.launchpad.net/yade/+question/406791
>
> Hi,
> I've created a geometry using Autocad2013 software (.dwg format) and
> exported it to .stl in Rhinoceros5, and convert the file to .gts format
> using " stl2gts -r < fileName.stl > fileName.gts " method, but can't open
> the .gts file and it seems that the file hasn't been made correctly.
> What can I do to get the correct .gts file for my work?Is any method for
> that?or I must use other method for that?
> Best regards, Alma
>
> --
> You received this question notification because your team yade-users is
> an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
alma (alma6748) said :
#2

Hi Jan,
I've attached my files for you to this address:
https://www.dropbox.com/s/jp0ht1om1ttv64x/test.rar?dl=0
the systems that I sue are "Yade 1.07.0" and "Yade 1.20.0-39-53c22a7~trusty". unfortunately I couldnt find the version of stl2gts.
Thanks for attention,
Alma

Revision history for this message
alma (alma6748) said :
#3

Is there anyone to help me in my problem? I haven't much time, please help me.
Thanks,alma

Revision history for this message
Jan Stránský (honzik) said :
#4

Hello Alma,
why actually do you need to convert the .stl file to .gts format?
The files is plain text format, so you can write your own convertor :-)
cheers
Jan

PS: It is very long time since I used AutoCAD myself, but I would expect
such software to be able to export the geometry to various formats..

Revision history for this message
alma (alma6748) said :
#5

Hi Jan,
> why actually do you need to convert the .stl file to .gts format?
because I'm using gts.read()-function for importing mesh file and filling it with spheres. Is there any way to use the .stl format for that (filling geometry with spheres)?

>The files is plain text format, so you can write your own convertor :-)
I prepared a gts file that It opens in softwares such Rhinoceros5 and MeshLab, but when importing it in Yade, I faced the following error:
RuntimeError Traceback (most recent call last)
/usr/bin/yade in <module>()
----> 1 surface=gts.read(open(mesh+'.gts'))

RuntimeError: expecting an integer (number of faces)

the gts file has been attached to this address: https://www.dropbox.com/s/jp0ht1om1ttv64x/test.rar?dl=0
If possible, please look at the file and test it ,I'm so confused with this error :-/
thanks for attention,
Alma

Revision history for this message
Jérôme Duriez (jduriez) said :
#6

Hi,

I could not find any .gts file in the dropbox link (only one .stl, one .msh and one .dwg)

Revision history for this message
Best Jan Stránský (honzik) said :
#7

Hi Alma,
sorry, there is no .gts file :-(

anyway, you can construct a gts surface based on facets, try the following
approach:

###################
import gts
from yade import ymport,pack
facets = ymport.stl('test.stl')
#O.bodies.append(facets)
s = gts.Surface()
for facet in facets: # creates fts.Face for each facet. The vertices and
edges are duplicated
vs = [facet.state.pos + facet.state.ori*v for v in facet.shape.vertices]
vs = [gts.Vertex(v[0],v[1],v[2]) for v in vs]
es = [gts.Edge(vs[i],vs[j]) for i,j in ((0,1),(1,2),(2,0))]
f = gts.Face(es[0],es[1],es[2])
s.add(f)
print s.is_closed() # since the vertices are duplicated, the surface is not
closed
threshold = 1e-3 # since using ori*v, the coordinates are not exactly same,
some nonzero threshold is needed
s.cleanup(threshold) # removes duplicated vertices and edges
print s.is_closed()
assert s.is_closed()
pred = pack.inGtsSurface(s)
r = 3
sphs = pack.regularHexa(pred,r,0)
O.bodies.append(sphs)
###################

cheers
Jan

Revision history for this message
alma (alma6748) said :
#8

hi Jerome,
I'm so sorry for my mistake, the link is: https://www.dropbox.com/s/qtqvngqzprfoi51/slope.gts.rar?dl=0
regards
Alma

Revision history for this message
alma (alma6748) said :
#9

hi Jan,
I'm so sorry for my mistake, the link is: https://www.dropbox.com/s/qtqvngqzprfoi51/slope.gts.rar?dl=0
thanks a lot for your assistance, that solved my problem.
best regards
Alma

Revision history for this message
alma (alma6748) said :
#10

Thanks Jan Stránský, that solved my question.