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.

Featurescript / app to generate SVG for CNC

loren_brichterloren_brichter Member Posts: 5 ✭✭
Hi,

Sorry if this has been covered, I'm looking to create the OnShape equivalent to https://apps.autodesk.com/FUSION/en/Detail/Index?id=3662665235866169729 for Fusion 360. There's a use case to be able to export SVGs of a set of 2D faces for CNC machines (Shaper Origin, laser cutters, etc).

My rough idea is to have a FeatureScript feature to allow the user to select a set of faces to be exported / (or ideally automatically sync'd somewhere). Then create a companion app that when activated would find those FeatureScript feature and do the actual SVG conversion / download / sync (since it seems you can't do any of that from within FeatureScript itself).

I skimmed the FeatureScript docs and couldn't find a way to actually dig into the shape of a selected face, and on the app side only saw examples on how to pull in tesselated 3D models of the whole part, which isn't helpful in this particular case.

Am I barking up the wrong tree? I figured since there's already a dxf exporter, OnShape is probably 98% of the way there to being able to generate what I want, I'm just not sure how to finish wiring it up since I'm new to this side of things.

Any pointers would be appreciated.

Thanks!

Comments

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,680
    The main issue here is that FeatureScript cannot export data, only create, modify or delete. So you would have to work out how to generate and create the profiles yourself then work out how to find the results with your app. 
    Senior Director, Technical Services, EMEAI
  • loren_brichterloren_brichter Member Posts: 5 ✭✭
    Makes sense, thanks. Is it possible in FeatureScript to dive down into the actual paths that make up an entity? Actually I'm re-reading the docs now and came across `evApproximateBSplineSurface` which actually looks like it might get me close to what I need.
  • caden_armstrong2caden_armstrong2 Member, User Group Leader Posts: 127 ✭✭✭
    BSpline surface isn't going to help you as you are trying to get the edges that define the shape of a planar surface.
    What you are looking for is to take the adjacent edges (qAdjacent with the face as the query, and looking at edge adjacent edge type entities).

    evCurveDefinition will give you the specifics of each edge type, which you would then use to construct your svg.
    As Neil said, you can't export with FeatureScript, but you can utilize the API to run featurescript code. The API also provides a method of detecting selections in a studio.

    What you are trying to do is possible, I've done it for DXFs, which are very close to SVGs.
  • loren_brichterloren_brichter Member Posts: 5 ✭✭
    @caden_armstrong thanks so much, this is super helpful!
  • hovishovis Member Posts: 7 ✭✭
    I have tried to make this app/featurescript before, and failed.  I'm specifically interested in exporting paths for the Shaper Origin, but I can see that there's continuing demand for a simpler SVG export to support different less-than-industrial CNC workflows.

    The API also provides a method of detecting selections in a studio.
    @caden_armstrong I don't suppose you could provide a link? I've looked for this but I can't find it. (The docs are great IF you know where to find the thing you're looking for).


  • caden_armstrong2caden_armstrong2 Member, User Group Leader Posts: 127 ✭✭✭
    If the part is already 2d, as a user you can right click on a face and export to dxf. Most CAM should be able to read dxf, even hobby grade softwares like lightburn support it. If you aren't looking for an automated way of doing it, thats an easy way to generate paths.
    That same function is supported in the api via /documents/.../export, but it will export the entire part as a projection into the specified view plane.

    @hovis
    Its the client messaging system.
    One of the things it can do is notify on user selection.

    https://onshape-public.github.io/docs/clientmessaging/#capturing-selection-messages-from-the-onshape-client


  • quinn_renehanquinn_renehan Member Posts: 4 EDU
    I would be an eager adopter of this feature if it were available.
    My students and I use Onshape and Shaper. The workflow from Onshape to Shaper is messy and complicated for students. Anything to make the process smoother would be greatly appreciated here.

  • roman_jurt190roman_jurt190 Member Posts: 32 EDU
    same here! we have to use illustrator after exporting from onshape to shaper origin. something like the fusion360 plugin for shaper origin is what we need:) https://apps.autodesk.com/FUSION/en/Detail/Index?id=3662665235866169729
  • dirk_van_der_vaartdirk_van_der_vaart Member Posts: 549 ✭✭✭
    Or use this, an online converter.
    https://convertio.co/nl/dxf-svg/
  • roman_jurt190roman_jurt190 Member Posts: 32 EDU
    edited May 2023
    Or use this, an online converter.
    https://convertio.co/nl/dxf-svg/
    yes - but getting nice, connected shapes usually means manually join the paths in illustrator... also the fusion origin-plugin does a nice color-coding job... pockets gray, outlines black...

    but also - even if it is a bit tedious...it's not the end of the world and it's not an everyday thing:)
  • k_m677k_m677 Member Posts: 2
    Hiya folks! Coming here to see if anyone has updates / progress on this workflow. I’m an Onshape + Shaper Origin user too. Definitely don’t love the Onshape —> DXF —> import into vector program to join —> SVG workflow. 
Sign In or Register to comment.