Page 1 of 4 1234 LastLast
Results 1 to 10 of 35

Thread: Insert a Block at each point along a Polyline

  1. #1
    Member
    Join Date
    2004-03
    Posts
    7
    Login to Give a bone
    0

    Question Insert a Block at each point along a Polyline

    Has anyone heard of/written a lisp that will put a block at each grip on a polyline? I have to put a 3' circle at each grip along a polyline(probably 2,000 grips)for a wetlands plat I am working on. Thanks for any help.

  2. #2
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    0

    Default Re: Insert a Block at each point along a Polyline

    If it's an LwPolyline, then you will need to extract the vetex points, and the elevations (z value). Make the points a list, and then just insert a block at each point with a foreach loop.

    Is that enough, or do you need more help?

  3. #3
    All AUGI, all the time
    Join Date
    2015-12
    Location
    Central Oregon
    Posts
    591
    Login to Give a bone
    0

    Default Re: Insert a Block at each point along a Polyline

    Here ya go.
    Code:
    ;;add a 3' dia. circle at every vertex of a pline
    ;;Jeff Mishler May 2006
    (defun c:circlevtx (/ ent i idx pt ss totparam rot)
      (if (setq ss (ssget '((0 . "*POLY*"))))
        (progn
          (vla-startundomark (vla-get-activedocument (vlax-get-acad-object)))
          (setq idx -1)
          (while (< (setq idx (1+ idx))(sslength ss))
    	(setq ent (ssname ss idx))
    	(setq totparam (fix (vlax-curve-getendparam ent))
    	      i -1
    	      r (getvar "circlerad"))
    	(if (= r 0.0)
    	  (setq r 1.5);;adjust default Radius here
    	  )
    	(while (< (setq i (1+ i)) totparam)
    	  (setq pt (vlax-curve-getpointatparam ent i))
    	  (entmake (list '(0 . "CIRCLE")
    			 (cons 10 pt)
    			 (cons 40 r)
    			 ;(cons 8 "circlelayer");set the layer here
    			 )
    		   )
    	  )
    	(setq pt (vlax-curve-getpointatparam ent (vlax-curve-getendparam ent)))
    	(entmake (list '(0 . "CIRCLE")
    		       (cons 10 pt)
    		       (cons 40 r)
    		       ;(cons 8 "circlelayer");set the layer here
    		       )
    		 )
    	)
          (vla-endundomark (vla-get-activedocument (vlax-get-acad-object)))
          )
        )
      (princ)
      )

  4. #4
    Member
    Join Date
    2004-03
    Posts
    7
    Login to Give a bone
    0

    Default Re: Insert a Block at each point along a Polyline

    Thanks to the both of you. Miff, did you just write that? Worked well.

  5. #5
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Insert a Block at each point along a Polyline

    Rename the defun as needed

    Code:
      (defun c:foo ()
        (vl-load-com)
        (setq *model-space* (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))))
        (setq obj (vlax-ename->vla-object (car (entsel))))
        (setq c (vlax-get obj "Coordinates") i 0)
        (repeat (/ (length c) 2)
      	(setq x (nth i c) y (nth (1+ i) c))
      	(vla-addcircle *model-space* (vlax-3d-point (list x y 0.0)) 3.0)
      	(setq i (+ i 2)) 
        )
        (princ)
      )
    R.K. McSwain | CAD Panacea |

  6. #6
    All AUGI, all the time
    Join Date
    2015-12
    Location
    Central Oregon
    Posts
    591
    Login to Give a bone
    0

    Default Re: Insert a Block at each point along a Polyline

    Yes & no.... I needed something similar last year so I wrote one that labeled the elevation of every vertex. I just took that and changed it to create a circle instead of text.....

    You're welcome.

    Coincidentally, that project that I needed it for was for Wetland creation......

  7. #7
    100 Club
    Join Date
    2005-05
    Location
    IL
    Posts
    103
    Login to Give a bone
    0

    Default Re: Insert a Block at each point along a Polyline

    Quote Originally Posted by miff
    Yes & no.... I needed something similar last year so I wrote one that labeled the elevation of every vertex. I just took that and changed it to create a circle instead of text.....

    You're welcome.

    Coincidentally, that project that I needed it for was for Wetland creation......
    Hey there Miff, you mentioned a program for labelling elevations at every vertex.....is that something you could post?

    Thanks

  8. #8
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Insert a Block at each point along a Polyline

    Quote Originally Posted by imblueflies
    Hey there Miff, you mentioned a program for labelling elevations at every vertex.....is that something you could post?

    Thanks
    Just made a slight modification to the above post.
    Works on 3D polylines.

    Code:
      (defun c:foo ()
        (vl-load-com)
        (setq *model-space* 
               (vla-get-modelspace 
                  (vla-get-activedocument 
                     (vlax-get-acad-object))))
        (setq obj (vlax-ename->vla-object (car (entsel))))
        (setq c (vlax-get obj "Coordinates") i 0)
        (repeat (/ (length c) 3)
      	(setq x (nth i c) y (nth (1+ i) c) z (nth (+ 2 i) c))
      	(vla-addtext *model-space* (rtos z 2) (vlax-3d-point (list x y 0.0)) 3.0)
      	(setq i (+ i 3)) 
        )
        (princ)
      )
    R.K. McSwain | CAD Panacea |

  9. #9
    Member
    Join Date
    2009-01
    Posts
    33
    Login to Give a bone
    0

    Default Re: Insert a Block at each point along a Polyline

    Quote Originally Posted by rkmcswain View Post
    Rename the defun as needed

    Code:
      (defun c:foo ()
        (vl-load-com)
        (setq *model-space* (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))))
        (setq obj (vlax-ename->vla-object (car (entsel))))
        (setq c (vlax-get obj "Coordinates") i 0)
        (repeat (/ (length c) 2)
      	(setq x (nth i c) y (nth (1+ i) c))
      	(vla-addcircle *model-space* (vlax-3d-point (list x y 0.0)) 3.0)
      	(setq i (+ i 2)) 
        )
        (princ)
      )

    Hello everyone,
    I want to create a lisp that you fill in the starting points of a profile made up of lines and arcs a text P1, P2, P3 ........... and direction of the arc R1, R2, R3 .... ...

    and at the same time I fill up the table of coordinates and the ray of course in relation to the active coordinate system.

    all objects within it should be ignored, while the external profile has to be moved to a new layer called F001

    Who can help me with some advice?

    dwg file in the attached sample.
    Attached Files Attached Files

  10. #10
    AUGI Addict
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: Insert a Block at each point along a Polyline


Page 1 of 4 1234 LastLast

Similar Threads

  1. insert block on polyline
    By ezhilanand10674421 in forum AutoLISP
    Replies: 4
    Last Post: 2015-08-11, 02:37 AM
  2. Replies: 0
    Last Post: 2015-03-19, 11:57 PM
  3. Replies: 5
    Last Post: 2011-03-30, 05:20 PM
  4. VBA project - draw a line of polyline, then insert a block
    By jbortoli in forum VBA/COM Interop
    Replies: 0
    Last Post: 2007-05-14, 08:01 AM
  5. insert block at mid point of a pline
    By cblendermann.91943 in forum AutoLISP
    Replies: 17
    Last Post: 2006-02-07, 12:56 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
  •