Results 1 to 3 of 3

Thread: Need LISP for Divide SPline (or Polyline) Into Different Lengths Based On Input

  1. #1
    Member
    Join Date
    2013-03
    Posts
    16
    Login to Give a bone
    0

    Default Need LISP for Divide SPline (or Polyline) Into Different Lengths Based On Input

    Need LISP for Divide SPline (or Polyline) Into Different Lengths Based On Input

    The task should be similar to the _measure command but, I would like to divide the spline into lengths that I give in input. (Decided by user)

    e.g. Length of spline: 10.000 meters

    Place a block at length:
    - 1238 m
    - 2005 m
    - 2018 m
    - 2458 m
    - 4098 m

    and so on..

    How I can do that? It would be perfect if it would be possible to give an excel file with the length values.

  2. #2
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    555
    Login to Give a bone
    0

    Default Re: Need LISP for Divide SPline (or Polyline) Into Different Lengths Based On Input

    Here is a start draws a point at the distance needs a lot more like don't exceed length.

    Code:
    (setq entSelection (car (entsel "\nSelect OBJECT To Divide: ")))
    (setq objSelection (vlax-ename->vla-object entSelection))
    (WHILE (/= DIST 0.0) 
    (setq DIST (getreal "\Enter offset distance 0 to exit"))
    (command "point" (vlax-curve-getpointatdist objSelection DIST))
    )

  3. #3
    All AUGI, all the time
    Join Date
    2010-10
    Posts
    535
    Login to Give a bone
    0

    Default Re: Need LISP for Divide SPline (or Polyline) Into Different Lengths Based On Input

    Quote Originally Posted by radosak368138 View Post
    ...The task should be similar to the _measure command but, I would like to divide the spline into lengths that I give in input. (Decided by user)
    ...
    Place a block at length:...and so on..
    Code:
    (defun c:demo ( / doc spc obj dst d distancevalue)
      (setq	doc (vla-get-activedocument (vlax-get-acad-object))
    	spc (vlax-get-property
    	      doc
    	      (if (= 1 (getvar 'CVPORT))
    		'Paperspace
    		'Modelspace
    	      )
    	    )
      )
      (if (and (setq distancevalue nil
    		 obj (car (entsel)))
    	   (wcmatch (cdr (assoc 0 (entget obj))) "*LINE")
    	   (setq dst
    		  (vlax-curve-getdistatparam obj (vlax-curve-getendparam obj))
    	   )
          )
    	    (while
    	      (progn
    		(setq d (getdist "\nEnter distance: "))
    		(cond
    		  ((null d) nil )
    		  ((> d dst) d (princ "\nExceeds Entity Length"))
    		  (T
    		   (Vlax-invoke spc
    		     'InsertBlock (vlax-curve-getpointatdist obj d)
    		     "BlockName"  1 1  1 0
    		   )
    		   (setq distancevalue (cons d distancevalue))
    		   (princ (strcat "\nBlock inserted at distance " (rtos d 2 2))
    		   )
    		  )
    		)
    	      )
    	    )
        (princ "\nInvalid Object")
      )
      (foreach p (reverse distancevalue)
        (print p))
      (princ)
    )
    (vl-load-com)
    EDIT: Oops, There's another thread just like this. my bad
    Last edited by pbejse; 2015-07-27 at 05:29 AM.

Similar Threads

  1. Need Lisp for divide polyline in custom length
    By radosak368138 in forum AutoLISP
    Replies: 12
    Last Post: 2015-07-29, 12:31 AM
  2. Replies: 1
    Last Post: 2015-03-19, 02:55 PM
  3. List total Polyline lengths according to Layer
    By irchrismm in forum AutoLISP
    Replies: 16
    Last Post: 2011-07-11, 07:10 AM
  4. Spline divide with VB6
    By srobillard in forum VBA/COM Interop
    Replies: 2
    Last Post: 2007-09-12, 10:53 AM
  5. polyline lengths
    By eebryant in forum AutoCAD Map 3D - General
    Replies: 11
    Last Post: 2006-11-04, 01:18 PM

Posting Permissions

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