Jump to content

Diesel loop - Smooth Exit


CadCornerMan

Recommended Posts

Hi all. I created a loop, i am using the if statement to test against a preset variable. The point is when i reach my last time around the loop, it always seems to carry out the last command one more time. I am trying to use ^Z null, surpresses automatic space) as recommended, but the ^Z seems to be having no effect on the operation.

Is there something about using ^Z that is not obvious and I should know? - Thanks:(

Link to comment
Share on other sites

can you post the whole macro, the problem might be elsewhere and it saves people guessing, Diesel does have some quirks and it could be anything.

Link to comment
Share on other sites

*^C^C$M=$(if,$(=,$(getvar,useri1),$(getvar,useri2)),^C,-text;j;c;$M=$(getvar,lastpoint);2;0;$M=$(getvar,useri1);_useri1;$M=$(+,$(getvar,useri1),1);_lastpoint;"0,$M=$(*,$(getvar,useri1),-5),0"

 

The macro is for producing a column of incrementing numbers.Prior to running it I have another macro where Useri1 is set as the start number. Useri2 is the last number and lastpoint gets set to 0,0,0. The plan I have in my head for the macro working is as follows, If useri1=useri2 then cancel, else (print useri1 to drawing,increment useri1 by 1,increase lastpoint to set the location for the next number), repeat.

 

When the loop cancels because useri1=useri2 it always asks for the lastpoint one more time. ^Z added to the end of the macro is meant to prevent this, but when i add it, it does not seem to make any difference.

 

I am just trying to learn the macro format so i may have made a rookie mistake somewhere. Thanks for stopping by this thread to help. The macro still get's the results I am looking for on the screen, I am just being fussy about it exiting smoothly without me having to cancel the last lastpoint.

Link to comment
Share on other sites

I'm running into a few problems, but have found that adding a semi colon after ^C solves part of the problem, however I cannot get the lastpoint variable to update in the macro, it fails to accept the input (but the macro still runs). Anyway I hope the semi colon helps, and do you have the variable MACROTRACE=1, it's a non documented variable but helps when you are trying to debug macro's

Link to comment
Share on other sites

Yes that's it! - The semi-colon after the ^C did the trick, i am now getting returned to the command line ready for the next command - instead of it finishing by asking for a lastpoint again. Cheers - much appreciated Steven. i'm just learning by trying to piece together the different articles I can find on the net.

Hoping to improve my drawing productivity by adding a few custom routines.

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