discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

passing text as a parameter?

K
Ken
Fri, Nov 3, 2023 7:40 AM

I have this small module that I can call for putting text in my models-
but rather than have pre-defined text already in the module as I have
now, I would like to be able to call the module and pass the text to it
each time I call it. Is this possible?

I have spent quite some time searching this but so far have found
nothing to indicate it can be done with text.

module place_text()
{
color("blue")
 rotate([0,0,0])
translate([0,0,0])
{
  linear_extrude(height = 1)
  text("VK7KRJ", font = "Liberation Sans:style=Bold", size=2.5);
 }
}

--
Cheers, Ken
bats059@gmail.com
https://vk7krj.com
https://vk7krj.com/running.html

A baby can be defined as an ego with a noise at one end and a smell at the other.
Your job as parents is to teach them to control all three.
My job as a grandad is to tell you how you are doing it all wrong!

I have this small module that I can call for putting text in my models- but rather than have pre-defined text already in the module as I have now, I would like to be able to call the module and pass the text to it each time I call it. Is this possible? I have spent quite some time searching this but so far have found nothing to indicate it can be done with text. module place_text() { color("blue")  rotate([0,0,0]) translate([0,0,0]) {   linear_extrude(height = 1)   text("VK7KRJ", font = "Liberation Sans:style=Bold", size=2.5);  } } -- Cheers, Ken bats059@gmail.com https://vk7krj.com https://vk7krj.com/running.html ---------------------------------------- A baby can be defined as an ego with a noise at one end and a smell at the other. Your job as parents is to teach them to control all three. My job as a grandad is to tell you how you are doing it all wrong!
NH
nop head
Fri, Nov 3, 2023 7:50 AM

Just add a parameter to the module.

module place_text(txt)
{
color("blue")
rotate([0,0,0])
translate([0,0,0])
{
linear_extrude(height = 1)
text(txt, font = "Liberation Sans:style=Bold", size=2.5);
}
}
place_text("VK7KRJ");

On Fri, 3 Nov 2023, 07:41 Ken via Discuss, discuss@lists.openscad.org
wrote:

I have this small module that I can call for putting text in my models-
but rather than have pre-defined text already in the module as I have now,
I would like to be able to call the module and pass the text to it each
time I call it. Is this possible?

I have spent quite some time searching this but so far have found nothing
to indicate it can be done with text.

module place_text()
{
color("blue")
rotate([0,0,0])
translate([0,0,0])
{
linear_extrude(height = 1)
text("VK7KRJ", font = "Liberation Sans:style=Bold", size=2.5);
}
}

--
Cheers, Kenbats059@gmail.comhttps://vk7krj.comhttps://vk7krj.com/running.html

A baby can be defined as an ego with a noise at one end and a smell at the other.
Your job as parents is to teach them to control all three.
My job as a grandad is to tell you how you are doing it all wrong!


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Just add a parameter to the module. module place_text(txt) { color("blue") rotate([0,0,0]) translate([0,0,0]) { linear_extrude(height = 1) text(txt, font = "Liberation Sans:style=Bold", size=2.5); } } place_text("VK7KRJ"); On Fri, 3 Nov 2023, 07:41 Ken via Discuss, <discuss@lists.openscad.org> wrote: > I have this small module that I can call for putting text in my models- > but rather than have pre-defined text already in the module as I have now, > I would like to be able to call the module and pass the text to it each > time I call it. Is this possible? > > I have spent quite some time searching this but so far have found nothing > to indicate it can be done with text. > > > module place_text() > { > color("blue") > rotate([0,0,0]) > translate([0,0,0]) > { > linear_extrude(height = 1) > text("VK7KRJ", font = "Liberation Sans:style=Bold", size=2.5); > } > } > > > -- > Cheers, Kenbats059@gmail.comhttps://vk7krj.comhttps://vk7krj.com/running.html > ---------------------------------------- > A baby can be defined as an ego with a noise at one end and a smell at the other. > Your job as parents is to teach them to control all three. > My job as a grandad is to tell you how you are doing it all wrong! > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
K
Ken
Fri, Nov 3, 2023 8:14 AM

Thanks nop head, that works a treat- so simple when you know how!

On 2023-11-03 18:50, nop head via Discuss wrote:

Just add a parameter to the module.

module place_text(txt)
{
color("blue")
 rotate([0,0,0])
translate([0,0,0])
{
  linear_extrude(height = 1)
  text(txt, font = "Liberation Sans:style=Bold", size=2.5);
 }
}

place_text("VK7KRJ");

On Fri, 3 Nov 2023, 07:41 Ken via Discuss,
discuss@lists.openscad.org wrote:

 I have this small module that I can call for putting text in my
 models- but rather than have pre-defined text already in the
 module as I have now, I would like to be able to call the module
 and pass the text to it each time I call it. Is this possible?

 I have spent quite some time searching this but so far have found
 nothing to indicate it can be done with text.


 module place_text()
 {
 color("blue")
  rotate([0,0,0])
 translate([0,0,0])
 {
   linear_extrude(height = 1)
   text("VK7KRJ", font = "Liberation Sans:style=Bold", size=2.5);
  }
 }


 -- 
 Cheers, Ken
 bats059@gmail.com
 https://vk7krj.com
 https://vk7krj.com/running.html
 ----------------------------------------
 A baby can be defined as an ego with a noise at one end and a smell at the other.
 Your job as parents is to teach them to control all three.
 My job as a grandad is to tell you how you are doing it all wrong!

 _______________________________________________
 OpenSCAD mailing list
 To unsubscribe send an email to discuss-leave@lists.openscad.org

OpenSCAD mailing list
To unsubscribe send an email todiscuss-leave@lists.openscad.org

--
Cheers, Ken
bats059@gmail.com
https://vk7krj.com
https://vk7krj.com/running.html

A baby can be defined as an ego with a noise at one end and a smell at the other.
Your job as parents is to teach them to control all three.
My job as a grandad is to tell you how you are doing it all wrong!

Thanks nop head, that works a treat- so simple when you know how! On 2023-11-03 18:50, nop head via Discuss wrote: > Just add a parameter to the module. > > module place_text(txt) > { > color("blue") >  rotate([0,0,0]) > translate([0,0,0]) > { >   linear_extrude(height = 1) >   text(txt, font = "Liberation Sans:style=Bold", size=2.5); >  } > } > > place_text("VK7KRJ"); > > On Fri, 3 Nov 2023, 07:41 Ken via Discuss, > <discuss@lists.openscad.org> wrote: > > I have this small module that I can call for putting text in my > models- but rather than have pre-defined text already in the > module as I have now, I would like to be able to call the module > and pass the text to it each time I call it. Is this possible? > > I have spent quite some time searching this but so far have found > nothing to indicate it can be done with text. > > > module place_text() > { > color("blue") >  rotate([0,0,0]) > translate([0,0,0]) > { >   linear_extrude(height = 1) >   text("VK7KRJ", font = "Liberation Sans:style=Bold", size=2.5); >  } > } > > > -- > Cheers, Ken > bats059@gmail.com > https://vk7krj.com > https://vk7krj.com/running.html > ---------------------------------------- > A baby can be defined as an ego with a noise at one end and a smell at the other. > Your job as parents is to teach them to control all three. > My job as a grandad is to tell you how you are doing it all wrong! > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org -- Cheers, Ken bats059@gmail.com https://vk7krj.com https://vk7krj.com/running.html ---------------------------------------- A baby can be defined as an ego with a noise at one end and a smell at the other. Your job as parents is to teach them to control all three. My job as a grandad is to tell you how you are doing it all wrong!