• Login
sketchucation logo sketchucation
  • Login
πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

[Ruby doc] .materialType method

Scheduled Pinned Locked Moved Developers' Forum
8 Posts 4 Posters 1.4k Views 4 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    tomasz
    last edited by 30 Aug 2008, 10:47

    @unknownuser said:

    materialType
    The materialType method retrieves the type of the material.
    Syntax
    type = material.materialType
    Return Value
    type - the material type for the Material object

    The last line explains everything. πŸ˜†
    As far as I can tell:

    0 - just coloured material
    1 - textured
    2 - texured & coloured

    A strange thing - when I reset colour of the texture the Type stays 2!!

    I am intensively looking for a method that would tell me if a texture on a face is 'projected/photomacthed' or not. This one doesn't seem to do the job 😞

    I hope a Google friend will enlighten us or we can somehow figure it out together.

    Thanks
    Tomasz

    Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

    1 Reply Last reply Reply Quote 0
    • T Offline
      tomasz
      last edited by 1 Sept 2008, 20:57

      Any clue? I know there are a lot commercial exporters and SU2KT is a great rival πŸ˜„

      Tomasz

      Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

      1 Reply Last reply Reply Quote 0
      • N Offline
        notareal
        last edited by 8 Sept 2008, 08:09

        @unknownuser said:

        ...'projected/photomacthed'

        Sorry cannot help with that. But it would be great if there is a way to find out it.

        Welcome to try [Thea Render](http://www.thearender.com/), Thea support | [kerkythea.net](http://www.kerkythea.net/) -team member

        1 Reply Last reply Reply Quote 0
        • T Offline
          todd burch
          last edited by 8 Sept 2008, 09:03

          I'm working on getting an answer for this.

          Todd

          1 Reply Last reply Reply Quote 0
          • T Offline
            todd burch
            last edited by 8 Sept 2008, 15:04

            I checked with Google. You are correct, these are the values:

            0 = solid
            1 = textured
            2 = colorized textured

            I've updated the doc: http://groups.google.com/group/SketchUp-Plugins-Dev/web/Ruby-Material.html?hl=en#materialType

            Todd

            1 Reply Last reply Reply Quote 0
            • F Offline
              Fletch
              last edited by 9 Sept 2008, 02:53

              @unknownuser said:

              I am intensively looking for a method that would tell me if a texture on a face is 'projected/photomacthed' or not. This one doesn't seem to do the job

              Todd, I'm not quite clear, sorry 😳

              Correct me if I'm wrong, I read the post you linked at google groups, but it's apparent to me, (I'm no programmer) then that it's impossible with the methods provided in SU6 to check to see the difference if a material applied in the scene is a photomatched texture or just any old .jpg Texture.

              πŸ’­ If not, will there be a patch released to provide a method? Or at least can google team please confirm providing this method in SU7 ❓

              Fletch
              Twilight Render Cross-platform Plugin for SketchUp on PC or Mac

              1 Reply Last reply Reply Quote 0
              • T Offline
                todd burch
                last edited by 9 Sept 2008, 12:23

                @fletch said:

                ... it's apparent to me, (I'm no programmer) then that it's impossible with the methods provided in SU6 to check to see the difference if a material applied in the scene is a photomatched texture or just any old .jpg Texture.

                And you would be correct. There is not Ruby support for Photomatch in V6. I can't speak for V7.

                1 Reply Last reply Reply Quote 0
                • T Offline
                  tomasz
                  last edited by 9 Sept 2008, 12:44

                  It is sad. So maybe SU SDK could help, but it isn't within my abilities to play with it.

                  def SU2KT;;texture_distorted?(e,mat,mat_dir)
                  	distorted=false
                  	temp_tw=Sketchup.create_texture_writer
                  	model = Sketchup.active_model
                  	entities = model.active_entities
                  	model.start_operation "Group" #For Undo
                  	group=entities.add_group
                  	group.material = mat
                  	g_handle=temp_tw.load(group)
                  	temp_handle=temp_tw.load(e,mat_dir)
                  	entities.erase_entities group
                  	Sketchup.undo
                  	distorted=true if temp_handle!=g_handle
                  	temp_tw=nil
                  	return distorted
                  end
                  

                  Here is what I am doing in SU2KT, but it is slow, memory consuming and dirty. 😞

                  Btw. Todd - have you noticed that .materialType doesn't change from 2 back to 1 if a material is not longer colorized. Am I correct?

                  Thanks
                  Tomasz

                  Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  1 / 1
                  • First post
                    3/8
                    Last post
                  Buy SketchPlus
                  Buy SUbD
                  Buy WrapR
                  Buy eBook
                  Buy Modelur
                  Buy Vertex Tools
                  Buy SketchCuisine
                  Buy FormFonts

                  Advertisement