<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>Pass Module name in variable to other (generic) module ?</title>
        <description> Can I call a module () with the name of another module as a parameter ?

for instance, to cut-off everything below z=0, I difference the object with a cube that is below z=0. 
If I make a generic cut-off module, I could call that one, supply the name of the object module and it will cut the remainder off.

i have more idea&#039;s to process other modules ... for instance, punch a hole in them, this way.

Can this be done ?

Thomas</description>
        <link>https://reprap.org/forum/read.php?313,739123,739123#msg-739123</link>
        <lastBuildDate>Sat, 18 Jul 2026 23:09:47 -0400</lastBuildDate>
        <generator>Phorum 5.2.23</generator>
        <item>
            <guid>https://reprap.org/forum/read.php?313,739123,739718#msg-739718</guid>
            <title>Re: Pass Module name in variable to other (generic) module ?</title>
            <link>https://reprap.org/forum/read.php?313,739123,739718#msg-739718</link>
            <description><![CDATA[ OpenScad's <a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/User-Defined_Functions_and_Modules#Children" target="_blank"  rel="nofollow"><i>children()</i></a> will execute all or some of the constructs which follow the module call.  For more than one "child", the "children" are surrounded by brackets.  So, looked at from this point of view, the standard <i>difference()</i> is actually subtracting <i>children([1:$children-1])</i> from <i>children(0)</i>.]]></description>
            <dc:creator>enif</dc:creator>
            <category>OpenSCAD</category>
            <pubDate>Tue, 17 Jan 2017 13:19:06 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?313,739123,739694#msg-739694</guid>
            <title>Re: Pass Module name in variable to other (generic) module ?</title>
            <link>https://reprap.org/forum/read.php?313,739123,739694#msg-739694</link>
            <description><![CDATA[ Ahh,<br />
nice solution.  Definitely gonna do that stuff. <br />
<br />
So 'Children' is in fact the united instructions you perform a function on ?<br />
Or do I miss it ?]]></description>
            <dc:creator>Replace</dc:creator>
            <category>OpenSCAD</category>
            <pubDate>Tue, 17 Jan 2017 12:24:13 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?313,739123,739225#msg-739225</guid>
            <title>Re: Pass Module name in variable to other (generic) module ?</title>
            <link>https://reprap.org/forum/read.php?313,739123,739225#msg-739225</link>
            <description><![CDATA[ I doubt that there is any way in OpenScad to pass the name of a module to be called as a parameter.<br />
<br />
However, OpenScad has probably an even better alternative: the concept of <i>children</i>!<br />
<br />
So you can easily create a module such as e.g.:<br />
<pre class="bbcode">
module cutbelow(z=0,max=100){
   difference(){
     children();
     translate([-max,-max,z-max])cube([2*max,2*max,max]);
   }
}</pre>
<br />
which will take whatever follows and cut away everything below z=0 (or whatever z value is specified), such as<br />
<pre class="bbcode">
cutbelow()sphere(r=20);</pre>
<br />
or<br />
<br />
<pre class="bbcode">
cutbelow(z=-5)rotate([45,0,0])cylinder(r=20,h=40);</pre>
<br />
<div id="div_3d8e2d6bbb483dce50e89b3d6fd5dc72"
     class="mod_embed_images_extended"
     style="width:494px">

  

    
      
    

    <div id="imagediv_3d8e2d6bbb483dce50e89b3d6fd5dc72" class="mod_embed_images_image"
         style="width:494px; height:400px">

    

    <a href="http://forums.reprap.org/file.php?313,file=88991,filename=cutbelow.png">
        <img src="/forum/thumbcache/509/a5d/468/4bd/e1f/362/fd9/689/39e/976/b4_800x400.png"
             width="494"
             height="400"
             id="image_3d8e2d6bbb483dce50e89b3d6fd5dc72"
             alt=""
             title=""/>
    </a>

    

    </div>

    <div class="mod_embed_images_info " id="info_3d8e2d6bbb483dce50e89b3d6fd5dc72"
      style="display:block">
      <a id="link_3d8e2d6bbb483dce50e89b3d6fd5dc72" href="http://forums.reprap.org/file.php?313,file=88991,filename=cutbelow.png"></a>
    </div>

  

 </div>


<script type="text/javascript">
mod_embed_images_loadimage('3d8e2d6bbb483dce50e89b3d6fd5dc72', '/forum/thumbcache/509/a5d/468/4bd/e1f/362/fd9/689/39e/976/b4_800x400.png', 'http://forums.reprap.org/file.php?313,file=88991,filename=cutbelow.png', 'https://reprap.org/forum/addon.php?313,module=embed_images,check_scaling=1,url=http%3A%2F%2Fforums.reprap.org%2Ffile.php%3F313%2Cfile%3D88991%2Cfilename%3Dcutbelow.png', '', 739225, 800, 400, 'Loading image ...', false);
</script>
<br/>]]></description>
            <dc:creator>enif</dc:creator>
            <category>OpenSCAD</category>
            <pubDate>Mon, 16 Jan 2017 03:37:06 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?313,739123,739123#msg-739123</guid>
            <title>Pass Module name in variable to other (generic) module ?</title>
            <link>https://reprap.org/forum/read.php?313,739123,739123#msg-739123</link>
            <description><![CDATA[ Can I call a module () with the name of another module as a parameter ?<br />
<br />
for instance, to cut-off everything below z=0, I difference the object with a cube that is below z=0. <br />
If I make a generic cut-off module, I could call that one, supply the name of the object module and it will cut the remainder off.<br />
<br />
i have more idea's to process other modules ... for instance, punch a hole in them, this way.<br />
<br />
Can this be done ?<br />
<br />
Thomas]]></description>
            <dc:creator>Replace</dc:creator>
            <category>OpenSCAD</category>
            <pubDate>Sun, 15 Jan 2017 17:14:52 -0500</pubDate>
        </item>
    </channel>
</rss>
