Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

arrayrect through lisp

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
robert06
1276 Views, 4 Replies

arrayrect through lisp

Arrayrect does not work through lisp as expected, command prompt appearance is different through lisp than running the command straight from commandline.

Intention is to use the Array as object, not classic array. Firstly ucs is here temporarily changed to give array intended direction (wondering why there is no angle option available in standard), spacing values are preset, for number of columns and rows code stops for user inputs:

 

(defun c:a25 ()
    (command ".undo" "begin")
    (command "ucs" pause pause "")
    (setq xxx (ssget))
    (command "arrayrect" xxx "" "col" pause "2.5" "r" pause "12" "0" "x")
    (command "ucs" "p")
    (command "undo" "end")
    (princ)
)

 

In addition would be nice if array base point could be set same as temporary ucs 0,0.

 

4 REPLIES 4
Message 2 of 5
dbroad
in reply to: robert06

Starting the arrayrect command from lisp yields this sequence:

Command: (command "arrayrect" pause)
nil
1 found


Select objects:
Type = Rectangular Associative = Yes

Specify opposite corner for number of items or [Base point/Angle/Count] <Count>: c
Enter number of rows or [Expression] <4>: 3
Enter number of columns or [Expression] <4>: 4
Specify opposite corner to space items or [Spacing] <Spacing>: s
Specify the distance between rows or [Expression] <1'-4 5/32">: 4
Specify the distance between columns or [Expression] <1'-4 5/32">: 4
Select grip to edit array or [ASsociative/Base point/Rows/Columns/Levels/eXit]<eXit>:

 

It appears that there is an angle prompt but it comes first.  Also there is no "COL" option.  When scripting a command, do it on the command line first this way.

Architect, Registered NC, VA, SC, & GA.
Message 3 of 5
robert06
in reply to: dbroad

thank you, dbrod

 

for my particular case it's good as:


(defun c:a25 ()
    (setq xxx (ssget))
    (command "_arrayrect" xxx "" "b" pause "a" pause "c" "1" pause "s" "2.5" "r" "1" "12" "0" "x")
    (princ)
)

 

assigning number of rows other than 1, or pausing for user input there, changes the sequence again, so additional modifications are needed then

 

Robert

Message 4 of 5
dbroad
in reply to: robert06

Glad you got it working.  Happy Lisping.

Architect, Registered NC, VA, SC, & GA.
Message 5 of 5
shcvip
in reply to: dbroad

Thank you for your help!

I'm from China.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost