How to add all SU materials in our list?

No, incorrect ! This lists only the material objects that have already been loaded into the model’s materials collection. Not what is on disk in the various “Materials” directories.

It is already in the model’s memory at that point.

Only if the user has clicked the house icon, and is looking at the “In Model” materials collection.

Computer platforms differ. MS Windows and MacOS are different in their filesystems and where they organize user and program data files.

It is a situation that programmers must deal with.

And the location of material files is only 1 of many differences you will need to deal with as a SketchUp extension programmer.

No, it is not that simple. It depends upon whether the user wants to use a material that is already in the model, or is still on disk in one of the material repositories.

Listen, it is not the same for Ruby. You’ll just need to realize this. You did do the correct thing in having the API find the file …

  filename = 'Materials/Asphalt and Concrete/Blacktop Old 01.skm'
  path = Sketchup.find_support_file(filename)

This was shown you in the API documentation.

Yes, …

  # Within some method...
  filename = 'Materials/Asphalt and Concrete/Blacktop Old 01.skm'
  materials = Sketchup.active_model.materials
  matl_name = File.basename(filename,".skm")
  matl = materials["[#{matl_name}]"]
  if matl.nil? # not in model materials collection, load it:
    begin
      matl = materials.load(Sketchup.find_support_file(filename))
    rescue => err
      put err.inspect
    end
  end
  return unless matl

No … let the API give your code the file path as shown above. It is cross-platform.