View Full Version : 3 python beginner questions
Little_Devil 09-27-2010, 09:10 PM hi,
i'm playing with r12 python sript engine - i have 3 questions.
1. there are no methods in the sdk to move an object axis ? i have to move all
points to move the axis ?
2. there are no edge methods apart from
PolygonObject.GetEdgeS()
PolygonObject.GetEdgeH() ?
3. there are no methods to get normals for point/edge/poly selections, i have to use
member of c4d.vector and calculate them myself ?
please excuse my rusty english and thanks in advance for your replies.
|
|
Per-Anders
09-27-2010, 09:18 PM
1) Moving an axis can be done either using callcommands for the existing axis tools or by doing the axis movement manually, all you do is move the points in the opposite direction to the axis.
2) What are you trying to do to the edges beyond select or hide them? You can adjust their breaking using the phongbreaks.
3) Normals must be calculated by hand however you can use the PolygonObject;:CreatePhongNormals() function to return the point normals for the whole object, polygon normals may be retrieved by simply using the cross products of the points, edges are the averaged of the neighbor polygons, the n-gon access is not currently available in Python which would also give you access to n-gon normal data. For Splines you may use the SplineHelp class to retrieve spline normals.
Little_Devil
09-28-2010, 07:30 PM
thanks for the quick reply.
Little_Devil
09-28-2010, 11:03 PM
if it is not too much i have got a fourth question. most langues have something like a
math class (sin,cos,abs,sqr,sqrt...). when i'm trying to use pythons math class like this
y = math.fabs(x)
http://docs.python.org/release/2.6.4/library/math.html?highlight=math#module-math
cinema says NameError: global name 'math' is not defined. i guess i have to
import something, but the python documentation doesnt name anything to import ?
where is my fault ?
thanks for your patience :)
Per-Anders
09-29-2010, 02:04 AM
Yes you must import the math library. At the beginning of your script just write :
import math
next to the other import calls. Then this will work.
Little_Devil
09-29-2010, 11:05 AM
thanks for your quick reply again. quite obvious. :banghead:
Little_Devil
09-30-2010, 06:20 PM
1. renamed the threadtitle to match the topic
2. can you name some ressources for *polymodeling* algorithms ? i've already checked
the stickies, did a quite extensive googlesearch for
edge loop algorithm
edge loop code
edge loop script
with 0 results. i've done the first steps iwth polyobjects, created a script that can create
plane and discs and want to take the next step now. i'm just medicore in math, so my
apologies, if the edge loop thing is such a obvious thing, for me it is not.
i would prefer free ressources, but I'm also willing to buy a good book if there is no other way.
Per-Anders
09-30-2010, 06:36 PM
You could just use the inbuilt routines for that. Use SendModelingCommand to make use of the inbuilt edge loop routines.
Little_Devil
10-01-2010, 06:08 AM
i'm aware of that, but that is not what i am aiming for .
CGTalk Moderation
10-01-2010, 06:08 AM
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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.