OK, Maybe someone here can help me with this incredibly painful macro.This nasty macro I am working on is close to working, but I think the evaluation sequence is not running correctly and causing the diesel interpeter to error out. I must be missing something and have tried to get quotes to force the eval, but I still keep having it messed up on something.
The routine makes an array of holes for making shelf pin holes in cabinets, the user clicks the top right corner of the carcass opening and the bottom left corner of the cabinet carcass, it evaluates the ht of the cabinet to determine how far from the top to start (3" if ht<36", 6" if >36"), then figures the width between the column of holes and figures how many rows to make, the spacing is known (32mm).
Here it is raw, with all quotes removed;
^C^C_UCS;NEW;\_setenv;pt1;0,0,0;_ID;\_setenv;pt2;$m=$(getvar,la stpoint);$(IF,$(<,$(-,$(index,1,$(getenv,pt2)),$(index,1,$(getenv,pt1))),-36) ,SETVAR;USERR1;6;,SETVAR;USERR1;3;);USERR2;$(-,$(*,"$(INDEX,0,$(GETENV,PT2)),-1) ,4);USERI1;$(FIX,$(/,$(-,$(*,$(INDEX,1,$(GETENV,PT2)),-1)),$(*,2,$(GETVAR,USERR1 )),1.2598));CIRCLE;-2,-$(getVAR,USERR1);.098425;-ARRAY;L;;R;$(GETVAR,USERI1);2;- 1.2598;-$(GETVAR,USERR2);
to break it down a bit.
First it sets the UCS to the upper right hand corner of the cabinet opening and sets the lower left hand corner of the cabinet, making pt1 0,0,0 and making pt2 the lower LH corner.
^C^C_UCS;NEW;\_setenv;pt1;0,0,0;_ID;\_setenv;pt2;$m=$(getvar,las tpoint);
Next we determine the opening ht, and if less then 36" set USERR1 to 3, if greater then 36" it gets set to 6.
$(IF,$(<,$(-,$(index,1,$(getenv,pt2)),$(index,1,$(getenv,pt1))),-3 6),SETVAR;USERR1;6;,SETVAR;USERR1;3;);
Next step is to figure the width needed and set it to USERR2
USERR2;$(-,$(*,"$(INDEX,0,$(GETENV,PT2)),-1),4);
We then calculate the number of rows (the array has to stop either no less then 3" or 6" from the bottom of the cabinet, depending on the value of USERR1);
USERI1;$(FIX,$(/,$(-,$(*,$(INDEX,1,$(GETENV,PT2)),-1)),$(*,2,$( GETVAR,USERR1)),1.2598));
I then make a circle for the array to use;
CIRCLE;-2,-$(getVAR,USERR1);.098425;
Then the array itself;
-ARRAY;L;;R;$(GETVAR,USERI1);2;-1.2598;-$(GETVAR,USERR2);
Now I have managed to get each element to work, but when stacked into a massive macro, something is losing it in the evaluation sequence, but I cant seem to get my head around where to put the quotes to nest it correctly, anyone have any guidance to making this thing work right. I cannot add too much more to it, as I still have to set ucs back to world at the end and am almost at the character limit for macros.
Help please.
Chris M.