CGTalk > Software > Maxon Cinema 4D
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
Thread Tools Search this Thread Display Modes
Old 02-21-2013, 04:42 PM   #1
New Member
Jax, USA
Join Date: Feb 2013
Posts: 1
MoGraph "alphabet" export each letter

This is x-posted from c4dcafe. I figured there might be some users here not there and vice versa. Sorry if that's frowned upon.

I'm trying to create a script where the user will set a specific font, run the script, and it will export out lowercase,uppercase, and numbers, as .OBJs.
Eventually I'd like to add simple materials and baking textures to it, but I just want to get the initial script down first.

I haven't found any good documentation on setting Font (i see it's sorta new in R13), but found one where the user selected an object and used that font.

Here's what I have hacked together so far. It currently keeps every letter, so only A works, and then every letter after has every previous letter...

I need to add some simple features initially:
- Choose font easier
- Name MoText as letter
- Delete previous letter

Any ideas?

import c4d import string from c4d import FontData from string import ascii_uppercase doc = c4d.documents.GetActiveDocument() selectedObj = doc.GetActiveObject() def main(): for i in range(0,3): letter = string.ascii_lowercase[i] MoText = c4d.BaseObject(1019268) font = selectedObj[c4d.PRIM_TEXT_FONT] MoText[c4d.PRIM_TEXT_TEXT] = letter MoText[c4d.PRIM_TEXT_FONT] = font doc.InsertObject(MoText) c4d.EventAdd() c4d.documents.SaveDocument(doc,"/"+letter+".obj", 0, c4d.FORMAT_OBJEXPORT) if __name__=='__main__': main()

UPDATE: Little update. Figured out how to delete stuff (why is there so much stuff not in the Python C4D Documentation?? and where can I find it all in one place?)
This does at minimum what I want. I need to work on collapsing the MoText into one single object, but I think I found that.
The next part is adding a simple material and baking it. I don't think that's going to be easy or possible.

import c4d import string from c4d import FontData from string import ascii_uppercase doc = c4d.documents.GetActiveDocument() font=c4d.FontData() fontbc=c4d.gui.FontDialog() font.SetFont(fontbc) def main(): for i in range(0,26): letter = string.ascii_lowercase[i] Text = c4d.BaseObject(1019268) Text[c4d.PRIM_TEXT_TEXT] = letter Text[c4d.PRIM_TEXT_FONT] = font doc.InsertObject(Text) c4d.EventAdd() c4d.documents.SaveDocument(doc,"/"+letter+".obj", 0, c4d.FORMAT_OBJEXPORT) Text.Remove() if __name__=='__main__': main()

Last edited by tjoynt : 02-21-2013 at 06:31 PM.
Old 02-21-2013, 04:42 PM   #2
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
Join Date: Sep 2003
Posts: 1,066,479
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 08:19 PM.

Powered by vBulletin
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.