Plotting blocks along a polyline - how to speed up/ improve?

I've created a lisp function to place a block from another file to plot along a polyline at a specific distance, i've avoided using a command because of a couple reason, it takes just as long & when i try to undo the who function i either have to mass delete or ctrl + z until each block has been removed off the line

im looking for a way to speed this up, at the moment it is very slow, is there a better way i can optimise this/ do it different?
(defun c:testing ()
  (setq pline (vlax-ename->vla-object (car (entsel "\nSelect polyline: "))))
  (setq startpt (vlax-curve-getStartPoint pline))
  (setq endpt (vlax-curve-getEndPoint pline))
  (setq tot 0)
  (setq op (if (minusp (- (vlax-curve-getdistatpoint pline (vlax-curve-getclosestpointto pline endpt))
                          (setq d1 (vlax-curve-getdistatpoint pline (vlax-curve-getclosestpointto pline startpt)))
                       )
               )
             -
             +
           )
  )
  (setq tl (if (= op -)
             (vlax-curve-getdistatparam pline (vlax-curve-getstartparam pline))
             (vlax-curve-getdistatparam pline (vlax-curve-getendparam pline))
           )
  )

  (while ((if (= op -)
            >=
            <=
          )
            (setq d2 (op d1 tot))
            tl
         )
    (vla-insertblock
      (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))
      (vlax-curve-getpointatdist pline d2)
      "C:\\...\\...\\...\\Cone.dwg"  ;; Replace this path of drawing with yours
      0.3
      0.3
      0.3
      0
    )
    (setq tot (+ tot 3))
  )
)

Comments

  • hi,
    can't you use the _arraypath command?
  • Piet said:

    hi,
    can't you use the _arraypath command?

    im cant find anywhere how to use the command, what arguments it takes?

    my next issue would be after inserting the block how would i selected that specific block automatically without the user selecting it

  • I have make layouts where you set title block scale and it makes layouts walking along a pline, it aligns the sheet to the orientation of the pline arcs ok, 40+ one go etc

    It does need to be set up to suit a end user title block.

    It is not free but real cheap.

    Next step is have plot layout range.