Community
AutoCAD LT Forum
Welcome to Autodesk’s AutoCAD LT Forums. Share your knowledge, ask questions, and explore popular AutoCAD LT topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to end the "select objects" part in a script?

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
Coooper
5475 Views, 4 Replies

How to end the "select objects" part in a script?

Dear Forum,

 

I am trying to write my first script in AutoCAD LT 2014 and got stuck. I can not find an answer anywhere for the problem.

 

The script is supposed to

 

- open a certain block in the block editor

- delete some information from a block,

- change a property of an object within that block,

- then close the modified block

- then select this modifed block plus some other blocks with the help of "FILTER"

    (requiring my user input in the dialog box)

- and in the end explode all those selected blocks

 

My script is workling fine, except for the step where I want to execute the "explode" command over the objects selected via the "FILTER"

 

This seems to be because the selection is lost before the "explode" command is applied to the selection (see command history for this script)

 

Here's the script:

 

-BEDIT
Floor
_-BVSTATE
_s
ATT
erase
window
50,950,0
1300,-2292,0

chprop
window
-50,1050,0
1050,-50,0

la
Layer 2

_BCLOSE

Filter
All

 

explode


______________________________________________________

 

 

Here's the corresponding command hisory:

 

Command: _SCRIPT
Enter script file name <C:\BlockTEST.scr"

Command: -BEDIT

Enter block name or [?]: Floor
Regenerating model.

Command: _-BVSTATE

Current visibility state: FF
Enter an option [New/Set/Delete] <New>: _s

Enter visibility state name to make current or [?]: ATT

Command: erase

Select objects: window

Specify first corner: 50,950,0
Specify opposite corner: 1300,-2292,0
28 found

Select objects:

Command: chprop

Select objects: window

Specify first corner: -50,1050,0
Specify opposite corner: 1050,-50,0
1 found

Select objects:

Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: la

Enter new layer name <0>: Layer 2

Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]:

Command: _BCLOSE
Enter option [Save/Discard changes] <Save>:
Regenerating model.

Command: Filter           (here I get the "Filter"-dialog box to manually select an existing filter)
Applying filter to selection.
Select objects: All
2 found

Select objects:
Exiting filtered selection.       (why is the selection not kept acrtive so "explode" is applied to them??)
Command: explode              (because if I simply end the script: Filter
                                                                                                  All
Select object: *Cancel*                                                              

_______________________ ... without the "explode" I end up with the correctly selected blocks,  

                                                  ready for me to "explode" them by hand)

 


I tried all combinations I could think of in this last step:

- with two "returns" to end the slection process           ->  FILTER is repeated, no success

- with "explode" directly after "All", so no empty line   -> selection is lost and command history reads:

 

                                                                                         ...

                                                                                         Command: Filter
                                                                                        Applying filter to selection.
                                                                                        Select objects: All
                                                                                        2 found                         (yes! correct until here)

                                                                                  

                                                                                        Select objects: explode


                                                                                         *Invalid selection*

                                                                                         ...

and others.

 

 

I can get this to work using a macro with this content:

 

^C^C-bedit;Floor;_-BVSTATE;_s;ATT;erase;window;50,950,0;1300,-2292,0;;chprop;window;-50,1050,0;1050,-50,0;;la;Layer 2;;_BCLOSE;;filter;all;;explode;

 

I guess it is not pretty, but in the end that one block is modified and then exploded together with the other blocks.

 

 

 

Very much looking forward to your help!

 

4 REPLIES 4
Message 2 of 5
pendean
in reply to: Coooper

scripts do not control pop-ups, never have, still don't. This applies to when you are done with pop-ups too. No fix.
Message 3 of 5
Coooper
in reply to: pendean

Hello pendean,

 

thank you for the clear, yet saddening answer.

 

I will work with scripts and macros some more to get a better understanding of the possibilities and limitations, but while we're at it: Is there an easy answer on why my automated procedure works when I translate it into the macro? Can macros control pop-ups?

Message 4 of 5
pendean
in reply to: Coooper

macros, like scripts, do not control pop-ups or what happens after a pop-up is closed.
If you need to automate, consider stepping up to full AutoCAD with it's full power coding/customization ability (allows you to skip/circumvent pop-ups).

In your case, would SELECTSIMILAR be an option instead of FILTER? Don;t forget about SELECTSIMILARMODE variable that controls the options you may want. Test and find out.
Message 5 of 5
Coooper
in reply to: pendean

I will try if I can use the SELECTSIMILAR command to my advantage.

 

Thank you for the help!

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

Post to forums  

Autodesk Design & Make Report

”Boost