{-----------------------------------------------------------------------------}
{ create a refline from the nearest bom flag attach point                     }
{-----------------------------------------------------------------------------}
DEFINE Docu_bom_create_flag_refline

  PARAMETER Flag_pid
  PARAMETER Dest_pid
  PARAMETER Dest_pnt

  LOCAL     Flag_pnt
  LOCAL     Local_dest_pnt
  LOCAL     Curr_pid
  LOCAL     View_scale
  LOCAL     Mm_per_unit
  LOCAL 		Curr_rtl_atype
  LOCAL 		Curr_rtl_color
  LOCAL	  	Leader_diameter
  LOCAL 		Dot_diameter
  
  LET 		Dot_diameter 2.5	{Hier die Punktgroesse eintragen}

  IF ((DOCU_PART_EXISTS Flag_pid) AND (DOCU_PART_EXISTS Dest_pid))

    INQ_ENV 6
    LET Mm_per_unit (INQ 2)

    INQ_PART NO_UNIQUE_LIST '.'
    LET Curr_pid (INQ 302)

    EDIT_PART Flag_pid
    EDIT_PART PARENT       { should be the view part }

    INQ_PART NO_UNIQUE_LIST '.'
    LET View_scale (INQ 4)

    LET Local_dest_pnt (Dest_pnt / View_scale)    

    LET Flag_pnt (DOCU_BOM_ATTACH_PNT Flag_pid (Local_dest_pnt * Mm_per_unit))
    
    Docu_delete_flag_attach_point Flag_pid '*'

    { store old arrow type and size and set new one}
	    INQ_ENV 12 
	    LET Curr_rtl_atype (inq 604) 
	    LET Leader_diameter (INQ 9)
    	LEADER_ARROW Dot_diameter DOT_TYPE END
    	
    	INIT_SUBPART 'UK-HELP' END
    	TEXT 'A' 0,0 END
    	LINE 0,-10 10,-10 END
    	REFLINE 0,0 0,-10 END
    	INQ_ELEM 0,-.1 END
    	LET Curr_rtl_color (inq 201) 
    	DELETE ALL END
    	END_PART
    	DELETE 'UK-HELP' END  	

    	RTL_COLOR YELLOW END

    REFLINE SELECT Flag_pid Flag_pnt SELECT Dest_pid Local_dest_pnt END
     
    { restore saveed type and size}
    LEADER_ARROW Leader_diameter Curr_rtl_atype END
    RTL_COLOR RGB_COLOR Curr_rtl_color END

    EDIT_PART Curr_pid

  END_IF

END_DEFINE
