Ben624 Posted June 19, 2007 Share Posted June 19, 2007 Alright, this is driving me crazy. I'm trying to write a script that creates a listbox with all of my viewports. Somehow in the execution of the WHILE/DO loop, my script can't find the viewports using the GetType() function. I've also tried using the Eval() function with no luck. I've tried isolating each part of the script, and everything works on its own. For instance, when I assign the viewport's handle explicitly according to the name of an existing VP, the script runs fine and it adds it to the listbox. Unfortunately, when I put it all together, it can't seem to find the viewports, or anything else for that matter. I've even tried changing the object type that it searches for, but it always comes up with nothing. I've run it in the Debugger and VPEval always evaluates to 0. Any thoughts? Here's the offending snippet /////////////////////////////////////////// CASE item OF SetupDialogC: BEGIN vpHand := FObject; WHILE vpHand <> NIL DO BEGIN VPeval := GetType(vpHand); IF (VPeval = 122) THEN BEGIN vpName := getName(vpHand); InsertChoice(11, 0, vpName); END; vpHand := NextObj(vpHand); END; END; /////////////////////////////////////////////// Quote Link to comment
Ben624 Posted June 19, 2007 Author Share Posted June 19, 2007 Update: I am able to get the script to locate objects of other types. It will populate the listbox with names of symbols (T=15) and plugins (T=86). It still won't return anything for viewports (T=122). Quote Link to comment
Ben624 Posted June 19, 2007 Author Share Posted June 19, 2007 Figured it out. For some reason I have to write a nested WHILE/DO loop that looks through each layer seperately. Quote Link to comment
MullinRJ Posted June 19, 2007 Share Posted June 19, 2007 What about using ForEachObject() or ForEachObjectInLayer()? They do the work of nested WHILE/DO constructs and have a lot of flexibility, to boot. Raymond Quote Link to comment
Ben624 Posted June 19, 2007 Author Share Posted June 19, 2007 That's how I started off, but I couldn't get the callback procedure that I used for ForEachObject() to talk to the list box that I created in the dialog. Quote Link to comment
Yotarou Posted June 20, 2007 Share Posted June 20, 2007 I think that it is searchable from NameList() and GetObject(). Quote Link to comment
Recommended Posts
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.