ILoveMadoka Posted June 18, 2019 Posted June 18, 2019 (edited) If this worked, it would do exactly what I need to do (over and over and over) (DEFUN C:A1 () (SETQ SS (SSGET)) (setq num (getint "Number of Rows:")) (setq DIST "-0.9375") (COMMAND "ARRAY" SS "" "RECTANGULAR" "COLUMNS" "1" "1" "ROWS" NUM DIST "" "") (PRINC)) What it returns is: Requires an integer between 1 and 32767. ; error: Function cancelled I've tried all sorts of things but can't this to work. Please help.. Edited June 18, 2019 by ILoveMadoka Quote
dlanorh Posted June 18, 2019 Posted June 18, 2019 (edited) Try this. Tested in AutoCAD 2012 (DEFUN C:A1 (/ ss num dist);; LOCALISE YOUR VARIABLES (SETQ ss (SSGET)) (setq num (getint "Number of Rows : ")) (setq dist -0.9375) ;;This needs to be a real number not a string (COMMAND "-ARRAY" ss "" "_R" num 1 dist) ;;This needs to be "-ARRAY" NOT "ARRAY" (PRINC)) If you want something different type the command on the command line and follow the options/prompts (COMMAND "ARRAY" SS "" "RECTANGULAR" "COLUMNS" "1" "1" "ROWS" NUM DIST "" "") My prompts/options don't follow this ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ After "RECTANGULAR" should come "COUNT" then num of rows then num of columns (NOT strings) then distance Edited June 18, 2019 by dlanorh Added to Post Quote
jonathann3891 Posted June 18, 2019 Posted June 18, 2019 (edited) See if this works (defun c:a1 (/ ss num dist) (setq ss (ssget) (setq num (getint "\nEnter number of rows: ")) (setq dist -0.9375) (command "-array" ss "" "rectangular" "columns" "1" "1" "rows" num dist "" "") (princ) ) Just notied that @dlanorh posted about the same time I did. His solution is better than mine. Edited June 18, 2019 by jonathann3891 Quote
ILoveMadoka Posted June 18, 2019 Author Posted June 18, 2019 ps: I'm using Autocad 2020 The prompts are: Command: Array Select Objects Array Type [Rect/Path/Polar] Rectangular Select grip to edit array or [ASsociative/Base point/COUnt/Spacing/COLumns/Rows/Levels/eXit]<eXit>: COLUMNS Enter the number of columns or [Expression] <4>: 1 Specify the distance between columns or [Total/Expression] <1.0995>: 1 Select grip to edit array or [ASsociative/Base point/COUnt/Spacing/COLumns/Rows/Levels/eXit]<eXit>: ROWS Enter the number of rows or [Expression] <3>: 5 <Variable NUM> Specify the distance between rows or [Total/Expression] <0.8866>: -.9375 <Variable DIST> Specify the incrementing elevation between rows or [Expresson] <0.0000>: <ENTER> Select grip to edit array or [ASsociative/Base point/COUnt/Spacing/COLumns/Rows/Levels/eXit]<eXit>: <ENTER> to Exit Jonathann3891 You left off a ")" after the ssget. I am getting the same error as before with your code Sir.. dlanorh Your code works perfectly... (DEFUN C:A1 (/ ss num dist);; LOCALISE YOUR VARIABLES (SETQ ss (SSGET)) (setq num (getint "Number of Rows : ")) (setq dist -0.9375) ;;This needs to be a real number not a string (COMMAND "-ARRAY" ss "" "_R" num 1 dist) ;;This needs to be "-ARRAY" NOT "ARRAY" (PRINC)) I guess -ARRAY is the legacy command. Thank you so much!! Quote
dlanorh Posted June 18, 2019 Posted June 18, 2019 Based on the command output, did you try this ? (COMMAND "ARRAY" SS "" "_R" "_COL" 1 1.0 "_R" num dist "" "") The number of columns needs to be an integer and the distance a real. Does this still error? Quote
ILoveMadoka Posted June 19, 2019 Author Posted June 19, 2019 Same error Requires an integer between 1 and 32767. ; error: Function cancelled Your method works great! Thank you again! 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.