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

common insert blocks lisp for uniformly and non-uniformly scaled blocks

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
robert06
685 Views, 5 Replies

common insert blocks lisp for uniformly and non-uniformly scaled blocks

As there are two different prompt sequences in "-insert", one for blocks which are allowed to be scaled uniformly only and other with separate scale factor prompt for each axis, is there a way to create common lisp for inserting both block types with uniformed scale factor (scale factor 1 etc on each direction)?

Command: -INSERT
Enter block name or [?] <block1>:

Units: Meters Conversion: 1.0000000
Specify insertion point or [Basepoint/Scale/Rotate]:

 

Command: -INSERT

Enter block name or [?] <block1>: block2

Units: Meters Conversion: 1.0000000
Specify insertion point or [Basepoint/Scale/X/Y/Z/Rotate]: Specify scale factor or [Corner/XYZ] <1>:

 

5 REPLIES 5
Message 2 of 6
hmsilva
in reply to: robert06

Try
(command "_.insert" BlockName "_S" 1 "_R" 0 "_NONE" InsertionPoint)

Henrique

EESignature

Message 3 of 6
robert06
in reply to: hmsilva

thank you for clue Henrique, yes, I got it working by setting rotate and scale prior base point. Also, rotate had to be set before scale.

 

(defun c:qin ()
    (command "-insert" pause "_r" 0 "_s" 1 pause)
    (princ)
)

 

first pause for user input for blockname, second for insertion point.

 

///

No logical solution here, just experimenting, for block insertion with user input also at rotation, it workes like this:


(defun c:yr ()
    (command "-insert" pause pause 1 pause)
        (princ)
)

 

the sequence of prompts here: blockname, basepoint, scalefactor, rotation

Robert

Message 4 of 6
hmsilva
in reply to: robert06


@robert06 wrote:

thank you for clue Henrique, yes, I got it working by setting rotate and scale prior base point. Also, rotate had to be set before scale.

 

(defun c:qin ()
    (command "-insert" pause "_r" 0 "_s" 1 pause)
    (princ)
)

 

first pause for user input for blockname, second for insertion point.

 

///

No logical solution here, just experimenting, for block insertion with user input also at rotation, it workes like this:


(defun c:yr ()
    (command "-insert" pause pause 1 pause)
        (princ)
)

 

the sequence of prompts here: blockname, basepoint, scalefactor, rotation

Robert


You're welcome, Robert.

 

To maintain the same user input to uniform and non-uniform scaled blocks with scale = 1, and allowing the user to enter the block name, insertion point and rotation angle, perhaps something like this

 

(defun c:yr ()
  (command "-insert" "\\" "_s" 1 "\\" "\\")
  (princ)
)

 

Henrique

EESignature

Message 5 of 6
robert06
in reply to: hmsilva

That's better, thank you.

Message 6 of 6
hmsilva
in reply to: robert06

You're welcome, Robert.
Glad I could help

Henrique

EESignature

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

Post to forums  

Autodesk Design & Make Report

”Boost