Jayme McColgan Posted December 1, 2022 Share Posted December 1, 2022 hey y'all! so i have a menu command plugin that allows me to click around in the drawing and place a custom object using vs.CreateCustomObjectN(), I'm trying to get this to behave like the Spotlight numbering tool where you can move around the drawing clicking on lights and it changes them to a red outline amd inserts some stuff based on the object i clicked on I'm trying to use vs.ReDraw() to display the newly inserted plugin object while i'm clicking around but that doesn't seem to be working. Quote Link to comment
Pat Stanford Posted December 1, 2022 Share Posted December 1, 2022 Take a look at TrackObject instead of Pick Object. It will highlight objects that meet a criteria. This example lets you continuously click on objects and display a message of their RGB values. Procedure ColorPaletteIndex; CONST TB = CHR(9); VAR H1 :Handle; R1,G1,B1 :LongInt; C1 :Integer; X1,Y1,Z1 :Real; R2,G2,B2 :String; Function Callback(Hd1:Handle):Boolean; BEGIN GetFillBack(Hd1, R1, G1, B1); Callback:=True; End; BEGIN H1:=FObject; While H1<> Nil DO Begin TrackObject(callback, H1, X1,Y1,Z1); RGBToColorIndex(R1,G1,B1, C1); R2:=Num2Str(0,R1/257); G2:=Num2Str(0,G1/257); B2:=Num2Str(0,B1/257); Message('Click on an object to report the Fill Back color.',CHR(10),'Click in a blank area to quit',CHR(10),'Color Index of highlighted object is: ', C1,' ', CHR(13), R1,TB,G1,TB,B1,CHR(13),R2,TB,G2,TB,B2); End; End; Run(ColorPaletteIndex); Quote Link to comment
Sam Jones Posted December 1, 2022 Share Posted December 1, 2022 "Track Object" is really cool for guiding the use of menu commands, but it will not solve your redraw problem. Unfortunately, as far as I know, nothing will solve your problem. No redrawing will take place until after the entire command is completed. Quote Link to comment
Jayme McColgan Posted December 1, 2022 Author Share Posted December 1, 2022 ive been exploring using vs.TrackObject() but have run into a whole other issue of getting it to run more then once. it doesn't seem to play nicely with while loops in python. might need to bang my head against the wall some more with this. Quote Link to comment
Pat Stanford Posted December 1, 2022 Share Posted December 1, 2022 Take a look at this post and the entire thread. Apparently none of the interactive functions work well in Python as Python does not have a way to wait until the data is returned. Quote Link to comment
Jayme McColgan Posted December 1, 2022 Author Share Posted December 1, 2022 1 hour ago, Pat Stanford said: Take a look at this post and the entire thread. Apparently none of the interactive functions work well in Python as Python does not have a way to wait until the data is returned. well thats a damn shame. ill post back here if i come up with some sort of workaround or solution. Quote Link to comment
Pat Stanford Posted December 1, 2022 Share Posted December 1, 2022 Check the Developer docs for GetPt for more information on how to handle the interactive functions under Python. https://developer.vectorworks.net/index.php/VS:GetPt It calls another procedure and is non-blocking. The notes on GetPt basically apply to all of the similar User Interactive functions. 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.