Jump to content

Recommended Posts

Posted

I have a drawing set that has something like 200 drawings in it, all of which has revision clouds. I now need to delete ALL the revision clouds. This will take HOURS by hand due to the size of the files.

 

Is there a way to automate opening all .dwg files in one location, selecting a certain block, deleting it, saving the file, and closing? Rinse and repeat.

  • Replies 20
  • Created
  • Last Reply

Top Posters In This Topic

  • resullins

    9

  • ReMark

    6

  • Lee Mac

    5

  • MBSupport

    1

Posted

I would recommend creating an AutoLISP program to perform the necessary operations on each drawing, and then running it through my Script Writer program (or an alternative batch processing program).

 

opening all .dwg files in one location, selecting a certain block, deleting it, saving the file, and closing?

 

Are you looking to simply delete a specific block reference from each drawing?

Or all instances of a block reference?

Posted

You need to be a bit careful here. You will need to use AutoCAD full version to select the revision blocks using SSGET, this can be done and is very specific, the problem I see is when you come to removing the revision clouds. Can you be absolutely certain you are only selecting the revision clouds and not something else as well. The revision clouds are probably on a specific layer but you can’t be sure that nothing else is on that layer as well.

 

I think the best option is to partially automate the script to delete the revision blocks and then pause the script to manually delete the revision clouds. Any none AutoCAD command in a script routine will pause the script, allowing you to work on a drawing, when you are finished type RESUME on the AutoCAD command line to resume the script and open the next drawing. The ability to pause a script is a very useful feature.

 

Patrick

http://www.multi-batch.com/

Posted

@Lee: I'll take a look. I'm hoping it's a simple lisp, as I'm still not very good! But your site has been suggested as the place to go! As usual.

 

@MB: I can't do something that requires user input, that defeats the purpose of what I'm trying to do. The files I'm working with take 5-6 minutes to save and close apiece.

Posted (edited)

This could be incorporated in your script file.

 

;; FIND AND ERASE BLOCK
;; EDIT "yourblockname" TO SUIT
(setq ss (ssget "_X" '((0 . "INSERT") ( 2 . "youroldblockname"))))
;; Find all blocks named "youroldblockname"
(if ss (command "_.ERASE" ss ""))
;; PURGE BLOCK
;; EDIT "youroldblockname" TO SUIT
_PURGE
_B
"youroldblockname"
_N
_QSAVE
;; END SCRIPT

 

Acknowledgement: Written by MTE Controls and posted at the AutoCAD Electrical Discussion Group in 2006.

Edited by SLW210
code tags added
Posted

For deleting all references (including all nested references, nested to any depth) of specific blocks, save this program to your AutoCAD Support Path and then in your Script, use:

 

(load "DeleteBlocksV1-0.lsp" nil) (if LM:DeleteBlocks (LM:DeleteBlocks (LM:acdoc) '([highlight]"Block1" "Block2" "Block3"[/highlight])))

Change the highlighted list of block names to suit (the list is not case-sensitive).

 

For selecting and deleting revision clouds - I agree that this could potentially be hazardous if your drawing were to contain other LWPolylines with arc segments residing on the same layer as the revision clouds.

 

To reduce this potential risk, if your revisions clouds have not been modified since they were created, you could use the following function to return a filter list which can then be used with the ssget function to retrieve a set of revision clouds:

[color=GREEN];; Revision Cloud Filter List  -  Lee Mac[/color]

([color=BLUE]defun[/color] LM:RevCloudFilter ( [color=BLUE]/[/color] bulge fuzz )
   ([color=BLUE]setq[/color] bulge (([color=BLUE]lambda[/color] ( a ) ([color=BLUE]/[/color] ([color=BLUE]sin[/color] a) ([color=BLUE]cos[/color] a))) ([color=BLUE]/[/color] ([color=BLUE]*[/color] 11.0 [color=BLUE]pi[/color]) 72.0))
         fuzz  1e-4
   )
   ([color=BLUE]list[/color]
      '(0 . [color=MAROON]"LWPOLYLINE"[/color])
      '(-4 . [color=MAROON]"<OR"[/color])
          '(-4 . [color=MAROON]"<NOT"[/color])
              '(-4 . [color=MAROON]"<OR"[/color])
                  '(-4 . [color=MAROON]">="[/color])
                   ([color=BLUE]cons[/color] 42 ([color=BLUE]+[/color] bulge fuzz))
                  '(-4 . [color=MAROON]"<="[/color])
                   ([color=BLUE]cons[/color] 42 ([color=BLUE]-[/color] bulge fuzz))
              '(-4 . [color=MAROON]"OR>"[/color])
          '(-4 . [color=MAROON]"NOT>"[/color])
          '(-4 . [color=MAROON]"<NOT"[/color])
              '(-4 . [color=MAROON]"<OR"[/color])
                  '(-4 . [color=MAROON]">="[/color])
                   ([color=BLUE]cons[/color] 42 ([color=BLUE]+[/color] ([color=BLUE]-[/color] bulge) fuzz))
                  '(-4 . [color=MAROON]"<="[/color])
                   ([color=BLUE]cons[/color] 42 ([color=BLUE]-[/color] ([color=BLUE]-[/color] bulge) fuzz))
              '(-4 . [color=MAROON]"OR>"[/color])
          '(-4 . [color=MAROON]"NOT>"[/color])
      '(-4 . [color=MAROON]"OR>"[/color])
   )
)

Posted

I have actually just created a dynamic block called "RevCloud" or something like that, so I don't need to select arcs or anything like that... the whole thing is a block.

 

I actually made it into a block for this purpose, so it would be more easily manipulable with code.

Posted

ma·nip·u·lat·able?

We're still talking only one block even if there are 200 instances of the same block in each drawing. That macro I posted earlier would work. All you would have to do is put it into a form that Lee Mac's Script Writer could use to batch process an entire folder of drawings.

Posted

Yup... just one block, though there may be multiple instances. So I'm going to give yours a try... as soon as I find the time... or, you know, my petition for 36 hour days gets passed!

Posted

And I stand by manipulable. Valid choice! And shorter for my swollen fingers to type!

Posted

Haven't you had that kid yet? What are you waiting for an engraved invitation?

 

Heck, I was an EMT and a surgical technician at one time. I deliver and not just pizza either! LoL

Posted

HA!!!! I wish. Nope... still sitting here working. I have TWO as-built drawing sets to complete in the next two days. Have to get them to the printer Friday. I'm being induced on Monday... but we may not make it that long!

 

If you wanna come on down, we can go neighborhood shopping, and have a kid! :lol:

Posted

I delivered my son and scrubbed in on three cesarean sections. One was for a set of twins. Pretty darn amazing.

 

Speaking of amazing...so you are literally chained to the desk making life good for your boss and at some time you will "take a break", birth a child, plow the back 40, then come back to work and finish off the rest of the drawings?

 

You are Super Woman!

Posted

Yes. Well, currently, I'm chained to a desk trying to sort through red lines that were compiled by a guy that doesn't know the purpose of a Keynote.

 

But hopefully I'm going to finish the drawings, then go have the baby and start my maternity leave!

Posted

I wish you and your husband the very best and I hope you have a healthy, happy baby (girl or boy)! And if your slave driver of a boss calls while you are on maternity leave and begs you to come in for just a "few hours" tell him you'd be happy to do it if...

 

1) He watches your baby while you work (he may have to change a diaper too) and....

 

2) Pays you a maternity escalator fee equal to five times your normal rate.

 

Go home, put up your feet, have a non-alcoholic ice tea and have your husband cook you dinner. You deserve it.

Posted
I have actually just created a dynamic block called "RevCloud"

 

That macro I posted earlier would work.

 

ReMark, the code you posted will not work for dynamic blocks.

Posted

I was not aware of that limitation Lee. Thank you for bringing it to my attention. :)

  • 1 month later...
Posted

I think I got everything right except I'm obviously missing something. When I load and run the script, it's giving me this:

 

Temp\Test\V-1209OLMC-AVDB-001-COVER PAGE.dwg" nil) nil

Command: (if LM:DeleteBlocks (LM:DeleteBlocks (LM:acdoc) '(RevCloud))) nil

Command: _.save Save drawing as

Temp\Test\V-1209OLMC-AVDB-001-COVER PAGE.dwg>: _Y A drawing with this name

already exists.

Do you want to replace it? _.close

Yes or No, please.

A drawing with this name already exists.

Do you want to replace it? *Cancel*

 

But when I put an extra space before the _Y, it gives me a different error.

Posted
Temp\Test\V-1209OLMC-AVDB-001-COVER PAGE.dwg" nil) nil

 

From the above output, it looks as though you are attempting to load a drawing, not an AutoLISP file; also remember that in AutoLISP you must use either forward slashes '/', or double-backslashes '\\' as filepath delimiters.

 

Command: (if LM:DeleteBlocks (LM:DeleteBlocks (LM:acdoc) '(RevCloud))) nil

 

The nil would indicate that the function is not loaded which would confirm that the LISP program has not been loaded.

 

Command: _.save Save drawing as

Temp\Test\V-1209OLMC-AVDB-001-COVER PAGE.dwg>: _Y A drawing with this name

already exists.

Do you want to replace it? _.close

Yes or No, please.

A drawing with this name already exists.

Do you want to replace it? *Cancel*

 

I would recommend using the _.qsave command over the _.save command to avoid the 'replace drawing' prompt. :)

Posted

Ugh... I feel so out of it. It's been a year since I've even touched a program, and now I'm doing it while multitasking with sleep deprivation!

 

Thanks Lee! I'll take a look... after I go back through all the LISP tutorials I can find!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...