KludgeCode

is Ben Rudgers

The Production Code for KludgeCode Extrude

The key to making the program do what I really required digging around in VectorScript’s abysmal documentation and crap examples until I found the “Array of Handles”.

And here’s the thing I struggle with – 1000 handles seems like a lot. So many in fact that I fear crashing the computer. My personal legacy of learning programming on the TRS-80 with 4kb of RAM is that I naturally count allocated resources as “one, two and many.”

I have a million times more RAM. I am always concerned about using too much. A 1000 element array seems inconceivably wasteful.

Here’s the actual production code for the extrude without the demo constraints:


PROCEDURE super;

   VAR
      index : integer;
	handleBin:ARRAY[1..1000] of HANDLE;
	Obj_class : string;
	Start_class : string;
	End;

Procedure loadBin(h1:HANDLE);
   Begin
      index:=index+1;
      handleBin[index]:=h1;
   End;

PROCEDURE change_it(objectHand:HANDLE);
   Begin
		dselectall;
		obj_class := getclass (objectHand);
		Nameclass (obj_class);
		setselect (objectHand);
		domenutextbyname ('extrude and edit', 0);
	End;      

BEGIN
       Start_class := ActiveClass;  
	index:=0;
         ForEachObject(loadBin,sel=true);
         index:=1;
		 while handleBin[index] <> nil Do begin	
			change_it (handleBin[index]);
			index := index+1;
		end;
	Nameclass (Start_class);
 	End;
Run (super);

It’s no accident that I called the main routine “super”. I was pretty damn pleased with myself.