Creating array path along a polyline

is there a way i can change/ moveaway from using the command feature to do the following?

im grabbing a block from another file and plotting it onto a selected polyline with a certain distance
(defun c:coneline (/ d1 d2 dist pline op startpt endpt tl tot)
  (defun coning(dist)
    (setq cmd (getvar 'CMDECHO)) (setvar "CMDECHO" 0)
    (command "_.layer" "s" "0" "") 
    (setq conepath "C:/.../.../Blocks/Cone.dwg")
    (setq startpt (vlax-curve-getStartPoint pline)
        endpt  (vlax-curve-getEndPoint pline)
        tot 0
        op  (if (minusp (- (vlax-curve-getdistatpoint pline (vlax-curve-getclosestpointto pline endpt))
                           (setq d1 (vlax-curve-getdistatpoint pline (vlax-curve-getclosestpointto pline startpt)))))
              -
              +)
        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)
    (command "._-insert" conepath (setq startpt (vlax-curve-getpointatdist pline d2)) 0.3 0.3 0)
    (setq tot (+ tot dist)))
    (setvar 'cmdecho echo)
    (princ)
  )
  
  (setq pline (vlax-ename->vla-object (car (entsel "\nSelect polyline: "))))
  (setq dcl_id (load_dialog "C:\\...\\...\\Dialogs\\CONELINE.dcl"))
  (if (not (new_dialog "CONELINE" dcl_id))
    (exit))
  (action_tile "c10"  "(setq spacing 1)")
  (action_tile "c15"  "(setq spacing 1.5)")
  (action_tile "c20"  "(setq spacing 2)")
  (action_tile "c30"  "(setq spacing 3)")
  (action_tile "c45"  "(setq spacing 4.5)")
  (action_tile "c90"  "(setq spacing 9)")
  (action_tile "c18"  "(setq spacing 18)")
  (start_dialog)(unload_dialog dcl_id)
  (coning spacing)
  (princ)
)

Comments

  • ALANH
    edited November 2022
    look into

    (vla-InsertBlock mspace (vlax-3d-point bpt) blockname 1 1 1 0.0)