PDA

View Full Version : Script/Polyline problem



Rooster
17th Dec 2012, 04:12 pm
Got a conundrum for anyone feeling clever today:

I have a very simple 2D drawing of a building with room outlines, and nothing else. The rooms consist of separate polylines - these are exported as a DWG file from a survey package. The polylines are joined, but looking at the properties AutoCAD thinks they are open. The solution is to explode the polylines and rejoin, after which they all appear as closed. All fine. However, not wanting to manually do this on all my drawings, I wrote a quick script which goes like this:

EXPLODE
ALL
PEDIT
M
ALL

J
0

;END

The script works, except that it is only exploding and joining one room/group of polylines at a time - ie, after running it, one of my rooms now shows as closed, but the others are still open. If I run it again, one more room will be closed etc etc. Obviously, I need it to do all rooms/polylines in one go.

The weird thing is if I manually enter the exact same commands as my script above, it works perfectly. So why the difference?

Rooster
19th Dec 2012, 02:09 pm
Just an update for anyone that's interested.... I've got round this problem by altering my script to the following:

_AI_SELALL
XPLODE
G
E
PEDIT
M
ALL

J
0

;END

Seems that it now works when selecting the polylines before exploding. Still doesn't explain why the previous one worked manually but not as a script.