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.

Tangent connected query of a face using only the faces from another query

Hi,

I am writing a featurescript that will allow me to move (moveFace) a particular tab geometry only by clicking one of the face of the tab. The tab in question looks like this:

Now you might not be able to see it but there is a relief in the corner of the tab with fileted edges. What I want to achieve is clicking on the top face of the tab as such:

and making a code that will select all of the faces of that tab for the move face operation like this:


Now as you can see, I managed to make it work. I am using qTangentConnectedFaces which gives me all of the top faces since I have fillets everywhere. Then I use qSubtraction to remove the faces that are parallel to the original face. This works really well. However, if the corner of my plates are filleted I end up with this query:



Which is the real problem. I feel like I'm almost there. If I could add something that would take all the tangent connected faces to the top face but only within the faces of that query it would work since the tab is already isolated from the rest. How would you guys go on about this problem? If there is a better solution, I would like to know it but I would also like to know if what I'm thinking is doable for learning purposes.

Thanks

Comments

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,683
    edited November 2018
    What does it look like before the qSubtraction? Shouldn’t be selecting the other faces because they’re not tangent. Is this a sheet metal model?

    EDIT: sorry I missed the small fillet. Not easy to do unless you are certain the geometry is the same each time. Move face will move the fillets with just that single top face selection though. 
    Senior Director, Technical Services, EMEAI
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,050 ✭✭✭✭✭
    Is this only for sheet metal?
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • Raphael_MassicotteRaphael_Massicotte Member Posts: 8 PRO
    edited November 2018
    No this is only for regular parts. I might not have been clear enough but the goal is to laterally translate the tab not offset it (i.e not making it longer or smaller), so selecting only the top face as Cody suggested won't work. Does anybody have an idea how to do it? I assume the geometry will never change. Is it possible to make a tangent connected faces query of the top face but restricting the faces to those of the query that I actually have?
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,050 ✭✭✭✭✭
    edited November 2018
    Here's my code for it:

    var face = <b><i>FACE_QUERY</i></b>;
    debug(context, qFaceOrEdgeBoundedFaces(
                qUnion([
                        face,
                        qSubtraction(
                            qOwnedByBody(
                                qOwnerBody(face),
                                EntityType.FACE
                            ),
                            qSubtraction(
                                qTangentConnectedFaces(face),
                                qParallelPlanes(qTangentConnectedFaces(face), evPlane(context, {
                                                "face" : face
                                            }).normal)
                            )
                        )
                    ])
            ));

    Or this simpler code (it should support non-tangent edges)
    
    var face = <b><i>FACE_QUERY</i></b>;<br>debug(context, qFaceOrEdgeBoundedFaces(
                qUnion([
                        face,
                        qLargest(qEdgeAdjacent(face, EntityType.FACE)),
                        qParallelPlanes(qOwnedByBody(qOwnerBody(face), EntityType.FACE), evPlane(context, { "face" : face }).normal)
                    ])
            ));

    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • Raphael_MassicotteRaphael_Massicotte Member Posts: 8 PRO
    Thanks @mbartlett21 your first code is exactly what I needed! The qFaceOrEdgeBoundedFaces is exactly what I needed and what I was asking for. I didn't know of it's existence or at least I didn't think it worked this way.

    I don't think the second would work in every cases because of the qLargest query. But the first one is perfect. My code was exactly the same as yours apart from the qFaceOrEdgeBoundedFaces.
Sign In or Register to comment.