Make invisible MI-entities visible

Product: Creo Elements/Direct Drafting
Release: 16.00
Technical Area: Macro Programming

Description:

Due to translations, parametrical-, pre- or post processes invisible data can be generated and stored in the MI file. This is because some entity types contain a display flag which could be used by one of these processes. This display flag will decide whether or not the entity will become visible in the drawing. Following entity types could be affected:

   - "ARC"   … geometrical arcs
   - "BSPL"  … geometrical bsplines
   - "CCIR"  … construction circles
   - "CIR"    … geometrical circles
   - "CLIN"  … construction lines
   - "FIL"    … geometrical fillets
   - "PLN"   … geometrical border lines (used for manual hatches)
   - "TEX"  … text entities
   - "LIN"   … geometrical line
   - "PMA"  … geometrical points
   - "SPL"   … geometrical splines

Depending on the amount of such invisible entities they can increase the file size significantly although the corresponding (visible) drawing appears quite small. This is the reason why users want to cleanup these “unnecessary” data. The macro below will address this requirement.

Instructions about how to use the macro:

1. INPUT the attached file into Drafting

2. Type the macro-name:      Chg_dsp_flag_mi  <parameter>
     into the command line of Drafting. The possible parameter can be e.g. “ARC” or any other entity as listed above.

3. Select the MI file you want to check for invisible entities.

Notes:

- The resulting MI file can be found in the same directory with the ending “_mod.mi”.
- The macro will allow you to either check one dedicated entity type 
   [= enter the name of the entity type in quotes] or for all entities [= use parameter “ALL”].
- Unlike the command SHOW_INV_GEO this macro enables the user:
            - to determine a certain element type which should become visible.
            - to cover all element types holding such a display flag.

Macro Code:

DEFINE Chg_dsp_flag_mi
  PARAMETER Mi_entity    { "ARC", "BSPL", "CCIR", "CIR", "CLIN", "FIL", "PLN", "TEX", "LIN", "PMA", "SPL" or "ALL" }
  LOCAL Wui_check
  LOCAL F_name
  LOCAL String_in
  INQ_ENV 10
  IF ((INQ 6) >= 2)
    LET Wui_check (WUI_FILE_DIALOG CAPTION 'Open File'
                          DEF_DIR 'C:\Temp'
                          FILTER 'MI File (*.mi)|*.mi|All Files (*.*)|*.*||')
    INQ_ENV 0
    LET F_name (INQ 904)
  ELSE
    Fbt_init
    FBROWSER SET_DIR  "c:\temp"
    FBROWSER SET_MASK "*.*"
    Fbt_dtabs_all_on 0
    READ STRING "Select file" F_name
  END_IF
  LET Mi_entity (UPC Mi_entity)
  OPEN_INFILE 1 F_name
  IF ((UPC (SUBSTR F_name ((LEN F_name) -1) 2)) = "MI")
    OPEN_OUTFILE 2 DEL_OLD ((SUBSTR F_name 1 ((LEN F_name) -3))+"_mod.mi")
  ELSE
    OPEN_OUTFILE 2 (F_name+"mod")
  END_IF
  LOOP
    READ_FILE 1 String_in
  EXIT_IF (String_in = "END-OF-FILE")
    WRITE_FILE 2 String_in
    IF (Mi_entity = "ALL")
                      IF ((String_in = "ARC") OR (String_in = "BSPL") OR (String_in = "CCIR") OR
                           (String_in = "CIR") OR (String_in = "CLIN") OR (String_in = "FIL") OR
                           (String_in = "PLN") OR (String_in = "TEX") OR (String_in = "LIN") OR
                           (String_in = "PMA") OR (String_in = "SPL"))
                        READ_FILE 1 String_in
                        WRITE_FILE 2 String_in
                        READ_FILE 1 String_in
                        WRITE_FILE 2 String_in
                        READ_FILE 1 String_in
                        WRITE_FILE 2 String_in
                        READ_FILE 1 String_in
                        WRITE_FILE 2 String_in
                        READ_FILE 1 String_in
                        IF (String_in = "1")
                          WRITE_FILE 2 "0"
                        ELSE
                          WRITE_FILE 2 String_in
                        END_IF
                      END_IF
    ELSE_IF (String_in = Mi_entity)
                      READ_FILE 1 String_in
                      WRITE_FILE 2 String_in
                      READ_FILE 1 String_in
                      WRITE_FILE 2 String_in
                      READ_FILE 1 String_in
                      WRITE_FILE 2 String_in
                      READ_FILE 1 String_in
                      WRITE_FILE 2 String_in
                      READ_FILE 1 String_in
                      IF (String_in = "1")
                        WRITE_FILE 2 "0"
                      ELSE
                        WRITE_FILE 2 String_in
                      END_IF
    END_IF
  END_LOOP
  CLOSE_FILE 1
  CLOSE_FILE 2
END_DEFINE
Did this document help you?
Yes
No
Not what I was looking for