harshil Posted yesterday at 10:51 AM Posted yesterday at 10:51 AM (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 19 hours ago by SLW210 Added Code Tags!! Quote
SLW210 Posted 19 hours ago Posted 19 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 9 hours ago Author Posted 9 hours ago Green line should follow white curve path instead the duplicating lines are offsetting in opposite direction of curve Quote
SLW210 Posted 2 hours ago Posted 2 hours ago That's an Image, not a drawing. But since you want guesses only, my WAG is the direction of whatever object you are using for the 'curve path". Quote
harshil Posted 45 minutes ago Author Posted 45 minutes ago manually arraypath is working fine but only while script running it is not working. At some location of layout it is working and at other location same script is not working. test_01.dwg Quote
harshil Posted 44 minutes ago Author Posted 44 minutes ago curve direction reverse using pedit I have tried but not working. I think script is not working because of default base point selection. 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.