Script: Fillet 3D Wire Blockly

Fillet 3D Wire Blockly picture
Type
Blockly logo indicatorblockly
Date Created
Mar 1, 2024, 8:52:25 AM
Last Edit Date
May 27, 2025, 8:30:45 PM

Project Information

In the latest v0.15.0 release we fixed and improved this algorithm. In this project we deomstrate how it works.

View Full Project

Script Code

<xml xmlns="https://developers.google.com/blockly/xml">
 <variables>
  <variable id="rIY|Dn)1QdvLLNjzZ-*s">nrRays</variable>
  <variable id="p9/Ol0L/L#bE:JI(5Uh(">innerFilletRadius</variable>
  <variable id=",/et5C|cK+]3NY:%_j!s">outerRadiusFillet</variable>
  <variable id="RwvX0OzX1if7fO7ld$02">filletIndexes</variable>
  <variable id="a(lnwdi|27GhEdWcHW6A">radiusList</variable>
  <variable id="!-qq?Skeyp+lFbio.xAj">i</variable>
  <variable id="+Hd9l5uqZXm),-4GGz(8">starPromise</variable>
  <variable id="/x:G{;(Y971beTaQkJiK">starFilletPromise</variable>
 </variables>
 <block type="base_time_async_context" id="YxFZMoXnK{qof?[PEd06" x="-1135" y="-1545">
  <statement name="Then">
   <block type="variables_set" id="mIW!g|4wdO#^;u5Zq,Bg">
    <field name="VAR" id="rIY|Dn)1QdvLLNjzZ-*s">nrRays</field>
    <value name="VALUE">
     <block type="math_number" id="|D^1y9]r/p$4Q@IjC*]C">
      <field name="NUM">7</field>
     </block>
    </value>
    <next>
     <block type="variables_set" id="M^46F(Y,V@J?#KLj}]`l">
      <field name="VAR" id="p9/Ol0L/L#bE:JI(5Uh(">innerFilletRadius</field>
      <value name="VALUE">
       <block type="math_number" id="UlK9he,QWWTw.Cs-3Y;6">
        <field name="NUM">1.7</field>
       </block>
      </value>
      <next>
       <block type="variables_set" id=",H5{}h^dRSW-jk}00xZ:">
        <field name="VAR" id=",/et5C|cK+]3NY:%_j!s">outerRadiusFillet</field>
        <value name="VALUE">
         <block type="math_number" id="L/BRmy2AWWM!%=^nUh]R">
          <field name="NUM">0.6</field>
         </block>
        </value>
        <next>
         <block type="variables_set" id="MsJpG.,g|.CUlJD)]Y/o">
          <field name="VAR" id="RwvX0OzX1if7fO7ld$02">filletIndexes</field>
          <value name="VALUE">
           <block type="bitbybit.vector.span" id="h2O.6?rtu$uPr.kS3P~!">
            <value name="Step">
             <block type="math_number" id="pgR`2W?heVbsRDNJU6d1">
              <field name="NUM">1</field>
             </block>
            </value>
            <value name="Min">
             <block type="math_number" id="{Ht{4jCLw%z`EnN_k9+%">
              <field name="NUM">1</field>
             </block>
            </value>
            <value name="Max">
             <block type="math_arithmetic" id="#Jf6RK@NFpYxoB$X1slN">
              <field name="OP">MULTIPLY</field>
              <value name="A">
               <block type="variables_get" id="*`%CG*n?{8Q|?cqJV{0,">
                <field name="VAR" id="rIY|Dn)1QdvLLNjzZ-*s">nrRays</field>
               </block>
              </value>
              <value name="B">
               <block type="math_number" id="jepAN[_k+sdevh!gg!6:">
                <field name="NUM">2</field>
               </block>
              </value>
             </block>
            </value>
           </block>
          </value>
          <next>
           <block type="bitbybit.babylon.scene.enableSkybox" id="O[b)*aCH_$R[mO5_mX;f">
            <value name="Skybox">
             <block type="bitbybit.babylon.enums.skyboxEnum" id="{?7Tk*UMbl#e74%m?PzJ">
              <field name="bitbybit.babylon.enums.skyboxEnum">'clearSky'</field>
             </block>
            </value>
            <value name="Size">
             <block type="math_number" id="CJ4(F7s0NZY/bR4tNW?.">
              <field name="NUM">1000</field>
             </block>
            </value>
            <value name="Blur">
             <block type="math_number" id="1$Gd/YcAr`;Kkj+tx8eY">
              <field name="NUM">0.1</field>
             </block>
            </value>
            <value name="EnvironmentIntensity">
             <block type="math_number" id="Uhab4WuGZpb$z1QRp-hv">
              <field name="NUM">0.7</field>
             </block>
            </value>
            <next>
             <block type="variables_set" id="{ijEYxx=TWzZfW)XpObP">
              <field name="VAR" id="a(lnwdi|27GhEdWcHW6A">radiusList</field>
              <value name="VALUE">
               <block type="lists_create_with" id="_qTuf/-.]Z|Csmx7EUkm">
                <mutation items="0">
                </mutation>
               </block>
              </value>
              <next>
               <block type="controls_for" id="Q8NjENy0~J;vHkMFSvhS">
                <field name="VAR" id="!-qq?Skeyp+lFbio.xAj">i</field>
                <value name="FROM">
                 <block type="math_number" id="ui9!X1P4UM3Q%$e%{Wsj">
                  <field name="NUM">1</field>
                 </block>
                </value>
                <value name="TO">
                 <block type="math_arithmetic" id="UA+zau%=ZdIvjS|Qe0SO">
                  <field name="OP">MULTIPLY</field>
                  <value name="A">
                   <block type="variables_get" id="Ss1dTGfVeQ8S^h(I8J;x">
                    <field name="VAR" id="rIY|Dn)1QdvLLNjzZ-*s">nrRays</field>
                   </block>
                  </value>
                  <value name="B">
                   <block type="math_number" id="9eUyo=dJGSA8lSj8uI2T">
                    <field name="NUM">2</field>
                   </block>
                  </value>
                 </block>
                </value>
                <value name="BY">
                 <block type="math_number" id="}QE#e*_[jLFgJUZjDrpd">
                  <field name="NUM">1</field>
                 </block>
                </value>
                <statement name="DO">
                 <block type="controls_if" id="34#(2r9o+-YDJIo[HoeH">
                  <mutation else="1">
                  </mutation>
                  <value name="IF0">
                   <block type="logic_compare" id="Sg5Ty54Pk==$IKp.@r#%">
                    <field name="OP">EQ</field>
                    <value name="A">
                     <block type="bitbybit.math.modulus" id="O3vJa+IuVxKe[VO]T#o6">
                      <value name="Number">
                       <block type="variables_get" id="IKG:jr%S;`i)m{Ah{B3e">
                        <field name="VAR" id="!-qq?Skeyp+lFbio.xAj">i</field>
                       </block>
                      </value>
                      <value name="Modulus">
                       <block type="math_number" id="xT4ZG(2MQiJ{Cp+;EXhP">
                        <field name="NUM">2</field>
                       </block>
                      </value>
                     </block>
                    </value>
                    <value name="B">
                     <block type="math_number" id="Imt|B7}Gs9~likazG2Oi">
                      <field name="NUM">0</field>
                     </block>
                    </value>
                   </block>
                  </value>
                  <statement name="DO0">
                   <block type="lists_setIndex" id="x7imOL2S2,9seB6y}{Ld">
                    <mutation at="false">
                    </mutation>
                    <field name="MODE">INSERT</field>
                    <field name="WHERE">LAST</field>
                    <value name="LIST">
                     <block type="variables_get" id="ki]/zxp0Qk-F_Yy*p9B%">
                      <field name="VAR" id="a(lnwdi|27GhEdWcHW6A">radiusList</field>
                     </block>
                    </value>
                    <value name="TO">
                     <block type="variables_get" id="#d[m.4:5@J$EbW{a~h^{">
                      <field name="VAR" id=",/et5C|cK+]3NY:%_j!s">outerRadiusFillet</field>
                     </block>
                    </value>
                   </block>
                  </statement>
                  <statement name="ELSE">
                   <block type="lists_setIndex" id="dn5}(iOiYE015pThzI4U">
                    <mutation at="false">
                    </mutation>
                    <field name="MODE">INSERT</field>
                    <field name="WHERE">LAST</field>
                    <value name="LIST">
                     <block type="variables_get" id="wwAR~H6MvEPe;`bLwb3D">
                      <field name="VAR" id="a(lnwdi|27GhEdWcHW6A">radiusList</field>
                     </block>
                    </value>
                    <value name="TO">
                     <block type="variables_get" id="uILL+)o%k2#goBe_a-q!">
                      <field name="VAR" id="p9/Ol0L/L#bE:JI(5Uh(">innerFilletRadius</field>
                     </block>
                    </value>
                   </block>
                  </statement>
                 </block>
                </statement>
                <next>
                 <block type="variables_set" id="w$A#9;ZuJs$@@5-u]Nu8">
                  <field name="VAR" id="+Hd9l5uqZXm),-4GGz(8">starPromise</field>
                  <value name="VALUE">
                   <block type="bitbybit.occt.shapes.wire.createStarWire" id="Ebv[zzO7~kL18Mc[%NMf">
                    <value name="Center">
                     <block type="bitbybit.point.pointXYZ" id=";5+zQQaM]k]P~2+}=dQd">
                      <value name="X">
                       <block type="math_number" id="U)IQ;dG)PY#d;F}Jlb]8">
                        <field name="NUM">0</field>
                       </block>
                      </value>
                      <value name="Y">
                       <block type="math_number" id="=^VM;4V/W8$kbQ{GO+{_">
                        <field name="NUM">0</field>
                       </block>
                      </value>
                      <value name="Z">
                       <block type="math_number" id="b(AyGHBm.72y#@ZwKr%j">
                        <field name="NUM">0</field>
                       </block>
                      </value>
                     </block>
                    </value>
                    <value name="Direction">
                     <block type="bitbybit.vector.vectorXYZ" id="@v;xLVTxvQs7Hw.C0rBj">
                      <value name="X">
                       <block type="math_number" id="-Gk9C29KzXPCuG4%I7iC">
                        <field name="NUM">0</field>
                       </block>
                      </value>
                      <value name="Y">
                       <block type="math_number" id="oI4cOrd#bR[G!)0XN4wm">
                        <field name="NUM">1</field>
                       </block>
                      </value>
                      <value name="Z">
                       <block type="math_number" id="@U8UBf.~_!cbuuy5pg0d">
                        <field name="NUM">0</field>
                       </block>
                      </value>
                     </block>
                    </value>
                    <value name="NumRays">
                     <block type="variables_get" id="1]d!Vhld]f^t]!f$k`LP">
                      <field name="VAR" id="rIY|Dn)1QdvLLNjzZ-*s">nrRays</field>
                     </block>
                    </value>
                    <value name="OuterRadius">
                     <block type="math_number" id=";]s@N~EDaP?X[FxiN,K^">
                      <field name="NUM">10</field>
                     </block>
                    </value>
                    <value name="InnerRadius">
                     <block type="math_number" id="*5`?bJ4LjQ|8:/9g)eMw">
                      <field name="NUM">4</field>
                     </block>
                    </value>
                    <value name="OffsetOuterEdges">
                     <block type="math_number" id="5^w5q4%6~9CHp`{;oEcL">
                      <field name="NUM">4</field>
                     </block>
                    </value>
                    <value name="Half">
                     <block type="logic_boolean" id=",QSI$H0HP-(i`C!t/ry]">
                      <field name="BOOL">FALSE</field>
                     </block>
                    </value>
                   </block>
                  </value>
                  <next>
                   <block type="variables_set" id="mWi4F%Q_|iM2zR}(A?{3">
                    <field name="VAR" id="/x:G{;(Y971beTaQkJiK">starFilletPromise</field>
                    <value name="VALUE">
                     <block type="bitbybit.occt.fillets.fillet3DWire" id="d8#IZ;nS+{;j$::lcV7P">
                      <value name="Shape">
                       <block type="variables_get" id="2=Wi@:n!Xmi$rpL~PFD0">
                        <field name="VAR" id="+Hd9l5uqZXm),-4GGz(8">starPromise</field>
                       </block>
                      </value>
                      <value name="RadiusList">
                       <block type="variables_get" id="vp]jdUZOp;o}%S=qE@:4">
                        <field name="VAR" id="a(lnwdi|27GhEdWcHW6A">radiusList</field>
                       </block>
                      </value>
                      <value name="Indexes">
                       <block type="variables_get" id="?%7XP$Hkn|qjMs#*zj7$">
                        <field name="VAR" id="RwvX0OzX1if7fO7ld$02">filletIndexes</field>
                       </block>
                      </value>
                      <value name="Direction">
                       <block type="bitbybit.vector.vectorXYZ" id="91JU{LIl`!(5wh]qm{GZ">
                        <value name="X">
                         <block type="math_number" id="Y#`eE{go~]%[~K)%=6#c">
                          <field name="NUM">0</field>
                         </block>
                        </value>
                        <value name="Y">
                         <block type="math_number" id="U?IET*#GY/k9yV{|26P:">
                          <field name="NUM">1</field>
                         </block>
                        </value>
                        <value name="Z">
                         <block type="math_number" id=".!zd5ec((7yx(@Q7iD5a">
                          <field name="NUM">0</field>
                         </block>
                        </value>
                       </block>
                      </value>
                     </block>
                    </value>
                    <next>
                     <block type="bitbybit.draw.drawAnyAsyncNoReturn" id="$i3o*mQXU%/_sO@xl}]g">
                      <value name="Entity">
                       <block type="variables_get" id="k:~5Cg[R94gN{E{GD*Am">
                        <field name="VAR" id="+Hd9l5uqZXm),-4GGz(8">starPromise</field>
                       </block>
                      </value>
                      <value name="Options">
                       <block type="bitbybit.draw.optionsOcctShapeSimple" id="NJ9Zwbbp5E@d+FCsUJ3%">
                        <value name="Precision">
                         <block type="math_number" id="gAbQ2A`}Tl-+YK9m)~ht">
                          <field name="NUM">0.01</field>
                         </block>
                        </value>
                        <value name="DrawFaces">
                         <block type="logic_boolean" id="E;5cCx:9K`_`g,)bO5!(">
                          <field name="BOOL">FALSE</field>
                         </block>
                        </value>
                        <value name="FaceColour">
                         <block type="colour_picker" id="Tss?4[%4!]EK[hw_brt9">
                          <field name="COLOUR">#ff0000</field>
                         </block>
                        </value>
                        <value name="DrawEdges">
                         <block type="logic_boolean" id="h_n=Pv918Q:P:5la+DV.">
                          <field name="BOOL">TRUE</field>
                         </block>
                        </value>
                        <value name="EdgeColour">
                         <block type="colour_picker" id="BU-xP%@7wo;gi/yeLQ}V">
                          <field name="COLOUR">#ffffff</field>
                         </block>
                        </value>
                        <value name="EdgeWidth">
                         <block type="math_number" id="{`Wm:.sX3l6X+0*JC7r$">
                          <field name="NUM">15</field>
                         </block>
                        </value>
                       </block>
                      </value>
                      <next>
                       <block type="bitbybit.draw.drawAnyAsyncNoReturn" id="hMYIY{dn1|e095?ZFIse">
                        <value name="Entity">
                         <block type="bitbybit.occt.transforms.translate" id="RmhL@P6gQ_;kg).V1?$4">
                          <value name="Shape">
                           <block type="variables_get" id="=^@vD6[hAtimj$awb,0M">
                            <field name="VAR" id="/x:G{;(Y971beTaQkJiK">starFilletPromise</field>
                           </block>
                          </value>
                          <value name="Translation">
                           <block type="bitbybit.vector.vectorXYZ" id="sf^;7*(S-^LY95fF0##q">
                            <value name="X">
                             <block type="math_number" id="=`*Xz/PGy4x%O^)5P.up">
                              <field name="NUM">0</field>
                             </block>
                            </value>
                            <value name="Y">
                             <block type="math_number" id="|JN+SPG}tYi8qdY2Zp!e">
                              <field name="NUM">5</field>
                             </block>
                            </value>
                            <value name="Z">
                             <block type="math_number" id="mfw(QoT!JfaPbgPPGQM^">
                              <field name="NUM">0</field>
                             </block>
                            </value>
                           </block>
                          </value>
                         </block>
                        </value>
                        <value name="Options">
                         <block type="bitbybit.draw.optionsOcctShapeSimple" id="s~Rg[1?%c3Q7=B%y+q%p">
                          <value name="Precision">
                           <block type="math_number" id="y|uw;5ds=^_Ik3A,?vsz">
                            <field name="NUM">0.01</field>
                           </block>
                          </value>
                          <value name="DrawFaces">
                           <block type="logic_boolean" id="=Mi)gm/)m0R;G;/a4VOb">
                            <field name="BOOL">FALSE</field>
                           </block>
                          </value>
                          <value name="FaceColour">
                           <block type="colour_picker" id="}!l~fdJqR87$[vR7ku^$">
                            <field name="COLOUR">#ff0000</field>
                           </block>
                          </value>
                          <value name="DrawEdges">
                           <block type="logic_boolean" id="u5bpZ;**L{-7L1F2nU9L">
                            <field name="BOOL">TRUE</field>
                           </block>
                          </value>
                          <value name="EdgeColour">
                           <block type="colour_picker" id="%6n{;A_R~ENS]tup`kNF">
                            <field name="COLOUR">#ffffff</field>
                           </block>
                          </value>
                          <value name="EdgeWidth">
                           <block type="math_number" id=";[`bQ0X=n$(|ECXV}bV(">
                            <field name="NUM">15</field>
                           </block>
                          </value>
                         </block>
                        </value>
                        <next>
                         <block type="bitbybit.draw.drawAnyAsyncNoReturn" id=":LORr]JWID{]nh.@d(,o">
                          <value name="Entity">
                           <block type="bitbybit.occt.fillets.filletEdges" id="a[/9-iB:/ER^nZ1rZ0L~">
                            <value name="Shape">
                             <block type="bitbybit.occt.operations.makeThickSolidSimple" id="[-;z]vFLEOM{Sc|@$0#g">
                              <value name="Shape">
                               <block type="bitbybit.occt.shapes.face.createFaceFromWire" id="b%z{#XU;:/f#G2wl;3Bo">
                                <value name="Shape">
                                 <block type="bitbybit.occt.transforms.translate" id="(Z|o@u|1%obSX#$M3-22">
                                  <value name="Shape">
                                   <block type="variables_get" id=",$7fiU1MnXzG*:b2[N^%">
                                    <field name="VAR" id="/x:G{;(Y971beTaQkJiK">starFilletPromise</field>
                                   </block>
                                  </value>
                                  <value name="Translation">
                                   <block type="bitbybit.vector.vectorXYZ" id="Wj*!tEsvN_}0ydA+DNVE">
                                    <value name="X">
                                     <block type="math_number" id="b*XdDPBj@ilcfbV,T,O(">
                                      <field name="NUM">0</field>
                                     </block>
                                    </value>
                                    <value name="Y">
                                     <block type="math_number" id="sGf_ba{bOU^Z70*ch9fM">
                                      <field name="NUM">10</field>
                                     </block>
                                    </value>
                                    <value name="Z">
                                     <block type="math_number" id="OF@-M}~,sEvgiPaqU|!~">
                                      <field name="NUM">0</field>
                                     </block>
                                    </value>
                                   </block>
                                  </value>
                                 </block>
                                </value>
                                <value name="Planar">
                                 <block type="logic_boolean" id="[@.?a~Iq5FnB51bQhRK$">
                                  <field name="BOOL">FALSE</field>
                                 </block>
                                </value>
                               </block>
                              </value>
                              <value name="Offset">
                               <block type="math_number" id="zyfsf%)@;)S*G:B3$1ly">
                                <field name="NUM">-1</field>
                               </block>
                              </value>
                             </block>
                            </value>
                            <value name="Radius">
                             <block type="math_number" id="?blPv*38`9tpU16vQ7*)">
                              <field name="NUM">0.3</field>
                             </block>
                            </value>
                           </block>
                          </value>
                          <value name="Options">
                           <block type="bitbybit.draw.optionsOcctShapeSimple" id="!#5Oh,X[g?|D;fAQr,I~">
                            <value name="Precision">
                             <block type="math_number" id="PJF%x5dJ[EWT1!l+ub^t">
                              <field name="NUM">0.005</field>
                             </block>
                            </value>
                            <value name="DrawFaces">
                             <block type="logic_boolean" id="KOB19PY9BdKNRW,[:y(u">
                              <field name="BOOL">TRUE</field>
                             </block>
                            </value>
                            <value name="FaceColour">
                             <block type="colour_picker" id="1bkOh~Z![kQfnc7.NbZ|">
                              <field name="COLOUR">#3333ff</field>
                             </block>
                            </value>
                            <value name="DrawEdges">
                             <block type="logic_boolean" id="/Q+RreGEh,_J06*ei^Y1">
                              <field name="BOOL">TRUE</field>
                             </block>
                            </value>
                            <value name="EdgeColour">
                             <block type="colour_picker" id="StzHgk@*RS.(#(HC#Wz+">
                              <field name="COLOUR">#000000</field>
                             </block>
                            </value>
                            <value name="EdgeWidth">
                             <block type="math_number" id="=pk:t:.)*Q0^xr!Rz-L!">
                              <field name="NUM">2</field>
                             </block>
                            </value>
                           </block>
                          </value>
                          <next>
                           <block type="bitbybit.draw.drawGridMeshNoReturn" id="{HVY~,_B0[W)P(-qB-_+">
                            <value name="Width">
                             <block type="math_number" id="xt~XJ$W;kaMy;54RWS!n">
                              <field name="NUM">400</field>
                             </block>
                            </value>
                            <value name="Height">
                             <block type="math_number" id="S~m]^!m0Az~:v6Fx$~~x">
                              <field name="NUM">400</field>
                             </block>
                            </value>
                            <value name="Subdivisions">
                             <block type="math_number" id="08d*gPz@%fzqJ0=l)=M`">
                              <field name="NUM">10</field>
                             </block>
                            </value>
                            <value name="MajorUnitFrequency">
                             <block type="math_number" id="at)keE8=K.+hXDF_[]eD">
                              <field name="NUM">10</field>
                             </block>
                            </value>
                            <value name="MinorUnitVisibility">
                             <block type="math_number" id="{!BWdg)-ML.JG4W4SsK7">
                              <field name="NUM">0.45</field>
                             </block>
                            </value>
                            <value name="GridRatio">
                             <block type="math_number" id="3+2x$n,%:n5W-dW3^EV!">
                              <field name="NUM">0.5</field>
                             </block>
                            </value>
                            <value name="Opacity">
                             <block type="math_number" id="F^/POR!mOH]P!Xqyw;8E">
                              <field name="NUM">0.5</field>
                             </block>
                            </value>
                            <value name="BackFaceCulling">
                             <block type="logic_boolean" id="?)UzlLqsI1gf6kA!?)qx">
                              <field name="BOOL">FALSE</field>
                             </block>
                            </value>
                            <value name="MainColor">
                             <block type="colour_picker" id="]HWZ?VH{)=iqMuHwI]yi">
                              <field name="COLOUR">#ffffff</field>
                             </block>
                            </value>
                            <value name="SecondaryColor">
                             <block type="colour_picker" id="I_dxNk=+2*LGoG;2tJ]1">
                              <field name="COLOUR">#ffffff</field>
                             </block>
                            </value>
                           </block>
                          </next>
                         </block>
                        </next>
                       </block>
                      </next>
                     </block>
                    </next>
                   </block>
                  </next>
                 </block>
                </next>
               </block>
              </next>
             </block>
            </next>
           </block>
          </next>
         </block>
        </next>
       </block>
      </next>
     </block>
    </next>
   </block>
  </statement>
 </block>
</xml>