Author Topic: How do I explode a block using a script?  (Read 8283 times)

0 Members and 1 Guest are viewing this topic.

Luke

  • Guest
How do I explode a block using a script?
« on: January 10, 2008, 11:27:22 AM »
I thought I already posted this but had some errors...

Anyhow, how do you insert a drawing using a script and explode it through the script also.  I got the insert part handled but can not figure out how to explode.

The drawing appears empty but actually has my dimension styles embedded in it.


David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: How do I explode a block using a script?
« Reply #1 on: January 10, 2008, 11:29:31 AM »
explode;last;
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Luke

  • Guest
Re: How do I explode a block using a script?
« Reply #2 on: January 10, 2008, 11:37:08 AM »
That's what I thought but try it once.

It's like because the drawing I'm trying to insert as a block is "empty" the command last is not recognized...

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: How do I explode a block using a script?
« Reply #3 on: January 10, 2008, 11:44:53 AM »
Maybe place a "point" at 0,0 in your insert so it will explode
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Luke

  • Guest
Re: How do I explode a block using a script?
« Reply #4 on: January 10, 2008, 11:49:35 AM »
Still doesn't find it

T.Willey

  • Needs a day job
  • Posts: 5251
Re: How do I explode a block using a script?
« Reply #5 on: January 10, 2008, 11:52:37 AM »
To use the 'last' option, the object has to be on the screen.  If it's not, then you can use the lisp function '(entlast)'.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: How do I explode a block using a script?
« Reply #6 on: January 10, 2008, 11:57:49 AM »
If I recall you need to include and asterisks before the file name and it inserts exploded. use the -insert command in your script.
Be your Best


Michael Farrell
http://primeservicesglobal.com/

Luke

  • Guest
Re: How do I explode a block using a script?
« Reply #7 on: January 10, 2008, 11:59:36 AM »
The script I attached is just a small portion of a whole huge script that is doing a bunch of other things.  These are all aready in place and there are a bunch.  

I pasted the '(entlast)' into the script after I added explode but it doesn't work.  Is there something additional I can do to the script to make it work?

Code: [Select]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;               THIS CODE INSERTS THE DIMENSION STYLE DRAWING                 ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-insert
LCC_DIMSTYLES.dwg
0,0,0
1
1
0
explode
'(entlast)'
;..........................................................................FINISHED

ronjonp

  • Needs a day job
  • Posts: 7529
Re: How do I explode a block using a script?
« Reply #8 on: January 10, 2008, 12:01:05 PM »
Try (command "._explode" (entlast))....or MJ's solution.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Luke

  • Guest
Re: How do I explode a block using a script?
« Reply #9 on: January 10, 2008, 12:10:43 PM »
If I use the * per mjfarrell  code needs to be...
Code: [Select]
-insert
*LCC_DIMSTYLES.dwg
0,0,0
[color=red]1[/color]
0

If I use the (command "._explode" (entlast)) per ronjonp code needs to be...
Code: [Select]
-insert
LCC_DIMSTYLES.dwg
0,0,0
[color=red]1
1[/color]
0
(command "._explode" (entlast))
 

not quite sure why ACAD changes the prompts with the * input but it works.

Thanks!!  Greatly appreciated!

ronjonp

  • Needs a day job
  • Posts: 7529
Re: How do I explode a block using a script?
« Reply #10 on: January 10, 2008, 12:18:49 PM »
you can also keep everything on the same line like so: -insert LCC_DIMSTYLES.dwg 0,0,0 1 1 0

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

T.Willey

  • Needs a day job
  • Posts: 5251
Re: How do I explode a block using a script?
« Reply #11 on: January 10, 2008, 12:20:37 PM »
Acad acts funny if the block is not scaled the same in all directions.  I assume that is why you only need to enter one scale factor when you know the block is going to be exploded on insert.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: How do I explode a block using a script?
« Reply #12 on: January 10, 2008, 12:21:58 PM »
changing the thought process a little, I think I did this a while back, and when Acad asked for insert point, I hit ESC with a (command) to cancel out.  Does this ring a bell?
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: How do I explode a block using a script?
« Reply #13 on: January 10, 2008, 12:23:12 PM »
I tested from the command line and it works
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

T.Willey

  • Needs a day job
  • Posts: 5251
Re: How do I explode a block using a script?
« Reply #14 on: January 10, 2008, 12:26:25 PM »
changing the thought process a little, I think I did this a while back, and when Acad asked for insert point, I hit ESC with a (command) to cancel out.  Does this ring a bell?
This is a technique to insert the block into the drawings block collection, but not actually insert it into the drawing space.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Luke

  • Guest
Re: How do I explode a block using a script?
« Reply #15 on: January 10, 2008, 01:14:25 PM »
Yes, that seems to do it also.  But so now here's my stupid question...

what is the command to ECS in a script.

I tried ^C^C
I tried ESC
I tried CANCEL


David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: How do I explode a block using a script?
« Reply #16 on: January 10, 2008, 01:14:32 PM »
yes, but that would define his dimstyles correct?  Hes inserting a blank dwg that has the styles defined
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: How do I explode a block using a script?
« Reply #17 on: January 10, 2008, 01:15:01 PM »
(command)  its a lisp thing
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: How do I explode a block using a script?
« Reply #18 on: January 10, 2008, 01:30:29 PM »
Yes, that seems to do it also.  But so now here's my stupid question...

what is the command to ECS in a script.

I tried ^C^C
I tried ESC
I tried CANCEL



Commander,

Typically one does not use escape in a script.  From Help:

Each line of the script file contains a command. Each blank space in a script file is significant because SPACEBAR is accepted as a command or data field terminator. You must be very familiar with the sequence of prompts to provide an appropriate sequence of responses in the script file.

NoteKeep in mind that prompts and command names may change in future releases, so you may need to revise your scripts when you upgrade to a later version of this program. For similar reasons, avoid the use of abbreviations; future command additions might create ambiguities.
A script can execute any command at the command prompt except a command that displays a dialog box. In most cases, a command that displays a dialog box has an alternative version of the command that displays command prompts instead of a dialog box.

Script files can contain comments. Any line that begins with a semicolon (;) is considered a comment, and it is ignored while the script file is being processed. The last line of the file must be blank.

All references to long file names that contain embedded spaces must be enclosed in double quotes. ...A script is treated as a group, a unit of commands, reversible by a single U command. However, each command in the script causes an entry in the undo log, which can slow script processing. If you like, you can use UNDO Control None to turn off the undo feature before running the script, or you can write it at the beginning of the script itself. Remember to turn it back on (UNDO Control All) when the script is finished.



Instead one would 'enter' through until the end of the desired command or action had been executed.  Sort of like the first rule of writing a script; is to know all of the command actions, and prompts as well as the objects you want to action on prior to writing the script.

Be your Best


Michael Farrell
http://primeservicesglobal.com/

Luke

  • Guest
Re: How do I explode a block using a script?
« Reply #19 on: January 10, 2008, 01:42:02 PM »
(command) to cancel does work.  However, in my case this is just a small portion withing a huge script so cancel stops the script.  So for me I need to do it one of these 2 ways...

Quote
If I use the * per mjfarrell  code needs to be...

Code:
-insert
*LCC_DIMSTYLES.dwg
0,0,0
1
0
If I use the (command "._explode" (entlast)) per ronjonp code needs to be...

Code:
-insert
LCC_DIMSTYLES.dwg
0,0,0
1
1
0
(command "._explode" (entlast)) 

ELOQUINTET

  • Guest
Re: How do I explode a block using a script?
« Reply #20 on: January 11, 2008, 07:45:19 PM »
i have asked this question on several occasions here for similar reasons. we will get architectural drawings sent to us and the xrefs will be bound as inserts but i need to prepare the drawings for our use. the first thing i need to do is explode the blocks then go through the rest of the processes. i haven't been able to figure out how to cancel out of the exploding of these blocks but continue with the rest after. you say (command) does cancel out does resume work for resuming in this instance. i've read about that but am not able to test it right now?

ronjonp

  • Needs a day job
  • Posts: 7529
Re: How do I explode a block using a script?
« Reply #21 on: January 11, 2008, 09:05:52 PM »
Dan,

What exactly do you do to "prepare" these files?

Ron

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

ELOQUINTET

  • Guest
Re: How do I explode a block using a script?
« Reply #22 on: January 14, 2008, 08:53:30 AM »
it depends on the files ron but mostly we explode any bound xrefs then manipulate  layer color and visibility and purge out unwanted stuff. this and not being able to shrink the size of the missing xref path are my 2 main problems. When we bring these into our template we want to leave behind as much unwanted garbage as we can.