• Website
  • Search
  • Member List
  • Help
  • Old Forum
  • Social Media
    •   @Wings3dOfficial
    •   @Wings3dOfficial
    •   Wings3dOfficial
    •   Wings3dOfficial
  • Register
  • Login
  • Website
  • Search
  • Member List
  • Help
  • Old Forum
  • Register
  • Login
Wings 3D Development Forum Wings 3D Programming v
« Previous 1 2 3 4 Next »
Parsing .obj file

 
  • 0 Vote(s) - 0 Average
Parsing .obj file

Namrata
Offline

Junior Member

Posts: 8
Threads: 3
Joined: Mar 2015
#1
03-30-2015, 01:20 AM
Hi,

I imported a .obj file using the e3d_obj:import("filename") command.
Now I need to access all the vertices from that file. I have attached in the file the record that is created.

Could you please help me figure out how I can access all the values corresponding to 'vs' and store that as a separate list.


Attached Files
.txt   obj_record.txt (Size: 3.67 KB / Downloads: 2)
ggaliens
Offline

Erlang Hacker
Posts: 954
Threads: 143
Joined: Nov 2012
#2
03-30-2015, 02:00 AM (This post was last modified: 03-30-2015, 02:06 AM by ggaliens.)
As you probably know ... #e3d_file is an intermediate data format. I will find you a snippet that converts into #we{ }

Code:
carveCSGImport(FileName) ->
    case e3d_obj:import( getTempDir() ++ "/" ++ FileName ) of
        {ok,{e3d_file,[],[],[],_}} ->
            { empty, error };
        {ok,E3dFile0} ->
            NameNow = io_lib:format("polyhead~p_~p_~p", tuple_to_list(erlang:now()) ),
            #e3d_file{} = E3dFile0,
            St0 = newSt(),  %% Worried about impact of this new wpa:import on coffin speed. Need test !
            St = wpa:import(E3dFile0, St0),
            Wes = gb_trees:values(St#st.shapes),
            WeNew = wings_we:merge(Wes),
            {ok,WeNew#we{name=NameNow}};
        _OTHER ->
            _OTHER
    end.

So ... wpa:import(E3dFile0, St0)

will get the data into the current wings state #st{}

And then you can just find the last item into that state if you want.
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D - Powered by MyBB

Linear Mode
Threaded Mode