Have a look at the following links:
It could spell the end of SketchUp & Ruby. Would it not be nice to simply quickly make your own 3d kit bashing stuff without relying on antiquated Ruby Add-ons
Have a look at the following links:
It could spell the end of SketchUp & Ruby. Would it not be nice to simply quickly make your own 3d kit bashing stuff without relying on antiquated Ruby Add-ons
Yikes! I should have been more descriptive.
I'm trying provide a color to the faces of those 4 circles.
the following code draws 4 circles:
mod = Sketchup.active_model
ents = mod.active_entities
sel = mod.selection
face = sel.grep(Sketchup;;Face)[0]
locations=[@pt1,@pt2,@pt3,@pt4]
locations.each{|loc| @pt1=loc
ents.add_circle(@pt1, @vec3, @dia, 24)
What code do I need to apply a single color to each circle?
I'm looking at http://ruby.sketchup.com/Sketchup/Color.html for inspiration,
but I'm not able to make the code work!
color=Sketchup;;Color.new(163,204,204)
TIA!
Here is the bottom line in the .ZIP to .RBZ saga
My current version of Winrar 5.31 (64-bit) ....failed to faithfully do a proper .zip conversion.
TIG informed me how one script I sent him was able to be installed while the other was not.
How is this possible?
That lead me to investigate what had happens to WinRar, which I have used for .rar .zip and password protect files since the early 2000's
I attached one of my very old XP HDD's via a none sata to usb connection to my PC. And there it was, an old copy of Winrar 3.71
I admit I'm a so learner, this is not the first time I have regretted getting on that bloody upgrade treadmill. I can hardly wait for SU 2018
@tig said:
Rather than send me the ZIP can you send me the equivalent RBZ so that I can test it too...
Obviously use PM, to avoid publishing it unduly...
I will do that, and then in return you can send me a new .rbz file you made for me to try.
(urgent issue to attend to... I will do this next hr.)
thanks for the clarification!
I sent the same file yesterday to my Client who purchased this particular plugin
and who also informed me about the SU 2016 issue. I just got his response
For the benefit to other members reading this thread.
to quote TIG: "As to why there are some issues with some of your ZIP/RBZ files is a mystery..."
Coincidentally SU 2016 Extension Manager also fails to install all of the other for purchase ruby scripts. This situation came to light when one of my Clients informed me that my scripts do not work in SU 2016. That's the reason I started this thread.
I also warned clients not to use my scripts for SU 2016 on my blog.
Manual installation, without the use of Extension Manager in SU 2015 ....works!
Hence loading the file in the Ruby Console also ....works!
Manual installation, without the use of Extension Manager in SU 2016 .....fails!
Hence loading the file in the Ruby Console also ....fails!
So now you have the problem you can no longer write or edit an .rb files the way you did with past version of SU 2015 and earlier.
If you still have SU 2015 installed, stay with that version, and you wont have any install problems.
If you are really serious about running another copy or another version of SU, without it interfering with the registry then you should consider virtualization a version of your SU software.
https://my.vmware.com/web/vmware/downloads
Example: I'm currently using SU 2015 as my main workhorse for daily work. Having found out that SU 2016 wont run many of my Ruby scripts. I created a virtual copy of SU 2016, also known as a Portable version, using vmware.
Warning: this process should not be attempted without a good understanding of Windows and what virtualization is.
Here is a short description of how I make a portable copy.
Now I can run a portable version of SketchUp from my USB3 HDD or move that Portable to any other HDD
If you are competent in using vmware you can make versions that allow you to add addons scripts to your portable version, this is very important.
good luck!
@TIG: you said something to the effect that amain.rb, can now only communicate with any additional files (such as Icons) if found in a same named folder. If my above interpretation is correct, is that why the next 5 steps work, using the SketchUp Extension Manager in SU 2016?
Hence:
Is this the only rabbit hole I should be avoiding?
@Dan please look at the attached pic, do you see the end result?
@Dan If you have ever written a script, which used to work prior to 2016 you will find that the extension policy set to Unrestricted does nothing to help with the installation process.
You wasted far to much time nit picking my words hence taking them out of the overall context.
Highly condensed, your last sentence was all that was needed,....maybe!
Additionally, I never signed up for the sketchUcation PluginStore
My name only appears on the list of Authors because I provided some scripts to the sketchUcation forum.
My scripts were also changed by others to make them conform to .rbz installation. I had nothing to do with that.
I have not been able to figure out why my scripts, are no longer able to be read by SketchUp 2016? My scripts don't follow the .RBZ format which is simply a rename of a .ZIP or .RAR file extension
previously a simple How to Text file, was all that was needed to install a plugin.
C:/Users/USERNAME/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins
Works!
C:/Users/USERNAME/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins
Does not Work!
Some Background:
AutoCad 2.5 came on 6 x 3.5" 2.44 diskettes. Something most users here will have to Google first to see what a 2.44 diskette looked like. The reason I mention this, AutoDesk never cut off any of its users from any version they provided year after year. The main reason any program or OS becomes voluminous after a while is because software programmers in general do not wish to alienate their existing user base.
Hence I find it a bit heavy handed that a small group here, without the benefit of such history, keep making trivial changes that in reality don't benefit all past and present SketchUp users.
@Kass: I don't use Web dialogs, I have refused to learn 2 more languages to implement Web dialogs. From the day someone thought they were a bad idea, I decided not to go down that road. Web dialogs are dead... RIP!
I'm also still motivated to make my own Ruby scripts for my daily tasks. I have many of them. But I will NO longer share them with the SketchUp community for fear they wont meet some [highlight=#ff8000:1o0czok1]Trivial=Trimble[/highlight:1o0czok1] standard now or in the future.
The whole idea of sharing at this forum has been replaced by a few bad apples here, that thought they had a better idea of how to implement Ruby installation using Ruby, and in the process also thought it was a good idea to create 1st class and 2nd class Forum users..... shame on you!
@ArcTeo: Today I checked D. Bur web site: http://rhin.crai.archi.fr/rld/author_details.php?id=27 It contains several of my free scripts:
I also never ask for a donation... silly me
I suspect neither of them will work in 2016 & 1017, I still use 2015 on a daily basis
I have been told they wont work in 2016 & 1017 because they are not in .rbz format.
You may not be aware, but every .rbz file is simply a .zip or .rar file.
Placing the files in the required dirs. was really never a problem. I never had one complaint, from customers, not being able to read my instructions. The changes are in the Extra Ruby code required for the .rbz installation process that puts the script and icons in the correct dirs. Here is an example:
http://sketchucation.com/forums/viewtopic.php?p=347912#p347912
Where TIG ended up fixing my non Extension Friendly script....(thanks TIG)
Maybe its time to re-examine where Ruby is heading?
Does Ruby have a future going forward in SketchUp
Here is my really check on whats been happening with scripting: The following are Programs that have moved on. Houdini, Rhino/Grasshooper, Blender to name a few, or game engines like Unity, CryEngine, Unreal. All use node based VB.net Python or C# components that make it easier for any user, not just programmers, to communicate with the main program. As far as I'm concerned, I see learning more about Ruby as relevant as learning more about AutoLisp, which I also wasted many years learning, except for one very important fact AutoLisp was simpler to learn. It had a compact set of subroutines, and it was by design a 3D Math based math language, the same cannot be said about the SketchUp Ruby API. Another even simpler scripting interface is GDL. GDL as a Basic like Language interface which communicates with ArchiCad.
I hope someone is listening otherwise all of this is a waste of time.
I'm actually becoming less and less and less motivated with each new release of SketchUp.
What once used to work, now no long does. Particularly since 2016and now 2017.
I really don't have the time, nor do I care care to upgrade my Ruby scripts to the latest and greatest [highlight=#ff8000:400kq15r]Trimble Tweeks[/highlight:400kq15r]! .........
Thanks for your quick response TIG.
I recall having trouble distinguishing between edges and lines in the past, Its not something one always remembers. May I suggest adding a second example to the API for others looking for clarification
....again Thanks!
I hope inconsistencies in the API are still being corrected!
I'm following the included example.
http://ruby.sketchup.com/Sketchup/Face.html#followme-instance_method
However Followme does not seem to like to turn 90 degree corners see the attached pic and code.
group=entities.add_group
entities=group.entities
#...1 followme profile
face=entities.add_face @pt
#...2 primary section profile used by follow-me
line = entities.add_line(@ptT, @ptX, @ptY, @ptZ) #line color RED
face=face.followme(line)
followme draws from @ptT, @ptX them ignores @ptY, @ptZ to finish wrapping around the remaining 2 lines ?
@unknownuser said:
I have no idea how you determine what @ptw1616 is but another option might be creating an array of the locations like this
All the points are per-determined in my script. They relate to the user selected area.
Various combination of points make a pattern of lights the user can choose from in the Light Array Type Dialog Box.
Your understanding of Ruby has helped me tremendously. Furthermore I did not realize the importance of the last "}" .....which I originally thought might have been a typo........ Yikes!!!
@unknownuser said:
The last pic I posted above shows the code snippet
- Cuts a single hole for a recessed light
- Draws the recessed light
- At 3d point location @ptw1616
The other 3 recessed lights require either the same repeating code with a different 3d point location, Or as sdmitch suggested a method that passes the variables to it. It appears to me that there is only 1-3d point variable that needs to be passed on to this new method? I don't know now what if any of the code I currently have, will still be relevant, or how and where this new method will fit into the remainder to my script.
I hope this is somewhat less vague!
# Draw Circle on selected ceiling geometry - Cut Hole
> mod = Sketchup.active_model
> ents = mod.active_entities
> sel = mod.selection
> face = sel.grep(Sketchup;;Face)[0]
> ents.add_circle(@ptw1616, @vec3, @Ldia, 24)
> sel.clear
> sel.add(ents.to_a.last)
> sel[0].erase!
>
> # Draw Recessed Light
> tube = entities.add_group
> tube_inner = tube.entities.add_circle(@ptw1616, @vec3, @Ldia-@Lthick , 24)
> tube_outer = tube.entities.add_circle(@ptw1616, @vec3, @Ldia , 24)
> cross_section_face = tube.entities.add_face tube_outer
> inner_face = tube.entities.add_face tube_inner
> tube.entities.erase_entities inner_face
> cross_section_face.pushpull -@Ldepth, false
mod = Sketchup.active_model
ents = mod.active_entities
sel = mod.selection
face = sel.grep(Sketchup;;Face)[0]
ents.add_circle(@ptw1616, @vec3, @Ldia, 24)
sel.clear
sel.add(ents.to_a.last)
sel[0].erase!
# Draw Recessed Light
tube = entities.add_group
tube_inner = tube.entities.add_circle(@ptw1616, @vec3, @Ldia-@Lthick , 24)
tube_outer = tube.entities.add_circle(@ptw1616, @vec3, @Ldia , 24)
cross_section_face = tube.entities.add_face tube_outer
inner_face = tube.entities.add_face tube_inner
tube.entities.erase_entities inner_face
cross_section_face.pushpull -@Ldepth, false [/code:35jvptxs]
@sdmitch said:
Put the repeated code in its own method and pass the variables to it.
Thanks! I'm aware of "making my own method" and it has not escaped me from looking at your scripts, regardless I have never been able to get any of my attempts to work ... hence I gave up! What would be really great if some You tube videos existed that use the Ruby Sketchup API, demonstrating the process and pitfalls .....just thinking out loud!
@dan rathbun said:
Do not ever use global variables for plugin variables!
Never mind that examples use them. That doesn't make it okay.
I use global variables only during script development.When I do the math that locates points, I use the Ruby Console to varify that I have made no mistake in point location, this comes in very handy when one has been coding for 8 hours, lots of typing mistakes can creep in when you one gets older
Thanks!!