Converting Spline to Polyline

Discussion in 'Software' started by Willallison, May 1, 2008.

  1. Willallison
    Joined: Oct 2001
    Posts: 3,590
    Likes: 130, Points: 0, Legacy Rep: 2369
    Location: Australia

    Willallison Senior Member

    In order to create a dxf file for CNC cut panels, I have been asked to convert all the lines to polylines.
    This is a simple matter for lines and arcs - one simply uses the PEDIT command and at the prompt "object is not a polyline", "would you like to convert it", you hit Y.
    But for splines it's not such a simple matter - at least not that I've found so far...
    The easiest I've come across is to do a WMFOUT, then WMFIN, scale x2, then EXPLODE once, thus creating a 2D polyline.

    Anyone got a simpler method?
    Any flaws in my method(s)?
     
  2. Gilbert
    Joined: Aug 2004
    Posts: 525
    Likes: 5, Points: 28, Legacy Rep: 28
    Location: Cathlamet, WA

    Gilbert Senior Member

    Simpler? The method I've used is simple but it is probably not simpler. I've used Autocadr12 for many years but never heard of metafiles before your post. I haven't tried them yet either.
    My method has been to use the object snap set to end and draw line segments rather perpendicular to the spline at each endpoint along the spline. When I have all these drawn I just erase the spline and draw a polyline connecting the endpoints of the lines I have drawn. This can be a little tedious if it is a very long spline.
    Now a question for you. Why does the imported metafile need to be scaled x2? Also, do you know why it becomes a polyline when it is exploded? If you explode a spline it ends up just a bunch of little line segments. I'm trying to pick your brain a little here because I haven't turned up much about metafiles by checking my references.
    Thanks.
     
  3. Willallison
    Joined: Oct 2001
    Posts: 3,590
    Likes: 130, Points: 0, Legacy Rep: 2369
    Location: Australia

    Willallison Senior Member

    The splines in this instance are made up of a lot of segments - so it would indeed be very tedious to essentially recreate it manually.
    My experience with metafiles is not much greater than yours - I have no idea why the resulting import requires scaling up - other than it is otherwise 1/2 the size!
    R12..... next you'll be telling me you have to pedal to get your computer started;)

    I came across the method by searching one of the multitude of AutoCAD help forums. It's not all that complicated I admit, and does appear to give accurate results....
     
  4. duluthboats
    Joined: Mar 2002
    Posts: 1,604
    Likes: 57, Points: 58, Legacy Rep: 779
    Location: Minneapolis,MN, USA

    duluthboats Senior Dreamer

    Maybe import the file into Rhino than export as .dxf. You will be asked if you want splines or polylines. I think? :eek: Not at home so I can't check the idea.
     
  5. Martijn_vE
    Joined: Apr 2005
    Posts: 254
    Likes: 24, Points: 0, Legacy Rep: 401
    Location: Netherlands

    Martijn_vE Marine software developer

    Or simply save your DWG as a R12 DXF file. In release 12 there were no splines yet, so all your splines will be automatically converted to polylines. Your CNC shop will definitely be able to read that.
     
  6. Willallison
    Joined: Oct 2001
    Posts: 3,590
    Likes: 130, Points: 0, Legacy Rep: 2369
    Location: Australia

    Willallison Senior Member

    Martijn-vE... well now aren't you a clever fella!!:D
    It works! And converts the whole lot into polylines in one hit.... I owe you a beer!
    For those giving it a try, this is how I did it..
    save as .dxf R12
    open a new document and DXFIN the R12 file.
    save as whatever .dwg you want (in my case AutoCAD 2004)

    One question though - it converts them into 3D polylines. This being a 2D document, does that matter?
     
  7. Martijn_vE
    Joined: Apr 2005
    Posts: 254
    Likes: 24, Points: 0, Legacy Rep: 401
    Location: Netherlands

    Martijn_vE Marine software developer

    2D polylines are merely 3D polylines with all z coordinates set to zero. It shouldn't make any difference at all.
     
  8. Gilbert
    Joined: Aug 2004
    Posts: 525
    Likes: 5, Points: 28, Legacy Rep: 28
    Location: Cathlamet, WA

    Gilbert Senior Member

    So!!! No more laughing at Autocadr12?
    I've been designing boats entirely within Autocad since 1987 using Autolisp routines written by my brother that give me splines and accurate ruling lines for chined hulls plus panel development and more. I have had very little desire to change to anything else even today. Although I do use Freeship to quickly conjure up looks at my next notion for a design.
     
  9. Gilbert
    Joined: Aug 2004
    Posts: 525
    Likes: 5, Points: 28, Legacy Rep: 28
    Location: Cathlamet, WA

    Gilbert Senior Member

    By the way, I actually was able to do this in Autocadr9 or r10 (I can't remember which) but I use r12 because it's object snap is so much better.
     
  10. CGN
    Joined: Jan 2003
    Posts: 547
    Likes: 9, Points: 18, Legacy Rep: 138
    Location: MX

    CGN Senior Member

  11. Willallison
    Joined: Oct 2001
    Posts: 3,590
    Likes: 130, Points: 0, Legacy Rep: 2369
    Location: Australia

    Willallison Senior Member

    :p Hah! Bet I can top that - I still use BBC computers for some of my work. The latest ain't always the greatest....
    Ahhh, for the good ol' days....
     
  12. nautique210
    Joined: Apr 2008
    Posts: 31
    Likes: 1, Points: 0, Legacy Rep: 16
    Location: GA, USA

    nautique210 wake master

    From my experience, sometimes u have to redraw them for the CNC software. Generally u are better off with arcs and lines. In autocad a spline is not good for export (even within acad they are not good) and depending on the CAM software polylines are not good either. always save them as R12.dxf. it all depends on how much grief u want to give the person who is to receive the files. better to put some effort into giving them good data, esp. if they want to nest it for quick machining. For example if u have a polyline to give curvature then what you actually have is a heap of small straight segments and the machine head will stop-start continuously and it will take forever.

    a method i once used when extracting 3D models into 2D files for machining was to redraw over them using a scaled viewport in a layout. hopefully the CAM software is better these days, but they certainly used to be temperamental..

    cheers
     
  13. nautique210
    Joined: Apr 2008
    Posts: 31
    Likes: 1, Points: 0, Legacy Rep: 16
    Location: GA, USA

    nautique210 wake master

    i've used every release since r13, and u know autocad will always be autocad. they keep adding so much stuff to it. i'm on 2009 (r17?) now and i dont see the point. its all based around 3D and the 3D modeling tools suck so bad. r12 was probably the best version, i'd like to see how that runs!
     
  14. Grant Nelson
    Joined: Feb 2005
    Posts: 210
    Likes: 12, Points: 0, Legacy Rep: 163
    Location: Netherlands

    Grant Nelson Senior Member

    What about the Flatten command?
    When importing from Rhino having used Make2D, often straight lines are registered as splines. I use Flatten to turn them into lines.
    But remember that polylines, while they can be curved, they only approximate a spline. I can guess this is what happens when you export to AutoCAD12 too. You should lay the two version over each other to decided if that is OK for what you are doing I tried a really bendy line and the deviation was not more than .25% as far as I could see. On a hull line it was down around .1% of the length between any two points.
     

  15. bobg3723
    Joined: Aug 2005
    Posts: 278
    Likes: 7, Points: 18, Legacy Rep: 95
    Location: Crystal, MN - USA

    bobg3723 Senior Member

    I've never had to convert files to CNC, so you'll only get a blank stare from me.:confused:
    But reading the AutoLisp posts there were a fair amount of discussion regarding these very same problems and workarounds. One of the threads concerned a commercial utility that traced splines using only straight lines segments fitted by their BULGE settings. I don't know if thats CNC friendly, but it's a heck of alot less vertices required to follow a noodly spline.
     
Loading...
Forum posts represent the experience, opinion, and view of individual users. Boat Design Net does not necessarily endorse nor share the view of each individual post.
When making potentially dangerous or financial decisions, always employ and consult appropriate professionals. Your circumstances or experience may be different.