Jayme McColgan Posted July 22, 2022 Share Posted July 22, 2022 hey guys, I'm working on a plugin that will behave similarly to the instrument summary but for power. part of that requires the plugin to find all the lighting devices in the drawing and gather information about that. i've done this a few times with menu command based plugins but i want to make it a point object to give a graphical interface like the instrument summary... below is the part of my script that deselects everything and then selects all my lighting devices, loops though them and collects some info about it. from what i can tell this just flat out doesn't work in a point object plugin... i've tested it in a menu command and works like a dream. it seems to select all the lights, NOT do the for each object, and then NOT deselect anything... i've also tried using a widget button (with event based turned on) to gather light info and that gives me some other weird results with not redrawing all the 2d elements like text and rectangles correctly. cur_lay_opt = vs.GetLayerOptions() vs.SetLayerOptions(5) vs.DSelectAll() vs.SelectObj("(PON='Lighting Device')") vs.ForEachObject(light_collect, '((VSEL=TRUE))') vs.DSelectAll() vs.SetLayerOptions(cur_lay_opt) Quote Link to comment
Pat Stanford Posted July 22, 2022 Share Posted July 22, 2022 It is probably not a good design decision to have an object that when reset changes the selection and options of the drawing. Changing selection is the hard way. You would be much better off just using the criteria of PON='Lighting Device' directly in the ForEachObject call. Then you can avoid all of the selecting, selecting, and layer options setting. Have you tried to put something for debugging into the light_collect procedure to make sure it is running? I often use AlrtDialog for this so that I get an dialog box that requires input for each time the procedure runs. 1 Quote Link to comment
Jayme McColgan Posted July 22, 2022 Author Share Posted July 22, 2022 thanks Pat. i also use AlrtDialog when i need to debug something. it wasn't being triggered when i put it in the light_collect function. maybe the plugin didn't recognize that it had something selected since it was selecting and running at in the same pass? who knows... ANYWAYS... moving the PON='Lighting Device' to the foreach seemed to do the trick. its seeing the lights now. thanks! 1 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.