[Plugin] Make Fur v.2.1.0(20140323)
-
@frederik said:
...Only in UK in Europe (and I believe on Cypres too) they drive in the left side...
And Ireland, too.
-
Countries that drive on the left
Quite a few.
-
-
Yeah. Though already a minority of the countries, still "the sun never sets over the countries that drive on the left".
-
@unknownuser said:
This code only checks for FR Sketchup locale.
And when French user uses directly FR Locale "." (modified) whith English SU version seems there is no problem?
-
Hi, All.
I update this to v1.3e.
Thomas,Thank you very very much!
At last, I also understood.
I use your code "decimal_sep = 1.2.to_l.to_s.match(/\d(\D)\d/)[1]".
and model.options["UnitsOptions"]["LengthUnit"] >= 2 then unit is metric.
It not depend to Sketchup locale.I think that this is perhaps no problem.
please reply when there is a problem.Thanks
-
@tak2hata said:
I use your code "decimal_sep = 1.2.to_l.to_s.match(/\d(\D)\d/)[1]".
and model.options["UnitsOptions"]["LengthUnit"] >= 2 then unit is metric.
It not depend to Sketchup locale.I think that this is perhaps no problem.
please reply when there is a problem.I think that should work.
-
Oh - you posted update already! I see. I'll try it out then.
-
1.3e not working for me.
Error: #<NoMethodError: undefined method
[]' for nil:NilClass>
C:/Program Files (x86)/Google/Google SketchUp 7/Plugins/fur_en.rb:734:infur_dialog_ini' C:/Program Files (x86)/Google/Google SketchUp 7/Plugins/fur_en.rb:741:in
fur_webdialog'
C:/Program Files (x86)/Google/Google SketchUp 7/Plugins/fur_en.rb:1414
C:/Program Files (x86)/Google/Google SketchUp 7/Plugins/fur_en.rb:1413:incall'
-
With 1.3e I get
Error: #<TypeError: no implicit conversion to float from nil> C:/Program Files/Google/Google SketchUp 7/Plugins/fur_en.rb:1326:in
initialize'
C:/Program Files/Google/Google SketchUp 7/Plugins/fur_en.rb:1326:innew' C:/Program Files/Google/Google SketchUp 7/Plugins/fur_en.rb:1326:in
s_to_vec'
C:/Program Files/Google/Google SketchUp 7/Plugins/fur_en.rb:713:inshow_webdialog' C:/Program Files/Google/Google SketchUp 7/Plugins/fur_en.rb:658:in
call'`
with the 'web-dialog' accept button.
You must be passing an empty argument to a defn ? -
@thomthom said:
1.3e not working for me.
Error: #<NoMethodError: undefined method
[]' for nil:NilClass>
C:/Program Files (x86)/Google/Google SketchUp 7/Plugins/fur_en.rb:734:infur_dialog_ini' C:/Program Files (x86)/Google/Google SketchUp 7/Plugins/fur_en.rb:741:in
fur_webdialog'
C:/Program Files (x86)/Google/Google SketchUp 7/Plugins/fur_en.rb:1414
C:/Program Files (x86)/Google/Google SketchUp 7/Plugins/fur_en.rb:1413:incall'
I think this is LengthFormat or LengthPrecision problem.
So I will change code..def fur_dialog_ini unitoptions = Hash.new Sketchup.active_model.options["UnitsOptions"].each{|key ,val| unitoptions[key] = val } Sketchup.active_model.options["UnitsOptions"]["LengthFormat"] = 0 if unitoptions["LengthFormat"] != 0 Sketchup.active_model.options["UnitsOptions"]["LengthPrecision"] = 1 if unitoptions["LengthPrecision"] == 0 @fur_units_metric = false lunit = unitoptions["LengthUnit"] @fur_units_metric = true if lunit >= 2 lprec = Sketchup.active_model.options["UnitsOptions"]["LengthPrecision"] @decimal_sep = 1.2.to_l.to_s.match(/\d(\D)\d/)[1] @delim = "," @delim = ";" if @decimal_sep == ',' unitoptions.each{|key ,val| Sketchup.active_model.options["UnitsOptions"][key] = val } end
@tig said:
With 1.3e I get
Error: #<TypeError: no implicit conversion to float from nil> C:/Program Files/Google/Google SketchUp 7/Plugins/fur_en.rb:1326:in
initialize'
C:/Program Files/Google/Google SketchUp 7/Plugins/fur_en.rb:1326:innew' C:/Program Files/Google/Google SketchUp 7/Plugins/fur_en.rb:1326:in
s_to_vec'
C:/Program Files/Google/Google SketchUp 7/Plugins/fur_en.rb:713:inshow_webdialog' C:/Program Files/Google/Google SketchUp 7/Plugins/fur_en.rb:658:in
call'`
with the 'web-dialog' accept button.
You must be passing an empty argument to a defn ?Sorry,I will change the code.
-
Why are you doing this?
Sketchup.active_model.options["UnitsOptions"].each{|key ,val| unitoptions[key] = val } Sketchup.active_model.options["UnitsOptions"]["LengthFormat"] = 0 if unitoptions["LengthFormat"] != 0 Sketchup.active_model.options["UnitsOptions"]["LengthPrecision"] = 1 if unitoptions["LengthPrecision"] == 0
You're changing the model settings.
-
This whole thing makes no sense...
def fur_dialog_ini unitoptions = Hash.new Sketchup.active_model.options["UnitsOptions"].each{|key ,val| unitoptions[key] = val } Sketchup.active_model.options["UnitsOptions"]["LengthFormat"] = 0 if unitoptions["LengthFormat"] != 0 Sketchup.active_model.options["UnitsOptions"]["LengthPrecision"] = 1 if unitoptions["LengthPrecision"] == 0 @fur_units_metric = false lunit = unitoptions["LengthUnit"] @fur_units_metric = true if lunit >= 2 lprec = Sketchup.active_model.options["UnitsOptions"]["LengthPrecision"] @decimal_sep = 1.2.to_l.to_s.match(/\d(\D)\d/)[1] @delim = "," @delim = ";" if @decimal_sep == ',' unitoptions.each{|key ,val| Sketchup.active_model.options["UnitsOptions"][key] = val } end
You create an hash to store model UnitOptions, then change them and then restore the original values...?
-
From what I could understand, that method could be condensed to:
def fur_dialog_ini units = Sketchup.active_model.options["UnitsOptions"]["LengthUnit"] @fur_units_metric = (units >= 2) # true if units are 2 or greater @decimal_sep = 1.2.to_l.to_s.match(/\d(\D)\d/)[1] @delim = (@decimal_sep == ',') ? ";" ; "," end
-
Hmmm,
When LengthFormat is Architectural or LengthPrecision = 0,
"1.2.to_l.to_s.match(/\d(\D)\d/)[1]" return error.Is that problem excluding this?
-
Ah, yes. I see the problem. ..hm... this needs some more thinking...
-
Ok - turns out that you can't trust the SU methods to extract the decimal separator as model settings affects the length to string formatting. (Should have thought of that. )
Looking at there seems to mostly be just comma or period as decimal separator. At least if you make that assumption it will cover most.
So here is an alternative:
def get_decimal_separator # If this raises an error the decimal separator is not '.' '1.2'.to_l return '.' rescue return ',' end def fur_dialog_ini @decimal_sep ||= get_decimal_separator @delim ||= (@decimal_sep == ',') ? ";" ; "," end
This snippet makes some assumptions:
Only comma or period as decimal separator.
If the separator is a period then comma is used as list separator.
If the separator is a comma then ; is used as list separator.The method is working out the decimal separator is by trial and error.
-
wow... keep it coming. Thanks.
-
I thought of a very cool thing to do with this plugin... those xmas stuff that you put on Xmas trees, you know?? Well, actually this plugin also makes it easy to do the Xmas tree itself.
I am talking about this thing that goes around the tree
-
Is v1.3e working for others?
Nothing happens when i select it?
Advertisement