Results 1 to 3 of 3

Thread: splines to polylines

  1. #1
    Active Member
    Join Date
    2005-02
    Posts
    67

    Default splines to polylines

    I'm almost certain I've seen this here recently, but can't find it. Is there a LISP out there that will convert an spline to a polyline.


    Thanks

  2. #2
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,217

    Default Re: splines to polylines

    Quote Originally Posted by tflaherty
    I'm almost certain I've seen this here recently, but can't find it. Is there a LISP out there that will convert an spline to a polyline.


    Thanks
    Hi
    I not sure but maybe there is what you need
    Thank you

    f.
    Code:
    (defun sp2p (num      /	       acsp	adoc	 delta	  diff
    	     lengt    mea_point		pline	 pt_list  pt_safe
    	     spline   sp_ent
    	    )
      (vl-load-com)
      (setq	adoc (vla-get-activedocument
    	       (vlax-get-acad-object)
    	     )
    	acsp (vla-get-block
    	       (vla-get-activelayout adoc)
    	     )
      )
      (vla-endundomark adoc)
      (vla-startundomark adoc)
    
      (if (setq sp_ent (car (entsel "\t\n***\tSELECT SPLINE\t***\n")))
        (progn
          (setq spline (vlax-ename->vla-object sp_ent))
          (setq lengt (vlax-curve-getdistatpoint
    		    spline
    		    (vlax-curve-getendpoint spline)
    		  )
    	    delta (/ lengt num)
    	    diff  delta
          )
          (while (/= (length pt_list) num)
    	(setq mea_point (vlax-curve-getpointatdist spline delta))
    	(setq pt_list (cons mea_point pt_list))
    	(setq delta (+ delta diff))
          )
    
          (setq pt_list (append pt_list
    			    (list (vlax-curve-getstartpoint spline))
    		    )
    	    pt_list (append (list (vlax-curve-getendpoint spline)) pt_list)
    	    pt_list (apply 'append pt_list)
          )
          (setq pt_safe
    	     (vlax-safearray-fill
    	       (vlax-make-safearray
    		 vlax-vbdouble
    		 (cons 0 (1- (length pt_list)))
    	       )
    	       pt_list
    	     )
          )
          (setq pline (vla-addpolyline acsp pt_safe))
    ;;;    (vla-put-type pline acfitcurvepoly);for smoothing polyline
          (vla-update pline)
          (vlax-release-object pline)
    
          (vla-delete spline)
          (vlax-release-object spline)
        )
        (princ "Nothing selected. Try again...")
      )
      (vla-endundomark adoc)
      (princ)
    )
    ;;CaLL:
    ;(sp2p 100);100 - number of vertices
    ;(princ)

  3. #3
    Administrator Mike.Perry's Avatar
    Join Date
    2001-03
    Posts
    13,499

    Default Re: splines to polylines

    Quote Originally Posted by tflaherty
    I'm almost certain I've seen this here recently, but can't find it. Is there a LISP out there that will convert an spline to a polyline.
    Hi

    A quick forum search returned the following threads amongst others...

    Key Word(s): *Polyine* + *Spline"

    offsetting a spline

    spline to pline

    Spline to Pline

    Have a good one, Mike

Similar Threads

  1. 2012: Grrr ~ Joining Polylines, splines, and lines OHMY!
    By dsthilare in forum AutoCAD General
    Replies: 3
    Last Post: 2011-08-06, 07:43 PM
  2. Transforming Splines into Polylines
    By chgolombek in forum ACA General
    Replies: 3
    Last Post: 2007-11-20, 07:55 PM
  3. Converting splines to polylines?
    By matt.143284 in forum AutoCAD LT - General
    Replies: 4
    Last Post: 2007-08-31, 12:47 AM
  4. Convert Splines to Polylines
    By juliefrancoeur in forum AutoCAD General
    Replies: 7
    Last Post: 2006-04-03, 09:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •