Problem with drivers value's statement












1












$begingroup$


enter image description here



i set up cube rotation and movement by object near by cube,but i also want to set up its z location so it cannot penetrate through plane every time it move forward and backward,there is some problem in expression i use in driver.
enter image description here










share|improve this question







New contributor




Shivam Modi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$








  • 3




    $begingroup$
    You've got an extra closing parenthesis at the end of the line (or a missing opening one somewhere)
    $endgroup$
    – thibsert
    17 hours ago
















1












$begingroup$


enter image description here



i set up cube rotation and movement by object near by cube,but i also want to set up its z location so it cannot penetrate through plane every time it move forward and backward,there is some problem in expression i use in driver.
enter image description here










share|improve this question







New contributor




Shivam Modi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$








  • 3




    $begingroup$
    You've got an extra closing parenthesis at the end of the line (or a missing opening one somewhere)
    $endgroup$
    – thibsert
    17 hours ago














1












1








1





$begingroup$


enter image description here



i set up cube rotation and movement by object near by cube,but i also want to set up its z location so it cannot penetrate through plane every time it move forward and backward,there is some problem in expression i use in driver.
enter image description here










share|improve this question







New contributor




Shivam Modi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$




enter image description here



i set up cube rotation and movement by object near by cube,but i also want to set up its z location so it cannot penetrate through plane every time it move forward and backward,there is some problem in expression i use in driver.
enter image description here







python drivers






share|improve this question







New contributor




Shivam Modi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




Shivam Modi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




Shivam Modi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 17 hours ago









Shivam ModiShivam Modi

63




63




New contributor




Shivam Modi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Shivam Modi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Shivam Modi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 3




    $begingroup$
    You've got an extra closing parenthesis at the end of the line (or a missing opening one somewhere)
    $endgroup$
    – thibsert
    17 hours ago














  • 3




    $begingroup$
    You've got an extra closing parenthesis at the end of the line (or a missing opening one somewhere)
    $endgroup$
    – thibsert
    17 hours ago








3




3




$begingroup$
You've got an extra closing parenthesis at the end of the line (or a missing opening one somewhere)
$endgroup$
– thibsert
17 hours ago




$begingroup$
You've got an extra closing parenthesis at the end of the line (or a missing opening one somewhere)
$endgroup$
– thibsert
17 hours ago










1 Answer
1






active

oldest

votes


















2












$begingroup$

Use a python console



enter image description here



Recommend using a python console or a text editor to crunch in your expressions when they get too complex. See image in the way it has shown the error message. Most syntax aware text editors have some way to highlight matching brackets, including blender.



Define any variables in your expression first with dummy values



>>> x = 1


Conveniently if using the python console, the math methods are already imported, .



>>> locals().keys()
dict_keys(['__name__', '__doc__', '__package__', '__loader__', '__spec__', '__builtins__', 'bpy', 'C', 'D', 'help', 'Vector', 'Matrix', 'Euler', 'Quaternion', 'Color', 'geometry', 'interpolate', 'noise', 'bvhtree', 'kdtree', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil', 'copysign', 'cos', 'cosh', 'degrees', 'erf', 'erfc', 'exp', 'expm1', 'fabs', 'factorial', 'floor', 'fmod', 'frexp', 'fsum', 'gamma', 'gcd', 'hypot', 'isclose', 'isfinite', 'isinf', 'isnan', 'ldexp', 'lgamma', 'log', 'log1p', 'log10', 'log2', 'modf', 'pow', 'radians', 'remainder', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'trunc', 'pi', 'e', 'tau', 'inf', 'nan', 'M', 's', 't', 'x', 'bmesh'])


just as most are known to the driver namespace (can be used in driver expressions)



>>> bpy.app.driver_namespace.keys()
dict_keys(['__builtins__', '__name__', '__doc__', '__package__', '__loader__', '__spec__', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil', 'copysign', 'cos', 'cosh', 'degrees', 'erf', 'erfc', 'exp', 'expm1', 'fabs', 'factorial', 'floor', 'fmod', 'frexp', 'fsum', 'gamma', 'gcd', 'hypot', 'isclose', 'isfinite', 'isinf', 'isnan', 'ldexp', 'lgamma', 'log', 'log1p', 'log10', 'log2', 'modf', 'pow', 'radians', 'remainder', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'trunc', 'pi', 'e', 'tau', 'inf', 'nan', 'bpy', 'noise'])


In the case you crunch in hit enter and the next line presents you with ... it most likely means you are missing a brace.



>>> sqrt(2) * (x - round(x, 0)) if (x % 2) < 1 else sqrt(2) * (x % 2
...
... )
1.4142135623730951


Test with different input values. The history (up and down arrows) saves retyping everything



>>> x = 0.33
>>> sqrt(2) * (x - round(x, 0)) if (x % 2) < 1 else sqrt(2) * (x % 2)
0.46669047558312143


And when you are happy with it, select it with the mouse copy CtrlC and then paste CtrlV into the driver expression



See also defining a driver method and adding to namespace [Find Link]






share|improve this answer











$endgroup$













  • $begingroup$
    thanx it is working now correctly.
    $endgroup$
    – Shivam Modi
    15 hours ago











Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "502"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






Shivam Modi is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fblender.stackexchange.com%2fquestions%2f133936%2fproblem-with-drivers-values-statement%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2












$begingroup$

Use a python console



enter image description here



Recommend using a python console or a text editor to crunch in your expressions when they get too complex. See image in the way it has shown the error message. Most syntax aware text editors have some way to highlight matching brackets, including blender.



Define any variables in your expression first with dummy values



>>> x = 1


Conveniently if using the python console, the math methods are already imported, .



>>> locals().keys()
dict_keys(['__name__', '__doc__', '__package__', '__loader__', '__spec__', '__builtins__', 'bpy', 'C', 'D', 'help', 'Vector', 'Matrix', 'Euler', 'Quaternion', 'Color', 'geometry', 'interpolate', 'noise', 'bvhtree', 'kdtree', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil', 'copysign', 'cos', 'cosh', 'degrees', 'erf', 'erfc', 'exp', 'expm1', 'fabs', 'factorial', 'floor', 'fmod', 'frexp', 'fsum', 'gamma', 'gcd', 'hypot', 'isclose', 'isfinite', 'isinf', 'isnan', 'ldexp', 'lgamma', 'log', 'log1p', 'log10', 'log2', 'modf', 'pow', 'radians', 'remainder', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'trunc', 'pi', 'e', 'tau', 'inf', 'nan', 'M', 's', 't', 'x', 'bmesh'])


just as most are known to the driver namespace (can be used in driver expressions)



>>> bpy.app.driver_namespace.keys()
dict_keys(['__builtins__', '__name__', '__doc__', '__package__', '__loader__', '__spec__', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil', 'copysign', 'cos', 'cosh', 'degrees', 'erf', 'erfc', 'exp', 'expm1', 'fabs', 'factorial', 'floor', 'fmod', 'frexp', 'fsum', 'gamma', 'gcd', 'hypot', 'isclose', 'isfinite', 'isinf', 'isnan', 'ldexp', 'lgamma', 'log', 'log1p', 'log10', 'log2', 'modf', 'pow', 'radians', 'remainder', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'trunc', 'pi', 'e', 'tau', 'inf', 'nan', 'bpy', 'noise'])


In the case you crunch in hit enter and the next line presents you with ... it most likely means you are missing a brace.



>>> sqrt(2) * (x - round(x, 0)) if (x % 2) < 1 else sqrt(2) * (x % 2
...
... )
1.4142135623730951


Test with different input values. The history (up and down arrows) saves retyping everything



>>> x = 0.33
>>> sqrt(2) * (x - round(x, 0)) if (x % 2) < 1 else sqrt(2) * (x % 2)
0.46669047558312143


And when you are happy with it, select it with the mouse copy CtrlC and then paste CtrlV into the driver expression



See also defining a driver method and adding to namespace [Find Link]






share|improve this answer











$endgroup$













  • $begingroup$
    thanx it is working now correctly.
    $endgroup$
    – Shivam Modi
    15 hours ago
















2












$begingroup$

Use a python console



enter image description here



Recommend using a python console or a text editor to crunch in your expressions when they get too complex. See image in the way it has shown the error message. Most syntax aware text editors have some way to highlight matching brackets, including blender.



Define any variables in your expression first with dummy values



>>> x = 1


Conveniently if using the python console, the math methods are already imported, .



>>> locals().keys()
dict_keys(['__name__', '__doc__', '__package__', '__loader__', '__spec__', '__builtins__', 'bpy', 'C', 'D', 'help', 'Vector', 'Matrix', 'Euler', 'Quaternion', 'Color', 'geometry', 'interpolate', 'noise', 'bvhtree', 'kdtree', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil', 'copysign', 'cos', 'cosh', 'degrees', 'erf', 'erfc', 'exp', 'expm1', 'fabs', 'factorial', 'floor', 'fmod', 'frexp', 'fsum', 'gamma', 'gcd', 'hypot', 'isclose', 'isfinite', 'isinf', 'isnan', 'ldexp', 'lgamma', 'log', 'log1p', 'log10', 'log2', 'modf', 'pow', 'radians', 'remainder', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'trunc', 'pi', 'e', 'tau', 'inf', 'nan', 'M', 's', 't', 'x', 'bmesh'])


just as most are known to the driver namespace (can be used in driver expressions)



>>> bpy.app.driver_namespace.keys()
dict_keys(['__builtins__', '__name__', '__doc__', '__package__', '__loader__', '__spec__', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil', 'copysign', 'cos', 'cosh', 'degrees', 'erf', 'erfc', 'exp', 'expm1', 'fabs', 'factorial', 'floor', 'fmod', 'frexp', 'fsum', 'gamma', 'gcd', 'hypot', 'isclose', 'isfinite', 'isinf', 'isnan', 'ldexp', 'lgamma', 'log', 'log1p', 'log10', 'log2', 'modf', 'pow', 'radians', 'remainder', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'trunc', 'pi', 'e', 'tau', 'inf', 'nan', 'bpy', 'noise'])


In the case you crunch in hit enter and the next line presents you with ... it most likely means you are missing a brace.



>>> sqrt(2) * (x - round(x, 0)) if (x % 2) < 1 else sqrt(2) * (x % 2
...
... )
1.4142135623730951


Test with different input values. The history (up and down arrows) saves retyping everything



>>> x = 0.33
>>> sqrt(2) * (x - round(x, 0)) if (x % 2) < 1 else sqrt(2) * (x % 2)
0.46669047558312143


And when you are happy with it, select it with the mouse copy CtrlC and then paste CtrlV into the driver expression



See also defining a driver method and adding to namespace [Find Link]






share|improve this answer











$endgroup$













  • $begingroup$
    thanx it is working now correctly.
    $endgroup$
    – Shivam Modi
    15 hours ago














2












2








2





$begingroup$

Use a python console



enter image description here



Recommend using a python console or a text editor to crunch in your expressions when they get too complex. See image in the way it has shown the error message. Most syntax aware text editors have some way to highlight matching brackets, including blender.



Define any variables in your expression first with dummy values



>>> x = 1


Conveniently if using the python console, the math methods are already imported, .



>>> locals().keys()
dict_keys(['__name__', '__doc__', '__package__', '__loader__', '__spec__', '__builtins__', 'bpy', 'C', 'D', 'help', 'Vector', 'Matrix', 'Euler', 'Quaternion', 'Color', 'geometry', 'interpolate', 'noise', 'bvhtree', 'kdtree', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil', 'copysign', 'cos', 'cosh', 'degrees', 'erf', 'erfc', 'exp', 'expm1', 'fabs', 'factorial', 'floor', 'fmod', 'frexp', 'fsum', 'gamma', 'gcd', 'hypot', 'isclose', 'isfinite', 'isinf', 'isnan', 'ldexp', 'lgamma', 'log', 'log1p', 'log10', 'log2', 'modf', 'pow', 'radians', 'remainder', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'trunc', 'pi', 'e', 'tau', 'inf', 'nan', 'M', 's', 't', 'x', 'bmesh'])


just as most are known to the driver namespace (can be used in driver expressions)



>>> bpy.app.driver_namespace.keys()
dict_keys(['__builtins__', '__name__', '__doc__', '__package__', '__loader__', '__spec__', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil', 'copysign', 'cos', 'cosh', 'degrees', 'erf', 'erfc', 'exp', 'expm1', 'fabs', 'factorial', 'floor', 'fmod', 'frexp', 'fsum', 'gamma', 'gcd', 'hypot', 'isclose', 'isfinite', 'isinf', 'isnan', 'ldexp', 'lgamma', 'log', 'log1p', 'log10', 'log2', 'modf', 'pow', 'radians', 'remainder', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'trunc', 'pi', 'e', 'tau', 'inf', 'nan', 'bpy', 'noise'])


In the case you crunch in hit enter and the next line presents you with ... it most likely means you are missing a brace.



>>> sqrt(2) * (x - round(x, 0)) if (x % 2) < 1 else sqrt(2) * (x % 2
...
... )
1.4142135623730951


Test with different input values. The history (up and down arrows) saves retyping everything



>>> x = 0.33
>>> sqrt(2) * (x - round(x, 0)) if (x % 2) < 1 else sqrt(2) * (x % 2)
0.46669047558312143


And when you are happy with it, select it with the mouse copy CtrlC and then paste CtrlV into the driver expression



See also defining a driver method and adding to namespace [Find Link]






share|improve this answer











$endgroup$



Use a python console



enter image description here



Recommend using a python console or a text editor to crunch in your expressions when they get too complex. See image in the way it has shown the error message. Most syntax aware text editors have some way to highlight matching brackets, including blender.



Define any variables in your expression first with dummy values



>>> x = 1


Conveniently if using the python console, the math methods are already imported, .



>>> locals().keys()
dict_keys(['__name__', '__doc__', '__package__', '__loader__', '__spec__', '__builtins__', 'bpy', 'C', 'D', 'help', 'Vector', 'Matrix', 'Euler', 'Quaternion', 'Color', 'geometry', 'interpolate', 'noise', 'bvhtree', 'kdtree', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil', 'copysign', 'cos', 'cosh', 'degrees', 'erf', 'erfc', 'exp', 'expm1', 'fabs', 'factorial', 'floor', 'fmod', 'frexp', 'fsum', 'gamma', 'gcd', 'hypot', 'isclose', 'isfinite', 'isinf', 'isnan', 'ldexp', 'lgamma', 'log', 'log1p', 'log10', 'log2', 'modf', 'pow', 'radians', 'remainder', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'trunc', 'pi', 'e', 'tau', 'inf', 'nan', 'M', 's', 't', 'x', 'bmesh'])


just as most are known to the driver namespace (can be used in driver expressions)



>>> bpy.app.driver_namespace.keys()
dict_keys(['__builtins__', '__name__', '__doc__', '__package__', '__loader__', '__spec__', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil', 'copysign', 'cos', 'cosh', 'degrees', 'erf', 'erfc', 'exp', 'expm1', 'fabs', 'factorial', 'floor', 'fmod', 'frexp', 'fsum', 'gamma', 'gcd', 'hypot', 'isclose', 'isfinite', 'isinf', 'isnan', 'ldexp', 'lgamma', 'log', 'log1p', 'log10', 'log2', 'modf', 'pow', 'radians', 'remainder', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'trunc', 'pi', 'e', 'tau', 'inf', 'nan', 'bpy', 'noise'])


In the case you crunch in hit enter and the next line presents you with ... it most likely means you are missing a brace.



>>> sqrt(2) * (x - round(x, 0)) if (x % 2) < 1 else sqrt(2) * (x % 2
...
... )
1.4142135623730951


Test with different input values. The history (up and down arrows) saves retyping everything



>>> x = 0.33
>>> sqrt(2) * (x - round(x, 0)) if (x % 2) < 1 else sqrt(2) * (x % 2)
0.46669047558312143


And when you are happy with it, select it with the mouse copy CtrlC and then paste CtrlV into the driver expression



See also defining a driver method and adding to namespace [Find Link]







share|improve this answer














share|improve this answer



share|improve this answer








edited 15 hours ago

























answered 15 hours ago









batFINGERbatFINGER

25.4k52876




25.4k52876












  • $begingroup$
    thanx it is working now correctly.
    $endgroup$
    – Shivam Modi
    15 hours ago


















  • $begingroup$
    thanx it is working now correctly.
    $endgroup$
    – Shivam Modi
    15 hours ago
















$begingroup$
thanx it is working now correctly.
$endgroup$
– Shivam Modi
15 hours ago




$begingroup$
thanx it is working now correctly.
$endgroup$
– Shivam Modi
15 hours ago










Shivam Modi is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















Shivam Modi is a new contributor. Be nice, and check out our Code of Conduct.













Shivam Modi is a new contributor. Be nice, and check out our Code of Conduct.












Shivam Modi is a new contributor. Be nice, and check out our Code of Conduct.
















Thanks for contributing an answer to Blender Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fblender.stackexchange.com%2fquestions%2f133936%2fproblem-with-drivers-values-statement%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to label and detect the document text images

Vallis Paradisi

Tabula Rosettana