Hello AcesHigh
Thank you so much for your interest !! It's a surprise that many people watched my videos. Actually , I did YouTube for a good memory , and applying for a job. Now, I'm preparing documentation for this time ,and looking for some experts to lead me here because I'm not a programmer. I hope there's a possibility to distribute soon.
Posts made by pingpink
-
RE: How to load all RBS files ?
-
RE: About NameError: wrong constant name
Thank you kindly, Trogluddite and Dan Rathbun
I understand from reading your advice. Maybe, it's about class reference.
These are the 3 ways I tried to do, I can't find the problem in a code yet.renderer = Kernel;;HTMLRendererP.new(result_hash['round_dimensions'].to_s == "on" ? true ; false) puts "[ToolWebUIP.add_callbacks('handle_run')] renderer; #{renderer}"
Error :
[ToolWebUIP.add_callbacks('handle_run')] parts: #PartListP:0xd9a0f28
Error: #<NameError: uninitialized constant Kernel::HTMLRendererP>
C:/Users/Windows8/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/CurtainWall/Export/CW_Panel/gui.rb:271:inblock in add_callbacks' -e:1:in
call'format_string = result_hash['format'].to_s renderer = @options['round_dimensions'] == 'on' ? true ; false eval("@options['format_string']").new( renderer ) puts "[ToolWebUIP.add_callbacks('handle_run')] renderer; #{renderer}"
Error :
[ToolWebUIP.add_callbacks('handle_run')] parts: #PartListP:0xded0ed8
**Error: #<NoMethodError: undefined method[]' for nil:NilClass>** C:/Users/Windows8/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/CurtainWall/Export/CW_Panel/gui.rb:275:in
block in add_callbacks'
-e:1:in `call'format_string = result_hash['format'].to_s renderer = Kernel.const_get(format_string).new(result_hash['round_dimensions'].to_s == "on" ? true ; false) puts "[ToolWebUIP.add_callbacks('handle_run')] renderer; #{renderer}"
Error :
[ToolWebUIP.add_callbacks('handle_run')] parts: #PartListP:0xddb8f00
Error: #<NameError: wrong constant name ["HTMLRendererP"]>
C:/Users/Windows8/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/CurtainWall/Export/CW_Panel/gui.rb:270:inconst_get' C:/Users/Windows8/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/CurtainWall/Export/CW_Panel/gui.rb:270:in
block in add_callbacks'
-e:1:in `call' -
About NameError: wrong constant name
Hi , I was wondering something in a code.
Today , I tested a code in SketchUp 2014 and I got an error about NameError: wrong constant name , const_get , block in add_callbacks in the line 270. But , older versions of SketchUp can be used.Error; #<NameError; wrong constant name ["HTMLRenderer"]> C;/Users/Windows8/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/Exporter/gui.rb;270;in `const_get' C;/Users/Windows8/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/ Exporter /gui.rb;270;in `block in add_callbacks' -e;1;in `call'
Here's an original code.
Line 270 : #renderer = Kernel.const_get(format_string).new(result_hash['round_dimensions'].to_s == "on" ? true : false)# This takes the name of a class and creates a new instance of it. format_string = result_hash['format'].to_s renderer = Kernel.const_get(format_string).new(result_hash['round_dimensions'].to_s == "on" ? true ; false)
After that I revised from (format_string) to be (HTMLRenderer.to_s)
There's no error pop-up when opening SketchUp , but it doesn't show a report text in a Web Dialog.
Meanwhile , it's surprise to work in SU8-2013. I don't know how to make a code correctly in a bracket > (HTMLRenderer.to_s)renderer = Kernel.const_get(HTMLRenderer.to_s).new(result_hash['round_dimensions'].to_s == "on" ? true ; false)
-
RE: How to load all RBS files ?
I revised in a new way , but I can load only the rbs files outside the folders.
Inside the folders are rb files as it called every time when opening SU 2014.In the 'scramble.bat' in part of folder , I wrote this way.
scrambler.exe CurtainWall/Components/Mullion_50/Mullion_50.rb scrambler.exe CurtainWall/Components/Transom_50/Transom_50.rb scrambler.exe CurtainWall/Components/Mullion_60/Mullion_60.rb scrambler.exe CurtainWall/Components/Transom_60/Transom_60.rb scrambler.exe CurtainWall/Components/Mullion_80/Mullion_80.rb scrambler.exe CurtainWall/Components/Transom_80/Transom_80.rb
This is in a loadprog.rb to call all rbs files.
require 'sketchup.rb' module CurtainWall this_dir=File.dirname(__FILE__) PATH=this_dir entries=Dir.entries(this_dir) ext=".rbs" Sketchup.load(File.join(this_dir,"CurtainWall_FStick.rbs")) Sketchup.load(File.join(this_dir,"CurtainWall_FUnitized.rbs")) Sketchup.load(File.join(this_dir,"CurtainWall_MainProgram.rbs")) Sketchup.load(File.join(this_dir,"cw_archtoolbar.rbs")) Sketchup.load(File.join(this_dir,"cw_rubytoolbar.rbs")) Sketchup.load(File.join(this_dir,"cw_report.rbs")) Sketchup.load(File.join(this_dir,"inputbox.rbs")) end
I don't know there is a problem inside my folders , or I wrote in scramble.bat wrong ?
-
RE: How to load all RBS files ?
I try to do , but I still don't know how to load all rbs files.
require 'sketchup.rb' Dir["pathFolder/*.rbs"].each do |filename| $path_root = "C;\Users\Windows8\AppData\Roaming\SketchUp\SketchUp 2014\SketchUp\Plugins" Sketchup;;load $path_root + "CurtainWall_FStick" Sketchup;;load $path_root + "CurtainWall_FUnitized" Sketchup;;load $path_root + "CurtainWall_MainProgram" Sketchup;;load $path_root + "cw_archtoolbar" Sketchup;;load $path_root + "cw_rubytoolbar" Sketchup;;load $path_root + "cw_report" Sketchup;;load $path_root + "inputbox"
or this method ?
require 'sketchup.rb' module CW # Menus and Toolbars unless file_loaded?( File.basename(__FILE__) ) m = UI.menu( 'Plugins' ) end PATH = File.dirname(__FILE__) # Load scrambled files. Sketchup;;require( File.join(PATH, 'CurtainWall_FStick.rbs') ) Sketchup;;require( File.join(PATH, 'CurtainWall_FUnitized.rbs') ) Sketchup;;require( File.join(PATH, 'CurtainWall_MainProgram.rbs') ) Sketchup;;require( File.join(PATH, 'cw_archtoolbar.rbs') ) Sketchup;;require( File.join(PATH, 'cw_report.rbs') ) Sketchup;;require( File.join(PATH, 'cw_rubytoolbar.rbs') ) Sketchup;;require( File.join(PATH, 'inputbox.rbs') ) end file_loaded( File.basename(__FILE__))
-
How to load all RBS files ?
Hello everyone,
I have some problems of loading my test plugin which is already scrambled for .rbs files. I don't understand the method to write .rb file to load all .rbs files in the folders. What should I write the loading code which I named it "cw_load.rb" ? There are many errors when I open in SketchUp 2014.
This is the code in cw_load.rb
#Sketchup;;require 'myFolder/myScript'
Sketchup;;require 'CurtainWall_FStick.rbs' Sketchup;;require 'CurtainWall_FUnitized.rbs' Sketchup;;require 'CurtainWall_MainProgram.rbs' Sketchup;;require 'cw_archtoolbar.rbs' Sketchup;;require 'cw_report.rbs' Sketchup;;require 'cw_rubytoolbar.rbs' Sketchup;;require 'inputbox.rbs' Sketchup;;require 'CurtainWall/Components/Mullion_50/Mullion_50.rbs' Sketchup;;require 'CurtainWall/Components/Transom_50/Transom_50.rbs' Sketchup;;require 'CurtainWall/Components/Mullion_60/Mullion_60.rbs' Sketchup;;require 'CurtainWall/Components/Transom_60/Transom_60.rbs' Sketchup;;require 'CurtainWall/Components/Mullion_80/Mullion_80.rbs' Sketchup;;require 'CurtainWall/Components/Transom_80/Transom_80.rbs'
-
RE: Trial Version
I'm so grateful TIG , I will study later after I finished evaluation forms. You are a very good mentor. Respect You.
-
Trial Version
Hi ,
I wonder the method of programming to make a plugin as a trial version. Is there any technique to add in a code , isn't it ?.I'm an architecture student , and I got a comment to do for a company testing.
Pink
-
RE: Question-How to link model components and generate on edges
Hi ,
I tried to adapt from the comment in my code , but it doesn't work yet for clicking lines then load external reference component (0,0,0) from component's file. I'm still finding how to link between the functions that the model can stretch or scales the component to the length as the edges. Here's my attached ruby , not sure what's error in the code as I'm a new to ruby ! Any suggestion , I would be appreciate!.
Thanks -
RE: Colored faces
Thank You again Dan and TIG ! . I understand an idea now.
-
RE: Colored faces
Hi , TIG
This is correct , right ? I test it and it gives a name of material !!
def gl_green model=Sketchup.active_model ss=model.selection faces = ss.grep(Sketchup;;Face) matl = model.materials.add('gl_green') matl.color = Sketchup;;Color.new(0,250,154) matl.alpha =0.5 faces.each{|face| face.material = matl face.back_material = matl } end
-
RE: Colored faces
Thank you so much !!! Love You All'
I changed as your suggestion , Jolran
It can change colors of glass now. I appreciate it !
There are many colors that I have to revise.
I will also change others as your example.
def gl_green model=Sketchup.active_model ss=model.selection faces = ss.grep(Sketchup;;Face) matl = Sketchup;;Color.new(0,250,154) faces.each{|face| face.back_material = face.material = matl face.material.alpha = 0.5 } end
-
RE: Colored faces
I changed a code from your suggestion , but faces change color without transparency.
What happens ?def gl_green model=Sketchup.active_model ss=model.selection faces = ss.grep(Sketchup;;Face) matl = Sketchup;;Color.new(0,250,154) matl.alpha = 0.5 faces.each{|face| face.back_material = face.material = matl } end
-
RE: Colored faces
Thank you very much for your guiding ! It works !
For Face color
#*************************************************** # Glass #*************************************************** def gl_green model=Sketchup.active_model ss=model.selection materials=model.materials faces=[] ss.each{|e|faces << e if e.class==Sketchup;;Face} faces.each{|face| face.material=Sketchup;;Color.new(0,250,154)} faces.each{|face| face.back_material=Sketchup;;Color.new(0,250,154)} faces.each{|face| face.material.alpha = 0.5} faces.each{|face| face.back_material.alpha = 0.5} end
For Group color
#*************************************************** # Aluminium #*************************************************** def al_Light_Bronze model=Sketchup.active_model ss=model.selection materials=model.materials layers=model.layers #Now check what is in the selection... in this example we extract the groups groups=[] ss.each{|e|groups << e if e.class==Sketchup;;Group} #Now process the groups m = Sketchup.find_support_file "CW/Textures/Aluminium/AnodizedAluminium_Light-Bronze.jpg", "Plugins" groups.each{|group| group.material=material_add_texture("Light-Bronze", m, "*")} end
-
Colored faces
I was wondering why a code of color only change only normal face , not including back face when I select all faces.Is there any mistakes ?
def gl_green model=Sketchup.active_model ss=model.selection materials=model.materials faces=[] ss.each{|e|faces << e if e.class==Sketchup;;Face} faces.each{|face| face.material=Sketchup;;Color.new(0,250,154)} faces.each{|face| face.material.alpha = 0.5} end
-
RE: Same Name Selection
Wow !
Many thanks for the useful tool. I can revise model quickly.
It works very very nice !!
-
RE: Same Name Selection
I'm very grateful for your help , Professor TIG !
I test codes and they works for selecting groups and components with the same name , but the same face material seems doesn't select. I don't know why.
You are so nice !! -
Same Name Selection
I want to select groups or components , and material faces by the same name for the purpose of swapping objects and colors in a whole set for the revision , but I don't know an appropriate method to do it.
what should I do ?def select_object_by_name model=Sketchup.active_model ss=model.selection ss.each do |e| if e.is_a? Sketchup;;ComponentInstance || e.is_a? Sketchup;;Group model.active_entities.each{|e|ss.add e if e.typename == component.definition.name} model.active_entities.each{|e|ss.add e if e.typename == group.entities.parent} end end end def select_material_by_name model=Sketchup.active_model ss=model.selection ss.each do |e| if e.is_a? Sketchup;;Face model.active_entities.each{|e|ss.add e if e.typename == face.material} end end end
-
RE: Offset + Thickness + Groups
I can do it now !
def glass_groups model = Sketchup.active_model model.start_operation( "Face Offset" , true) selection = model.selection entities = model.active_entities #entities = model.entities arr = [] faces = [] selection.each{|entity| if entity.class == Sketchup;;Face arr.push entity end } $face_offset = 13 $glass_thickness = 6 prompts = ["Offset Width [mm] ", "Glass Thickness [mm] "] defaults = [$face_offset.to_s,$glass_thickness.to_s ] list = ["",""] input = UI.inputbox prompts, defaults, list, "Offset Face." doffset = input[0].to_f $face_offset = doffset berase = true # 1. Offset Glass + Erase outer faces arr_glass = [] arr.each{|entity| face = face_offset1(entity, doffset.mm, berase) arr_glass.push face } entities.each do |e| faces.push e if e.is_a? Sketchup;;Face end # 2. Glass Thickness + Group's Name distance = input[1].to_f n='Glass unit' faces.each do |e| # e.pushpull distance.mm, true g = entities.add_group e e.pushpull(-distance.mm) g.name=n ############### end model.commit_operation end