Jump to content

Adding a Diesel string has caused Wipeout Command to Fail


Recommended Posts

I have just added the following string to an existing long macro:

 

VPLAYER;Thaw;$M=$(getvar,CLAYER);Current;;

 

Then later in the macro I call the WIPEOUT command to create a wipeout from the last rectangle placed by the macro.

 

WIPEOUT;Polyline;Last;No;

 

Now it breaks at that point, and the command line, instead of returning "Last" is returning "$(++)". It is hard to search for because google doesn't recognise $(++) as a term to include in results.

 

I do not know if it is the Wipeout command specifically, or if others would be affected in the same way. There are other "Last" commands that are used between the diesel and the wipeout which work fine.

 

Has anyone seen anything like this before?

Link to comment
Share on other sites

Without seeing the complete macro it's difficult to pinpoint the problem, but the way that diesel works isn't always logical, it could be trying to use values from a different part of the macro than you expect, you could try turning MACROTRACE=1 which will give you an output on the command line used for debuging diesel, but I'll warn you now it isn't easy. If you post the complete macro I will take a look but no promises as to finding a solution.

Link to comment
Share on other sites

Thanks so much for your response steven-g! I was posting the code and just thought I'd try some things before uploading.

 

If I strip the macro back to what I think is the problem, it starts to work again:

 

^C^C-LAYER;New;WIPEOUT;;ORTHO;OFF;_PSPACE;VPLAYER;Thaw;$M=$(getvar,CLAYER);Current;;RECTANG;0,0;\MOVE;Last;;0,0;0,0;OFFSET;1.5;0,0;-10,10;Exit;ERASE;Previous;;WIPEOUT;Polyline;Last;No;

I added in commands a piece at a time, and then it started breaking at different places.

 

With some trial and error I narrowed it down to being about 256 characters AFTER the Diesel began. So it seems that is the limit and when it reaches it then AutoCAD truncates the macro and returns $(++).

 

Here is one with 274 characters, (261 of which are after the Diesel starts) that was breaking halfway through the final "LAST":

 

VPLAYER;Thaw;$M=$(getvar,CLAYER);Current;;OSMODE;0;REC;\\CHANGE;Last;;Properties;Color;White;;UCS;OBject;Last;OFFSET;1.5;0,0;-10,10;Exit;ERASE;Previous;;WIPEOUT;Polyline;Last;;No;DRAWORDER;Last;;Back;Change;Last;;Properties;LAyer;WIPEOUT;;COPY;PREVIOUS;;0;1;COPY;LAST
;;0;1;

So the command line looks like:

Command: COPY

Select objects: LA 1 found

Select objects: $(++)*Cancel*
$(++)

Some of this series of mine are over 500 character long, but this new Diesel, if it worked would have been great at troubleshooting it. The Diesel is essential to be at the start. My next trial is whether I can run the Diesel then call the rest of the macro as a script file instead.

Edited by YZ
Link to comment
Share on other sites

This should work (fingers crossed)

^C^C^CVPLAYER;T;$M=$(getvar,CLAYER);Current;;OSMODE;0;REC;\\CHANGE;L;;P;C;White;;UCS;OB;L;OFFSET;1.5;0,0;-10,10;Exit;ERASE;P;;WIPEOUT;Polyline;L;No;DRAWORDER;L;;B;-layer;n;wipeout;;Change;L;;P;LA;WIPEOUT;;COPY;P;;0;1;COPY;L;;0;1;

1) I found a few points I took out a return at the point where you created a wipeout you had a double return and it stalled the program (look carefully see if you can spot it)

2) changing the properties of the new wipout to a new layer, although the program asks you to input the new name it won't create it so you have to create the new layer called wipeout first using the -layer command

3) There is a limit to how long a macro can be (not sure but from the look of things it is around the 256 characters) so I cut down a lot of the commands, when Autocad is asking you to input an option it will accept just the highlighted characters, so use L in place of Last or OB for OBject, this cuts the length of the macro down (but does make it difficult to read)

 

As a note I think scripts do require the full words but they don't have the same limit on the length

Link to comment
Share on other sites

Thanks steven-g, you are all over macros!

 

1. Oh yes, is see the redundant ; Last; behave differently depending on whether commands that allow for multiple selections or not. Force of habit.

 

2. My Fuller version of the macro does start with -Layer command to create Wipeout layer. I did not want to post the entire macro due to trade secrets. Usually I use transparency on this forum, but this one has had too much work!

 

3. A macro can be a lot longer than 256 (I have some with 3000 characters). But once a Diesel expression is introduced, then it seems to have that limit of 256. I always code with the full word, rather than the highlighted characters, just so troubleshooting is easier. But I have never run in to this problem before. This is from a whole series of macros with different variables, and some of them have over 500 characters, so I don't think I could bring them down to be short enough through that method anyway.

 

I have read once that a Diesel expression cannot return more than 256 characters. Is it possible that I need to "close" the diesel expression properly? Is it including the rest in the limit? Or is it simply that once Diesel is included, you have to finish the macro in under 256 characters?

 

Thanks for looking so deeply into this code.

Link to comment
Share on other sites

Yeah I figured you might already have the correct layer in there.

I too can't quite get what and when the limits kick in, but the $(++) is an error code from diesel to let you know the string is too long.

It's really difficult to comment on theoretical's with diesel, it is best to try different ways and deffinately have macrotrace set to 1 and learn to read what it is saying, or least pick out the clues as to when it is giving problems, I'm looking at the moment, into combing scripts and macros which is a good way of getting blocks of commands working and into seperate areas for making life easier.

Link to comment
Share on other sites

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...