Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- 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.
Featurescript – Fillet a sheet metal part using edges attribute
Hello there !
I’d like to be able to fillet sheet metal parts corners through Featurescript, using the attribute of edges.
For the moment, I managed to create fillets like so :
- Select the edge using annotation { "Name" : "My Query", "Filter" : EntityType.EDGE, "MaxNumberOfPicks" : 1 } definition.entitiesHomemade is Query;
- Create the fillet using available public code such as sheetMetalCornerBreak or C2CfullRoundFillet (because opFillet doesn't work on sheet metal parts)
This method works great, but these public functions need as input the edge Query from annotation. Now i’d like to do the same thing but using the attribute ("JMN") of my edge.
To do this I tried transforming my attribute into a query using qHasAttribute("JMN") or qOwnedByBody(qHasAttribute("JMN"), EntityType.EDGE)) but it doesn’t work.
Any tips ?
Thank you 😊
Best Answer
-
MichaelPascoe Member Posts: 1,989 PRO
Gotcha. Here is how you can convert the transient id array back into a query of edges:
https://cad.onshape.com/documents/28b6b8878dbecd49e8c8d643/w/db4da420a14d…/** * Example function to convert the transient id's to a query. */ function GetQueryFromTransientIdList(context is Context, transientIdList is array) returns Query { const allBodyEdgesQuery = qOwnedByBody(qAllSolidBodies(), EntityType.EDGE); var evaluatedAllBodyEdges = evaluateQuery(context, allBodyEdgesQuery); var output_edges_query = qNothing(); for (var edge in evaluatedAllBodyEdges) { for (var transientId in transientIdList) { if (transientId == edge.transientId) { output_edges_query = qUnion([output_edges_query, edge]); } } } return output_edges_query; }
Learn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! Learn How to FeatureScript Here 🔴2
Answers
Please share a link to your document so we can help you better.
Learn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! Learn How to FeatureScript Here 🔴
Thank you for helping out MichealPascoe ! 😁
Here is the link to a minimal reproducible example :
What is your end goal?
I'm confused why you are trying to use attributes if your goal is to simply fillet all edges parallel to the Z_Axis.
Learn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! Learn How to FeatureScript Here 🔴
Sure! Let me clarify what I’m trying to do 🙂:
opFillet()
. I’ve worked around this by usingsheetMetalCornerBreak()
, but it only works when I use a user annotation query as input (i.e by selecting the edge directly on the onshape interface, not something i can do from python code). Now i'd like to use the attribute as input.So to sum it up, in the python interface, i give the user attribute of all important elements, so that if i want to modify them or interact with them, i can do it.
I hope this explanation clears things up!
Gotcha. Here is how you can convert the transient id array back into a query of edges:
https://cad.onshape.com/documents/28b6b8878dbecd49e8c8d643/w/db4da420a14d…
Learn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! Learn How to FeatureScript Here 🔴
Wow, that’s brilliant!
Thank you so much @MichaelPascoe, You saved me from going insane after struggling with this for three days! ! 😅