Get the selected surface colour RGB value

Get the selected surface colour RGB value

hx
Advocate Advocate
586 Views
3 Replies
Message 1 of 4

Get the selected surface colour RGB value

hx
Advocate
Advocate

At the PM2024, How can I get the selected surface colour rgb values?

Can use a macro to do that?

001.png

0 Likes
Accepted solutions (1)
587 Views
3 Replies
Replies (3)
Message 2 of 4

icse
Collaborator
Collaborator

try this:

 

	GRAPHICS LOCK
	DIALOGS MESSAGE ON
	SIZE MODEL 
	STRING LIST $tempContent = tokens(widget('TextInfo.InfoText').value)
	TEXTINFO close
	DIALOGS MESSAGE ON
	DIALOGS ERROR On
	int $len = size($tempContent)
	
	string $rgb = 'R:' + trim($tempContent[$len-4]) + ' G:' + trim($tempContent[$len-3]) + ' B:' + trim($tempContent[$len-2])
	
	message info $rgb
0 Likes
Message 3 of 4

hx
Advocate
Advocate

@icse 

If the surface's infromation was not raise. how can I get the values?

 

0 Likes
Message 4 of 4

icse
Collaborator
Collaborator
Accepted solution

heres an alternative version:

 

string $temp = "C:\temp\surfaceColor.tmp"
DELETE FILE $temp

GRAPHICS LOCK
DIALOGS MESSAGE OFF

ECHO OFF DCPDEBUG UNTRACE COMMAND ACCEPT
TRACEFILE OPEN $temp
SIZE MODEL
TRACEFILE CLOSE

DIALOGS MESSAGE ON
DIALOGS ERROR On

STRING LIST $tempContent = {}

FILE OPEN $temp FOR READ AS Input
FILE READ $tempContent FROM Input
FILE CLOSE Input 




string list $items = tokens($tempContent[size($tempContent)-1])

int $len = size($items)

string $rgb = 'R: ' + $items[$len-4] + '  G: ' + $items[$len-3] + '  B: ' + $items[$len-2]

message info $rgb