Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

allow setting angles equal

david_lang457david_lang457 Member Posts: 71 ✭✭
I have run across a few cases where I want to set two angles equal to each other (similar to the way that you can set two line segments to equal lengths), but it appears there is currently no way to do this. Instead I need to set the angles to the same numerical value, which doesn't work when I want the angles to be generated based on other geometry.
Tagged:

Comments

  • SledDriverSledDriver Member Posts: 116 ✭✭✭
    I think this will do what you want. It uses a FeatureScript called Measure Angle

    https://cad.onshape.com/documents/c20e49034ae017371b469b8c/w/c7606b785669c4b91914cb9c/e/87cbf35dfbaf7dbb066ab9f2

    Cheers
    SledDriver
  • SledDriverSledDriver Member Posts: 116 ✭✭✭
    Ugh. Maybe not. Seems "Measure Angle" can only measure up to 90 degrees, after which is just shows 180-(actual angle) degrees.
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    if you need to set equal angles within the same sketch you can conclude them in some triangles and set that triangles equal by three sides. i think the problem with such type of constrain is that you can't select the angle itself, because there is no such sketch entity type
  • david_lang457david_lang457 Member Posts: 71 ✭✭
    that's a good workaround I hadn't thought of, I still think it would be useful to be able to select dimensions for the equality constraints.
  • lougallolougallo Member, Moderator, Onshape Employees, Developers Posts: 2,001
    @david_lang457 Just as a clarification, Can you tell me where these angles are?  Are they sketch dimensions?  Do they exist in the same sketch?  Do you have an example of a scenario or image we can see?  I have a few improvements I am thinking of but more interested in how the angles are determined (or drawn).
    Lou Gallo / PD/UX - Support - Community / Onshape, Inc.
  • david_lang457david_lang457 Member Posts: 71 ✭✭
    I'm fiddling around with things at https://cad.onshape.com/documents/f9d19e22360c53f3b187e294/w/0b58d153b5ce237f68887780/e/216f8b9fa7eadec76b2be7e8

    I have a tilted disk supported in the center with a ball joint that has a rim that will ride against a fixed rim. I need to set the angle of the edge of the disk based on the angle of tilt of the disk (which is generated based on the amount of vertical movement of a point of the disk during a full rotation)

    one way to do this is to have the angle between the plane of the disk and the rim be equal to the angle between the plane of the disk and horizontal, but it's not a Z shape, both angles go in the same direction
  • lougallolougallo Member, Moderator, Onshape Employees, Developers Posts: 2,001
    @david_lang457 So this is all in one sketch?  You can make them a mirror or use the symmetry constraint.  If you just wanted to add an angle dimension to both and then make them equal.  You can add a variable above the sketch and reference it in both angle dimensions or you can vote for something like this:

    https://forum.onshape.com/discussion/5951/add-variable-while-sketching#latest

    Allowing you to build a variable reference on the fly which would make this process very easy.
    Lou Gallo / PD/UX - Support - Community / Onshape, Inc.
  • neobobkrauseneobobkrause Member Posts: 105 EDU
    Ugh. Maybe not. Seems "Measure Angle" can only measure up to 90 degrees, after which is just shows 180-(actual angle) degrees.
    Hmm. So I looked at the code for "Measure Angle". Me thinks that the condition that checks for a value greater than 90 degrees can and should be changed to check for a value greater than 180. I modified a copy of the code and works correctly for me. Here's my code...

    annotation { "Feature Type Name" : "Measure Angle", "Feature Name Template" : "Measure Angle ###name", "UIHint" : "NO_PREVIEW_PROVIDED" }
    export const measureAngle = defineFeature(function(context is Context, id is Id, definition is map)
        precondition
        {
            annotation { "Name" : "Name", "Default" : "angle" }
            definition.name is string;

            annotation { "Name" : "First axis", "Filter" : QueryFilterCompound.ALLOWS_AXIS }
            definition.first is Query;

            annotation { "Name" : "Second axis", "Filter" : QueryFilterCompound.ALLOWS_AXIS }
            definition.second is Query;
        }
        {
            if (!match(definition.name, '[a-zA-Z_][a-zA-Z_0-9]*').hasMatch)
                throw regenError(ErrorStringEnum.VARIABLE_NAME_INVALID);

            const axis1 = evAxis(context, { "axis" : definition.first });
            const axis2 = evAxis(context, { "axis" : definition.second });

            var angle = angleBetween(axis1.direction, axis2.direction);
            if (angle > 180 * degree)
                angle = 180 * degree - angle;

            setVariable(context, definition.name, angle);
        });


    - Bob
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,014 PRO
    edited January 2019
    I've seen this a lot over the years and I have an opinion. I don't mean to offend any number crunching ninja's but....... it drives me crazy when I have to read equations when trying to understand your design intent.

    I offer up this simpler approach:

    Draw it in the sketch, there's symmetry, there's a simple construction line & equal constraints or use a variable. For me, I want to open the sketch and know what's going on immediately. The fact that onshape declares a variable in the tree, to me it makes it totally usable & makes it good practice. It's not hidden and I don't have to try and figure it out, the angle assignment is obvious.



    We all like numbers and equations. Solve the problem with a feature script, show your wife, get a hug, erase it and then draw it up.


    To me the best modelers design for the next guy and using equations just makes it harder.


    This is my opinion.


  • david_lang457david_lang457 Member Posts: 71 ✭✭
    Yes, you can work around this lack by creating additional lines (with multiple constraints), but it muddies up the drawing, and added complexity adds additional chances for mistakes.

    using variables can work in some cases, but only in cases where you know the angle ahead of time, if you want to do something like bisect an angle as you are manipulating the parts, it won't work
Sign In or Register to comment.