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.

Beams feature problems

MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,034 EDU
The beams feature won't take projected curves as input.
Is there any reason for this?
mb - draftsman - also FS author: View FeatureScripts
IR for AS/NZS 1100

Best Answers

  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,034 EDU
    Answer ✓
    @NeilCooke
    I have now fixed the problem.
    I replaced this line of code
    </code>loopPlane = evPlane(context, { "face" : qGeometry(qEdgeAdjacent(firstEdge, EntityType.FACE), GeometryType.PLANE) });</pre><div><a rel="nofollow" href="https://forum.onshape.com/discussion/comment/38753#"></a></div><br>with this block of code<br><pre class="CodeBlock"><code>
            try
            {
                // this will be two faces so just have to return the first
                loopPlane = evPlane(context, { "face" : qGeometry(qEdgeAdjacent(firstEdge, EntityType.FACE), GeometryType.PLANE) });
            }
            catch
            {
                const lineResult = evAxis(context, { "axis" : firstEdge });
                definition.axis = lineResult;
    
                var baseNormal = perpendicularVector(lineResult.direction);
                var normal = rotationMatrix3d(lineResult.direction, 0 * degree) * baseNormal;
    
                return plane(lineResult.origin, normal, lineResult.direction);
            }
    It now works fine.




    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • tim_doctortim_doctor Member Posts: 1
    edited May 2021 Answer ✓
    @NeilCooke

    Bumping this old thread because I'm having the exact same issue described above using v18 of the Beams Feature. I have a Projected Curve between two straight lines. Beam feature fails and seems to not like using a projected curve as an input. Obviously, I don't really know how to read FeatureScript code to figure this out for myself. Has @MBartlett21 's solution not been rolled in to the official version of the Beam Feature?

    Here's a dummy model showing what I'm looking at. Beams works with sketch entities, but doesn't like the projected curve... even though it's a line. What am I missing?


  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,310
    Answer ✓
    @tim_doctor - I must admit I don't recall seeing this code (sorry @MBartlett21) - I've added it (without QA) to V19
    Senior Director, Technical Services, EMEAI

Answers

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,310
    It is probably a spline
    Senior Director, Technical Services, EMEAI
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,034 EDU
    @NeilCooke

    I created it by making a projected curve between two straight lines.

    If I create a plane, then make a sketch on it and project those lines into the sketch, the Beam feature works fine like that.
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,310
    Without looking at the code maybe I restricted selection to sketch entities and model edges. 
    Senior Director, Technical Services, EMEAI
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,034 EDU
    @NeilCooke

    The filter is: EntityType.EDGE && (GeometryType.LINE || GeometryType.ARC)
    I don't think that would be a problem 
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,034 EDU
    edited March 2018
    @NeilCooke

    I copied it here and it is this section of code that is having a problem:
    function getPlane(context is Context, definition is map, edgeLoop is array) returns Plane
    {
        const firstEdge = qNthElement(definition.edges, edgeLoop[0].edge);
        
        var loopPlane;
        
        try 
        {
            // check if the first entity is a sketch edge, if not check for solid or surface edge
            loopPlane = evOwnerSketchPlane(context, { "entity" : firstEdge });
        }
        catch
        {
            // this will be two faces so just have to return the first
            loopPlane = evPlane(context, { "face" : qGeometry(qEdgeAdjacent(firstEdge, EntityType.FACE), GeometryType.PLANE) });
    
            if (size(edgeLoop) > 1)
            {
                const point1 = edgeLoop[0].vertex[0].origin;
                const point2 = edgeLoop[0].vertex[1].origin;
                var point3;
                var normal;
                var success = false;
    
                for (var i = 1; i < 2; i += 1)
                {
                    for (var j = 0; j < 2; j += 1)
                    {
                        point3 = edgeLoop[i].vertex[j].origin;
                        normal = cross(point3 - point1, point2 - point1);
                        if (norm(normal).value > TOLERANCE.zeroLength)
                        {
                            success = true;
                            break;
                        }
                    }
                    if (success)
                        break;
                }
                loopPlane = plane(point1, normalize(normal), normalize(point2 - point1));
            }
        }
    
        return loopPlane;
    }
    
    
    
    This specifically is the line of code throwing the error:
    
    loopPlane = evPlane(context, { "face" : qGeometry(qEdgeAdjacent(firstEdge, EntityType.FACE), GeometryType.PLANE) });
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,034 EDU
    Answer ✓
    @NeilCooke
    I have now fixed the problem.
    I replaced this line of code
    </code>loopPlane = evPlane(context, { "face" : qGeometry(qEdgeAdjacent(firstEdge, EntityType.FACE), GeometryType.PLANE) });</pre><div><a rel="nofollow" href="https://forum.onshape.com/discussion/comment/38753#"></a></div><br>with this block of code<br><pre class="CodeBlock"><code>
            try
            {
                // this will be two faces so just have to return the first
                loopPlane = evPlane(context, { "face" : qGeometry(qEdgeAdjacent(firstEdge, EntityType.FACE), GeometryType.PLANE) });
            }
            catch
            {
                const lineResult = evAxis(context, { "axis" : firstEdge });
                definition.axis = lineResult;
    
                var baseNormal = perpendicularVector(lineResult.direction);
                var normal = rotationMatrix3d(lineResult.direction, 0 * degree) * baseNormal;
    
                return plane(lineResult.origin, normal, lineResult.direction);
            }
    It now works fine.




    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • tim_doctortim_doctor Member Posts: 1
    edited May 2021 Answer ✓
    @NeilCooke

    Bumping this old thread because I'm having the exact same issue described above using v18 of the Beams Feature. I have a Projected Curve between two straight lines. Beam feature fails and seems to not like using a projected curve as an input. Obviously, I don't really know how to read FeatureScript code to figure this out for myself. Has @MBartlett21 's solution not been rolled in to the official version of the Beam Feature?

    Here's a dummy model showing what I'm looking at. Beams works with sketch entities, but doesn't like the projected curve... even though it's a line. What am I missing?


  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,310
    Answer ✓
    @tim_doctor - I must admit I don't recall seeing this code (sorry @MBartlett21) - I've added it (without QA) to V19
    Senior Director, Technical Services, EMEAI
  • CBowersCBowers Member Posts: 50 PRO
    @NeilCooke I'm having an issue with ends of beams being automatically coped if the trimming beam is projected along a curved path and the trimmed beam is of the same size or larger. Is this something that can be easily fixed? Having to use a workaround where I use replace face for the tops and bottoms of the beams needing trimmed, but it's kind of tedious.
    In this picture the bottom dark grey beam is along a curved path. The diagonal light blue beam is automatically coped and I can't choose to have it do anything else. These are HSS 8x8x1/4.
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,310
    @CBowers - it is a major change to get this to work and I'm fairly confident that if I fix this, it will break other things. I'll have a think if there is a better way I can do it, but in the meantime your method is the best/only way.
    Senior Director, Technical Services, EMEAI
Sign In or Register to comment.