Author Topic: converting splines into best fit lines and arcs to withing a certain tolerance?  (Read 4191 times)

0 Members and 1 Guest are viewing this topic.

Bob Q

  • Guest
I saw there was someone working on routine back in 2004, just wondering if there have been any nice routines created that will do a Spline to best fit lines and arcs?

I had one years ago in the era of 2000, but lost it! Ha!

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Looking through my collections I have:

Code: [Select]
;;CADALYST 12/03 AutoLISP Solutions  SPLINE-TO-PLINE.LSP
;;(c) 2003 Tony Hotchkiss

(defun spline-to-pline (/ i)
Code: [Select]
;;;CADALYST 01/06  Tip 2082: Spline2Pline2.lsp     Spline to Polyline Conversion - Update     (c) 2006 Cadalyst and Lloyd Beachy + narrator
 
;; Spline2Pline2.lsp (c) 2005 Lloyd Beachy + narrator
;; Routine to convert splines to plines

(Defun C:S2P2 (/ ss pt# cmdecho osmode clayer count ent lay lng pt-list cnt)

7/29/2004
Code: [Select]
;|Try this snippet. What it does is step through the given spline at a given tolerance
distance and pull a point off of the curve. It then adds that point to a running list.
The snippet returns that list of points that you could then use to build your polyline.
|;

(vl-load-com)

(defun Spline->Pline


I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

GP

  • Newt
  • Posts: 83
  • Vercelli, Italy
Try FLATTEN (the best).

Bob Q

  • Guest
Any chance I could get a copy of those couple routines?
Thanks!


Bob Q

  • Guest
Try FLATTEN (the best).

I tried flatten, and the attached image shows what it does. It seems to convert everything into lines, making the radiuses really jaged.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
What about using PEDIT?

Bob Q

  • Guest
You get a similar situation, all lines, no best fit arcs.

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Hi

Look at the PLINECONVERTMODE sysvar.
Speaking English as a French Frog

Bob Q

  • Guest
Hi

Look at the PLINECONVERTMODE sysvar.

o.k. cool! I will check it out!
Thanks

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Try FLATTEN (the best).

I tried flatten, and the attached image shows what it does. It seems to convert everything into lines, making the radiuses really jaged.

Wow that was drawn using a spline?  :o
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Bob Q

  • Guest
It was a nice smooth spline, the result was after running flatten...