sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Applying Material or Color to Group

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 3 Posters 731 Views 3 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.
    • medeekM Offline
      medeek
      last edited by

      How does one apply a color or material to a group? I can't seem to find a simple explanation or example in the SketchUp API documentation.

      Nathaniel P. Wilkerson PE
      Medeek Engineering Inc
      design.medeek.com

      1 Reply Last reply Reply Quote 0
      • D Offline
        driven
        last edited by

        a group is a drawing element so look at

        Drawingelement.material=

        in the API

        john

        learn from the mistakes of others, you may not live long enough to make them all yourself...

        1 Reply Last reply Reply Quote 0
        • TIGT Offline
          TIG Moderator
          last edited by

          group.material=material

          Where the given material is a reference to a material already available in the model, or perhaps it's the name of an existing material, or the name of one of the standard 'color' - that might be not yet loaded:
          So e.g.
          material=Sketchup.active_model.materials['truss_wood']Where material returns 'nil' if it's not found, or a reference to that named material otherwise.
          Or alternatively:
          material='truss_wood'
          which will work if you know that the material named 'truss_wood' is already in the model,
          or perhaps...
          material='brown'
          Which uses the material named 'brown', or it makes the new material then uses it otherwise.
          There is a preset list of 'colors' [à la html]:
          http://www.sketchup.com/intl/en/developer/docs/ourdoc/color
          If you want a material with another color or transparent, or a texture, then you must add it to the model.materials before referencing it.
          http://www.sketchup.com/intl/en/developer/docs/ourdoc/materials#add
          You then create a new color and apply it to that new material, which by default would be black with no transparency [0,0,0,0]
          http://www.sketchup.com/intl/en/developer/docs/ourdoc/material#color=
          If you also want to add a texture to the material, use http://www.sketchup.com/intl/en/developer/docs/ourdoc/material#texture=
          Which specifies the image file to use, then you can edit the texture's details with texture=material.texture Using:http://www.sketchup.com/intl/en/developer/docs/ourdoc/texture#size=
          etc...

          TIG

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

          Advertisement