Skip to main content
Question

.obj files and fme - accessing the points


Forum|alt.badge.img

Hi

First time using .obj files and i can build the mesh as a single item. How would i go about access each individual point geometry? I have tried a few things i could think of but nothing worked.

Anyone know much about obj files?

thanks

4 replies

takashi
Evangelist
  • October 15, 2016

Hi @lemzip, I can provide two ways to extract every vertex point from a Mesh geometry.

TINGenerator: Send the Mesh feature to the Points/Lines port of a TINGenerator, set 0 to the "Surface Tolerance" parameter, and then pick the Point features output from the VertexPoints port.

Or,

PythonCaller with this script.

class FeatureProcessor(object):
    def input(self, feature):
        mesh = feature.getGeometry()
        for i, xyz in enumerate(mesh.getVertices()):
            feature.setGeometry(fmeobjects.FMEPoint(*xyz))
            feature.setAttribute('_vertex_id', i)
            self.pyoutput(feature)

Forum|alt.badge.img
  • Author
  • October 16, 2016
takashi wrote:

Hi @lemzip, I can provide two ways to extract every vertex point from a Mesh geometry.

TINGenerator: Send the Mesh feature to the Points/Lines port of a TINGenerator, set 0 to the "Surface Tolerance" parameter, and then pick the Point features output from the VertexPoints port.

Or,

PythonCaller with this script.

class FeatureProcessor(object):
    def input(self, feature):
        mesh = feature.getGeometry()
        for i, xyz in enumerate(mesh.getVertices()):
            feature.setGeometry(fmeobjects.FMEPoint(*xyz))
            feature.setAttribute('_vertex_id', i)
            self.pyoutput(feature)

 

@takashi, Thanks i can now pull out the vertex.

 

Another question, the vertex x,y, and z in the file in plain text is like this:

 

 

v  11416.5 -0.00023741 -5431.3
v  11422 -0.000238869 -5464.68
v  11357.1 -0.000239796 -5485.89
v  11379.5 -0.000241047 -5514.52
v  11379.1 -0.000239044 -5468.68

Is that in any relation to a spatial projection etc or is it just the location in the file?

 

 

I cannot find anywhere in the file that gives me any indication on spatial reference used.

itay
Supporter
Forum|alt.badge.img+17
  • Supporter
  • October 16, 2016
lemzip wrote:

 

@takashi, Thanks i can now pull out the vertex.

 

Another question, the vertex x,y, and z in the file in plain text is like this:

 

 

v 11416.5 -0.00023741 -5431.3 v 11422 -0.000238869 -5464.68 v 11357.1 -0.000239796 -5485.89 v 11379.5 -0.000241047 -5514.52 v 11379.1 -0.000239044 -5468.68

Is that in any relation to a spatial projection etc or is it just the location in the file?

 

 

I cannot find anywhere in the file that gives me any indication on spatial reference used.
I don't think the obj supports any spatial projection and that it is all relative location.

 

 


itay
Supporter
Forum|alt.badge.img+17
  • Supporter
  • October 17, 2016
lemzip wrote:

 

@takashi, Thanks i can now pull out the vertex.

 

Another question, the vertex x,y, and z in the file in plain text is like this:

 

 

v 11416.5 -0.00023741 -5431.3 v 11422 -0.000238869 -5464.68 v 11357.1 -0.000239796 -5485.89 v 11379.5 -0.000241047 -5514.52 v 11379.1 -0.000239044 -5468.68

Is that in any relation to a spatial projection etc or is it just the location in the file?

 

 

I cannot find anywhere in the file that gives me any indication on spatial reference used.
Digging further into the documentation revels the possibility to move the data into world coordinate systems when reading, but it requires the 'companion' dataset files (??)

 

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings