Jump to content

Importing CSV information with Python


rsths

Recommended Posts

Hi Everyone,

 

I am new to Cinema 4D in the last few months, so my apologies as I believe this is a relatively simple problem. I am a graduate film student working on my thesis project, and I have created an elevation model of a research watershed.  It is currently a polygon object in Cinema 4D.  What I would like to do is have shapes (cylinders) rise up from the elevation model to a height that corresponds to the amount of carbon in the soil at that particular point.  I would also like a MoText object to display the amount of carbon above the corresponding cylinder.  The following code, which I cobbled together from online tutorials, does a lot of what I need.  It successfully creates the cylinders and the necessary text in the proper locations in Cinema 4D. However, I am struggling with the following issues.

 

1.  How to center the MoText over the corresponding cylinder.

2. How to shift the Y-axis of the cylinders to the bottom of each object.  That way when I use a clamp constraint on the cylinders, the bottom will be stuck to the surface of my elevation model.  Right now when I do it, the center sticks to surface.

3.  How to clamp the cylinders to the surface of my elevation model and animate their height to go from zero to my specified value (I know this step can be done without Python, so this is simply a nice bonus if it is easy to program)

 

While I could program all this manually, I will be doing more of this in the future, and I know Cinema has the capability to do it with Xpresso/Python.  Unfortunately, I haven’t done much programming since high school.  I have been watching tutorials on Python/Xpresso, but it is a bit overwhelming with all the different options. I learn best from examples, so if someone can get my started with the right syntax and commands  for some of these issues - I would sure appreciate it.

 

Thank you for any insights you can provide

SIC_Content_v2.txt

Link to comment
  • 5 weeks later...
On 11/17/2017 at 2:19 AM, rsths said:

Hi Everyone,

 

I am new to Cinema 4D in the last few months, so my apologies as I believe this is a relatively simple problem. I am a graduate film student working on my thesis project, and I have created an elevation model of a research watershed.  It is currently a polygon object in Cinema 4D.  What I would like to do is have shapes (cylinders) rise up from the elevation model to a height that corresponds to the amount of carbon in the soil at that particular point.  I would also like a MoText object to display the amount of carbon above the corresponding cylinder.  The following code, which I cobbled together from online tutorials, does a lot of what I need.  It successfully creates the cylinders and the necessary text in the proper locations in Cinema 4D. However, I am struggling with the following issues.

 

1.  How to center the MoText over the corresponding cylinder.

2. How to shift the Y-axis of the cylinders to the bottom of each object.  That way when I use a clamp constraint on the cylinders, the bottom will be stuck to the surface of my elevation model.  Right now when I do it, the center sticks to surface.

3.  How to clamp the cylinders to the surface of my elevation model and animate their height to go from zero to my specified value (I know this step can be done without Python, so this is simply a nice bonus if it is easy to program)

 

While I could program all this manually, I will be doing more of this in the future, and I know Cinema has the capability to do it with Xpresso/Python.  Unfortunately, I haven’t done much programming since high school.  I have been watching tutorials on Python/Xpresso, but it is a bit overwhelming with all the different options. I learn best from examples, so if someone can get my started with the right syntax and commands  for some of these issues - I would sure appreciate it.

 

Thank you for any insights you can provide

SIC_Content_v2.txt

Hi

can you show the method how you create the Elevation model from CSV file in C4D?

Link to comment
×
×
  • Create New...

Copyright Core 4D © 2023 Powered by Invision Community