0
$\begingroup$

I ran into a problem with texts and python in blender scripting.

def main(context):
    font_curve = bpy.data.curves.new(type="FONT", name="numberPlate")
    font_curve.body = (numberPlate)
    font_obj = bpy.data.objects.new(name="Font Object", object_data=font_curve)
    bpy.context.scene.collection.objects.link(font_obj)

I'm currently using this to add in a custom text but I also want to have control over the scale and location of the text I am adding in.

I'm a python beginner and I don't know how else to go about it as I have tried everything I know.

Would appreciate your help. Cheers!

$\endgroup$

1 Answer 1

1
$\begingroup$

I'm using Blender 3.0.0 Just set location and scale after making the object

font_curve = bpy.data.curves.new(type="FONT", name="numberPlate")
font_curve.body = "ABC123"
obj = bpy.data.objects.new(name="Font Object", object_data=font_curve)

# -- Set scale and location
obj.location = (-1, 1, 0)
obj.scale = (0.75, 0.5, 0.5)
bpy.context.scene.collection.objects.link(obj)
$\endgroup$
2
  • 1
    $\begingroup$ Whew. That worked plenty. Thank you. $\endgroup$ Commented Feb 13, 2022 at 13:12
  • $\begingroup$ You are welcome! I remember being a beginner too :) $\endgroup$ Commented Feb 14, 2022 at 12:06

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.