Thanks Dan, although .to_mm.to_mm.to_mm looks like some kind of comedy code. I gotta say Ruby seems the most obscure, non-sensical language I have used so far.
Latest posts made by PaulG
-
RE: Return values
-
Return values
Hello,
I am confused with the output from the volume method it is called with puts(box.volume)and the output is 61.023... I am expecting it to be 100x100x100. The three test puts() in the get_data method show the correct value and the box created in the draw_box method has the correct dimensions.
Sketchup.require 'sketchup.rb' module MyModule class Box def volume return(@width * @breadth * @height) end def initialize @width = nil @breadth = nil @height = nil main() end def main get_data() draw_box() end def get_data prompts = ["Width mm", "Breadth mm", "Height mm"] defaults = ["100", "100", "100"] results = UI.inputbox(prompts, defaults, "Box Values") @width = results[0].to_i.mm @breadth = results[1].to_i.mm @height = results[2].to_i.mm puts(@width) #this outputs expected value puts(@breadth) #this outputs expected value puts(@height) #this outputs expected value end def draw_box model = Sketchup.active_model entities = model.active_entities pt1 = [0,0,0] pt2 = [0,@width,0] pt3 = [@breadth,@width,0] pt4 = [@breadth,0,0] face = entities.add_face(pt1,pt2,pt3,pt4) face.reverse! face.pushpull(@height) end end end
-
RE: Styles
Thanks for the info, most of what I want to do will be black lines on white, it was diagonal lines that wee causing me the biggest issues, especially after export to PDF and when zooming.
Looks like vectors will be the way forward for me. -
RE: Styles
I have been messing about and editing the styles and having better results, when I have finished my layout page I get better results changing the raster setting to vector, does this have any negative effects?
-
Styles
Hi,
I've seen some great looking layout drawings in various threads. But which styles are you guys using? My stuff looks all blocky and pretty horrible.
-
RE: Menus & Tools
Ok thanks, so require is basically like including a header file, so if I have 20 menuitems calling 20 different tools in my menu I will need to require 20 files, this seems like im including code I wont need if my user only uses 1 tool. Is there a more efficiant approach to this?
-
RE: Menus & Tools
Thanks for that,the require method includes code from the tool file into the menu file same as require sketchup.rb? Is there a practical limit on the number of files you can require?
-
Menus & Tools
Hi,
I have been trying to make a new tool and organize it a bit better, but I can't work out how to get it running. I have a menu rb file in the plugins file which I want to call the tool in it's own folder.
Previously I have had the tool file in the plugins folder with the menu adding code and tool in the same file and used active_model.select_tool(RNC_Files::Tool_1.new()) to get the tool running.#menu file module RNC_Files menu = UI.menu("Plugins") submenu = menu.add_submenu("RNC_Tools") submenu = add_item("Tool_1"){Sketchup.load("RNC_Tools/Tool_1.rb")} end
#tool file module RNC_Files class Tool_1 def initialize UI.messagebox("Tool_1 has been called") end end end
Hopefully you guys can point me in the right direction, maybe I'm taking the wrong approach. Any advise will be greatfully recieved.