sketchucation logo sketchucation
    • Login
    1. Home
    2. tetsuyahishida
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    T
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 3
    • Posts 11
    • Groups 1

    tetsuyahishida

    @tetsuyahishida

    10
    Reputation
    1
    Profile views
    11
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    tetsuyahishida Unfollow Follow
    registered-users

    Latest posts made by tetsuyahishida

    • RE: [Plugin] ShadowProjector

      Wow now I got it.I guess that's the best way.

      Thanks so much.

      @tig said:

      @tetsuyahishida said:

      TIG!

      Read the .rb file's code to see how it works...
      The sun has a 'direction' [to get the direction of the rays of sunlight we reverse that vector].
      The selected faces are processed in turn - 'selected face'...
      It finds the edges of all faces in the model or groups/instances that might shine onto that 'selected face'.
      It extrudes these edges into a grouped 'tube' with a very long set of faces, which it then intersects with the 'selected face' and adds faces temporarily.
      The tube is erased.
      It then has a set of edges representing the outer limits of the 'selected face's' shadows; internal 'coplanar' edges are erased so it's as simple as possible.
      Each 'shadow' group is formated as the options set, text added etc...
      Obviously it's much more complicated than that [e.g. how to spot if there's a 'hole' in a face], but the principle is as stated...

      posted in Plugins
      T
      tetsuyahishida
    • RE: [Plugin] ShadowProjector

      TIG!

      This plugin is wonderful. I'm now planning to make a plugin to export an hourly data of the shadow ratio.
      And now checking the code of yours.
      Since sketchup API doesn't have enough kind of shadow API,
      it would very helpful if you could explain the algorithm to get the shadow.

      Anyway thanks for your masterpiece.

      posted in Plugins
      T
      tetsuyahishida
    • RE: Exportvertices2csv.rb as a teaching material

      Thankyou all!
      The problem was solved.

      Dan Rathbun

      Do you mean the whole class "Exportvertices2csv"
      should be a module?
      Or, the instance method "printcsv"should be a module?

      posted in Developers' Forum
      T
      tetsuyahishida
    • Exportvertices2csv.rb as a teaching material

      Hi

      I'm now studying Ruby Code and using TIG's
      "exportvertices2csv"as a teaching material.

      I think TIG is putting all the code in initialize,in order to make the code simple.
      Although I know that is a wise way. I'm now practicing to rapping it in instance method.

      In order to devide it in to "initialize part" and "outputting csv part"
      I've wrote these code.

      
      =begin
      (c) TIG 2011
      Type
        Exportvertices2csv.new
      in the Ruby Console.
      Exports all Vertices is a Selection to a X,Y,Z 'CSV' file.
      Edit sep="," if something other than a separating comma is desired e.g. ';'
      Make sep="\t" if a TSV file is desired and change ext="csv" to ext="tsv".
      It uses the current Model Units/accuracy with the approximate '~ ' and 
      unit suffix [if any] removed; e.g. change Model Units to 'meters' 3dp to 
      get exported csv in meters 1.234 - don't use 'fraction' 1' 2 1/2" formats, 
      always use a 'decimal' format.
      1.0 20110105 First issue.
      1.1 20110116 Wrapped in protective class.
      =end
      require 'sketchup.rb'
      ###
      class Exportvertices2csv
      def printcsv(verts)
          pts=[]
          verts.each{|v|pts << v.position.x.to_s.gsub(/^~ /,'').to_f.to_s+sep+v.position.y.to_s.gsub(/^~ /,'').to_f.to_s+sep+v.position.z.to_s.gsub(/^~ /,'').to_f.to_s}
          model=Sketchup.active_model
          path=model.path
          if not path or path==""
            path=Dir.pwd
            title="Untitled"
          else
            path=File.dirname(path)
            title=model.title
          end#if
          ofile=File.join(path,title+'_verts.'+ext).tr("\\","/")
          begin
            file=File.new(ofile,"w")
          rescue### trap if open
            UI.messagebox("Vertices File;\n\n  "+ofile+"\n\nCannot be written - it's probably already open.\nClose it and try making it again...\n\nExiting...")
          return nil
          end
          pts.each{|pt|file.puts(pt)}
          file.close
          puts (pts.length.to_s)+" vertices written to\n"+ofile
          begin
            UI.openURL("file;/"+ofile)
          rescue
          end
      end#def
      def initialize()
          sep="," ### <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
          ext="csv" ### <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
          model=Sketchup.active_model
          ss=model.selection
          verts=[]
          ss.each{|e|verts << e.vertices if e.class==Sketchup;;Face or e.class==Sketchup;;Edge}
          if not verts
            UI.messagebox("No Vertices were Selected.\nExiting.")
      	  return nil
          end#if
          verts.flatten!.uniq!
          self.printcsv(verts)
      end #def
      
      
      end#class
      ###
      
      
      
      
      

      but recieve this error message.

      Exportvertices2csv.new
      Error: #<NoMethodError: undefined method `printcsv' for #Array:0xde0858c>

      does someone have any idea?

      Sincerely yours

      posted in Developers' Forum
      T
      tetsuyahishida
    • RE: Does anyone use UML?

      Thank you for all your imformation!
      UML seems to be not so popular.
      But thank you for the link!!

      posted in Developers' Forum
      T
      tetsuyahishida
    • Does anyone use UML?

      Hi all.
      Since I'm a beginner,this question might be odd
      but does anyone use UML to write plugin?

      I always get confused with the class relationships.
      And to adopt Design Patterns, it seems that UML is quite important.

      posted in Developers' Forum
      T
      tetsuyahishida
    • RE: Plugin(export attributes to csv)

      Dan Rathbun
      Thank you so much for instruction.
      I am now studying "Design Patterns in Ruby"
      And just learned about Singlton Pattern.

      Does every one use Design Pattern making sketchup plugin?
      Or maybe use UML?

      posted in Developers' Forum
      T
      tetsuyahishida
    • RE: Plugin(export attributes to csv)

      Thank you for your reply.

      jim
      The user and he said typing"export2csv.new" solved the problem.
      He was typing "export2csv"

      TIG
      I've immedeately modified the authority. Sorry about my insensitiveness.

      Still I got three questions

      First, does "::"of "TetsuyahishidaTools::Export2csv.new()"
      stands for scope resolution operator?If not, what does it stand for?

      Second, Why does the "TetsuyahishidaTools Module" have to be a "Module"?
      Is it because in Ruby, a class can only inherit from a single other class?
      Or something about nesting rule?

      Third, are there any way to do the same thing using "include"?

      Sorry for my poor English and ruby skill.
      Best regards.

      posted in Developers' Forum
      T
      tetsuyahishida
    • RE: Plugin(export attributes to csv)

      TIG

      Thank you for your advise.
      I've removed sketchup.rb from GITHUB.

      Unfortunately, some other people still can't use the plugin.

      <Error message>
      #<NameError: undefined loca variable or method 'export2csv' for main:Object>

      do you have any idea what's wrong?

      Link Preview Image
      export2csv/export2csv.rb at version0.8 · tetsuyahishida/export2csv

      sketchup plugin. Contribute to tetsuyahishida/export2csv development by creating an account on GitHub.

      favicon

      GitHub (github.com)


      screenshot

      posted in Developers' Forum
      T
      tetsuyahishida
    • RE: Plugin(export attributes to csv)

      TIG
      Thank you so much for your reply!
      I'm a fan of you. So excited to be able to get in touch with you.

      The Plugin worked flawlessly after the modification.

      Dan Rathbun
      Thank you for your advice.
      It is the same as the Google version.

      I'll push the changes.
      Since using "git" and push it to GITHUB seems to be a very usefull method I think other sketchup user might like using it.

      posted in Developers' Forum
      T
      tetsuyahishida