Skip to main content
Question

.obj files and fme - accessing the points

  • October 14, 2016
  • 4 replies
  • 69 views

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

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

takashi
Celebrity
  • 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

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+18
  • Supporter
  • October 16, 2016

 

@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+18
  • Supporter
  • October 17, 2016

 

@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 (??)