PDA

View Full Version : Pause for user input when inserting a Block containing Attributes



mwilson
2004-11-10, 06:25 PM
HELLO

FOLLOWING IS A LISP ROUTINE THAT I AM TRYING TO WRITE.
EVERYTHING WORKS FINE, EXCEPT BLOCK ATT1 HAS AN ATTRIBUTE
ATTACHED. IT WILL INSERT THE BLOCK, BUT I CAN'T GET THE
ROUTINE TO PAUSE FOR USER INPUT.
ANY HELP WOULD BE APPRECIATED.
WE ARE USING 2004

THANKS MIKE

(defun c:TEST ()
(command "ucs" "w")
(command "layer" "m" "ATT" "c" "7" "" "")
(command "dim" "dimstyle" "r" 777 "e")
(setq S (* (getvar "dimscale") 0.03))
(setq s1 (FIX s))
(setq p (getpoint "\nPICK INSERTION POINT:"))
(command "INSERT" "C:/BLOCKS/att1" p s "" "" "")
(command "ucs" "p")
(princ)
)

rad.77676
2004-11-10, 06:35 PM
HELLO

FOLLOWING IS A LISP ROUTINE THAT I AM TRYING TO WRITE.
EVERYTHING WORKS FINE, EXCEPT BLOCK ATT1 HAS AN ATTRIBUTE
ATTACHED. IT WILL INSERT THE BLOCK, BUT I CAN'T GET THE
ROUTINE TO PAUSE FOR USER INPUT.
ANY HELP WOULD BE APPRECIATED.
WE ARE USING 2004

THANKS MIKE



(defun c:TEST ()
(command "ucs" "w")
(command "layer" "m" "ATT" "c" "7" "" "")
(command "dim" "dimstyle" "r" 777 "e")
(setq S (* (getvar "dimscale") 0.03))
(setq s1 (FIX s))
(setq p (getpoint "\nPICK INSERTION POINT:"))
(command "INSERT" "C:/BLOCKS/att1" p s "" "" "")
(command "ucs" "p")
(princ)
)
Read the help file on ATTREQ variable, this should help!

Coolmo
2004-11-10, 06:47 PM
Are you aware of the the word PAUSE inside the (command.....)? I don't know if it will work here but it's a way to make the program pause for user input and then continue to the next command.

Example: To draw a line...

(Command "line" pause pause "") Where the two pauses are used to allow the user to pick on the screen where he/she wants the two endpoints of the line to be drawn. The "pause" can be used for any typed input or on screen input.

mwilson
2004-11-10, 06:49 PM
YES I TRIED "PAUSE", BUT IT DID NOT WORK

rad.77676
2004-11-10, 07:00 PM
No prompts display for attributes during block insertion


--------------------------------------------------------------------------------

Issue

When inserting a block using the INSERT command, block attribute prompts do not display the default values for the attributes, and the attribute values are automatically accepted (there is no opportunity to change them).

Solution

Change the value for the ATTREQ system variable. You can then modify the preset attribute values as the block is inserted.

On the command line, type attreq and press ENTER.
Type 1 and press ENTER.
Start the INSERT command to insert the block with attributes.
You can now change the attribute values at the prompts when inserting the block instead of accepting the default values.

Glenn Pope
2004-11-10, 07:16 PM
You could prompt the user for the information within the lisp.

Ex.
(setq ATTINFO (getstring "\nEnter Info Here: "))

Then just place that in with the insert command.

Ex.
(command "INSERT" "C:/BLOCKS/att1" p s "" "" "" ATTINFO)

Also you will need to set ATTDIA to 0.

mwilson
2004-11-10, 08:43 PM
GLEN

HER IS THE LISP ROUTINE WITH YOUR CHANGES


(defun c:TEST ()
(command "ucs" "w")
(command "layer" "m" "ATT" "c" "7" "" "")
(command "dim" "dimstyle" "r" 777 "e")
(setq S (* (getvar "dimscale") 0.03))
(setq s1 (FIX s))
(setq p (getpoint "\nPICK INSERTION POINT:"))
(setq ATTINFO (getstring "\nEnter Info Here: "))
(command "INSERT" "C:/BLOCKS/att1" p s "" "" "" ATTINFO)
(command "ucs" "p")
(princ)
)



HERE IS WHAT HAPPENS (ATTDIA SET TO 0)

Command: TEST ucs
Current ucs name: *WORLD*
Enter an option [New/Move/orthoGraphic/Prev/Restore/Save/Del/Apply/?/World]
<World>: w
Command: layer
Current layer: "ATT"
Enter an option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/Freeze/Thaw/LOck/Unlock/stAte]:
m
Enter name for new layer (becomes the current layer) <ATT>: ATT Enter an option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/Freeze/Thaw/LOck/Unlock/stAte]:
c
New color [Truecolor/COlorbook] <7 (white)>: 7
Enter name list of layer(s) for color 7 (white) <ATT>: Enter an option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/Freeze/Thaw/LOck/Unlock/stAte]:
Command: dim
Dim: dimstyle
Current dimension style: 777
>>Enter a dimension style option
[Save/Restore/STatus/Variables/Apply/?] <Restore>: r
>>Enter a dimension style name, [?] or <select dimension>: 777
Current dimension style: 777

Resuming TEST command.

Command:
Dim: e
Command:
PICK INSERTION POINT:
Enter Info Here: XXXX
INSERT Enter block name or [?] <att1>: C:/BLOCKS/att1 Specify insertion point
or [Scale/X/Y/Z/Rotate/PScale/PX/PY/PZ/PRotate]:
Enter X scale factor, specify opposite corner, or [Corner/XYZ] <1>:
3.840000000000000 Enter Y scale factor <use X scale factor>: Specify rotation
angle <0>:
Enter attribute values
NUMBER:
Command: XXXX Unknown command "XXXX". Press F1 for help.

Command: ucs
Current ucs name: *WORLD*
Enter an option [New/Move/orthoGraphic/Prev/Restore/Save/Del/Apply/?/World]
<World>: p

Glenn Pope
2004-11-10, 10:22 PM
:Oops: My Bad.

It should be
(command "INSERT" "C:/BLOCKS/att1" p s "" "" ATTINFO "")


Also you could set ATTDIA at the start of your routine. Then set it back when its done. Better yet, set up an error catching function to set it back if the routine is canceled before it's done.

mwilson
2004-11-10, 10:39 PM
GLENN

THANKS

IT IS WORKING FINE NOW