POV-Ray : Newsgroups : povray.windows : How to generate sphere and cylinder with csv file : Re: How to generate sphere and cylinder with csv file Server Time
18 Apr 2024 20:11:57 EDT (-0400)
  Re: How to generate sphere and cylinder with csv file  
From: Jeff
Date: 29 Mar 2017 10:50:01
Message: <web.58dbc93eae95604b4de507a60@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> clipka <ano### [at] anonymousorg> wrote:
> > Accordin to the OP it isn't really CSV, but rather tab-separated (or
> > blank-separated?) values.
> >
> > These are /not/ ideally suited for the use with `#read`.
>
> Right on.
> It looks like space or tab-delimited.
> Perhaps the OP could link to the source.
>
> Opening in Excel or OpenOffice and saving as true CSV ought to do it.
-- so, i did try to run the code , and it shows me the list of information from
the nodes.csv file. so, its probably means it could work with it.


> He's also going to need to fix that ID string with something like (untested):
>
> #declare ID = substr(S3,strlen(S1),strlen(S3)-strlen(S1))
>
> where S1 is the mode, and S3 is the ID.
>
> (BTW, I didn't see a dedicated entry for "strlen()" in the F1 documentation
> section on String Functions. Perhaps I overlooked it...)
-- they are dedicated , but i just put some of it, because they are not in a
organized order. so, i just pick some samples from it.


#include "colors.inc"
#fopen nodesfile "C:\\Users\\Jeff\\Desktop\\nodes.csv" read
#fopen linksfile "C:\\Users\\Jeff\\Desktop\\links.csv" read
  #while (defined(nodesfile))
    #read (nodesfile,Var1,Var2,Var3,Var4)
#declare myImage = pigment {image_map {png "C:/Users/Jeff/Desktop/beijing.png"
}}
#declare Resolution = max_extent (myImage);
#declare ImageHeight = Resolution.y;
#declare ImageWidth = Resolution.x;
box {0, 1, translate -0.5 pigment {myImage} scale
<Resolution.x, Resolution.y, 1>}



#if (Verbose)
     #debug "Debugging on \n"
     etc
#end
#if (Var1 = "bus")
    #declare Color = pigment {Red};
#else if (Var2 = "subway")
    #declare Color = pigment {Green};
#else if (Var3 = "rail")
    #declare Color = pigment {Blue};
#else (Var4 = "tram")
    #declare Color = pigment {Yellow};
#end

camera {
   orthographic
   location <-1000,0,0>
   look_at 0
   rotate <0,clock*360,0>
   }

light_source    {
                <10,10,-1000>
                color White
                }

jeff.federick93@(gmail.com)is my email.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.