I would like you to recommend me which documents are the best to read about how to make a plugin? And can you also recommend me any YouTuber who made tutorials on how to make a plugin for SketchUp?
I have tried youtube and I watched the tutorial on how to make a plugin for a Sketchup 2014, but it seems to be outdated because I made a simple plugin and I am having trouble with a line that is not working properly as it should be. I thought it must be because the year is 2014… but I do not have any issue with other lines at the beginning. So the line I am having issue is where I named the operation “example”, then the next line is “def example”
that should give you an idea what are the issue. I’m currently using Sketchup Make 2017
I would appreciate your advice and helping with my education.
See the description under the backtrace() method of how to read the error messages how they tell the file, the line number and the method where an exception occurred.
In the class description, has links to all it’s subclasses doc pages.
Kernel module is mixed into Object, so it is the ancestor of everything !
It’s methods become global methods and need not be called with qualification:
It is one of the best and most complete Ruby references.
There are older online editions you can read to decide if you want to buy the most updated edition.
Thank you. I have been doing some studying. It’s going pretty well with trial and errors. But I am having trouble with finding the right code line that would allow me to specify a target in the SketchUp that I would want to remove or change. Is there a good document or somewhere. I have been looking for that information to get the correct information.
There are two ways to get references to specific entities. You can either use selection or you could implement a tool that lets users click entities themselves. The former is by far the easiest.
what I mean is that I don’t have to select the specific entity every time I started up a new project and have it removed. This is an automatic method. It’s a very simple method that I can learn from making my own plugin.
the specific target is “Chris”, it’s a dynamic model/entity. I wanted to remove it every time I started a new project using the program. But the problem is I am not sure how to target that entity that it has an ID or other information that should be the exact same thing every time I started a new project. That’s the ideal for an automatic method, but my hobby is that I make an model of any vehicles.
the simple plugin is where I would remove that “Chris” and automatically put up a rectangle so I can place the blueprint on that rectangle. without having to do the selection in manually way. This is a good way for me to learn how to programming. where I would learn how to do the basic functions such as removing, adding, or others
You can just use a template with no scale figure if you don’t want to have a scale figure.
If you really want to achieve this through scripting you could use the PID (persistent ID) of that component instance to target it. To get the PID in the first place you can use Sketchup.active_model.selection.first.persistent_id. Then you should be able to use Model#find_entity_by_persistent_id to retrieve a reference to the same entity later.
okay. Can you give me a good example of how would you build lines of function with the information you’ve provided? Please keep this in mind, I am a beginner, so thank in advances.
I agree with @eneroth3. I am not clear why you want to do this via code when the easier way is if you don’t want something in the model, don’t put it there in the first place. By that I mean open a new blank file, erase Chris, and then save as template default. From then on you won’t have him there and won’t need to remove him.