Jump to content

using vs.PickObject() and vs.CreateCustomObjectN() together


Recommended Posts

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.

 

 

Link to comment

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);
	

 

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...