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

abort rotation prompt in insert command and exit if blockname is empty

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
GeryKnee
263 Views, 4 Replies

abort rotation prompt in insert command and exit if blockname is empty

 

 

 

in the following command


(defun c:ddd ()
  (command "-insert")
  (princ)
)

 

i need to use it as bellow :

 a. the block name : not user specified / the current

    if the current block name is empty -> function halts / stops / exits

 b. Insertion point : user specified on screen

 c: scale : opposite corner specified on screen

 d: rotation : not user specified / use always the default 0 value

 

How must i write the command to work as above defined?

 

Gery

4 REPLIES 4
Message 2 of 5
stevor
in reply to: GeryKnee

 

 You might start with:

 

 (Defun C:ICB ()
  (if (and (/= "" (getvar "insname")) ; could use a name

         ; since using last name is risky
             (setq BIP (getpoint "\n Insert Point: "))
             (setq BCP (getcorner BIP " Oppo Corner: ") )
      ) ; ands
   (progn(princ "\n Inserting: ")(princ (getvar "insname"))

      ; could rescale the 'corner point for a proportional scale

      ; or just a X or a Y scale

     (command "-insert" "" BIP "c" bcp "" ) ; deault name

       ; respond to attribute queries here, if req'd

       ; finsh insert command, if req'd

     (princ " Inserted ")  
   ) (prince " Nyet ") ) (princ ) ) ; def

S
Message 3 of 5
GeryKnee
in reply to: stevor

 

thanks

 

i use it as following


(defun c:ddd ()
   (if (/= "" (getvar "insname"))
    (
     (command "-insert" "")
     )
    )
  (princ)
)

 

that is solving the problem of the null insname

 

the problem with the part of your code that changes the -insert command is that you have to scale the block without viewing it scalling in real time as -insert does.

What "-insert" needs is just at the last moment of the execution (when asks rotation) to abort the user definition by keyboard and use th value of 0 because this is the only value that i want to use.

Is it possible ?

 

Regards,

Gery

 

Message 4 of 5
Kent1Cooper
in reply to: GeryKnee


@GeryKnee wrote:

 

....

What "-insert" needs is just at the last moment of the execution (when asks rotation) to abort the user definition by keyboard and use th value of 0 because this is the only value that i want to use.

Is it possible ?

.... 



You can specify the Rotation as an option beforehand, and it won't ask for it later:

 

(command "_.insert" "YourBlockName" "_rotate" 0 ...carry on with whatever else...)

Kent Cooper, AIA
Message 5 of 5
GeryKnee
in reply to: Kent1Cooper

 

thanks Kent

Thats the solution

Regards,

Gery

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

Post to forums  

Autodesk Design & Make Report

”Boost