SlideShare a Scribd company logo
1 of 14
Download to read offline
Advanced Ruby Scripting
for SketchUp
Scott Lininger
May 29, 2008
What’s SketchUp?

  Google’s 3D drawing tool
  Used and loved by design professionals and hobbyists
  Easy to learn yet powerful
  Free and Pro versions are available


On the Nerdy Side…
  Client application for PC & Mac
  Written in C++ and Objective C
  OpenGL for display layer
  Has a Ruby programming API
How Do I Get to the API?

  If you have SU, you have the API
  You write a Ruby Script
  Put your script into /SketchUp 6/Plugins folder and restart
  SU
  Control SketchUp via a powerful, consistent Object model

     Sketchup.active_model.camera.eye.x


         entities[0].transform! by_some_amount


  edge.faces[0].material = some_color
WebDialogs

  WebDialogs provide an embedded browser inside
  SketchUp
     Internet Explorer on PC
     Webkit/Safari on Mac
Ruby Extension Modules

  Extend Ruby with native code binary (aka extension
  module)
  Better performance
  Better IP protection of your code
Advanced Technique 1:
Grab and Render Web Data

  Ruby Opens a Webdialog to some webpage
  The page uses AJAX or other techniques to pull data
     TIP: If your webpage is local, you can get data across
     domains
  JS calls a ruby method and sends down that data to
  SketchUp as a string


                        Stock Grabber
             Demo
                         + Footprinter
Advanced Technique 2:
Hide the Web Dialog

   Provides a “permanent” Javascript environment
   Javascript can take control at any time
   How to do it on the PC?

   my_dialog.show()
   my_dialog.set_position(9999,9999)



   On the Mac?
                                                  Secret
      Just don’t call .show() method   Demo   Stock Grabber
Advanced Technique 3:
Use WebDialogs + Ruby to Control the Camera

   Move the camera to control user experience
   Export 2D screenshots to get web-friendly output from SU



       Demo         3D Exporter



   http://sketchup.google.com/download/plugins.html
      3D Exporter is an open source project! Please contribute.
Advanced Technique 4:
Animate using Javascript’s setTimeout

   Create a timer in Javascript…
   timerID = setTimeout(quot;nextFrame()quot;, 500)


   It runs in the browser’s thread (not SketchUp’s)
   Quietly sends commands to Ruby to create animation.



            Demo       Spin My Yoda
Advanced Technique 5:
Capture Key Strokes with Javascript

   document.onClick can capture keystrokes
   dialog.show_modal() can force focus to your dialog
   Interesting way of adding keyboard support to SketchUp




           Demo      Nudge My Yoda
Advanced Technique 6:
Bring ‘em all together

   JS + Ruby Games in SketchUp




                            Prince IO
          Dem            The SketchUp Knight
           o
Advanced Technique 7:
Ruby Extension Modules

  Take these animation and processing techniques to
  the next level
  SketchyPhysics is a great example… numerous demos on
  YouTube
Learn More


  Get SketchUp
  http://sketchup.google.com
  API Documentation
  http://code.google.com/apis/sketchup/
  Join the SketchUp API Blog
  http://sketchupapi.blogspot.com/
  Join the Ruby User Group
  http://groups.google.com/group/Ruby-API
Advanced Ruby Scripting for SketchUp

More Related Content

Viewers also liked

Portfolio Presentation
Portfolio PresentationPortfolio Presentation
Portfolio Presentationjeffnissen
 
Solo Latin Tango Prat
Solo Latin Tango PratSolo Latin Tango Prat
Solo Latin Tango PratHOME
 
April Vacation
April VacationApril Vacation
April VacationDBrandon69
 
Bruno
BrunoBruno
BrunoHOME
 
廖上鈿
廖上鈿廖上鈿
廖上鈿nice567
 
Abb Tech Conference Program
Abb Tech Conference ProgramAbb Tech Conference Program
Abb Tech Conference Programrwaldo
 
Founders guild epiphany
Founders guild epiphanyFounders guild epiphany
Founders guild epiphanySteve Newcomb
 
Isurus Sales Effectiveness Analysis Overview
Isurus Sales Effectiveness Analysis OverviewIsurus Sales Effectiveness Analysis Overview
Isurus Sales Effectiveness Analysis OverviewRadwich
 
Boozefish Campaign
Boozefish CampaignBoozefish Campaign
Boozefish Campaignjeffnissen
 
13353102 Putting The Fun In Functional Applying Game Mechanics To Functional ...
13353102 Putting The Fun In Functional Applying Game Mechanics To Functional ...13353102 Putting The Fun In Functional Applying Game Mechanics To Functional ...
13353102 Putting The Fun In Functional Applying Game Mechanics To Functional ...GoogleTecTalks
 
An Introduction To Android
An Introduction To AndroidAn Introduction To Android
An Introduction To AndroidGoogleTecTalks
 
Isurus Market Opportunity Analysis Overview
Isurus Market Opportunity Analysis OverviewIsurus Market Opportunity Analysis Overview
Isurus Market Opportunity Analysis OverviewRadwich
 
FRE 6431s Project
FRE 6431s ProjectFRE 6431s Project
FRE 6431s Projectmalshetwey
 
Vanessa Mae Happy Valley Violin T
Vanessa Mae Happy Valley Violin TVanessa Mae Happy Valley Violin T
Vanessa Mae Happy Valley Violin THOME
 
Save Your Client\'s Money With MSA
Save Your Client\'s Money With MSASave Your Client\'s Money With MSA
Save Your Client\'s Money With MSAbigfaz2009
 

Viewers also liked (20)

Planta Poder
Planta PoderPlanta Poder
Planta Poder
 
Portfolio Presentation
Portfolio PresentationPortfolio Presentation
Portfolio Presentation
 
Solo Latin Tango Prat
Solo Latin Tango PratSolo Latin Tango Prat
Solo Latin Tango Prat
 
April Vacation
April VacationApril Vacation
April Vacation
 
Bruno
BrunoBruno
Bruno
 
廖上鈿
廖上鈿廖上鈿
廖上鈿
 
Make moda final
Make moda finalMake moda final
Make moda final
 
Abb Tech Conference Program
Abb Tech Conference ProgramAbb Tech Conference Program
Abb Tech Conference Program
 
123
123123
123
 
Founders guild epiphany
Founders guild epiphanyFounders guild epiphany
Founders guild epiphany
 
Isurus Sales Effectiveness Analysis Overview
Isurus Sales Effectiveness Analysis OverviewIsurus Sales Effectiveness Analysis Overview
Isurus Sales Effectiveness Analysis Overview
 
Planta Poder
Planta PoderPlanta Poder
Planta Poder
 
Boozefish Campaign
Boozefish CampaignBoozefish Campaign
Boozefish Campaign
 
13353102 Putting The Fun In Functional Applying Game Mechanics To Functional ...
13353102 Putting The Fun In Functional Applying Game Mechanics To Functional ...13353102 Putting The Fun In Functional Applying Game Mechanics To Functional ...
13353102 Putting The Fun In Functional Applying Game Mechanics To Functional ...
 
An Introduction To Android
An Introduction To AndroidAn Introduction To Android
An Introduction To Android
 
Isurus Market Opportunity Analysis Overview
Isurus Market Opportunity Analysis OverviewIsurus Market Opportunity Analysis Overview
Isurus Market Opportunity Analysis Overview
 
FRE 6431s Project
FRE 6431s ProjectFRE 6431s Project
FRE 6431s Project
 
Tcom Maint Operate
Tcom Maint OperateTcom Maint Operate
Tcom Maint Operate
 
Vanessa Mae Happy Valley Violin T
Vanessa Mae Happy Valley Violin TVanessa Mae Happy Valley Violin T
Vanessa Mae Happy Valley Violin T
 
Save Your Client\'s Money With MSA
Save Your Client\'s Money With MSASave Your Client\'s Money With MSA
Save Your Client\'s Money With MSA
 

Similar to Advanced Ruby Scripting for SketchUp

2013-03-07 indie developer toolkit
2013-03-07 indie developer toolkit2013-03-07 indie developer toolkit
2013-03-07 indie developer toolkitCocoaHeads Tricity
 
LUMIA APP LAB #15: USING THE NOKIA IMAGING SDK
LUMIA APP LAB #15: USING THE NOKIA IMAGING SDKLUMIA APP LAB #15: USING THE NOKIA IMAGING SDK
LUMIA APP LAB #15: USING THE NOKIA IMAGING SDKMicrosoft Mobile Developer
 
Html5 Game Development with Canvas
Html5 Game Development with CanvasHtml5 Game Development with Canvas
Html5 Game Development with CanvasPham Huy Tung
 
Don't Over-React - just use Vue!
Don't Over-React - just use Vue!Don't Over-React - just use Vue!
Don't Over-React - just use Vue!Raymond Camden
 
DIY: Computer Vision with GWT.
DIY: Computer Vision with GWT.DIY: Computer Vision with GWT.
DIY: Computer Vision with GWT.JooinK
 
DIY- computer vision with GWT
DIY- computer vision with GWTDIY- computer vision with GWT
DIY- computer vision with GWTFrancesca Tosi
 
Hacking the Kinect with GAFFTA Day 1
Hacking the Kinect with GAFFTA Day 1Hacking the Kinect with GAFFTA Day 1
Hacking the Kinect with GAFFTA Day 1benDesigning
 
DCEU 18: App-in-a-Box with Docker Application Packages
DCEU 18: App-in-a-Box with Docker Application PackagesDCEU 18: App-in-a-Box with Docker Application Packages
DCEU 18: App-in-a-Box with Docker Application PackagesDocker, Inc.
 
How I learned to stop worrying and love embedding JavaScript
How I learned to stop worrying and love embedding JavaScriptHow I learned to stop worrying and love embedding JavaScript
How I learned to stop worrying and love embedding JavaScriptKevin Read
 
Embedding V8 in Android apps with Ejecta-V8
Embedding V8 in Android apps with Ejecta-V8Embedding V8 in Android apps with Ejecta-V8
Embedding V8 in Android apps with Ejecta-V8Kevin Read
 
Creating 3D Worlds with WebGL and Babylon.js - Codemotion.es
Creating 3D Worlds with WebGL and Babylon.js - Codemotion.esCreating 3D Worlds with WebGL and Babylon.js - Codemotion.es
Creating 3D Worlds with WebGL and Babylon.js - Codemotion.esdavrous
 
Adobe premiere pro brochure
Adobe premiere pro   brochureAdobe premiere pro   brochure
Adobe premiere pro brochureZabeel Institute
 
RICOH THETA x IoT Developers Contest : Cloud API Seminar
 RICOH THETA x IoT Developers Contest : Cloud API Seminar RICOH THETA x IoT Developers Contest : Cloud API Seminar
RICOH THETA x IoT Developers Contest : Cloud API Seminarcontest-theta360
 
HoloLens Unity Build Pipelines on Azure DevOps
HoloLens Unity Build Pipelines on Azure DevOpsHoloLens Unity Build Pipelines on Azure DevOps
HoloLens Unity Build Pipelines on Azure DevOpsSarah Sexton
 
Grails beginners workshop
Grails beginners workshopGrails beginners workshop
Grails beginners workshopJacobAae
 
Flutter vs Java Graphical User Interface Frameworks - text
Flutter vs Java Graphical User Interface Frameworks - textFlutter vs Java Graphical User Interface Frameworks - text
Flutter vs Java Graphical User Interface Frameworks - textToma Velev
 
Om Pawar MP AJP.docx
Om Pawar MP AJP.docxOm Pawar MP AJP.docx
Om Pawar MP AJP.docxOmpawar61
 
JavaScript Revolution - 5/Nov/13 - PrDC Saskatoon, SK
JavaScript Revolution - 5/Nov/13 - PrDC Saskatoon, SKJavaScript Revolution - 5/Nov/13 - PrDC Saskatoon, SK
JavaScript Revolution - 5/Nov/13 - PrDC Saskatoon, SKDavid Wesst
 

Similar to Advanced Ruby Scripting for SketchUp (20)

2013-03-07 indie developer toolkit
2013-03-07 indie developer toolkit2013-03-07 indie developer toolkit
2013-03-07 indie developer toolkit
 
Swt 2009
Swt 2009Swt 2009
Swt 2009
 
LUMIA APP LAB #15: USING THE NOKIA IMAGING SDK
LUMIA APP LAB #15: USING THE NOKIA IMAGING SDKLUMIA APP LAB #15: USING THE NOKIA IMAGING SDK
LUMIA APP LAB #15: USING THE NOKIA IMAGING SDK
 
Html5 Game Development with Canvas
Html5 Game Development with CanvasHtml5 Game Development with Canvas
Html5 Game Development with Canvas
 
Don't Over-React - just use Vue!
Don't Over-React - just use Vue!Don't Over-React - just use Vue!
Don't Over-React - just use Vue!
 
DIY: Computer Vision with GWT.
DIY: Computer Vision with GWT.DIY: Computer Vision with GWT.
DIY: Computer Vision with GWT.
 
DIY- computer vision with GWT
DIY- computer vision with GWTDIY- computer vision with GWT
DIY- computer vision with GWT
 
Hacking the Kinect with GAFFTA Day 1
Hacking the Kinect with GAFFTA Day 1Hacking the Kinect with GAFFTA Day 1
Hacking the Kinect with GAFFTA Day 1
 
DCEU 18: App-in-a-Box with Docker Application Packages
DCEU 18: App-in-a-Box with Docker Application PackagesDCEU 18: App-in-a-Box with Docker Application Packages
DCEU 18: App-in-a-Box with Docker Application Packages
 
How I learned to stop worrying and love embedding JavaScript
How I learned to stop worrying and love embedding JavaScriptHow I learned to stop worrying and love embedding JavaScript
How I learned to stop worrying and love embedding JavaScript
 
Embedding V8 in Android apps with Ejecta-V8
Embedding V8 in Android apps with Ejecta-V8Embedding V8 in Android apps with Ejecta-V8
Embedding V8 in Android apps with Ejecta-V8
 
Creating 3D Worlds with WebGL and Babylon.js - Codemotion.es
Creating 3D Worlds with WebGL and Babylon.js - Codemotion.esCreating 3D Worlds with WebGL and Babylon.js - Codemotion.es
Creating 3D Worlds with WebGL and Babylon.js - Codemotion.es
 
Adobe premiere pro brochure
Adobe premiere pro   brochureAdobe premiere pro   brochure
Adobe premiere pro brochure
 
RICOH THETA x IoT Developers Contest : Cloud API Seminar
 RICOH THETA x IoT Developers Contest : Cloud API Seminar RICOH THETA x IoT Developers Contest : Cloud API Seminar
RICOH THETA x IoT Developers Contest : Cloud API Seminar
 
HoloLens Unity Build Pipelines on Azure DevOps
HoloLens Unity Build Pipelines on Azure DevOpsHoloLens Unity Build Pipelines on Azure DevOps
HoloLens Unity Build Pipelines on Azure DevOps
 
3d web
3d web3d web
3d web
 
Grails beginners workshop
Grails beginners workshopGrails beginners workshop
Grails beginners workshop
 
Flutter vs Java Graphical User Interface Frameworks - text
Flutter vs Java Graphical User Interface Frameworks - textFlutter vs Java Graphical User Interface Frameworks - text
Flutter vs Java Graphical User Interface Frameworks - text
 
Om Pawar MP AJP.docx
Om Pawar MP AJP.docxOm Pawar MP AJP.docx
Om Pawar MP AJP.docx
 
JavaScript Revolution - 5/Nov/13 - PrDC Saskatoon, SK
JavaScript Revolution - 5/Nov/13 - PrDC Saskatoon, SKJavaScript Revolution - 5/Nov/13 - PrDC Saskatoon, SK
JavaScript Revolution - 5/Nov/13 - PrDC Saskatoon, SK
 

More from GoogleTecTalks

Web Hooks And The Programmable World Of Tomorrow
Web Hooks And The Programmable World Of TomorrowWeb Hooks And The Programmable World Of Tomorrow
Web Hooks And The Programmable World Of TomorrowGoogleTecTalks
 
Using The Google Collections Library For Java
Using The Google Collections Library For JavaUsing The Google Collections Library For Java
Using The Google Collections Library For JavaGoogleTecTalks
 
Voice Browsing And Multimodal Interaction In 2009
Voice Browsing And Multimodal Interaction In 2009Voice Browsing And Multimodal Interaction In 2009
Voice Browsing And Multimodal Interaction In 2009GoogleTecTalks
 
V Code And V Data Illustrating A New Framework For Supporting The Video Annot...
V Code And V Data Illustrating A New Framework For Supporting The Video Annot...V Code And V Data Illustrating A New Framework For Supporting The Video Annot...
V Code And V Data Illustrating A New Framework For Supporting The Video Annot...GoogleTecTalks
 
New Media Mavericks Will The Revolution Be Spidered
New Media Mavericks Will The Revolution Be SpideredNew Media Mavericks Will The Revolution Be Spidered
New Media Mavericks Will The Revolution Be SpideredGoogleTecTalks
 
Performance Improvements In Browsers
Performance Improvements In BrowsersPerformance Improvements In Browsers
Performance Improvements In BrowsersGoogleTecTalks
 
Black Cloud Patterns Toward The Future
Black Cloud Patterns Toward The FutureBlack Cloud Patterns Toward The Future
Black Cloud Patterns Toward The FutureGoogleTecTalks
 
Advanced Gadget And Ui Development Using Googles Ajax Ap Is
Advanced Gadget And Ui Development Using Googles Ajax Ap IsAdvanced Gadget And Ui Development Using Googles Ajax Ap Is
Advanced Gadget And Ui Development Using Googles Ajax Ap IsGoogleTecTalks
 
A World Beyond Ajax Accessing Googles Ap Is From Flash And Non Java Script En...
A World Beyond Ajax Accessing Googles Ap Is From Flash And Non Java Script En...A World Beyond Ajax Accessing Googles Ap Is From Flash And Non Java Script En...
A World Beyond Ajax Accessing Googles Ap Is From Flash And Non Java Script En...GoogleTecTalks
 
Keynote Client Connectivity And The Cloud
Keynote Client Connectivity And The CloudKeynote Client Connectivity And The Cloud
Keynote Client Connectivity And The CloudGoogleTecTalks
 

More from GoogleTecTalks (11)

Web Hooks And The Programmable World Of Tomorrow
Web Hooks And The Programmable World Of TomorrowWeb Hooks And The Programmable World Of Tomorrow
Web Hooks And The Programmable World Of Tomorrow
 
Using The Google Collections Library For Java
Using The Google Collections Library For JavaUsing The Google Collections Library For Java
Using The Google Collections Library For Java
 
Voice Browsing And Multimodal Interaction In 2009
Voice Browsing And Multimodal Interaction In 2009Voice Browsing And Multimodal Interaction In 2009
Voice Browsing And Multimodal Interaction In 2009
 
V Code And V Data Illustrating A New Framework For Supporting The Video Annot...
V Code And V Data Illustrating A New Framework For Supporting The Video Annot...V Code And V Data Illustrating A New Framework For Supporting The Video Annot...
V Code And V Data Illustrating A New Framework For Supporting The Video Annot...
 
New Media Mavericks Will The Revolution Be Spidered
New Media Mavericks Will The Revolution Be SpideredNew Media Mavericks Will The Revolution Be Spidered
New Media Mavericks Will The Revolution Be Spidered
 
Performance Improvements In Browsers
Performance Improvements In BrowsersPerformance Improvements In Browsers
Performance Improvements In Browsers
 
Black Cloud Patterns Toward The Future
Black Cloud Patterns Toward The FutureBlack Cloud Patterns Toward The Future
Black Cloud Patterns Toward The Future
 
Advanced Gadget And Ui Development Using Googles Ajax Ap Is
Advanced Gadget And Ui Development Using Googles Ajax Ap IsAdvanced Gadget And Ui Development Using Googles Ajax Ap Is
Advanced Gadget And Ui Development Using Googles Ajax Ap Is
 
Advanced Kml
Advanced KmlAdvanced Kml
Advanced Kml
 
A World Beyond Ajax Accessing Googles Ap Is From Flash And Non Java Script En...
A World Beyond Ajax Accessing Googles Ap Is From Flash And Non Java Script En...A World Beyond Ajax Accessing Googles Ap Is From Flash And Non Java Script En...
A World Beyond Ajax Accessing Googles Ap Is From Flash And Non Java Script En...
 
Keynote Client Connectivity And The Cloud
Keynote Client Connectivity And The CloudKeynote Client Connectivity And The Cloud
Keynote Client Connectivity And The Cloud
 

Recently uploaded

What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 

Recently uploaded (20)

What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 

Advanced Ruby Scripting for SketchUp

  • 1. Advanced Ruby Scripting for SketchUp Scott Lininger May 29, 2008
  • 2. What’s SketchUp? Google’s 3D drawing tool Used and loved by design professionals and hobbyists Easy to learn yet powerful Free and Pro versions are available On the Nerdy Side… Client application for PC & Mac Written in C++ and Objective C OpenGL for display layer Has a Ruby programming API
  • 3. How Do I Get to the API? If you have SU, you have the API You write a Ruby Script Put your script into /SketchUp 6/Plugins folder and restart SU Control SketchUp via a powerful, consistent Object model Sketchup.active_model.camera.eye.x entities[0].transform! by_some_amount edge.faces[0].material = some_color
  • 4. WebDialogs WebDialogs provide an embedded browser inside SketchUp Internet Explorer on PC Webkit/Safari on Mac
  • 5. Ruby Extension Modules Extend Ruby with native code binary (aka extension module) Better performance Better IP protection of your code
  • 6. Advanced Technique 1: Grab and Render Web Data Ruby Opens a Webdialog to some webpage The page uses AJAX or other techniques to pull data TIP: If your webpage is local, you can get data across domains JS calls a ruby method and sends down that data to SketchUp as a string Stock Grabber Demo + Footprinter
  • 7. Advanced Technique 2: Hide the Web Dialog Provides a “permanent” Javascript environment Javascript can take control at any time How to do it on the PC? my_dialog.show() my_dialog.set_position(9999,9999) On the Mac? Secret Just don’t call .show() method Demo Stock Grabber
  • 8. Advanced Technique 3: Use WebDialogs + Ruby to Control the Camera Move the camera to control user experience Export 2D screenshots to get web-friendly output from SU Demo 3D Exporter http://sketchup.google.com/download/plugins.html 3D Exporter is an open source project! Please contribute.
  • 9. Advanced Technique 4: Animate using Javascript’s setTimeout Create a timer in Javascript… timerID = setTimeout(quot;nextFrame()quot;, 500) It runs in the browser’s thread (not SketchUp’s) Quietly sends commands to Ruby to create animation. Demo Spin My Yoda
  • 10. Advanced Technique 5: Capture Key Strokes with Javascript document.onClick can capture keystrokes dialog.show_modal() can force focus to your dialog Interesting way of adding keyboard support to SketchUp Demo Nudge My Yoda
  • 11. Advanced Technique 6: Bring ‘em all together JS + Ruby Games in SketchUp Prince IO Dem The SketchUp Knight o
  • 12. Advanced Technique 7: Ruby Extension Modules Take these animation and processing techniques to the next level SketchyPhysics is a great example… numerous demos on YouTube
  • 13. Learn More Get SketchUp http://sketchup.google.com API Documentation http://code.google.com/apis/sketchup/ Join the SketchUp API Blog http://sketchupapi.blogspot.com/ Join the Ruby User Group http://groups.google.com/group/Ruby-API