Module: DFC::Common::Material

Included in:
Sketchup::Material

Overview

DFC材质库 相关API

Class Method Summary # collapse

Class Method Details

.dialog_show {|id, src, name| ... } ⇒ Object

打开材质库

Examples:

DFC::Common::Material.dialog_show([]){|id,src,name|
  puts "#{id},#{src},#{name}"
}

Yields:

  • (id, src, name)

Yield Parameters:

  • id (String)

    材质id

  • src (String)

    材质缩略图

  • name (String)

    材质名

.exist?(lib, mat) ⇒ Boolean

判断材质是否存在

Parameters:

  • lib (String)

    指定库 项目|系统|用户

  • mat (Object)

    材质对象

Returns:

  • (Boolean)

.get_mat_by_id(id, type = '项目', flag = true) ⇒ Material/SU_Material

根据id获取材质

Parameters:

  • id (String)

    id

  • type (String) (defaults to: '项目')

    指定库 项目|系统|用户 默认项目库

Returns:

  • (Material/SU_Material)

    材质对象(子类对象) nil 不存在

.get_mats_by_type(type, key_word = nil, page = nil, num = nil) ⇒ Hash

根据类型获取材质

Examples:

返回的数据格式
  hash = {
      'data'=>[
          {
              'id'=>id,
              '材质预览'=>[路径...],
              '材质名称'=>材质名称,
              '材质类型'=>材质类型
      ],
      'page'=>'当前页'
      'count'=>'总页数'
  }

Parameters:

  • type (String)

    [系统,石材]‘

  • key_word (String) (defaults to: nil)

    关键字(不搜索的时候值为nil)

  • page (int) (defaults to: nil)

    第几页 nil 代表数据不分页

  • num (int) (defaults to: nil)

    一页多少个 nil 代表数据不分页

Returns:

  • (Hash)