Jump to content

Dear Visitors

If your confirmation email doesn't arrive, give us some time while we manually approve your account. Support ticket is not necessary, we are checking new registrations regularly and approving if registration requirements are met.

Please read Rules & Guidelines before posting around Forums. Information we seek is minimal and in the end saves us a lot of time and we are able to provide solutions faster.

Please consider supporting us via Contributions for all the work we are doing. Contributing even with the smallest amount, will remove ALL AD's and unlock some nice features like being able to be Tipped for providing help, or file etc.


Generating Number Sequences Using MoGraph with "00" before numbers


Go to solution Solved by jed,

Recommended Posts

Hi all!

I have a little problem with the mograph blend mode. As you can see in the screenshot, I want to number my cabinets with numbers from 001 to 150. With mograph I have succeeded but I cannot start with "001" instead "1" as the numbers in black. Is there any way to do it?

Thanks all

01.jpg

Link to comment
  • Solution

Assuming you're using Noseman's method of getting the text from the name, it's possible if you use python zfill and make the cloner editable -

 

zfill.png.5521c82bbe09c63e6f1a595d2499e308.png

 

import c4d
#Welcome to the world of Python


def main():
    global Output1
    Output1 = Input1.zfill(3)

 

zfill pads a string with zeros up to the max character count in brackets.

 

zfill.c4d

 

Noseman's method - Generating Number Sequences Using MoGraph in Cinema 4D - YouTube

Link to comment
1 hour ago, jed said:

Assuming you're using Noseman's method of getting the text from the name, it's possible if you use python zfill and make the cloner editable -

 

zfill.png.5521c82bbe09c63e6f1a595d2499e308.png

 


import c4d
#Welcome to the world of Python


def main():
    global Output1
    Output1 = Input1.zfill(3)

 

zfill pads a string with zeros up to the max character count in brackets.

 

zfill.c4d 640.45 kB · 1 download

 

Noseman's method - Generating Number Sequences Using MoGraph in Cinema 4D - YouTube

 

Unfortunately I don't know python..and dont't what do you do but it works! Thanks a lot!

Link to comment
1 hour ago, LightCacher said:

Unfortunately I don't know python.

Here's your 1st lesson 😀

 

I made a python node and deleted the ports (by default they are reals and Python is quite fussy about data types)

I made input and output ports data type string

code to be executed goes under def main(): and is indented by 4 spaces

the output variable is declared global so it can exist outside the main code body (where variables are local)

the = sign works a bit different to regular math. The RHS is evaluated and assigned to the LHS variable - Output1 is 'given' that value

zfill is a built in string command

 

the = sign malarkey is interesting because you can have apparently nonsense Python code such as

 

x = x + 1

 

which just increments x by 1

Link to comment
  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • LATEST ACTIVITIES

    1. 461

      Cinema R25 Release

    2. 461

      Cinema R25 Release

    3. 461

      Cinema R25 Release

    4. 461

      Cinema R25 Release

    5. 1

      Real teeth material

×
×
  • Create New...

Copyright Core 4D © 2021 Powered by Invision Community