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.

Onshape Live 22 gift - Frame Trime feature Improvement

emagdalenaC2iemagdalenaC2i Member, Developers, Channel partner Posts: 857 ✭✭✭✭✭
edited March 2022 in FeatureScript
A little gift for the Onshape live 22

The new Frame Trim feature always do Coped butt trims, so I have created an improvement to select Butt / Coped butt trims
The performance is also improved when the butt trim is used (91,57 s --> 13,68 s in the second example)






Here is the document with the code https://cad.onshape.com/documents/b5592f8871a94872ea10133e/w/06b6c00544917bdfffd78c74/e/5e7114c330fa12f357fa2daf?configuration=Alto=1.0+meter;AlturaRefuerzo=0.6+meter;Ancho=0.6+meter;Largo=0.8+meter&renderMode=0&rightPanel=cutlistPanel&uiState=6220ae9c6e9dc23b87daeee8
Un saludo,

Eduardo Magdalena                         C2i Change 2 improve                         ☑ ¿Por qué no organizamos una reunión online?  
                                                                     Partner de PTC - Onshape                                     Averigua a quién conocemos en común

Comments

  • jnewth_onshapejnewth_onshape Member, Onshape Employees Posts: 20
    Hi @emagdalenaC2i I'm Josh, a Part Studios developer on the Frames team. First: Thank you for using your skills to benefit the Onshape community. Seeing designers like yourself make great stuff with our tools, including new tools, is very exciting. 

    As to your code: I haven't run any tests but did read through it. One thing to remember: It looks like you are keeping the frame end attribution intact (see reapplyAttributes()). This is vital for correct downstream cutlist creation. It's also difficult to get right for all geometries. Your example shows a well-formed cutlist, but I'd encourage you to monitor the behavior of this custom feature as you try more complex end conditions and beam paths, particularly with "partial" endface trims, where some of the originally attributed endfaces remain. One tool that may help with your debugging is visualizing the beam attribution before and after a trim, using queries like:
            debug(context, qFrameStartFace(definition.frame), DebugColor.RED);
            debug(context, qFrameEndFace(definition.frame), DebugColor.GREEN);
            debug(context, qFrameSweptFace(definition.frame), DebugColor.MAGENTA);
            debug(context, qFrameSweptEdge(definition.frame), DebugColor.BLUE);

    We've got a lot of great stuff coming in 2022 for Frames. We will continue to extend and improve the product, aided by the community's feedback, improvements like yours, and...bug reports! Keep 'em coming!
  • emagdalenaC2iemagdalenaC2i Member, Developers, Channel partner Posts: 857 ✭✭✭✭✭
    Thanks @jnewth_onshape

    I have checked the reapplyAttributes() function and it works fine with this improvement.
    The reaplyNearest function sets the attributes to the new faces, just like the original macro

    Actually, I have found that there is a line in the code that could be removed in reapplyAttributes:
    const candidateFacesQuery = qIntersection([createdFacesQuery, allUnattributedFacesQuery]);

    Un saludo,

    Eduardo Magdalena                         C2i Change 2 improve                         ☑ ¿Por qué no organizamos una reunión online?  
                                                                         Partner de PTC - Onshape                                     Averigua a quién conocemos en común
  • emagdalenaC2iemagdalenaC2i Member, Developers, Channel partner Posts: 857 ✭✭✭✭✭
    @jnewth_onshape

    I have added the attribute information to our FS Perfiles2 and it works fine with cut lists.
    Our customers can update their features and use the cut lists in their existing documents.

    @NeilCooke something similar could be done with the Beam FS

    Take a look
    https://youtu.be/YuPKr0hi6sg
    Un saludo,

    Eduardo Magdalena                         C2i Change 2 improve                         ☑ ¿Por qué no organizamos una reunión online?  
                                                                         Partner de PTC - Onshape                                     Averigua a quién conocemos en común
  • emagdalenaC2iemagdalenaC2i Member, Developers, Channel partner Posts: 857 ✭✭✭✭✭
    Thanks @jnewth_onshape

    I have checked the reapplyAttributes() function and it works fine with this improvement.
    The reaplyNearest function sets the attributes to the new faces, just like the original macro

    Actually, I have found that there is a line in the code that could be removed in reapplyAttributes:
    const candidateFacesQuery = qIntersection([createdFacesQuery, allUnattributedFacesQuery]);

    @jnewth_onshape I'm glad to see news also in the frames and cutlist tools in this update. But there is still this line that does nothing...
    Un saludo,

    Eduardo Magdalena                         C2i Change 2 improve                         ☑ ¿Por qué no organizamos una reunión online?  
                                                                         Partner de PTC - Onshape                                     Averigua a quién conocemos en común
Sign In or Register to comment.