Material not Default while editing a Component

I’m adding faces to a component within my model. When I close the geometry, the material is not default. In one instance, the material is a glass material, in a separate instance, the material is a stacked stone texture I created. This only occurs when editing groups or components. FWIW: the created face is not the same any of the materials of any of the bounding edge materials. Heck of a Friday afternoon.

Share a model that exhibits this. My guess is you’ve applied the material to the group container not the faces inside. Seeing exactly what you’ve modeled would make it simple to tell you what’s going on.

Material applied to faces. Default material displayed on added face.

Material applied to object container. No materials applied to the faces, though.

That seems to be an issue and I have to delete geometry to fix the pesky thing. Thanks for the help. It’s frustracting since I couldn’t select all the geometry and use the paint bucket to set all the faces to “default”. It I tried that, it would use the embedded material.

Why do you have to delete any geometry to fix this?

In order for the default material to display you need to remove the material from the group/component container. Apply the default material to the group/component while it isn’t open for editing.

The material isn’t embedded. It’s just applied to the container instead of the faces. In most cases it’s better to apply the material to the faces inside rather than paint the group/component container.

There’s a hierarchy for material display. Materials applied to faces have first priority. Materials applied to components or groups come second. If you have nested objects the priority works up from the bottom level objects. The default material comes last. It will only be displayed if there’s no material applied to a face or an object container.

Here’s an example. The faces in the cylinder component are painted green. The box and hex geometry have the default material. The nested component containing the cylinder and the box is painted red and the nested component containing the box/cylinder component and the hex is painted yellow.

mats

I had a mess with nested groups and it was simpler to delete the geometry and clean up the mess. It’s always faster the second time. :smiley:

Ah … Excess nesting seems to be an issue for some users. Gald you figured out the easiest route to the fix.

The excess nesting becomes particularly interesting with users who place all geometry on Untagged. They work on the principle of “it it looks good, it is good.”

All edges and faces should be left untagged. Only groups and components should be given tags. With tag folders there should be much less need for nesting. Usually the only reason I use nesting anymore is when I have some components I want to treat as a single object for moving within the model. For example, the individual components for a frame and panel door would be collected into nested component. Same for the flywheel, crank shaft, and eccentric on a steam engine. For visibility control, though, tags and tag folders are easier and make actually working on the model simpler.

There is a little ruby script here you can run that will remove ALL materials applied to groups/component. Leaving only face assigned materials. It will work on nested ones also

# Removes materials applied directly to Groups and ComponentInstances,
# at all nesting levels, while leaving face-level materials intact.
module RemoveGroupComponentMaterials
  extend self

  def remove_materials
    model = Sketchup.active_model
    count = process_entities(model.entities)
    UI.messagebox("Removed materials from #{count} groups/components.")
  end

  private

  def process_entities(entities)
    count = 0

    entities.each do |entity|
      case entity
      when Sketchup::Group, Sketchup::ComponentInstance
        # Clear material applied directly to the group/instance
        unless entity.material.nil?
          entity.material = nil
          count += 1
        end
        # Recurse into its definition’s entities
        count += process_entities(entity.definition.entities)
      end
    end

    count
  end
end

# Run it immediately
RemoveGroupComponentMaterials.remove_materials

I’d suggest saving your file before you do!

ThomThom’s Materials Tools can also do that.

I work in the architorture world. I’ll nest for things such as doors, door hardware, and frames. It’s easier to move them when they’re one group or component. Usually a component since there are typically multiple instances. Tags are awesome. Since I’m old and started with AutoCAD in the 90s I still think of tags as layers. They make working so much simpler.

Yes. That’s what I was getting at. No need to collect all of the doors in the model into aa single nested component or group, though.

Keep in mind they don’t work exactly the same as layers. And, if you follow the “rules” and leave all edges and faces untagged, there’s no chasing tags as you work through the model so less chance you’ll induce errors in your model. Leave Untagged active at all times. You don’t even need to know what tag and object has when you open it for editing to make changes.