Cannot resolve an expression to make a dimension dependent of 3 variables. Someone can help ?

francois_boulet
francois_boulet Member Posts: 65 ✭✭✭
I'm not familiar with scripting. Maybe this is a very simple problem.
PLease see the attached PDF file ...
La simplicité est la sophistication suprême.
Léonard de Vinci

Best Answer

  • francois_boulet
    francois_boulet Member Posts: 65 ✭✭✭
    Answer ✓
    It Works, Thank you.
    And I found another way to do it with a conditional: (#ObstaAv>0?0:#Diff/#ObstaArr) in
    Thanks again !
    La simplicité est la sophistication suprême.
    Léonard de Vinci

Answers

  • Krz
    Krz Member, Developers Posts: 68 ✭✭✭
    You have incompatibe units.
    1st equation ([in]/[in])*[in] - ([in]) = [in]-[in] = [in] OK
    2nd eq: ([in]/[in])*[in] - ([in]*[in])*[in] = [in] - [in]^3  KO
    3rd eq: ([in]/[in])*[in] - ([in]*[in]) = [in] - [in]^2  KO

    So
    2nd eq should be: (#Diff/#ObstaArr) in-(#Diff*#ObstaAv)/in
  • Jake_Rosenfeld
    Jake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646 image
    @francois_boulet

    #Diff and #ObstaAv both have "in" as their unit already.  When multiplied together, the unit becomes in^2 (as expected for multiplying two lengths together).  Your expression will work if you do:
    ((#Diff * #ObstaAv) / in)

    but I suspect that what you actually meant to do is have ObstaArr and ObstaAv as unitless numbers instead of lengths?  Then your expression would look like:
    (#Diff / #ObstaArr) - (#Diff * #ObstaAv)

    But that's just a guess, and I can't tell your design intent.  You can set a variable to a number instead of a length using the "Number" option at the top:



    Jake Rosenfeld - Modeling Team
  • francois_boulet
    francois_boulet Member Posts: 65 ✭✭✭
    Answer ✓
    It Works, Thank you.
    And I found another way to do it with a conditional: (#ObstaAv>0?0:#Diff/#ObstaArr) in
    Thanks again !
    La simplicité est la sophistication suprême.
    Léonard de Vinci