Script
Example in Blockly

- Project
- Parametric lamp hood model
- Author
- bitbybit
- Created
- Mar 19, 2021, 10:05:56 AM
- Last edit
- Dec 5, 2023, 5:59:57 PM
Project
Parametric lamp hood model
This example demonstrates how parametric 3D model can be produced by using NURBS framework and CAD features of BitByBit platform. Parametric lamp model can also be saved to STL format and 3D printed.
View full projectScript code
<xml xmlns="https://developers.google.com/blockly/xml">
<variables>
<variable id="N+OhQF.Iia4:Zg0N)%[,">nrOfVerticalIsocurves</variable>
<variable id="`rGxYcbVI.oS!$wrnB;O">isocurveSubdivisions</variable>
<variable id="#1VT~LWG}andi//SIAde">verticalIsocurveRadius</variable>
<variable id="GM,7CmJ+1T{mog[#ic[$">downloadSTL</variable>
<variable id="=7(e`jknDQ|=M9C!RJ!9">profiles</variable>
<variable id="X#Wwsa#N(fG$9#K/+QaM">nurbsSurface</variable>
<variable id="p;`._Gi!_0FzRkUxmp[u">allIsoCurves</variable>
<variable id="D(6~p}*4[LyQm#uLmfss">hullSolids</variable>
<variable id="BTM;`6Kyoye/)kCNT`TN">i</variable>
<variable id="pxdVC9I{WZ@nr@!-C`E{">isocurvePoints</variable>
</variables>
<block type="variables_set" id="kzR5FGIm=.80e^rK{MIM" x="-3698" y="-1325">
<field name="VAR" id="N+OhQF.Iia4:Zg0N)%[,">nrOfVerticalIsocurves</field>
<value name="VALUE">
<block type="math_number" id="KM+r!C*$6,xE#H:(Gh6t">
<field name="NUM">70</field>
</block>
</value>
<next>
<block type="variables_set" id="Jq)vWOS)|58|BdWL#9IP">
<field name="VAR" id="`rGxYcbVI.oS!$wrnB;O">isocurveSubdivisions</field>
<value name="VALUE">
<block type="math_number" id=",_L]DyUR?;0:Y|/$8e1y">
<field name="NUM">41</field>
</block>
</value>
<next>
<block type="variables_set" id=",Pan_.b-oq]O-`aBm2ie">
<field name="VAR" id="#1VT~LWG}andi//SIAde">verticalIsocurveRadius</field>
<value name="VALUE">
<block type="math_number" id="Qk@!VId.,6-e7Bob)-J^">
<field name="NUM">0.1</field>
</block>
</value>
<next>
<block type="variables_set" id="F5S@x1MVhEq52aw}2GWH">
<field name="VAR" id="GM,7CmJ+1T{mog[#ic[$">downloadSTL</field>
<value name="VALUE">
<block type="logic_boolean" id="@cG1ck/WBVZe@};#m398">
<field name="BOOL">FALSE</field>
</block>
</value>
<next>
<block type="variables_set" id="Uj7cl]zU~gmEMg!EXHBk">
<field name="VAR" id="=7(e`jknDQ|=M9C!RJ!9">profiles</field>
<value name="VALUE">
<block type="lists_create_with" id="%E~Ad~t-tt!*n/UtA85m">
<mutation items="5">
</mutation>
<value name="ADD0">
<block type="bitbybit.verb.curve.ellipse.createEllipse" id="6)N5-?2?c/XNu/%wA_hc">
<value name="XAxis">
<block type="bitbybit.point.pointXYZ" id="tVCxw%xt0U_^/)8l%CSG">
<value name="X">
<block type="math_number" id="DP*w|9?y7FfDH]a_xEjX">
<field name="NUM">2</field>
</block>
</value>
<value name="Y">
<block type="math_number" id="CTrTHC|MiG3hFKS0SJ)s">
<field name="NUM">-0.5</field>
</block>
</value>
<value name="Z">
<block type="math_number" id="{Bj`)*/FL9iti#[VfR;-">
<field name="NUM">0</field>
</block>
</value>
</block>
</value>
<value name="YAxis">
<block type="bitbybit.point.pointXYZ" id="xID8)W~(;@_u0T98;D@U">
<value name="X">
<block type="math_number" id="L=LrWIZJES`!{_TZ/o`T">
<field name="NUM">0</field>
</block>
</value>
<value name="Y">
<block type="math_number" id="O%fqdd.p]TcP;^N3ufN1">
<field name="NUM">-0.5</field>
</block>
</value>
<value name="Z">
<block type="math_number" id="|el@8GV~(RLBF+P`Q3.9">
<field name="NUM">2</field>
</block>
</value>
</block>
</value>
<value name="Center">
<block type="bitbybit.point.pointXYZ" id="|j}}4X`R9)V|R)-dJnEN">
<value name="X">
<block type="math_number" id="blI3vtvOV~$r+aIrP$Bc">
<field name="NUM">0</field>
</block>
</value>
<value name="Y">
<block type="math_number" id="12_c9QsV0|cV97-Z=xB~">
<field name="NUM">0</field>
</block>
</value>
<value name="Z">
<block type="math_number" id="=~E;:d*[+1P%Mh{e4!PD">
<field name="NUM">0</field>
</block>
</value>
</block>
</value>
</block>
</value>
<value name="ADD1">
<block type="bitbybit.verb.curve.ellipse.createEllipse" id="4[OUk1,}hFN1WHs#C~_d">
<value name="XAxis">
<block type="bitbybit.point.pointXYZ" id="i#3}5Sro~f4}j/PqB^Xx">
<value name="X">
<block type="math_number" id=",L9cT5*Zjj!wfZ{fjGBx">
<field name="NUM">2</field>
</block>
</value>
<value name="Y">
<block type="math_number" id="?{hYO*hKVip+A7=2|9*{">
<field name="NUM">0</field>
</block>
</value>
<value name="Z">
<block type="math_number" id="RI~J]D%^fu=x+l%@Ma|,">
<field name="NUM">0</field>
</block>
</value>
</block>
</value>
<value name="YAxis">
<block type="bitbybit.point.pointXYZ" id="FKL)3~S%lAN|b8yE~_E3">
<value name="X">
<block type="math_number" id="G~jxJW8#MOEjy,MQ#jpU">
<field name="NUM">0</field>
</block>
</value>
<value name="Y">
<block type="math_number" id="{Kd5EB@{[0b,w?N-g@=i">
<field name="NUM">0</field>
</block>
</value>
<value name="Z">
<block type="math_number" id="__SI@iPX:d.e527%=~pj">
<field name="NUM">4</field>
</block>
</value>
</block>
</value>
<value name="Center">
<block type="bitbybit.point.pointXYZ" id="27UErwEojRKfavC#Eeil">
<value name="X">
<block type="math_number" id="[xL%]WV@ia6afP1}WqWL">
<field name="NUM">0</field>
</block>
</value>
<value name="Y">
<block type="math_number" id="SOTV~Hb1NI:iX70J,`!{">
<field name="NUM">3</field>
</block>
</value>
<value name="Z">
<block type="math_number" id="bMqbe[[]%d)16?KwIyRx">
<field name="NUM">0</field>
</block>
</value>
</block>
</value>
</block>
</value>
<value name="ADD2">
<block type="bitbybit.verb.curve.ellipse.createEllipse" id=":a7}ul_TwvI![:h5*f-}">
<value name="XAxis">
<block type="bitbybit.point.pointXYZ" id="QlFJ;3|jrlO:$ZzA}Nm8">
<value name="X">
<block type="math_number" id="}4xm#`.s2!%/BdNl8I%i">
<field name="NUM">4</field>
</block>
</value>
<value name="Y">
<block type="math_number" id="/R1=0T8n}PRfl;F!i)y5">
<field name="NUM">0</field>
</block>
</value>
<value name="Z">
<block type="math_number" id="{I;_~cW3Fb!TN04D_+y@">
<field name="NUM">0</field>
</block>
</value>
</block>
</value>
<value name="YAxis">
<block type="bitbybit.point.pointXYZ" id="7$r{P|jfe1?*0Ptp,Cyg">
<value name="X">
<block type="math_number" id="%8fzmRnbW}BsFQyN;EP]">
<field name="NUM">0</field>
</block>
</value>
<value name="Y">
<block type="math_number" id="w`RR]v1U`Lg}iXIFrY}u">
<field name="NUM">0</field>
</block>
</value>
<value name="Z">
<block type="math_number" id=".tV.QEwnblsFf$Fi$4/8">
<field name="NUM">2</field>
</block>
</value>
</block>
</value>
<value name="Center">
<block type="bitbybit.point.pointXYZ" id="5qa8yk^/wXunnf0Cv8Sd">
<value name="X">
<block type="math_number" id="T3I/0%A[CaKj6)s,Kp;_">
<field name="NUM">0</field>
</block>
</value>
<value name="Y">
<block type="math_number" id="ewf_c83c:t(Aptq=^=yd">
<field name="NUM">6</field>
</block>
</value>
<value name="Z">
<block type="math_number" id="o-jtvJOgo{IWS{x1|3ko">
<field name="NUM">0</field>
</block>
</value>
</block>
</value>
</block>
</value>
<value name="ADD3">
<block type="bitbybit.verb.curve.ellipse.createEllipse" id="VAc+_L2}rtHe;MuUVyCX">
<value name="XAxis">
<block type="bitbybit.point.pointXYZ" id="pyK~Bjef7q=D3{qMZ.Bg">
<value name="X">
<block type="math_number" id="w^a]$3x95cGgo09)XK6^">
<field name="NUM">1</field>
</block>
</value>
<value name="Y">
<block type="math_number" id="L!(SnPD@wgK].{1|.q4~">
<field name="NUM">0</field>
</block>
</value>
<value name="Z">
<block type="math_number" id="71FIe#F-o$IJ1^#.RC+/">
<field name="NUM">0</field>
</block>
</value>
</block>
</value>
<value name="YAxis">
<block type="bitbybit.point.pointXYZ" id="v[Urz6i(yUtb)geZ!uw/">
<value name="X">
<block type="math_number" id="Q*;DDDeEX$:[JS`Kb`$Q">
<field name="NUM">0</field>
</block>
</value>
<value name="Y">
<block type="math_number" id="H$+Mg:vp]UjFd+JMet+k">
<field name="NUM">0</field>
</block>
</value>
<value name="Z">
<block type="math_number" id="V86Gm44sdV3Gf4$l;Ymz">
<field name="NUM">2</field>
</block>
</value>
</block>
</value>
<value name="Center">
<block type="bitbybit.point.pointXYZ" id=",@IS{:XCd!h(Sgr|d4J/">
<value name="X">
<block type="math_number" id="iV3`a_/E^{BU2Z9k~[YU">
<field name="NUM">0</field>
</block>
</value>
<value name="Y">
<block type="math_number" id="duQr3Z_r(2$D:L+.xsG+">
<field name="NUM">12</field>
</block>
</value>
<value name="Z">
<block type="math_number" id="slq=F+6A;EQ3v[Cd-M}P">
<field name="NUM">0</field>
</block>
</value>
</block>
</value>
</block>
</value>
<value name="ADD4">
<block type="bitbybit.verb.curve.ellipse.createEllipse" id="uQ@`n(SJnvGM]Uy$LExM">
<value name="XAxis">
<block type="bitbybit.point.pointXYZ" id="QPjYRjo@Ycg#gk+;z%UH">
<value name="X">
<block type="math_number" id="Am*|P+-,vX!Fl{7g{kxN">
<field name="NUM">2</field>
</block>
</value>
<value name="Y">
<block type="math_number" id="w)]XZDSGV|:9b3Cn[+$I">
<field name="NUM">0.5</field>
</block>
</value>
<value name="Z">
<block type="math_number" id="`=*;y_d#$Z[hBK]Sa_~Q">
<field name="NUM">0</field>
</block>
</value>
</block>
</value>
<value name="YAxis">
<block type="bitbybit.point.pointXYZ" id="3QyA0r]s]jmmr(V,yhgJ">
<value name="X">
<block type="math_number" id="qZLxLvI95rz|.zljaQS-">
<field name="NUM">0</field>
</block>
</value>
<value name="Y">
<block type="math_number" id="/9GoW_$z?n:]ftF0x_iZ">
<field name="NUM">0.5</field>
</block>
</value>
<value name="Z">
<block type="math_number" id="u]BdgY|~#fuWLUbz6v)y">
<field name="NUM">2</field>
</block>
</value>
</block>
</value>
<value name="Center">
<block type="bitbybit.point.pointXYZ" id="[3ZY;)mZo4[[W1|$i;`x">
<value name="X">
<block type="math_number" id="-wt;p;/Or%f)nRLnBUod">
<field name="NUM">0</field>
</block>
</value>
<value name="Y">
<block type="math_number" id="vf}s+|G.gxSPpf,v]N[-">
<field name="NUM">16</field>
</block>
</value>
<value name="Z">
<block type="math_number" id="7Zr+D^T[eROU8HC2,dgV">
<field name="NUM">0</field>
</block>
</value>
</block>
</value>
</block>
</value>
</block>
</value>
<next>
<block type="variables_set" id="V4)u%{D*$f+9cpy3vSCJ">
<field name="VAR" id="X#Wwsa#N(fG$9#K/+QaM">nurbsSurface</field>
<value name="VALUE">
<block type="bitbybit.verb.surface.createSurfaceByLoftingCurves" id="?vb|69^V!Y8323@(Aj{]">
<value name="DegreeV">
<block type="math_number" id="[N_V5o@(UAHPI`Y67{8[">
<field name="NUM">3</field>
</block>
</value>
<value name="Curves">
<block type="variables_get" id="V?7p)BP`fX#ugvjQ`z=S">
<field name="VAR" id="=7(e`jknDQ|=M9C!RJ!9">profiles</field>
</block>
</value>
</block>
</value>
<next>
<block type="variables_set" id=":oxp_eQ@bGwc+bHo+n+t">
<field name="VAR" id="p;`._Gi!_0FzRkUxmp[u">allIsoCurves</field>
<value name="VALUE">
<block type="bitbybit.verb.surface.isocurvesSubdivision" id="+mc{R]Vu/I1we~bYJsj-">
<value name="Surface">
<block type="variables_get" id="W.d$R.^cs_Mf-Ce0(+r5">
<field name="VAR" id="X#Wwsa#N(fG$9#K/+QaM">nurbsSurface</field>
</block>
</value>
<value name="UseV">
<block type="logic_boolean" id="G0fBLDKv6R%*7)9}pYK4">
<field name="BOOL">FALSE</field>
</block>
</value>
<value name="IncludeLast">
<block type="logic_boolean" id="I;K2HS?g:4|71}pI{F7,">
<field name="BOOL">TRUE</field>
</block>
</value>
<value name="IncludeFirst">
<block type="logic_boolean" id="1(fqHLpj{E1!S?APe*4F">
<field name="BOOL">TRUE</field>
</block>
</value>
<value name="IsocurveSegments">
<block type="variables_get" id="$IvQ]GZ_9M0y0$.N3+Fi">
<field name="VAR" id="N+OhQF.Iia4:Zg0N)%[,">nrOfVerticalIsocurves</field>
</block>
</value>
</block>
</value>
<next>
<block type="variables_set" id="kK-hBDf{6hsl`}`s}zJo">
<field name="VAR" id="D(6~p}*4[LyQm#uLmfss">hullSolids</field>
<value name="VALUE">
<block type="lists_create_with" id="hbqduUd2F;Y-z0wByzP@">
<mutation items="0">
</mutation>
</block>
</value>
<next>
<block type="controls_forEach" id=";bW;c%O.x7-wxPW?=.)/">
<field name="VAR" id="BTM;`6Kyoye/)kCNT`TN">i</field>
<value name="LIST">
<block type="variables_get" id="zEy,#Jh5C4]Eaxu0k^$A">
<field name="VAR" id="p;`._Gi!_0FzRkUxmp[u">allIsoCurves</field>
</block>
</value>
<statement name="DO">
<block type="variables_set" id="W6tzT;N}L{JmQ37T*L;i">
<field name="VAR" id="pxdVC9I{WZ@nr@!-C`E{">isocurvePoints</field>
<value name="VALUE">
<block type="bitbybit.verb.curve.divideByEqualArcLengthToPoints" id="){~CHl5k1%dL^g:{/(x-">
<value name="Curve">
<block type="variables_get" id="Weej9E{+aX5.Qy2(21`D">
<field name="VAR" id="BTM;`6Kyoye/)kCNT`TN">i</field>
</block>
</value>
<value name="Subdivision">
<block type="variables_get" id="-BHQR{jPOs=AKLI)4Md7">
<field name="VAR" id="`rGxYcbVI.oS!$wrnB;O">isocurveSubdivisions</field>
</block>
</value>
</block>
</value>
<next>
<block type="lists_setIndex" id="O3_hO5U)6w%NK,rN)Bh5">
<mutation at="false">
</mutation>
<field name="MODE">INSERT</field>
<field name="WHERE">LAST</field>
<value name="LIST">
<block type="variables_get" id="Cw![+1lQk~=r=Rv$ZCDp">
<field name="VAR" id="D(6~p}*4[LyQm#uLmfss">hullSolids</field>
</block>
</value>
<value name="TO">
<block type="bitbybit.jscad.hulls.hullChain" id="Cz{lfxa;YH:_^stNxXuU">
<value name="Meshes">
<block type="bitbybit.jscad.shapes.spheresOnCenterPoints" id="Qn$qe~}Aq|Vv2C%oiaUN">
<value name="Centers">
<block type="variables_get" id="g]SP9pj8QN*!##vP;vG[">
<field name="VAR" id="pxdVC9I{WZ@nr@!-C`E{">isocurvePoints</field>
</block>
</value>
<value name="Radius">
<block type="variables_get" id="xej[Bb~B8acdccs1+*9^">
<field name="VAR" id="#1VT~LWG}andi//SIAde">verticalIsocurveRadius</field>
</block>
</value>
<value name="Segments">
<block type="math_number" id="zQ~/(=bE7:jgT1K!lXSf">
<field name="NUM">4</field>
</block>
</value>
</block>
</value>
</block>
</value>
</block>
</next>
</block>
</statement>
<next>
<block type="bitbybit.draw.drawAnyAsyncNoReturn" id="mMp3u`Cje~6feqd`lyg8">
<value name="Entity">
<block type="variables_get" id="7zg9o?#Zj[h([Fc!)3:|">
<field name="VAR" id="D(6~p}*4[LyQm#uLmfss">hullSolids</field>
</block>
</value>
<value name="Options">
<block type="bitbybit.draw.optionsSimple" id="+%KCaWn09]x2$wh`wZbS">
<value name="Colours">
<block type="colour_picker" id="2H1S7B/]`F+xgBO8VMdX">
<field name="COLOUR">#ffffff</field>
</block>
</value>
<value name="Size">
<block type="math_number" id="D`IW^d0s4uB:5NfK%+Qh">
<field name="NUM">3</field>
</block>
</value>
<value name="Opacity">
<block type="math_number" id="06{r0wF,z_Tv77}3yE]U">
<field name="NUM">1</field>
</block>
</value>
<value name="Updatable">
<block type="logic_boolean" id="Ls8gL)A^k#*a?~BAq9qp">
<field name="BOOL">FALSE</field>
</block>
</value>
</block>
</value>
<next>
<block type="controls_if" id="aBi6C;%V4=+^`SxYk9@}">
<value name="IF0">
<block type="variables_get" id="Ddf,NM}!9)nuvzR2O3ip">
<field name="VAR" id="GM,7CmJ+1T{mog[#ic[$">downloadSTL</field>
</block>
</value>
<statement name="DO0">
<block type="bitbybit.jscad.downloadSolidsSTL" id="ZbJ|gyrZ:S^Yjlp=0.(:">
<value name="Meshes">
<block type="variables_get" id="[7Srqr8|dn`Xaa(Pi-bG">
<field name="VAR" id="D(6~p}*4[LyQm#uLmfss">hullSolids</field>
</block>
</value>
<value name="FileName">
<block type="text" id=",?XA6rs7}wF$lMf3jiU$">
<field name="TEXT">bitbybit-parametric-lamp</field>
</block>
</value>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</xml>
