Community
PowerMill Forum
Welcome to Autodesk’s PowerMill Forums. Share your knowledge, ask questions, and explore popular PowerMill topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get the selected surface colour RGB value

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
hx
Advocate
280 Views, 3 Replies

Get the selected surface colour RGB value

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

Can use a macro to do that?

001.png

3 REPLIES 3
Message 2 of 4
icse
in reply to: hx

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
Message 3 of 4
hx
Advocate
in reply to: icse

@icse 

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

 

Message 4 of 4
icse
in reply to: hx

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report