harshil Posted 18 hours ago Posted 18 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 11 hours ago by SLW210 Added Code Tags!! Quote
SLW210 Posted 11 hours ago Posted 11 hours ago Please use Code Tags when posting code. (use <> in the Editor) Do you have a drawing with a before and after? Quote
harshil Posted 58 minutes ago Author Posted 58 minutes ago Green line should follow white curve path instead the duplicating lines are offsetting in opposite direction of curve 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.