Skip to content

Instantly share code, notes, and snippets.

@hanpama
Created November 16, 2017 08:17
Show Gist options
  • Save hanpama/4779e3c87ccbbd0866f3cf70369d7e94 to your computer and use it in GitHub Desktop.
Save hanpama/4779e3c87ccbbd0866f3cf70369d7e94 to your computer and use it in GitHub Desktop.
스케치업에서 루트 레벨 그룹들을 따로 KMZ 파일로 익스포트합니다.

Sketchup Group2KMZ Script

사용 방법

  1. 스케치업의 상단 메뉴에 있는 Window > Ruby Console 항목을 클릭하여 루비 콘솔을 엽니다.
  2. 아래의 스크립트를 붙여 넣고 엔터를 입력 후, 파일들이 들어갈 폴더를 선택합니다.
  3. 폴더에 가보면 kmz 파일들이 생겨 있습니다.
groups = Sketchup.active_model.entities.grep(Sketchup::Group)

chosen_folder = Pathname.new(UI.select_directory(title: "Select Export Directory"))

groups.each { |g| g.hidden = true }

groups.each_with_index { |g, i|
  
  g.hidden = false
  
  model_name = g.name
  if g.name.empty?
    model_name = 'Group %s' % i
  end
  
  file_path = chosen_folder + '%s.kmz' % model_name
  puts file_path

  active_model.export(file_path.to_s, { :hidden_geometry => false })
  g.hidden = true
}

groups.each { |g| g.hidden = false }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment