Giter VIP home page Giter VIP logo

sketchup-ruby-api-tutorials's Introduction

Getting Started & Tutorials

Example Extensions

We often find that we need a level of training that goes well beyond the basics, but is more informative than just reading the API documentation. Look no further! Check out our Example Extensions section for examples of fully functioning SketchUp Extensions, complete with comments and helpful hints.

How Do I Use These Tutorials?

Hopefully you can use these examples however you want. The Example code is available 3 different ways. You can:

  1. Read the Example Extensions tutorials on the SketchUp Developer website. Read through the step by step tutorial of the code and comments and try to follow along by building the same extension yourself. Use these examples to help learn better SketchUp API usage.
  2. Fork the fully commented examples from Github. Get the code right on your machine, with all the comments for easy access. Use it as a quick reference to comments, code snippets, etc.
  3. Fork the non-commented version from Github. This is handy for people who just want to look at the code quickly and move on. You can copy and paste chunks of code easily from the non-commented samples without the verbose comments getting in the way.

Depending what you are trying to achieve, there is a method to get there easily. Just get all the code at once, and pull out what you need. Or follow along line by line, tutorial style. The end goal is for everyone to gain access to solid code examples that help improve their SketchUp extensions.

Loading Directly from the Repository

If you clone this repository to your computer you can load the files directly from where you cloned them using a proxy loading script:

# Create a file in your Plugins folder with these lines:
$LOAD_PATH << 'some\path\to\sketchup-ruby-api-tutorials'
require 'load_tutorials.rb'

That snippet will take care of loading the examples and tutorials.

If you have examples of your own that you think might be useful open a Pull Request. Follow the pattern of the existing examples.

You can use Examples.reload while you work to reload all the files.

Development Guides

Also make sure to check out the Wiki section for guides on how to setup your project for extension development, IDE setup and more.

sketchup-ruby-api-tutorials's People

Contributors

d-meiser avatar eneroth3 avatar prescod avatar thomthom avatar timlanier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sketchup-ruby-api-tutorials's Issues

General cleanup

This is a quite old repo and there seems to be a lot of things we could look over in a general clean up. Here are a few points.

  • Consider merging tutorials and examples so we don't repeat ourselves and have two code bases to maintain.
  • Clarify what would map to an actual extension project. For instance, write a comment in the loader script telling it is a utility and not a part of the actual extensions. Getting this overview can be very difficult for new coders.
  • Consider wrapping the source for each extension in a src folder. I think rubocop-sketchup assumes such a folder, and it's a good practice to separate your source from "project meta" files like readme.
  • Clarify "tut" and "ex" prefix in file names. Prefer fully spelled out "tutorial" and "example".
  • Style Ruby for readability (after we've come up with a good RuboCop config).
  • Change Trimble Navigation to Trimble Inc in copyright notices.
  • Prefer inline Ruby load guard using instance variables over sketchup.rb methods.
  • Consider changing 99 to some other number for examples.

Hello Cube tutorial internally inconsistent on dev site

If you copy paste (which some people will definitely do instead of going to the GH repo) the two code samples from:

and infer file paths to create from the text on those pages, you end up with

  • tut_hello_cube.rb
  • tut_hello_cube/main.rb

That meshes poorly with line 8 in the loader script there, which references the directory ex_hello_cube:

ex = SketchupExtension.new('Hello Cube', 'ex_hello_cube/main')

Presumably this is related to #2, but seems more immediately problematic because the live example is broken as written.

task.json issue for vs code

Hi, I've tried to set task.json as below, but it doesn't work.
{ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", "tasks": [ { "label": "Debug SketchUp 2019", "type": "shell", "command": "open -a '/Applications/SketchUp 2019/SketchUp.app' --args -rdebug 'ide port=7000'", "windows": { "command": "&'C:/Program Files/SketchUp/SketchUp 2019/SketchUp.exe' -rdebug 'ide port=7000'" } } ] }

The TERMINAL prompts the error:
`Executing task: &'C:/Program Files/SketchUp/SketchUp 2019/SketchUp.exe' -rdebug 'ide port=7000' <

& was unexpected at this time.
The terminal process terminated with exit code: 1`

I remove the '&' or change the '/' to '\'๏ผŒ still not make any sense.
I really need your help!

empty group entity becomes deleted entity after pushpull a face

hello, sketchup.

I sometimes use sketchup ruby api.

When I tried to access an empty group after pushpull a face in active_model.active_entities, I couldn't access the group because it already has deleted. Sketchup::Face.pushpull method only deletes empty groups in active_model.active_entities.

I can use non-empty-group to avoid this issue, but I just want to know the reason why pushpull destroys empty groups.

thank you.

RubyMine project Setup for plugins outside of Sketchup Folder

Hi,

I tried to setup a RubyMine project based on the wiki which was nicely explaining everything step by step, but I wasn't able to actually load the sketchup script I made. It took me a while to get that Sketchup wouldn't load my script because it was outside of the plugin directory.

As the example in the wiki actually point to the folder "C:\Users\tthomas2\SourceTree\testup-2" (as seen here), I was thinking that RubyMine was telling Sketchup a way or another to load my plugin.

Then I found this page explaining that I need a rb file inside of my plugin folder that adds my plugin folder to the $LOAD_PATH.

Anyway, I feel like this should be part of the wiki for the next person to wonder here to know about that.

Initial license get during load

At the bottom of the Licenseing tutorial module ...
"master/examples/99_license/ex_hello_license/main.rb"

    # Fetching a license here so that it will be checked by SketchUp during
    # startup. This will include the extension in the dialog that warns about
    # missing licenses.
    ext_id = '6cce9800-40b0-4dd9-9671-8d55a05ae1e8'
    ext_lic = Sketchup::Licensing.get_extension_license(ext_id)

This is a bit contradictory to the text in the self.create_cube method.

How about wrapping it within an init method ?

    def self.init
      # Fetching a license here so that it will be checked by SketchUp during
      # startup. This will include the extension in the dialog that warns about
      # missing licenses.
      ext_id = '6cce9800-40b0-4dd9-9671-8d55a05ae1e8'
      ext_lic = Sketchup::Licensing.get_extension_license(ext_id)
    end

    self.init()

... or don't assign the results to local variables?

    Sketchup::Licensing.get_extension_license(
      '6cce9800-40b0-4dd9-9671-8d55a05ae1e8'
    )

?

README last sentence is confusing

Last line,

If you are working on you own examples you want to contribute back via a Pull Request you can use Examples.reload while you work to reload all the files.

is confusing, seems to have two different ideas fighting for control, and should likely be separated into two sentences, ie:

If you are working on **your** own examples, you can use `Examples.reload` while you work, to reload all the files.

If you wish to contribute some tutorials back to the project via a Pull Request, [ this sentence needs finishing or editing ] !!

how to write a sketchup plugin?

help! !
if there is somebody can tell me how to make a sketchup plugin, I wanna enhance the function of sketchup, especially on exporting behavior.
thanks and all !!!

VSCode task.json - & was unexpected at this time.

Hi,

There maybe a simple fix for this but as far as I can tell I followed the instructions here for setting the VSCode environment up for debugging ruby extensions for Sketchup 2016 to the letter.

However with Sketchup closed, when I choose [Tasks -> Run Tasks -> Debug Sketchup 2016] I get the following message in the Terminal:

Executing task: &'C:/Program Files/SketchUp/SketchUp 2016/SketchUp.exe' -rdebug 'ide port=7000' <

& was unexpected at this time.
The terminal process terminated with exit code: 1

It seems to be complaining about the & in front of the filepath, but if i remove it just complains about the C:

Can anyone assist with this?

Thanks
Alex

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.