PDA

View Full Version : White background for grabbing bitmaps


Tom von Alten
03-24-2003, 01:28 PM
After tweaking colors and making a viewport with a white background, in order to create a more readable screen dump bitmap, I figured I should put that stuff in a macro so that it would be handy for next time.

The color controls are such that "everything" is divided into
HATCH
DIMENSIONS (but only in the current part, see below)
Everything else

Based on the basic 8-color map and the way I usually work, I picked the following combinations (imagine it in two tab-aligned columns):

Background: BLACK, WHITE
DIMENSIONS: GREEN, BLUE
HATCH + Everything else:
WHITE, BLACK
BLUE, GREEN
RED, YELLOW
MAGENTA, CYAN

For some strange reason, dimensions can only be selected in the current part. (ENHANCEMENT REQUEST!!) I suppose I could loop through the part tree, but since I've never coded such a thing, this wouldn't be quick and dirty any more.

If you don't like the color transformation, it should be clear enough how to write in your own in the last 2 of the following 3 macros. Make sure you change both so that you have reversible functions.

Enjoy. (Oh and SAVE YOUR WORK before you try these, "just in case.")
____________
Tom von Alten


DEFINE Swap_color { Global color swap for background color changing }
PARAMETER Oldc
PARAMETER Newc
CHANGE_COLOR Newc SELECT GLOBAL Oldc CONFIRM
CHANGE_HATCH_COLOR Newc SELECT GLOBAL Oldc CONFIRM
END_DEFINE


DEFINE White_background { "Dark" colors on a white background }
Swap_color WHITE BLACK
Swap_color GREEN BLUE
Swap_color YELLOW RED
Swap_color CYAN MAGENTA
CHANGE_DIM_COLOR BLUE SELECT ALL CONFIRM
CHANGE_DIM_TEXT_COLOR BLUE SELECT ALL CONFIRM
CHANGE_VIEWPORT_COLOR WHITE
END_DEFINE


DEFINE Black_background { "Regular" colors on a black background }
Swap_color BLACK WHITE
Swap_color BLUE GREEN
Swap_color RED YELLOW
Swap_color MAGENTA CYAN
CHANGE_DIM_COLOR GREEN SELECT ALL CONFIRM
CHANGE_DIM_TEXT_COLOR GREEN SELECT ALL CONFIRM
CHANGE_VIEWPORT_COLOR BLACK
END_DEFINE

ChrisE
03-26-2003, 10:36 AM
Well, going down the parts tree is one option.

A different approach could be:

- Inquire ME10 for yellow dimensions
- Edit the part of the first dimension found
- change all dimension in the part to green
- go back to top part
- Inquire again until no more yellow dimensions can be found

Extract:
DEFINE dims
PARAMETER oc
PARAMETER nc
LOOP
EDIT_PART TOP
TRAP_ERROR
INQ_SELECTED_ELEM SELECT GLOBAL DIMENSIONS oc CONFIRM
IF (CHECK_ERROR)
END
END_IF
EXIT_IF ((INQ 14) = 0)
EDIT_PART (inq 101)
CHANGE_DIM_COLOR nc ALL END
END_LOOP
END_DEFINE

Good luck :D

Tom von Alten
03-26-2003, 12:01 PM
Brilliant! Thank you. Note that there are two things to change color on with dimensions. I wrote a generic color swapping for dimensions with your loop:


DEFINE Swap_dim_color
PARAMETER Oldc
PARAMETER Newc
LOOP
EDIT_PART TOP
TRAP_ERROR
INQ_SELECTED_ELEM SELECT GLOBAL DIMENSIONS Oldc CONFIRM
IF (CHECK_ERROR)
END
END_IF
EXIT_IF ((INQ 14)=0)
EDIT_PART (INQ 101)
CHANGE_DIM_COLOR Newc ALL
END
CHANGE_DIM_TEXT_COLOR Newc ALL
END
END_LOOP
END_DEFINE


(Thanks for tipping me off to the "code" tag for this forum, too.)

H.annes
03-27-2003, 01:33 AM
Good morning,

here is a small macro to scan the part tree:

DEFINE Part_list
LOCAL I
LOCAL Z
LOCAL Br1
LOCAL Br2
LOCAL Tmpstr
LOCAL Name
LOCAL Nr
CREATE_LTAB 'TMPLTAB'
PARTS_LIST TREE LTAB 'TMPLTAB'
LET I 1
WHILE (I <= (LTAB_ROWS 'TMPLTAB'))
LET Z (READ_LTAB 'TMPLTAB' I 1)
LET Br1 (POS Z ' [~')
LET Tmpstr (SUBSTR Z (Br1+2) (LEN Z - Br1 - 1))
LET Br2 (POS Tmpstr ']')
LET Name (SUBSTR Z 1 (Br1 - 1)) { <--- part name }
LET Nr (SUBSTR Tmpstr 1 (Br2-1)) { <--- part number }
EDIT_PART Nr
Part_action
LET I (I+1)
END_WHILE
DELETE_LTAB 'TMPLTAB'
END_DEFINE

{ what shall be done in this part: }
DEFINE Part_action
DISPLAY ('current part : ' + Name + ' / number : ' + Nr)
{ or: White_background ... }
END_DEFINE


I wrote it some years ago - might be useful.

regard from Austria,
Hannes