From 23801ad88e6d6b1d5704710a13cedec7218a49dc Mon Sep 17 00:00:00 2001 From: takion Date: Wed, 14 Mar 2018 03:08:17 +0100 Subject: [PATCH] warehouse fixs + unified translation --- README.md | 8 +- Zome.rb | 20 +- Zome.rbz | Bin 3409 -> 4739 bytes Zome/core.rb | 465 ------------------------- Zome/main.rb | 465 +++++++++++++++++++++++++ Zome/resources/fr/Zome.strings | 54 +++ ZomeFr.rb | 9 - ZomeFr.rbz | Bin 4409 -> 0 bytes ZomeFr/core.rb | 606 --------------------------------- 9 files changed, 538 insertions(+), 1089 deletions(-) delete mode 100644 Zome/core.rb create mode 100644 Zome/main.rb create mode 100644 Zome/resources/fr/Zome.strings delete mode 100644 ZomeFr.rb delete mode 100644 ZomeFr.rbz delete mode 100644 ZomeFr/core.rb diff --git a/README.md b/README.md index c274a6c..14856b6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Zome Sketchup Plugin - Rhombizonaèdre Polaire +# Zome Sketchup Plugin - Zonaèdre Polaire [![Zome ICON](https://raw.githubusercontent.com/takion/zome-polar-rhombizonahedron/master/img/zome-icon.png)](https://github.com/takion/zome-polar-rhombizonahedron#) @@ -15,10 +15,10 @@ ### SketchUp 2017 1. Télécharger et installer SketchUp: https://www.sketchup.com/fr/download/all -2. Télécharger le plugin : https://github.com/takion/zome-polar-rhombizonahedron/raw/master/ZomeFr.rbz +2. Télécharger le plugin : https://github.com/takion/zome-polar-rhombizonahedron/raw/master/Zome.rbz 3. Ouvrir sketchup -4. Barre de menu > fenêtre > gestionnaire d'extensions > installer l'extension > sélectionner ZomeFr.rbz -5. Barre de menu > extensions > zome > choisir configuration voulue et PAF ! +4. Barre de menu > fenêtre > gestionnaire d'extensions > installer l'extension > sélectionner Zome.rbz +5. Barre de menu > extensions > zome > choisir configuration voulue et voilà ! [![Zome Sample](https://raw.githubusercontent.com/takion/zome-polar-rhombizonahedron/master/img/zome-10-5.png)](https://github.com/takion/zome-polar-rhombizonahedron#) diff --git a/Zome.rb b/Zome.rb index 0f5d277..de03db9 100644 --- a/Zome.rb +++ b/Zome.rb @@ -1,13 +1,23 @@ -require 'sketchup.rb' -require 'extensions.rb' - module Takion module Zome - zome_extension = SketchupExtension.new('Zome', 'Zome/core.rb') + + require 'sketchup.rb' + require 'extensions.rb' + require 'langhandler.rb' + + LH = LanguageHandler.new('Zome.strings') + if !LH.respond_to?(:[]) + def LH.[](key) + GetString(key) + end + end + + zome_extension = SketchupExtension.new('Zome', 'Zome/main.rb') zome_extension.version = '1.2.4' zome_extension.copyright = '2018' - zome_extension.description = 'Zome Creator - PolarZonahedron' + zome_extension.description = LH['Zome Creator - PolarZonahedron'] zome_extension.creator = 'Jo Takion ' Sketchup.register_extension(zome_extension, true) + end end diff --git a/Zome.rbz b/Zome.rbz index c00f8a03a2436fef109a2a649f100f1391150bda..b67597772b1e6f2ace4bc7361088d49c12c2143a 100644 GIT binary patch literal 4739 zcmZ`-XH-+$x{Z_w(tBvqJ4){$(xnZZ)VP4FasavM{96AM{?&__yQ_l` z_%8?n;5nt64vZmgivJn_V1xqzT>lGl8*1ySud9tKLf*3d7Ic47Ilj)9e3wX7a0CIq zf9rMECoic@ShZgDlk-Ez&MC4+T+QC*o`C(N_|M+aJC);T1Dv6`H!y@IPCiJ{rIVne zV%SN|QuBhmhv34O(@F4yVflj;x)`tMX53}To9)bTxMpQc8n+NTay0SvUO6NydI#*2 zf{Rb(lj16?3+d+W6iU7KYqNE>P`>N5?-f7&CGIc`PH99seNR?Ke)))ziLQy-rc(3O z;c07quFe5l4jrRIarD^wix<|t6)B+J{ANna!U1D*NxwzLsU4`tY~RS5sAOsalx_q4?Ki6%|)WKxEYf9=7-!ISCj$m!G|`>~gMNyHUnK}?U*twg_~{je>1 z{({rj2PKZC(&G}Q$`$_}=dX#!nyZ|{hyVaNB>;f<&%|AAoZYTwx@o=+Wt5=4V0QdL z+F^rk!uSVin&+uxq@|50^D!HMSbbskZ=brGy2Kk#ON#rkUhEOb(`y{JOp4Ti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different from the number of needed sides" if ( @gen_zome['N_Niveaux'] == @gen_zome['N_Cotes'] ) - raise "Required a number of layers not equal to null" if ( @gen_zome['N_Niveaux'] <= 0 ) - raise "Minimum 2 layers required for coherent Zome" if ( @gen_zome['N_Niveaux'] < 2 ) - raise "Required a number of sides not equal to null" if( @gen_zome['N_Cotes'] <= 0 ) - raise "Minimum 3 sides required for coherent Zome" if ( @gen_zome['N_Cotes'] < 3 ) - raise "Angle can't be equal to 90" if ( @gen_zome['L_AngleDeForme'] == 90 ) - # - rescue - #UI.messagebox $!.message - #retry - end - - start - - angle_forme = @gen_zome['L_AngleDeForme'].degrees - hypotenus = @gen_zome['L_Arrete'] - msg = "" - - sinus = cos(angle_forme) - cosinus = sin(angle_forme) - retour = create_polarzonaedre(true,@gen_zome['N_Cotes'],@gen_zome['N_Niveaux'],sinus,cosinus,hypotenus) - - msg += "Sides: #{@gen_zome['N_Cotes']} \n" - msg += "Layers: #{@gen_zome['N_Niveaux']} \n" - msg += "Diameter: #{retour[0].inch} \n" - msg += "Height: #{retour[1].inch} \n" - msg += "Shape angle: #{angle_forme.radians} \n" - msg += "Edges: #{hypotenus.inch} \n" - - msg += retour[2] - - add_note msg - ending - end - - def zome_ah - config = [ - ['N_Cotes',10,'Sides of rotation around the axis'], - ['N_Niveaux',5,'Vertical Layer'], - ['L_AngleDeForme',35.2643896827547,'Shape angle'], - ['L_Hauteur',3000.mm,'Height at the top'], - ['T_Ties','Horizontal','Ties',"Horizontal|None"], - ['T_Ground','No','Ground',"Yes|No"], - ['T_Modelisation','Faces','Modelisation',"Squelette|Faces"] - ] - @gen_zome = {} if not @gen_zome - 0.upto(config.length-1){ |i| - @gen_zome[config[i][0]] = config[i][1] if not @gen_zome[config[i][0]] - } - - results = nil - prompts = [] - defaults = [] - drops = [] - 0.upto(config.length-1){ |i| - defaults.push config[i][1] - prompts.push config[i][2] - if(config[i][3]) - drops.push config[i][3] - else - drops.push '' - end - } - begin - results = UI.inputbox prompts,defaults,drops,'RhombiZonaèdre Polar by shapes angle and height' - return unless results - 0.upto(config.length-1){ |i| - @gen_zome[config[i][0]] = results[i] - } - # - raise "Required a number of layers not equal to null" if ( @gen_zome['N_Niveaux'] <= 0 ) - raise "Minimum 2 layers required for coherent Zome" if ( @gen_zome['N_Niveaux'] < 2 ) - raise "Required a number of sides not equal to null" if( @gen_zome['N_Cotes'] <= 0 ) - raise "Minimum 3 sides required for coherent Zome" if ( @gen_zome['N_Cotes'] < 3 ) - raise "Required height not equal to null" if ( @gen_zome['L_Hauteur'] <= 0 ) - raise "Angle can't be 90" if ( @gen_zome['L_AngleDeForme'] == 90 ) - # - rescue - UI.messagebox $!.message - retry - end - - start - - msg = "" - - angle_forme = @gen_zome['L_AngleDeForme'].degrees - - adjacent = @gen_zome['L_Hauteur']/@gen_zome['N_Niveaux'] - hypotenus = adjacent/angle_forme - oppose = sqrt(hypotenus*hypotenus - adjacent*adjacent) - - sinus = cos(angle_forme) - cosinus = sin(angle_forme) - - retour1 = create_polarzonaedre(false,@gen_zome['N_Cotes'],@gen_zome['N_Niveaux'],sinus,cosinus,hypotenus) - hypotenus *= @gen_zome['L_Hauteur']/retour1[1] - retour2 = create_polarzonaedre(true,@gen_zome['N_Cotes'],@gen_zome['N_Niveaux'],sinus,cosinus,hypotenus) - - msg += "Bases: #{@gen_zome['N_Cotes']} \n" - msg += "Layers: #{@gen_zome['N_Niveaux']} \n" - msg += "Diameter: #{retour2[0].inch} \n" - msg += "Height: #{retour2[1].inch} \n" - msg += "Shape angle: #{angle_forme.radians} \n" - msg += "Edges: #{hypotenus.inch} \n" - msg += retour2[2] - add_note msg - ending - end - - - def zome_ad - config = [ - ['N_Cotes',10,'Sides of rotation around the axis'], - ['N_Niveaux',5,'Vertical Layer'], - ['L_AngleDeForme',35.2643896827547,'Shape angle'], - ['L_Diametre',6000.mm,'Ground diameter'], - ['T_Ties','Horizontal','Ties',"Horizontal|None"], - ['T_Ground','No','Ground',"Yes|No"], - ['T_Modelisation','Faces','Modelisation',"Squelette|Faces"] - ] - @gen_zome = {} if not @gen_zome - 0.upto(config.length-1){ |i| - @gen_zome[config[i][0]] = config[i][1] if not @gen_zome[config[i][0]] - } - - results = nil - prompts = [] - defaults = [] - drops = [] - 0.upto(config.length-1){ |i| - defaults.push config[i][1] - prompts.push config[i][2] - if(config[i][3]) - drops.push config[i][3] - else - drops.push '' - end - } - begin - results = UI.inputbox prompts,defaults,drops,'RhombiZonaèdre Polar by shapes angle and height' - return unless results - 0.upto(config.length-1){ |i| - @gen_zome[config[i][0]] = results[i] - } - # - raise "Required a number of layers not equal to null" if ( @gen_zome['N_Niveaux'] <= 0 ) - raise "Minimum 2 layers required for coherent Zome" if ( @gen_zome['N_Niveaux'] < 2 ) - raise "Required a number of sides not equal to null" if( @gen_zome['N_Cotes'] <= 0 ) - raise "Minimum 3 sides required for coherent Zome" if ( @gen_zome['N_Cotes'] < 3 ) - raise "Required diameter not equal to null" if ( @gen_zome['L_Diametre'] <= 0 ) - raise "Angle can't be 90" if ( @gen_zome['L_AngleDeForme'] == 90 ) - # - rescue - UI.messagebox $!.message - retry - end - - start - - msg = "" - - angle_forme = @gen_zome['L_AngleDeForme'].degrees - - hypotenus = @gen_zome['L_Diametre']/2/PI - sinus = cos(angle_forme) - cosinus = sin(angle_forme) - - retour1 = create_polarzonaedre(false,@gen_zome['N_Cotes'],@gen_zome['N_Niveaux'],sinus,cosinus,hypotenus) - hypotenus *= @gen_zome['L_Diametre']/retour1[0] - retour2 = create_polarzonaedre(true,@gen_zome['N_Cotes'],@gen_zome['N_Niveaux'],sinus,cosinus,hypotenus) - - msg += "Bases: #{@gen_zome['N_Cotes']} \n" - msg += "Layers: #{@gen_zome['N_Niveaux']} \n" - msg += "Diameter: #{retour2[0].inch} \n" - msg += "Height: #{retour2[1].inch} \n" - msg += "Shape angle: #{angle_forme.radians} \n" - msg += "Edges: #{hypotenus.inch} \n" - msg += retour2[2] - add_note msg - ending - end - - def zome_dh - config = [ - ['N_Cotes',10,'Sides of rotation around the axis'], - ['N_Niveaux',5,'Vertical Layer'], - ['L_Diametre',6000.mm,'Ground diameter'], - ['L_Hauteur',3000.mm,'Height at the top'], - ['T_Ties','None','Ties',"Horizontal|None"], - ['T_Ground','No','Ground',"Yes|No"], - ['T_Modelisation','Faces','Modelisation',"Squelette|Faces"] - ] - @gen_zome = {} if not @gen_zome - 0.upto(config.length-1){ |i| - @gen_zome[config[i][0]] = config[i][1] if not @gen_zome[config[i][0]] - } - - results = nil - prompts = [] - defaults = [] - drops = [] - 0.upto(config.length-1){ |i| - defaults.push config[i][1] - prompts.push config[i][2] - if(config[i][3]) - drops.push config[i][3] - else - drops.push '' - end - } - begin - results = UI.inputbox prompts,defaults,drops,'Polar Zonohedron based on diameter and height' - return unless results - 0.upto(config.length-1){ |i| - @gen_zome[config[i][0]] = results[i] - } - # - raise "Required a number of layers not equal to null" if ( @gen_zome['N_Niveaux'] <= 0 ) - raise "Minimum 2 layers required for a coherent Zome" if ( @gen_zome['N_Niveaux'] < 2 ) - raise "Required a number of sides not equal to null" if( @gen_zome['N_Cotes'] <= 0 ) - raise "Minimum 3 sides required for a coherent Zome" if ( @gen_zome['N_Cotes'] < 3 ) - raise "Diameter can't be equal to null" if ( @gen_zome['L_Diametre'] <= 0 ) - raise "Required height not equal to null" if ( @gen_zome['L_Hauteur'] <= 0 ) - # - rescue - UI.messagebox $!.message - retry - end - - start - - - msg = "" - - adjacent = @gen_zome['L_Hauteur']/@gen_zome['N_Niveaux'] - - oppose = @gen_zome['L_Diametre']/@gen_zome['N_Niveaux']/2 - hypotenus = sqrt(adjacent*adjacent + oppose*oppose) - sinus = oppose/hypotenus - cosinus = adjacent/hypotenus - retour1 = create_polarzonaedre(false,@gen_zome['N_Cotes'],@gen_zome['N_Niveaux'],sinus,cosinus,hypotenus) - ndiametre = @gen_zome['L_Diametre']*(@gen_zome['L_Diametre']/retour1[0]) - - oppose = ndiametre/@gen_zome['N_Niveaux']/2 - hypotenus = sqrt(adjacent*adjacent + oppose*oppose) - sinus = oppose/hypotenus - cosinus = adjacent/hypotenus - retour2 = create_polarzonaedre(true,@gen_zome['N_Cotes'],@gen_zome['N_Niveaux'],sinus,cosinus,hypotenus) - - msg += "Bases: #{@gen_zome['N_Cotes']} \n" - msg += "Layers: #{@gen_zome['N_Niveaux']} \n" - msg += "Diameter: #{@gen_zome['L_Diametre'].inch} \n" - msg += "Height: #{@gen_zome['L_Hauteur'].inch} \n" - msg += "Edges: #{hypotenus.inch} \n" - # msg += "Shape angle: #{asin(cosinus).radians} \n" - msg += "Shape angle: #{acos(sinus).radians} \n" - msg += "Angle between the axes and the edge of the top layer: #{asin(sinus).radians} \n" - - msg += retour2[2] - - add_note msg - ending - end - end - zomes_menu = UI.menu("Plugins").add_submenu("Zome") - zomes_menu.add_item("By diameter and height") { Zome.gen_dh() } - zomes_menu.add_item("By angle and edges") { Zome.gen_al() } - zomes_menu.add_item("By angle and height") { Zome.gen_ah() } - zomes_menu.add_item("By angle and diameter") { Zome.gen_ad() } - file_loaded(File.basename(__FILE__)) - end -end diff --git a/Zome/main.rb b/Zome/main.rb new file mode 100644 index 0000000..cc53e43 --- /dev/null +++ b/Zome/main.rb @@ -0,0 +1,465 @@ +#https://github.com/takion/zome-polar-rhombizonahedron jo@redcat.ninja + +require 'sketchup.rb' +module Takion + module Zome + include Math + class Zome + def self.gen_dh + obj = self.new + obj.zome_dh() + end + def self.gen_al + obj = self.new + obj.zome_al() + end + def self.gen_ah + obj = self.new + obj.zome_ah() + end + def self.gen_ad + obj = self.new + obj.zome_ad() + end + + def initialize + + end + def start + @mo = Sketchup.active_model + Sketchup::set_status_text(LH["Zome modelisation in progress..."]) + @mo.start_operation LH["PolarZonahedron - Structure Processing"] + @t1 = Time.now + @entities = @mo.active_entities.add_group.entities + end + def ending + @mo.commit_operation + end + def add_note(msg) + @mo.add_note msg, 0, 0.03 + end + def rayon_polygone_regulier n_cotes,segment_length + return (segment_length/2.0)/(Math::sin((360.0/n_cotes)/(2.0*(180.0/Math::PI)))) + end + def aire_polygone_regulier n_cotes,segment_length,radius + if not radius + radius = rayon_polygone_regulier n_cotes,segment_length + end + area = n_cotes*(0.5*(segment_length*Math::sqrt((radius*radius)-((segment_length*segment_length)/4.0))))*@u_inch*1000.0 + return area.inch + end + def draw_face(pts) + if(@gen_zome['T_Modelisation']==LH['Faces']) + face = @entities.add_face(pts) + face.back_material = @gen_zome['RVB_BACK_FACES'] + face.material = @gen_zome['RVB_FACES'] + end + if(@gen_zome['T_Modelisation']==LH['Squelette']) + line = @entities.add_line( pts ) + end + end + def create_polarzonaedre(draw, bases, niveaux, sinus, cosinus, hypotenus) + @arretes_nb = (bases*2*niveaux)-bases + @tirants_nb = (bases*2*niveaux)/2 + @segments_nb = @arretes_nb+@tirants_nb + @connecteurs_nb = (bases*niveaux)+1 + + msg = "" + vector = Geom::Vector3d.new(sinus,0,cosinus) + vector.length = hypotenus + pts=[] + points=[] + pts[0] = Geom::Point3d.new(0,0,0) + + 1.upto(niveaux){ |i| + p_rotate = Geom::Transformation.rotation( pts[0] , Geom::Vector3d.new(0,0,1), i*2*Math::PI/bases ) + + pts[1] = pts[0].transform( vector ) + pts[3] = pts[1].transform( p_rotate ) + pts[2] = pts[3].transform( vector ) + # mb = i*2*Math::PI/bases + # UI.messagebox "#{mb.radians}" + points[i] = [] + 0.upto(bases-1){ |j| + f_rotate = Geom::Transformation.rotation( Geom::Point3d.new(0,0,0) , Geom::Vector3d.new(0,0,1), j*2*Math::PI/bases) + points[i][j] = pts.collect{|p| p.transform(f_rotate)} + + } + pts[0] = pts[3] + } + rot = Geom::Transformation.rotation [0,0,0], X_AXIS, 180.degrees + hauteur_r = points[niveaux-1][0][2][2] + + faces = [] + 1.upto(niveaux){ |i| + 0.upto(bases-1){ |j| + points[i][j].collect{|p| + p.transform!(rot) + p[2]+=hauteur_r + } + if(draw==true) + pt1 = points[i][j][1] + pt3 = points[i][j][3] + pt4 = points[i][j][0] + if(@gen_zome['T_Ties']==LH['Horizontal']) + if(i + raise LH["Number of layers different from the number of needed sides"] if ( @gen_zome['N_Niveaux'] == @gen_zome['N_Cotes'] ) + raise LH["Required a number of layers not equal to null"] if ( @gen_zome['N_Niveaux'] <= 0 ) + raise LH["Minimum 2 layers required for coherent Zome"] if ( @gen_zome['N_Niveaux'] < 2 ) + raise LH["Required a number of sides not equal to null"] if( @gen_zome['N_Cotes'] <= 0 ) + raise LH["Minimum 3 sides required for coherent Zome"] if ( @gen_zome['N_Cotes'] < 3 ) + raise LH["Angle can't be equal to 90"] if ( @gen_zome['L_AngleDeForme'] == 90 ) + # + rescue + #UI.messagebox $!.message + #retry + end + + start + + angle_forme = @gen_zome['L_AngleDeForme'].degrees + hypotenus = @gen_zome['L_Arrete'] + msg = "" + + sinus = Math::cos(angle_forme) + cosinus = Math::sin(angle_forme) + retour = create_polarzonaedre(true,@gen_zome['N_Cotes'],@gen_zome['N_Niveaux'],sinus,cosinus,hypotenus) + + msg += LH["Sides"]+": #{@gen_zome['N_Cotes']} \n" + msg += LH["Layers"]+": #{@gen_zome['N_Niveaux']} \n" + msg += LH["Diameter"]+": #{retour[0].inch} \n" + msg += LH["Height"]+": #{retour[1].inch} \n" + msg += LH["Shape angle"]+": #{angle_forme.radians} \n" + msg += LH["Edges"]+": #{hypotenus.inch} \n" + + msg += retour[2] + + add_note msg + ending + end + + def zome_ah + config = [ + ['N_Cotes',10,LH['Sides of rotation around the axis']], + ['N_Niveaux',5,LH['Vertical Layer']], + ['L_AngleDeForme',35.2643896827547,LH['Shape angle']], + ['L_Hauteur',3000.mm,LH['Height at the top']], + ['T_Ties',LH['Horizontal'],LH['Ties'],LH["Horizontal|None"]], + ['T_Ground',LH['No'],LH['Ground'],LH["Yes|No"]], + ['T_Modelisation',LH['Faces'],LH['Modelisation'],LH["Squelette|Faces"]] + ] + @gen_zome = {} if not @gen_zome + 0.upto(config.length-1){ |i| + @gen_zome[config[i][0]] = config[i][1] if not @gen_zome[config[i][0]] + } + + results = nil + prompts = [] + defaults = [] + drops = [] + 0.upto(config.length-1){ |i| + defaults.push config[i][1] + prompts.push config[i][2] + if(config[i][3]) + drops.push config[i][3] + else + drops.push '' + end + } + begin + results = UI.inputbox prompts,defaults,drops,LH['PolarZonahedron by shapes angle and height'] + return unless results + 0.upto(config.length-1){ |i| + @gen_zome[config[i][0]] = results[i] + } + # + raise LH["Required a number of layers not equal to null"] if ( @gen_zome['N_Niveaux'] <= 0 ) + raise LH["Minimum 2 layers required for coherent Zome"] if ( @gen_zome['N_Niveaux'] < 2 ) + raise LH["Required a number of sides not equal to null"] if( @gen_zome['N_Cotes'] <= 0 ) + raise LH["Minimum 3 sides required for coherent Zome"] if ( @gen_zome['N_Cotes'] < 3 ) + raise LH["Required height not equal to null"] if ( @gen_zome['L_Hauteur'] <= 0 ) + raise LH["Angle can't be 90"] if ( @gen_zome['L_AngleDeForme'] == 90 ) + # + rescue + UI.messagebox $!.message + retry + end + + start + + msg = "" + + angle_forme = @gen_zome['L_AngleDeForme'].degrees + + adjacent = @gen_zome['L_Hauteur']/@gen_zome['N_Niveaux'] + hypotenus = adjacent/angle_forme + oppose = Math::sqrt(hypotenus*hypotenus - adjacent*adjacent) + + sinus = Math::cos(angle_forme) + cosinus = Math::sin(angle_forme) + + retour1 = create_polarzonaedre(false,@gen_zome['N_Cotes'],@gen_zome['N_Niveaux'],sinus,cosinus,hypotenus) + hypotenus *= @gen_zome['L_Hauteur']/retour1[1] + retour2 = create_polarzonaedre(true,@gen_zome['N_Cotes'],@gen_zome['N_Niveaux'],sinus,cosinus,hypotenus) + + msg += LH["Bases"]+": #{@gen_zome['N_Cotes']} \n" + msg += LH["Layers"]+": #{@gen_zome['N_Niveaux']} \n" + msg += LH["Diameter"]+": #{retour2[0].inch} \n" + msg += LH["Height"]+": #{retour2[1].inch} \n" + msg += LH["Shape angle"]+": #{angle_forme.radians} \n" + msg += LH["Edges"]+": #{hypotenus.inch} \n" + msg += retour2[2] + add_note msg + ending + end + + + def zome_ad + config = [ + ['N_Cotes',10,LH['Sides of rotation around the axis']], + ['N_Niveaux',5,LH['Vertical Layer']], + ['L_AngleDeForme',35.2643896827547,LH['Shape angle']], + ['L_Diametre',6000.mm,LH['Ground diameter']], + ['T_Ties',LH['Horizontal'],LH['Ties'],LH["Horizontal|None"]], + ['T_Ground',LH['No'],LH['Ground'],LH["Yes|No"]], + ['T_Modelisation',LH['Faces'],LH['Modelisation'],LH["Squelette|Faces"]] + ] + @gen_zome = {} if not @gen_zome + 0.upto(config.length-1){ |i| + @gen_zome[config[i][0]] = config[i][1] if not @gen_zome[config[i][0]] + } + + results = nil + prompts = [] + defaults = [] + drops = [] + 0.upto(config.length-1){ |i| + defaults.push config[i][1] + prompts.push config[i][2] + if(config[i][3]) + drops.push config[i][3] + else + drops.push '' + end + } + begin + results = UI.inputbox prompts,defaults,drops,LH['PolarZonahedron by shapes angle and diameter'] + return unless results + 0.upto(config.length-1){ |i| + @gen_zome[config[i][0]] = results[i] + } + # + raise LH["Required a number of layers not equal to null"] if ( @gen_zome['N_Niveaux'] <= 0 ) + raise LH["Minimum 2 layers required for coherent Zome"] if ( @gen_zome['N_Niveaux'] < 2 ) + raise LH["Required a number of sides not equal to null"] if( @gen_zome['N_Cotes'] <= 0 ) + raise LH["Minimum 3 sides required for coherent Zome"] if ( @gen_zome['N_Cotes'] < 3 ) + raise LH["Required diameter not equal to null"] if ( @gen_zome['L_Diametre'] <= 0 ) + raise LH["Angle can't be 90"] if ( @gen_zome['L_AngleDeForme'] == 90 ) + # + rescue + UI.messagebox $!.message + retry + end + + start + + msg = "" + + angle_forme = @gen_zome['L_AngleDeForme'].degrees + + hypotenus = @gen_zome['L_Diametre']/2/Math::PI + sinus = Math::cos(angle_forme) + cosinus = Math::sin(angle_forme) + + retour1 = create_polarzonaedre(false,@gen_zome['N_Cotes'],@gen_zome['N_Niveaux'],sinus,cosinus,hypotenus) + hypotenus *= @gen_zome['L_Diametre']/retour1[0] + retour2 = create_polarzonaedre(true,@gen_zome['N_Cotes'],@gen_zome['N_Niveaux'],sinus,cosinus,hypotenus) + + msg += LH["Bases"]+": #{@gen_zome['N_Cotes']} \n" + msg += LH["Layers"]+": #{@gen_zome['N_Niveaux']} \n" + msg += LH["Diameter"]+": #{retour2[0].inch} \n" + msg += LH["Height"]+": #{retour2[1].inch} \n" + msg += LH["Shape angle"]+": #{angle_forme.radians} \n" + msg += LH["Edges"]+": #{hypotenus.inch} \n" + msg += retour2[2] + add_note msg + ending + end + + def zome_dh + config = [ + ['N_Cotes',10,LH['Sides of rotation around the axis']], + ['N_Niveaux',5,LH['Vertical Layer']], + ['L_Diametre',6000.mm,LH['Ground diameter']], + ['L_Hauteur',3000.mm,LH['Height at the top']], + ['T_Ties',LH['None'],LH['Ties'],LH["Horizontal|None"]], + ['T_Ground',LH['No'],LH['Ground'],LH["Yes|No"]], + ['T_Modelisation',LH['Faces'],LH['Modelisation'],LH["Squelette|Faces"]] + ] + @gen_zome = {} if not @gen_zome + 0.upto(config.length-1){ |i| + @gen_zome[config[i][0]] = config[i][1] if not @gen_zome[config[i][0]] + } + + results = nil + prompts = [] + defaults = [] + drops = [] + 0.upto(config.length-1){ |i| + defaults.push config[i][1] + prompts.push config[i][2] + if(config[i][3]) + drops.push config[i][3] + else + drops.push '' + end + } + begin + results = UI.inputbox prompts,defaults,drops,LH['Polar Zonahedron based on diameter and height'] + return unless results + 0.upto(config.length-1){ |i| + @gen_zome[config[i][0]] = results[i] + } + # + raise LH["Required a number of layers not equal to null"] if ( @gen_zome['N_Niveaux'] <= 0 ) + raise LH["Minimum 2 layers required for a coherent Zome"] if ( @gen_zome['N_Niveaux'] < 2 ) + raise LH["Required a number of sides not equal to null"] if( @gen_zome['N_Cotes'] <= 0 ) + raise LH["Minimum 3 sides required for a coherent Zome"] if ( @gen_zome['N_Cotes'] < 3 ) + raise LH["Diameter can't be equal to null"] if ( @gen_zome['L_Diametre'] <= 0 ) + raise LH["Required height not equal to null"] if ( @gen_zome['L_Hauteur'] <= 0 ) + # + rescue + UI.messagebox $!.message + retry + end + + start + + + msg = "" + + adjacent = @gen_zome['L_Hauteur']/@gen_zome['N_Niveaux'] + + oppose = @gen_zome['L_Diametre']/@gen_zome['N_Niveaux']/2 + hypotenus = Math::sqrt(adjacent*adjacent + oppose*oppose) + sinus = oppose/hypotenus + cosinus = adjacent/hypotenus + retour1 = create_polarzonaedre(false,@gen_zome['N_Cotes'],@gen_zome['N_Niveaux'],sinus,cosinus,hypotenus) + ndiametre = @gen_zome['L_Diametre']*(@gen_zome['L_Diametre']/retour1[0]) + + oppose = ndiametre/@gen_zome['N_Niveaux']/2 + hypotenus = Math::sqrt(adjacent*adjacent + oppose*oppose) + sinus = oppose/hypotenus + cosinus = adjacent/hypotenus + retour2 = create_polarzonaedre(true,@gen_zome['N_Cotes'],@gen_zome['N_Niveaux'],sinus,cosinus,hypotenus) + + msg += LH["Bases"]+": #{@gen_zome['N_Cotes']} \n" + msg += LH["Layers"]+": #{@gen_zome['N_Niveaux']} \n" + msg += LH["Diameter"]+": #{@gen_zome['L_Diametre'].inch} \n" + msg += LH["Height"]+": #{@gen_zome['L_Hauteur'].inch} \n" + msg += LH["Edges"]+": #{hypotenus.inch} \n" + # msg += LH["Shape angle"]+": #{Math::asin(cosinus).radians} \n" + msg += LH["Shape angle"]+": #{Math::acos(sinus).radians} \n" + msg += LH["Angle between the axes and the edge of the top layer"]+": #{Math::asin(sinus).radians} \n" + + msg += retour2[2] + + add_note msg + ending + end + end + zomes_menu = UI.menu("Plugins").add_submenu("Zome") + zomes_menu.add_item(LH['by diameter and height']) { Zome.gen_dh() } + zomes_menu.add_item(LH["by angle and edges"]) { Zome.gen_al() } + zomes_menu.add_item(LH["by angle and height"]) { Zome.gen_ah() } + zomes_menu.add_item(LH["by angle and diameter"]) { Zome.gen_ad() } + file_loaded(File.basename(__FILE__)) + end +end diff --git a/Zome/resources/fr/Zome.strings b/Zome/resources/fr/Zome.strings new file mode 100644 index 0000000..e693099 --- /dev/null +++ b/Zome/resources/fr/Zome.strings @@ -0,0 +1,54 @@ +"Zome Creator - PolarZonahedron"="Créateur de Zome - RhombiZonaèdre Polaire"; +"by diameter and height"="par diamètre et hauteur"; +"by angle and edges"="par angle et arête"; +"by angle and height"="par angle et hauteur"; +"by angle and diameter"="angle et diametre"; +"Zome modelisation in progress..."="Modélisation du Zome en cours ..."; +"PolarZonahedron - Structure Processing"="RhombiZonaèdre Polaire - Modélisation de la Structure"; +"Faces"="Face"; +"Squelette"="Squelette"; +"Horizontal"="Horizontal"; +"None"="Aucun"; +"Sides"="Côtés"; +"Layers"="Niveaux"; +"Height"="Hauteur"; +"Ground diameter"="Diamètre au sol"; +"Number of connectors"="Nombre de connecteurs"; +"Connector"="Connecteur"; +"Connectors"="Connecteurs"; +"branches"="branches"; +"Segments total number"="Nombre total de segments"; +"Number of Ties"="Nombre de tirants"; +"Zome Creator - OpenSource software developed by Jo"="Créateur de Zome - Logiciel libre développé par Jo"; +"Sides of rotation around the axis"="Côtés de révolution"; +"Vertical Layer"="Niveaux en Hauteur"; +"Shape angle"="Angle de forme"; +"Edges"="Arête"; +"Ties"="Tirants"; +"No"="Non"; +"Yes"="Oui"; +"Yes|No"="Oui|Non"; +"Ground"="Sol"; +"Faces"="Faces"; +"Modelisation"="Modélisation"; +"Squelette|Faces"="Squelette|Faces"; +"Number of layers different from the number of needed sides"="Nombre de côtés non nulle requis"; +"Required a number of layers not equal to null"="Nombre de niveaux non nulle requis"; +"Minimum 2 layers required for coherent Zome"="Minimum 2 niveaux pour un Zome cohérent"; +"Required a number of sides not equal to null"="Nombre de côtés non nulle requis"; +"Minimum 3 sides required for coherent Zome"="Minimum 3 côtés pour un Zome cohérent"; +"Angle can't be equal to 90"="L'angle ne peux pas être à 90"; +"Sides"="Côtés"; +"Layers"="Niveaux"; +"Diameter"="Diamètre"; +"Height"="Hauteur"; +"Shape angle"="Angle de forme"; +"Edges"="Arêtes"; +"Height at the top"="Hauteur au Sommet"; +"Horizontal|None"="Horizontal|Aucun"; +"Angle between the axes and the edge of the top layer"="Angle entre l'axe et l'arête du dernier niveaux"; +"Polar Zonahedron"="RhombiZonaèdre Polaire"; +"PolarZonahedron by shapes angle and height"="Zonaèdre Polaire sur Angle de forme et Hauteur"; +"PolarZonahedron by shapes angle and diameter"="Zonaèdre Polaire sur Angle de forme et Diamètre"; +"Polar Zonohedron based on diameter and height"="Zonaèdre Polaire sur Diamètre et Hauteur"; +"Polar Zonahedron based on shape angle and edges"="Zonaèdre Polaire sur Angle de forme et Arête"; diff --git a/ZomeFr.rb b/ZomeFr.rb deleted file mode 100644 index 403985e..0000000 --- a/ZomeFr.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'sketchup.rb' -require 'extensions.rb' - -zome_extension = SketchupExtension.new('Zome FR', 'ZomeFr/core.rb') -zome_extension.version = '1.2.4' -zome_extension.copyright = '2018' -zome_extension.description = 'Zome Creator - Rhombizonaèdre Polaire' -zome_extension.creator = 'Jo Takion ' -Sketchup.register_extension(zome_extension, true) diff --git a/ZomeFr.rbz b/ZomeFr.rbz deleted file mode 100644 index 0c9a2b317165236a5db31a4c84094d0a29d51af4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4409 zcmZ`-Wmpv4)`cOZJ0)gdU{D&QLljU_I%L41h8AfA1Ox%;bdc^;VdxGSq-6*x0qL%x z8!qqt-uvD^_gm-3I_KGYJ^R_`-&$H~IJh)8Sa&FOkyHPR{{w=%%S&e`Yh_mft-qTH zu~OXS)D1VMo6&bgYium6d;c`?yINSsNxudtP$(YCD%s#ru`(~WzjrdORG;qwJma+e z%vXW3@!3dO@dE9B{{b^L!nOJ~^2Jbxm@b4mj!0KAjkW<1uewRIMaXvl@=aeNA6n?^ z(~Inzh7-5m>h97U{AV$ZvSYcUQ=e@5gGPp%-PXa&+d59O!{wW-$aLq<=qe*nM)Jut zPCUrST0u>AKGwB9%=io zaj)uvuP<~NnkayV&z20Pav^xBz1aWVIzn4ceed>9uqZheR_zNcEV6&L7O-@7wZ2<@ z2fF1ttw?i|F?ht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EoVpddwD=F-{Eef723Us?0oU@bxyx?jijsP*uWZRH(VBj$?f$iz%UOR6if z;Zs=stmnN3gIc)4IJsRGH^%Arj$45_PcYU7*IXs2&rTq2kG_!S^{0lek)(HW+Mi=Y zQzFKhLLL0EkBu`MdrD4P5U2?#C8O(t(!b)V}p~}!+{CUDTCffG@kDYVmcyVq+k$V@%E%q3{{Z6ULcM29s<-SKDE4<0ysn=GPJ{qtRWhx{X zgJ)~oRqbiy*Oaxn^r2q+EFu}v8DOO~UQ?<2Wkc~18Jo23jC8GAHc=ek!4Fp7SZ$Eh zs9(w?4q91I-<+5%+KNB>LS`CT+47;XahmcePxU6qJu}i%QS)1#4(%%t0^fa5Kj7R1 zCVbgpWVuYF%6e;}RY?=7{teMyUKtjXXVZ(T<{6wSUVJVenEI1Gb|P@FwC84F@+}Tj zyxju_di%6pAG=>3-wMy@?IJl6kliF>ou(G)O-J(3?q`C6VxoGHigMw;v$I1?=)&w+ zGwCtx)@9N$+s&8Jvrr(e)e+-3WB--tOSSrLQtsG!oB7q?1$*0}VV<8#akbZA0Ch83 zhHdL?E(mjcurgyv5pbff{|;wZoZ|Ww!LUBv?WjP#IQzAAu)FM`L)SQO5cB8O_ZtG( zg>5p$trvq+XTP>Z*;uZ%XRgF^R>yi8HVZ|`MJ%=g!ZVUXSLGuLT41ZCep_he5r_GO zWLJejfwtRT!zHFy&d5`I-}25srE+58OUy&pm5)#R8*JyWc5Z<~Hz@Jx)m0z7RWoq@ zR0-^*$E~c_D5*62k!WX_>61Oz{E`B_;U+5cu3N4nRssTWibm!0iJBtwOf4TX8tNtxxzDqU!p7po4 V*HXj7|ErF3cZ%=Wm*TJ2zW~I&Wb6O{ diff --git a/ZomeFr/core.rb b/ZomeFr/core.rb deleted file mode 100644 index aebd5db..0000000 --- a/ZomeFr/core.rb +++ /dev/null @@ -1,606 +0,0 @@ -#https://github.com/takion/zome-polar-rhombizonahedron jo@redcat.ninja - -require 'sketchup.rb' -include Math -module Takion -class RhombiZonaedrePolaireFR - def self.generation func - self.new func - end - def initialize func - eval("#{func}") - end - def start - $mo = Sketchup.active_model - Sketchup::set_status_text("Modélisation du Zome en cours ...") - $mo.start_operation "PolarZonahedron - Structure Processing" - @t1 = Time.now - $entities = $mo.active_entities.add_group.entities - end - def ending - $mo.commit_operation - if not $takion_z_l - UI.messagebox("\nZome Creator" << - "\nLogiciel libre développé par Jo - jo@redcat.ninja" << - "\nhttps://github.com/takion/zome-polar-rhombizonahedron/", "Zome Creator - Logiciel libre") - $takion_z_l = true - end - end - def add_note(msg) - $mo.add_note msg, 0, 0.03 - end - def rayon_polygone_regulier n_cotes,segment_length - return (segment_length/2.0)/(Math.sin((360.0/n_cotes)/(2.0*(180.0/Math::PI)))) - end - def aire_polygone_regulier n_cotes,segment_length,radius - if not radius - radius = rayon_polygone_regulier n_cotes,segment_length - end - area = n_cotes*(0.5*(segment_length*Math.sqrt((radius*radius)-((segment_length*segment_length)/4.0))))*$u_inch*1000.0 - return area.inch - end - def draw_face(pts) - if($takion_zome['T_Modelisation']=='Faces') - face = $entities.add_face(pts) - face.back_material = $takion_zome['RVB_BACK_FACES'] - face.material = $takion_zome['RVB_FACES'] - end - if($takion_zome['T_Modelisation']=='Squelette') - line = $entities.add_line( pts ) - end - if($takion_zome['T_Modelisation']=='Tubes') - line = $entities.add_line(pts) - create_tubes(line,$takion_zome['L_TubesDiametre']) - end - end - def create_tubes(line,radius) - edges = [line] - verts=[] - newVerts=[] - startEdge=startVert=nil - edges.each {|edge|verts.push(edge.vertices)} - verts.flatten! - vertsShort=[] - vertsLong=[] - verts.each do |v| - if vertsLong.include?(v) - vertsShort.push(v) - else - vertsLong.push(v) - end - end - if (startVert=(vertsLong-vertsShort).first)==nil - startVert=vertsLong.first - closed=true - startEdge = startVert.edges.first - else - closed=false - startEdge = (edges & startVert.edges).first - end - #SORT VERTICES, LIMITING TO THOSE IN THE SELECTION SET - if startVert==startEdge.start - newVerts=[startVert] - counter=0 - while newVerts.length < verts.length - edges.each do |edge| - if edge.end==newVerts.last - newVerts.push(edge.start) - elsif edge.start==newVerts.last - newVerts.push(edge.end) - end - end - counter+=1 - if counter > verts.length - return nil if UI.messagebox("There seems to be a problem. Try again?", MB_YESNO)!=6 - newVerts.reverse! - reversed=true - end - end - else - newVerts=[startVert] - counter=0 - while newVerts.length < verts.length - edges.each do |edge| - if edge.end==newVerts.last - newVerts.push(edge.start) - elsif edge.start==newVerts.last - newVerts.push(edge.end) - end - end - counter+=1 - if counter > verts.length - return nil if UI.messagebox("There seems to be a problem. Try again?", MB_YESNO)!=6 - newVerts.reverse! - reversed=true - end - end - end - ###newVerts.uniq! ### allow IF closed - newVerts.reverse! if reversed - #CONVERT VERTICES TO POINT3Ds - newVerts.collect!{|x| x.position} - ###newVerts.push(newVerts[0]) - ### now have an array of vertices in order with NO forced closed loop ... - ### - do stuff - ### - pt1 = newVerts[0] - pt2 = newVerts[1] - vec = pt1.vector_to pt2 - theCircle = $entities.add_circle pt1, vec, radius - # theCircle = $entities.add_ngon pt1, vec, radius, 4 - theFace = $entities.add_face theCircle - i = 0 - @@theEdges= [] - 0.upto(newVerts.length - 2) do |something| - @@theEdges[i] = $entities.add_line(newVerts[i],newVerts[i+1]) ### make vertices into edges - i = i + 1 - end - ### follow me along selected edges - theFace.reverse!.followme @@theEdges ### - $mo.commit_operation - ### restore selection set of edges and display them - i = 0 - theEdgeX = [] - 0.upto(newVerts.length - 2) do |something| - theEdgeX[i] = $entities.add_line(newVerts[i],newVerts[i+1]) ### make vertices into edges - i = i + 1 - end - $mo.selection.clear - $mo.selection.add theEdgeX - end - def create_polarzonaedre(draw, bases, niveaux, sinus, cosinus, hypotenus) - @arretes_nb = (bases*2*niveaux)-bases - @tirants_nb = (bases*2*niveaux)/2 - @segments_nb = @arretes_nb+@tirants_nb - @connecteurs_nb = (bases*niveaux)+1 - - msg = "" - vector = Geom::Vector3d.new(sinus,0,cosinus) - vector.length = hypotenus - pts=[] - points=[] - pts[0] = Geom::Point3d.new(0,0,0) - - 1.upto(niveaux){ |i| - p_rotate = Geom::Transformation.rotation( pts[0] , Geom::Vector3d.new(0,0,1), i*2*PI/bases ) - - pts[1] = pts[0].transform( vector ) - pts[3] = pts[1].transform( p_rotate ) - pts[2] = pts[3].transform( vector ) - # mb = i*2*PI/bases - # UI.messagebox "#{mb.radians}" - points[i] = [] - 0.upto(bases-1){ |j| - f_rotate = Geom::Transformation.rotation( Geom::Point3d.new(0,0,0) , Geom::Vector3d.new(0,0,1), j*2*PI/bases) - points[i][j] = pts.collect{|p| p.transform(f_rotate)} - - } - pts[0] = pts[3] - } - rot = Geom::Transformation.rotation [0,0,0], X_AXIS, 180.degrees - hauteur_r = points[niveaux-1][0][2][2] - - faces = [] - 1.upto(niveaux){ |i| - 0.upto(bases-1){ |j| - points[i][j].collect{|p| - p.transform!(rot) - p[2]+=hauteur_r - } - if(draw==true) - pt1 = points[i][j][1] - pt3 = points[i][j][3] - pt4 = points[i][j][0] - if($takion_zome['T_Tirants']=='Horizontaux') - if(i - raise "Nombre de niveaux différents du nombre de côtés requis" if ( $takion_zome['N_Niveaux'] == $takion_zome['N_Cotes'] ) - raise "Nombre de niveaux non nulle requis" if ( $takion_zome['N_Niveaux'] <= 0 ) - raise "Minimum 2 niveaux requis pour un Zome cohérent" if ( $takion_zome['N_Niveaux'] < 2 ) - raise "Nombre de côtés non nulle requis" if( $takion_zome['N_Cotes'] <= 0 ) - raise "Minimum 3 côtés pour un Zome cohérent" if ( $takion_zome['N_Cotes'] < 3 ) - raise "Hauteur non nulle requise" if ( $takion_zome['L_Hauteur'] <= 0 ) - raise "L'angle ne peux pas être à 90" if ( $takion_zome['L_AngleDeForme'] == 90 ) - # - rescue - UI.messagebox $!.message - retry - end - if($takion_zome['T_Modelisation']=="Tubes") - begin - results_tubes = UI.inputbox ['Diamètre des Tubes'],[28.mm],[],'Modélisation Tubes' - return unless results_tubes - $takion_zome['L_TubesDiametre'] = results_tubes[0] - raise "Valeur non nulle requise" if ( $takion_zome['L_TubesDiametre'] <= 0 ) - rescue - UI.messagebox $!.message - retry - end - end - - start - - angle_forme = $takion_zome['L_AngleDeForme'].degrees - hypotenus = $takion_zome['L_Arrete'] - msg = "" - - sinus = cos(angle_forme) - cosinus = sin(angle_forme) - retour = create_polarzonaedre(true,$takion_zome['N_Cotes'],$takion_zome['N_Niveaux'],sinus,cosinus,hypotenus) - - msg += "Bases: #{$takion_zome['N_Cotes']} \n" - msg += "Niveaux: #{$takion_zome['N_Niveaux']} \n" - msg += "Diamètre: #{retour[0].inch} \n" - msg += "Hauteur: #{retour[1].inch} \n" - msg += "Angle de forme: #{angle_forme.radians} \n" - msg += "Arête: #{hypotenus.inch} \n" - - msg += retour[2] - - add_note msg - ending - end - - def zome_ah - config = [ - ['N_Cotes',10,'Côtés de Révolution'], - ['N_Niveaux',5,'Niveaux en Hauteur'], - ['L_AngleDeForme',35.2643896827547,'Angle de forme'], - ['L_Hauteur',3000.mm,'Hauteur au Sommet'], - ['T_Tirants','Horizontaux','Tirants',"Horizontaux|Aucun"], - ['L_RayonConnecteurs',150.mm,'Rayon des Connecteurs'], - ['T_Ground','Non','Sol',"Oui|Non"], - ['T_Modelisation','Faces','Modélisation',"Squelette|Faces|Tubes"] - ] - $takion_zome = {} if not $takion_zome - 0.upto(config.length-1){ |i| - $takion_zome[config[i][0]] = config[i][1] if not $takion_zome[config[i][0]] - } - - results = nil - prompts = [] - defaults = [] - drops = [] - 0.upto(config.length-1){ |i| - defaults.push config[i][1] - prompts.push config[i][2] - if(config[i][3]) - drops.push config[i][3] - else - drops.push '' - end - } - begin - results = UI.inputbox prompts,defaults,drops,'RhombiZonaèdre Polaire sur Angle de forme et Hauteur' - return unless results - 0.upto(config.length-1){ |i| - $takion_zome[config[i][0]] = results[i] - } - # - raise "Nombre de niveaux non nulle requis" if ( $takion_zome['N_Niveaux'] <= 0 ) - raise "Minimum 2 niveaux requis pour un Zome cohérent" if ( $takion_zome['N_Niveaux'] < 2 ) - raise "Nombre de côtés non nulle requis" if( $takion_zome['N_Cotes'] <= 0 ) - raise "Minimum 3 côtés pour un Zome cohérent" if ( $takion_zome['N_Cotes'] < 3 ) - raise "Hauteur non nulle requise" if ( $takion_zome['L_Hauteur'] <= 0 ) - raise "L'angle ne peux pas être à 90" if ( $takion_zome['L_AngleDeForme'] == 90 ) - # - rescue - UI.messagebox $!.message - retry - end - if($takion_zome['T_Modelisation']=="Tubes") - begin - results_tubes = UI.inputbox ['Diamètre des Tubes'],[28.mm],[],'Modélisation Tubes' - return unless results_tubes - $takion_zome['L_TubesDiametre'] = results_tubes[0] - raise "Valeur non nulle requise" if ( $takion_zome['L_TubesDiametre'] <= 0 ) - rescue - UI.messagebox $!.message - retry - end - end - - start - - msg = "" - - angle_forme = $takion_zome['L_AngleDeForme'].degrees - - adjacent = $takion_zome['L_Hauteur']/$takion_zome['N_Niveaux'] - hypotenus = adjacent/angle_forme - oppose = sqrt(hypotenus*hypotenus - adjacent*adjacent) - - sinus = cos(angle_forme) - cosinus = sin(angle_forme) - - retour1 = create_polarzonaedre(false,$takion_zome['N_Cotes'],$takion_zome['N_Niveaux'],sinus,cosinus,hypotenus) - hypotenus *= $takion_zome['L_Hauteur']/retour1[1] - retour2 = create_polarzonaedre(true,$takion_zome['N_Cotes'],$takion_zome['N_Niveaux'],sinus,cosinus,hypotenus) - - msg += "Bases: #{$takion_zome['N_Cotes']} \n" - msg += "Niveaux: #{$takion_zome['N_Niveaux']} \n" - msg += "Diamètre: #{retour2[0].inch} \n" - msg += "Hauteur: #{retour2[1].inch} \n" - msg += "Angle de forme: #{angle_forme.radians} \n" - msg += "Arête: #{hypotenus.inch} \n" - msg += retour2[2] - add_note msg - ending - end - - def zomes_ad - config = [ - ['N_Cotes',10,'Côtés de Révolution'], - ['N_Niveaux',5,'Niveaux en Hauteur'], - ['L_AngleDeForme',35.2643896827547,'Angle de forme'], - ['L_Diametre',6000.mm,'Diamètre au sol'], - ['L_RayonConnecteurs',150.mm,'Rayon des Connecteurs'], - ['T_Ground','Non','Sol',"Oui|Non"], - ['T_Modelisation','Faces','Modélisation',"Squelette|Faces|Tubes"] - ] - $takion_zome = {} if not $takion_zome - 0.upto(config.length-1){ |i| - $takion_zome[config[i][0]] = config[i][1] if not $takion_zome[config[i][0]] - } - - results = nil - prompts = [] - defaults = [] - drops = [] - 0.upto(config.length-1){ |i| - defaults.push config[i][1] - prompts.push config[i][2] - if(config[i][3]) - drops.push config[i][3] - else - drops.push '' - end - } - begin - results = UI.inputbox prompts,defaults,drops,'RhombiZonaèdre Polaire sur Angle de forme et Diamètre' - return unless results - 0.upto(config.length-1){ |i| - $takion_zome[config[i][0]] = results[i] - } - # - raise "Nombre de niveaux non nulle requis" if ( $takion_zome['N_Niveaux'] <= 0 ) - raise "Minimum 2 niveaux requis pour un Zome cohérent" if ( $takion_zome['N_Niveaux'] < 2 ) - raise "Nombre de côtés non nulle requis" if( $takion_zome['N_Cotes'] <= 0 ) - raise "Minimum 3 côtés pour un Zome cohérent" if ( $takion_zome['N_Cotes'] < 3 ) - raise "Diamètre non nulle requis" if ( $takion_zome['L_Diametre'] <= 0 ) - raise "L'angle ne peux pas être à 90" if ( $takion_zome['L_AngleDeForme'] == 90 ) - # - rescue - UI.messagebox $!.message - retry - end - if($takion_zome['T_Modelisation']=="Tubes") - begin - results_tubes = UI.inputbox ['Diamètre des Tubes'],[28.mm],[],'Modélisation Tubes' - return unless results_tubes - $takion_zome['L_TubesDiametre'] = results_tubes[0] - raise "Valeur non nulle requise" if ( $takion_zome['L_TubesDiametre'] <= 0 ) - rescue - UI.messagebox $!.message - retry - end - end - - start - - - msg = "" - - angle_forme = $takion_zome['L_AngleDeForme'].degrees - hypotenus = $takion_zome['L_Diametre']/2/PI - - sinus = cos(angle_forme) - cosinus = sin(angle_forme) - - retour1 = create_polarzonaedre(false,$takion_zome['N_Cotes'],$takion_zome['N_Niveaux'],sinus,cosinus,hypotenus) - - hypotenus *= $takion_zome['L_Diametre']/retour1[0] - retour2 = create_polarzonaedre(true,$takion_zome['N_Cotes'],$takion_zome['N_Niveaux'],sinus,cosinus,hypotenus) - - msg += "Bases: #{$takion_zome['N_Cotes']} \n" - msg += "Niveaux: #{$takion_zome['N_Niveaux']} \n" - msg += "Diamètre: #{$takion_zome['L_Diametre'].inch} \n" - msg += "Hauteur: #{retour2[1].inch} \n" - msg += "Angle de forme: #{angle_forme.radians} \n" - msg += "Arête: #{hypotenus.inch} \n" - msg += retour2[2] - add_note msg - ending - end - - def zome_dh - config = [ - ['N_Cotes',10,'Côtés de Révolution'], - ['N_Niveaux',5,'Niveaux en Hauteur'], - ['L_Diametre',6000.mm,'Diamètre au sol'], - ['L_Hauteur',3000.mm,'Hauteur au Sommet'], - ['T_Tirants','Aucun','Tirants',"Horizontaux|Aucun"], - ['L_RayonConnecteurs',150.mm,'Rayon des Connecteurs'], - ['T_Ground','Non','Sol',"Oui|Non"], - ['T_Modelisation','Squelette','Modélisation',"Squelette|Faces|Tubes"] - ] - $takion_zome = {} if not $takion_zome - 0.upto(config.length-1){ |i| - $takion_zome[config[i][0]] = config[i][1] if not $takion_zome[config[i][0]] - } - - results = nil - prompts = [] - defaults = [] - drops = [] - 0.upto(config.length-1){ |i| - defaults.push config[i][1] - prompts.push config[i][2] - if(config[i][3]) - drops.push config[i][3] - else - drops.push '' - end - } - begin - results = UI.inputbox prompts,defaults,drops,'RhombiZonaèdre Polaire sur Diamètre et Hauteur' - return unless results - 0.upto(config.length-1){ |i| - $takion_zome[config[i][0]] = results[i] - } - # - raise "Nombre de niveaux non nulle requis" if ( $takion_zome['N_Niveaux'] <= 0 ) - raise "Minimum 2 niveaux requis pour un Zome cohérent" if ( $takion_zome['N_Niveaux'] < 2 ) - raise "Nombre de côtés non nulle requis" if( $takion_zome['N_Cotes'] <= 0 ) - raise "Minimum 3 côtés pour un Zome cohérent" if ( $takion_zome['N_Cotes'] < 3 ) - raise "Diamètre non nulle requis" if ( $takion_zome['L_Diametre'] <= 0 ) - raise "Hauteur non nulle requise" if ( $takion_zome['L_Hauteur'] <= 0 ) - # - rescue - UI.messagebox $!.message - retry - end - if($takion_zome['T_Modelisation']=="Tubes") - begin - results_tubes = UI.inputbox ['Diamètre des Tubes'],[28.mm],[],'Modélisation Tubes' - return unless results_tubes - $takion_zome['L_TubesDiametre'] = results_tubes[0] - raise "Valeur non nulle requise" if ( $takion_zome['L_TubesDiametre'] <= 0 ) - rescue - UI.messagebox $!.message - retry - end - end - - start - - - msg = "" - - adjacent = $takion_zome['L_Hauteur']/$takion_zome['N_Niveaux'] - - oppose = $takion_zome['L_Diametre']/$takion_zome['N_Niveaux']/2 - hypotenus = sqrt(adjacent*adjacent + oppose*oppose) - sinus = oppose/hypotenus - cosinus = adjacent/hypotenus - retour1 = create_polarzonaedre(false,$takion_zome['N_Cotes'],$takion_zome['N_Niveaux'],sinus,cosinus,hypotenus) - ndiametre = $takion_zome['L_Diametre']*($takion_zome['L_Diametre']/retour1[0]) - - oppose = ndiametre/$takion_zome['N_Niveaux']/2 - hypotenus = sqrt(adjacent*adjacent + oppose*oppose) - sinus = oppose/hypotenus - cosinus = adjacent/hypotenus - retour2 = create_polarzonaedre(true,$takion_zome['N_Cotes'],$takion_zome['N_Niveaux'],sinus,cosinus,hypotenus) - - msg += "Bases: #{$takion_zome['N_Cotes']} \n" - msg += "Niveaux: #{$takion_zome['N_Niveaux']} \n" - msg += "Diamètre: #{$takion_zome['L_Diametre'].inch} \n" - msg += "Hauteur: #{$takion_zome['L_Hauteur'].inch} \n" - msg += "Arête: #{hypotenus.inch} \n" - # msg += "Angle de forme: #{asin(cosinus).radians} \n" - msg += "Angle de forme: #{acos(sinus).radians} \n" - msg += "Angle entre l'axe et l'arête du dernier niveaux: #{asin(sinus).radians} \n" - - msg += retour2[2] - - add_note msg - ending - end -end -end - -zomes_menu = UI.menu("Plugins").add_submenu("Zome") -zomes_menu.add_item("sur diametre et hauteur") { Takion::RhombiZonaedrePolaireFR.generation('zome_dh') } -zomes_menu.add_item("sur angle et arête") { Takion::RhombiZonaedrePolaireFR.generation('zome_al') } -zomes_menu.add_item("sur angle et hauteur") { Takion::RhombiZonaedrePolaireFR.generation('zome_ah') } -zomes_menu.add_item("sur angle et diametre") { Takion::RhombiZonaedrePolaireFR.generation('zomes_ad') } -file_loaded(File.basename(__FILE__))