harshil Posted 7 hours ago Posted 7 hours ago (edited) (defun c:AUTOHPA ( / objLayer pathLayer objSS pathSS objToArray pathCurve pathLength ) (setvar "CMDECHO" 0) ;; Define your custom layer names here (setq objLayer "V1") ; <-- Replace with your object layer name (setq pathLayer "P1") ; <-- Replace with your path layer name ;; Number of items (setq items 10) ;; Automatically select everything on the object layer (setq objSS (ssget "_X" (list '(0 . "*") (cons 8 objLayer)))) ;; Automatically select the first/only object on the path layer (setq pathSS (ssget "_X" (list '(0 . "*") (cons 8 pathLayer)))) (princ "working01") ;; Check if both selections actually found objects (if (and objSS pathSS) (progn ;; Get the first entity name from the path selection set (setq pathCurve (ssname pathSS 0)) ;; 3. Calculate the exact length of the path object automatically (setq pathLength (vlax-curve-getDistAtParam pathCurve (vlax-curve-getEndParam pathCurve))) (princ pathLength) (princ "working02") ;; Execute the array using the full object selection set (command "._ARRAYPATH" objSS "" pathCurve "M" "M" "I" items pathLength "" "X") (princ "\nArray completed successfully using layers.") ) (princ "\nError: Objects or Path curve not found on the specified layers.") ) (setvar "CMDECHO" 1) (princ) ) Edited 52 minutes ago by SLW210 Added Code Tags!! Quote
SLW210 Posted 50 minutes ago Posted 50 minutes ago Please use Code Tags when posting code. (use <> in the Editor) Do you have a drawing with a before and after? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.