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.

Options

Trying to get SVG of a sketch

I'm a novice user of OnShape.

I created this model in OnShape to illustrate and share an idea that I have for making rigid but temporary wooden joints


From the "side view" sketch of that model I exported a DXF file with the intent of generating an SVG file for some web documentation.  DXF doesn't seem to me to be the most appropriate format for a planar drawing, but choices are limited.

For my documentation I'd like SVG.

I fed the exported DXF file to varioous web based conversion utilities.

https://convertio.co/dxf-svg/ produced an SVG file with only three lines (each a path element with one M and one L step) in it.

https://cloudconvert.com/dxf-to-svg produced an SVG file containing a single polyline element with only two points.

I write my own utility, all--be-it incomplete, for parsing DXF files and it only finds three lines in the ENTITIES section of the DXF file.

I believe the sketch itself has eight line segments and three more guide lines.  Where are the rest of them?

Thanks.

Best Answer

  • Options
    tim_hess427tim_hess427 Member Posts: 648 ✭✭✭✭
    Answer ✓
    Your side view sketch only has three solid lines and two construction lines. The three solid lines all of which show up for me in inkscape. The construction lines don't seem to make it over. So, maybe try converting your construction lines to regular lines. Then they should export, and you can change the line style to whatever you like in another program.

    You should look into creating a drawing in onshape from the model, then exporting the drawing. You can create views of the model (or an assembly) and you can right-click on a drawing view, then there's an option to make sketches visible as well. 

    Once you have a drawing, you can export the whole thing as SVG, DXF, PDF, and other formats as well. 

Answers

  • Options
    shawn_crockershawn_crocker Member, OS Professional Posts: 807 PRO
    Why is the .dxf/.dgw file not able to work?  They are both 2d file types which I think is what you mean by planar?  Or I'm really misunderstanding your intent.
  • Options
    mark_nahabedianmark_nahabedian Member Posts: 31
    As I said, the reason I built the model is so that I could make drawings for a web page. Web browsers have native support for displaying SVG, but not for DXF.

    DXF is a 3d format that can still support 2d drawing by having every Z coordinate be zero, but given that a sketch is 2d, DXF is overkill.

    I can understand OnShape not thinking it worth the effort to export sketches in SVG. What I don't understand is why so much of my sketch seems to be missing from the DXF file and why the file has so much irrelevant crap.

    I'm very frustrated because it took me much longer to enter the model in OnShape (perhaps by a factor of 10) than to build the physical object out of wood. Now I find that I can't get the drawings I want from OnShape.


  • Options
    tim_hess427tim_hess427 Member Posts: 648 ✭✭✭✭

    I would try inkscape. You should be able to open the DXF and export as SVG. 


  • Options
    mark_nahabedianmark_nahabedian Member Posts: 31
    My personal experiences with Inkscape (under MSWindows10):

    I have poor eyesight.  Inkscape doesn't respect the system's theme preference.  I can get Inkscape to use a dark theme by navingating the barely visible preference dialog with the barely visible mouse.

    Though the Inkscape UI is in a dark theme now, the canvas isn't.

    The default size of Inkscape's canvas is ludicrously huge and I've not found a way to make it smaller.  Once I import the DXF file, I get something that occupies about 0.02 square inches of my screen.

    I can "zoom to selection" and see the same three lines that the other conversion tools showed and that my DXF parser discovered.

    My point still is: where is the rest of my sketch?  What do I need to do to get it out of OnShape?
  • Options
    tim_hess427tim_hess427 Member Posts: 648 ✭✭✭✭
    Answer ✓
    Your side view sketch only has three solid lines and two construction lines. The three solid lines all of which show up for me in inkscape. The construction lines don't seem to make it over. So, maybe try converting your construction lines to regular lines. Then they should export, and you can change the line style to whatever you like in another program.

    You should look into creating a drawing in onshape from the model, then exporting the drawing. You can create views of the model (or an assembly) and you can right-click on a drawing view, then there's an option to make sketches visible as well. 

    Once you have a drawing, you can export the whole thing as SVG, DXF, PDF, and other formats as well. 
  • Options
    mark_nahabedianmark_nahabedian Member Posts: 31
    Thank you Tim.  That was the explanation and the advice I needed.

    I spent so much time making the expolded view that I forgot how I described the part.  I should have paid more attention to this history.  

    It was easy to make a four view drawing of my part with no borders or title block.  That drawing could be directly exported as SVG.  I'd like less whitespace, but I can edit the SVG directly to get the layout I want.
  • Options
    mark_nahabedianmark_nahabedian Member Posts: 31
    For those who are interested here's the first draft of my description of the trapezoidal lap joint:

    https://github.com/MarkNahabedian/crafts/blob/main/TrapezoidalLapJoint/README.md
  • Options
    tim_hess427tim_hess427 Member Posts: 648 ✭✭✭✭
    Glad the feedback was helpful. 

    If you want to reduce the whitespace, you can change the scale of the drawing views in onshape so that they're bigger compared to the size of the sheet. You can right click on a view and change it there directly, or you can change the scale for the entire sheet all at once. 

    https://cad.onshape.com/help/Content/drawing_view_properties.htm?tocpath=Drawings%7CDrawing%20Basics%7C_____3
  • Options
    mark_nahabedianmark_nahabedian Member Posts: 31
    Thanks again Tim.  I changed the scale of the sheet to something I'm happier width.

    Maybe you could help with one more thing?  I created an exploded view and don't see a way to export it.  I'd like to add the exploded view to my web page.  If I were to just take a screenshot, the image woud be cluttered by the various OnShape controls.

  • Options
    tim_hess427tim_hess427 Member Posts: 648 ✭✭✭✭
    edited September 2021
    There are a couple of things you could do: 
    1. You can add the exploded view of the assembly to a drawing, then export that. (From the Insert dialog, select "Assemblies", then there is an "Explode/Position" field that should show a list of exploded views you can add.) (See: Using exploded views in drawings, here)
    2. Within the assembly, click on the menu button at the top (icon with three horizontal bars) and select Print. This basically takes a screenshot of whatever is in the model/assembly space without any controls or menus. (link)
Sign In or Register to comment.