Try to draw math functions - questions about AddMesh: extra objects scripts

there are different samples (not in my posted examples) to create
types of “klein-bottles” and some need 2 parts and the user has
to connect those – thats why i had put a “dont set new object to different
location” for some …
… and i did not use single indices to select one,
i did use a loop (thats in the sample code) and did
select it based on the name …
(something like a “blender” list to select it not only from the index,
but too, with the key-name … that would be a “dictionary-list”).

edit: about rendering those meshes, i did use a kind of wireframe setting
(in the “treadmill” blend), cause i liked the view of the net-surface
and thats why some will need a bit higher resolution and some will still
look surprising in low resolution (low, like only 16 or 32 …for the xyz-settings).

i see the klein bottle in 2 parts!

i did the snowman shape = 2 spheres
and made each part as one sample item !

but did not joint the 2 after
i could do it with bpy.ops afterward !

i removed most of the lines in the class
and that makes it a lot shorter! LOL

now got to find a way to pass or change parameters functions of the properties !

happy 2.6

Sorry to but in on this discussion, but I was reading thru this thread and came across this part.

Instead of checking to see if the 3d-math-addon is activated, couldn’t you just import the part of the add-on you need into the script you’re working on?

I admit to being a noob at python, so if this can’t be done, could you explain why not?

Thanks,
Randy

that’s what i did in the new script !
i copied the function i needed in my script
faster to get it i guess!

dictionnary !
did not work much with these beast!

how can is select one item and print one of the var ?
tried this but does not work ?

print (’ j =’,j,’ name =’,samples[j].name)

i can calculate the lenght but how to acces the data per item?

i got to find why i cannot get the last 2 items in that list dic !

thanks
happy 2.6

@ test-dr

Moebius problem

i’v been able to pass properties from the class to the dictionnary
and for the first Moebius i can change the radius
by changing the 1 for R = radius in formula

i can see the radius of the Moebius change in viewport
which is working nicely

but i would like to also change the width of the Moebius
but not certain how to change it ?
like i need to change bfunc but also the vmin and vmax
so how to calculate this V var for the S value = width of the Moebius?

did you use the formula from the site or from another site?
http://www.3d-meier.de/tut3/Seite13.html

cause the formula does not look the same ?

X= [R s + cos (t / 2)] * cos (t)
Y = [R s + cos (t / 2)] * sin (t)
Z = s sin (t / 2)

x=(1+v/2 cos(u/2)) *cos(u)
y=(1+v/2 *cos(u/2)) * sin(u)
z=v/2 *sin(u/2)

The constant R determines the radius of the belt.
The constant s determines the widht of the belt.
When parameter s = 0 we get a circle with radius R and height z = 0

samples.append( {“name”:“Moebius”,
“x”:"(1+v/2 *cos(u/2))*cos(u)",
“y”:"(1+v/2 *cos(u/2))*sin(u)",
“z”:"v/2 sin(u/2)",
“umin”: 0,
“umax”: 2
pi,
“uwrap”: True,
“vmin”: -1,
“vmax”: 1,
“vwrap”: True,
} )

samples.append( {“name”:“Moebius”,
“afunc”:“1.0”, # Radius of the Stripe = R
“bfunc”:“1.0”, # Width of the stripe = s
“x”:"(a +(b/2.0)*cos(u/2.0))*cos(u)",
“y”:"(a +(b/2.0)*cos(u/2.0))*sin(u)",
“z”:"(b/2.0)sin(u/2.0)",
“umin”: 0,
“umax”: 2
pi,
“uwrap”: True,
“vmin”: -1,
“vmax”: 1,
“vwrap”: True,
} )

any feedback appreciated

thanks
happy 2.6

about the
moebius formula

i dont remember,
i know i searched with google
and i shure did use some hints from wikipedia-pages,
some from other - and
i know, for some formulas, i had to enter those
into the xyz-math-gui fields and test with changes
what will happen.
I am no math-3d-genius and cannot imagine how the output will look…
… so some are tests and i did not correct some …

btw. this was the cause i did create this simple storage of xyz-surface-settings,
because i soon noticed i could create some nice shapes and could not remember
what kind of settings i had used … … (no history-line … )

ok i’ll check out wiki and some other math sites
to see if i can find this math forumula

need that for the doc also!

thanks

looks like wiki has the same equation!

how can pass teh negative sign for v min ?

i tried this and it gives error for thsi

t3=rad1
t4="-"+str(t3)
t5=str(t3)

p1[“vmin”]=t4
p1[“vmax”]=t5

there is a negative in the vmin but not certain why it is giving error on this one !

thanks

here is the error on console

the first property pass very well but the vmin does not like it !

vmin = -1.5 vmax= 1.5 width = 3.0
t4 = -3.0 t5= 3.0
eval = -3.0
vmin = -3.0 vmax= 3.0 width = 3.0
samples[i1] moebius = -3.0 samples[i1] moebius = 3.0
resol = 4
range_v_min= -3.0 range_v_max= 3.0
Traceback (most recent call last):
File “C:\Users\RJ\0blend25\00airfoilwindimill1\scriptformathfunction1\shapesho
rt5.blend\shapeshort5.py”, line 1469, in execute
File “C:\Users\RJ\0blend25\00airfoilwindimill1\scriptformathfunction1\shapesho
rt5.blend\shapeshort5.py”, line 1335, in add_xyz_object
File “C:\Users\RJ\0blend25\00airfoilwindimill1\scriptformathfunction1\shapesho
rt5.blend\shapeshort5.py”, line 1128, in xyz_function_surface_faces
TypeError: unsupported operand type(s) for -: ‘str’ and ‘str’

i can change the value in the dictionary and it works fine

but being refuse if i change it wiht he property!

the string with signe or not is valid i can eval it and no problems!

strange !

thanks

thanks