14 Replies Latest reply on Oct 17, 2017 5:42 AM by williamadowling

    Adobe Illustrator not responding !!

    karth80472045 Level 1

      Hello everyone,

       

       

      My script works for small size files upto 900kb it takes less than a minute , if it is more than 900 kb it is running for 1/2 hour  then it forces the illustrator to not respond and closes the illustrator.

       

       

      can anybody suggest how to make to run all files in a folder irrespective of file size .

       

       

      here is my code .

       

       

       

       

       

      var main_group_array;
      var error_file_name="";
      
      
      var can_path_item_array=[];
      var unit_intersect_point_array=[];
        var magentaColor6= new CMYKColor();
      magentaColor6.cyan = 75;//orange
      magentaColor6.magenta =100;
      magentaColor6.yellow = 0;
      magentaColor6.black = 0;
      var magentaColor10 = new CMYKColor();
      magentaColor10.cyan = 18.43;
      magentaColor10.magenta =100;
      magentaColor10.yellow = 100;
      magentaColor10.black = 10.2;//Brown
      
      
      var magentaColor9 = new CMYKColor();
      magentaColor9.cyan = 0;
      magentaColor9.magenta =99;
      magentaColor9.yellow = 0;
      magentaColor9.black = 0; //magenta 1
      
      
      var magentaColor7 = new CMYKColor();
      magentaColor7.cyan = 0;
      magentaColor7.magenta =97;
      magentaColor7.yellow = 0;
      magentaColor7.black = 0;//magenta 2
      
      
      var magentaColor8 = new CMYKColor();
      magentaColor8.cyan = 0;
      magentaColor8.magenta =95;
      magentaColor8.yellow = 0;
      magentaColor8.black = 0;//magenta 3
      
      
      var magentaColor4 = new CMYKColor();
      magentaColor4.cyan = 60.39;
      magentaColor4.magenta =32.94;
      magentaColor4.yellow = 100;
      magentaColor4.black = 14.51;//Green
      
      
      var magentaColor1 = new CMYKColor();
      magentaColor1.cyan = 56.47;
      magentaColor1.magenta =0;
      magentaColor1.yellow = 63.92;
      magentaColor1.black = 0;//LIGHT GREEN
      
      
      var magentaColor2 = new CMYKColor();
      magentaColor2.cyan = 19.61;
      magentaColor2.magenta =100;
      magentaColor2.yellow = 69.02;
      magentaColor2.black = 8.63;//Dark Brown
      
      
      var magentaColor3 = new CMYKColor();
      magentaColor3.cyan = 0;
      magentaColor3.magenta =69.8;
      magentaColor3.yellow = 100;
      magentaColor3.black = 0;//light orange
      var fileArray_title=[];
      sourceFolder = Folder.selectDialog( 'Select the folder with Illustrator files', '~' );
      files = sourceFolder.getFiles(/\.(svg|ai)$/i);
       fileArray_SM_name = get_csvfile("Select CIL CSV List");
        fileArray_title = get_csvfile("Select ID List CSV"); 
         error_file_name=sourceFolder.path+'/Tabledata.csv'; 
             error_file_name1=sourceFolder.path+'/Connector Numbers.csv'; 
              file_output=new File (error_file_name);
           
              file_output.open ('e');
               file_output.writeln ("CircuitFileName"+","+"LineNumber"+","+"Type"+","+"ConnectorNumber"+","+"TerminalNumber"+","+"FileName"+","+"DisplayName");
                 file_output1=new File (error_file_name1);
           
              file_output1.open ('e');
               file_output1.writeln ("Connector Number"+","+"file Name");
         function get_csvfile(Str_File)
      {
          var csv_file;
      
      
          csv_file = File.openDialog (Str_File);
          
          
      
      
          if(!csv_file.exists)
          {
             
        
              return;
           }
           else
          {
            
             fileArray_buffer = save_elements(csv_file);
             
            
           }
          return fileArray_buffer;
       }
      function save_elements( fileObj ) 
      {  
              var thisLine, csvArray;  
               fileArray_save_elements =[];  
                fileObj.open( 'r' );
               while( !fileObj.eof ) 
               {  
                   
                         thisLine = fileObj.readln();  
                         csvArray = thisLine.split( ',' );  
                         fileArray_save_elements.push( csvArray );  
                };  
           
             return fileArray_save_elements;
                fileObj.close();  
              
      };  
      
      
         
        
           if(files.length == 0)
      {
             alert("Folder doesnot have any file");  
          }
      
      
      
      
          if ( files.length > 0 )
          {
              
              for ( file_iteration = 0; file_iteration < files.length; file_iteration++ )
              {
                  sourceDoc = app.open(files[file_iteration]);    
                    var fileExtension = sourceDoc.name.substr((sourceDoc.name.lastIndexOf('.') + 1));
                     if(fileExtension=="ai")
                     {
                         $.sleep(1000);
                         check_title(sourceDoc);
                         sourceDoc.save();
                          sourceDoc.close();
                           $.sleep(10000);
                         }
                     else
                     {
                          check_title(sourceDoc)
                          }
                      }
                  }
            
           
                 
         
          
              
      
       function check_title(sourceDoc)
          {
              
             
       for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
              {
                 if(sourceDoc.layers.length==1)
                 {
                     mainloop4:
                     for(var grp1=0;grp1<sourceDoc.layers[lays1].groupItems.length;grp1++)
                  {
                      if(sourceDoc.layers[lays1].groupItems[grp1].name=="<CIRCUIT TITLE>")
                      {
              for (var tit=0;tit<sourceDoc.layers[lays1].groupItems[grp1].textFrames.length;tit++)
              {
                  if(sourceDoc.layers[lays1].groupItems[grp1].textFrames[tit].kind ==  TextType.POINTTEXT)
                  {
                  if(sourceDoc.layers[lays1].groupItems[grp1].textFrames[tit].textRange.characterAttributes.size==12)
                  {
                       if(sourceDoc.layers[lays1].groupItems[grp1].textFrames[tit].contents.slice(0,3)=="CAN")
                      {
                        
                      
      
       check_artboard();
       unlock( activeDocument.layers);
       color_empty_pathitem();
       delete_group();
       delete_group1();
        check_circle_ungroup_CAN();
        ungroup_group_subgroup();
                        ungroup_group();
                        ungroup_units();
                        autoColor_updation();
                        AAA_check1();
                         Check_battery_AAA();
                        ungroup_units1();
                         remove_fuse_group();
                        check_fuse_ungroup();
                        check_dot_repeat();
                        check_connector();
                        
                         rename_fuse_group();
                         line_check1_unit_CAN();
                         line_check1_unit_2_CAN();
                         reduce_opacity();
                         reduce_opacity_1();
                       
                        group_connector_name();
                        move_rectangle();
                        circleFront();
                        group_Circle_name_CAN();
                        checking_circleGroup_CAN();
                        check_unwantedline_CAN();
                        renaming_path();
                        renaming_CAN();
                        Check_batteryline();
                        line_pathitem_inside_CAN()
                          error_check();
                          list_connector_names();
                         
                         break mainloop4;
                        }
                    
                      if(sourceDoc.layers[lays1].groupItems[grp1].textFrames[tit].contents.slice(0,7)=="CONSULT")
                      {
                          check_artboard();
       unlock( activeDocument.layers);
       color_empty_pathitem();
       delete_group();
       delete_group1();
       check_circle_ungroup();
       ungroup_group_subgroup();
        ungroup_units();
         autoColor_updation();
         AAA_check1();
          Check_battery_AAA();
         ungroup_units1();
           remove_fuse_group();
           check_fuse_ungroup();
             check_dot_repeat();
             check_connector();
              rename_fuse_group();
               line_check1_unit();
               line_check1_unit_2();
                 reduce_opacity();
                 reduce_opacity_1();
                
                 group_connector_name();
                 move_rectangle();
                 check_can_AAA_PATH();
                 circleFront();
                  group_name_normal();        
                    checking_circleGroup_normal();
                    check_unwantedline_normal();
               renaming_path();
                        renaming_CAN();
                        Check_batteryline();
                         line_pathitem_inside_normal();
                        
                         write_to_link();
                          error_check();
                          list_connector_names();
                      
                     break mainloop4;
                          
                         
                          }
                      
                       if(sourceDoc.layers[lays1].groupItems[grp1].textFrames[tit].contents.slice(0,4)=="IPDM")
                      {
                            
       unlock( activeDocument.layers);
       color_empty_pathitem();
       delete_group();
       delete_group1();
        ungroup_units();
         autoColor_updation();
         AAA_check1();
            Check_battery_AAA();
         ungroup_units1();          
            remove_fuse_group();
           check_fuse_ungroup();         
            check_dot_repeat();
             check_connector();
              rename_fuse_group();
             reduce_opacity();
                 reduce_opacity_1();
                 
                 group_connector_name();
                  move_rectangle();
                  check_AAA_path_BCM();
                   
                        
                        
                         write_to_link();
            error_check();
            list_connector_names();
            break mainloop4;
           }
            if(sourceDoc.layers[lays1].groupItems[grp1].textFrames[tit].contents.slice(0,3)=="BCM")
                    {
                        unlock( activeDocument.layers);
       color_empty_pathitem();
       delete_group();
       delete_group1();
        ungroup_units();
         autoColor_updation();
         AAA_check1();
            Check_battery_AAA();
         ungroup_units1();          
            remove_fuse_group();
           check_fuse_ungroup();         
            check_dot_repeat();
             check_connector();
              rename_fuse_group();
             reduce_opacity();
                 reduce_opacity_1();
                
                 group_connector_name();
                  move_rectangle();
                  check_AAA_path_BCM();
                
                        
                         
                         write_to_link();
                             error_check();
                             list_connector_names();
                             break mainloop4;
                        }
                    else
                    {
                       check_artboard();
       unlock( activeDocument.layers);
       color_empty_pathitem();
       delete_group();
       delete_group1();
       check_circle_ungroup();
       ungroup_group_subgroup();
        ungroup_units();
         autoColor_updation();
         AAA_check1();
          Check_battery_AAA();
         ungroup_units1();
           remove_fuse_group();
           check_fuse_ungroup();
             check_dot_repeat();
             check_connector();
              rename_fuse_group();
               line_check1_unit();
               line_check1_unit_2();
                 reduce_opacity();
                 reduce_opacity_1();
                 
                 group_connector_name();
                 move_rectangle();
                 check_can_AAA_PATH();
                 circleFront();
                  group_name_normal();        
                    checking_circleGroup_normal();
                    check_unwantedline_normal();
               renaming_path();
                        renaming_CAN();
                       Check_batteryline();
                         line_pathitem_inside_normal();
                        
                         write_to_link();
                           error_check();
                           list_connector_names();
                          
                           break mainloop4;
                         } 
                    
                }
            }
        }
      }
      }
      }
      
      
      else if(sourceDoc.layers.length==3)
      {
          if(sourceDoc.layers[lays1].name=="RANGE" || sourceDoc.layers[lays1].name=="ILLUST")
          {
               for (var tit=0;tit<sourceDoc.layers[lays1].textFrames.length;tit++)
              {
                  if(sourceDoc.layers[lays1].textFrames[tit].kind ==  TextType.POINTTEXT)
                  {
                  if(sourceDoc.layers[lays1].textFrames[tit].textRange.characterAttributes.size==12)
                  {
                         if(sourceDoc.layers[lays1].textFrames[tit].contents.slice(0,7)=="CONSULT")
                      {
                      check_artboard();
       unlock( activeDocument.layers);
       color_empty_pathitem();
       delete_group();
       delete_group1();
       check_circle_ungroup();
       ungroup_group_subgroup();
        ungroup_units();
         autoColor_updation();
         AAA_check1();
          Check_battery_AAA();
         ungroup_units1();
           remove_fuse_group();
           check_fuse_ungroup();
             check_dot_repeat();
             check_connector();
              rename_fuse_group();
               line_check1_unit();
               line_check1_unit_2();
                 reduce_opacity();
                 reduce_opacity_1();
                 
                 group_connector_name();
                 move_rectangle();
                 check_can_AAA_PATH();
                 circleFront();
                  group_name_normal();        
                    checking_circleGroup_normal();
                    check_unwantedline_normal();
               renaming_path();
                        renaming_CAN();
                      Check_batteryline();
                         line_pathitem_inside_normal();
                        
                         write_to_link();
                            error_check();
                            list_connector_names();
                           
                       break ;
                        }
                        if(sourceDoc.layers[lays1].textFrames[tit].contents.slice(0,3)=="CAN")
                      {
                          check_artboard();
       unlock( activeDocument.layers);
       color_empty_pathitem();
       delete_group();
       delete_group1();
        check_circle_ungroup_CAN();
        ungroup_group_subgroup();
                        ungroup_group();
                        ungroup_units();
                         autoColor_updation();
                        AAA_check1();
                         Check_battery_AAA();
                        ungroup_units1();
                         remove_fuse_group();
                        check_fuse_ungroup();
                        check_dot_repeat();
                        check_connector();
                        
                         rename_fuse_group();
                         line_check1_unit_CAN();
                         line_check1_unit_2_CAN();
                         reduce_opacity();
                         reduce_opacity_1();
                       
                        group_connector_name();
                        move_rectangle();
                        circleFront();
                        group_Circle_name_CAN();
                        checking_circleGroup_CAN();
                        check_unwantedline_CAN();
                        renaming_path();
                        renaming_CAN();
                        Check_batteryline();
                        line_pathitem_inside_CAN()
                         error_check();
                         list_connector_names();
                       
                         break;
                    }
                if(sourceDoc.layers[lays1].textFrames[tit].contents.slice(0,4)=="IPDM")
      {
           unlock( activeDocument.layers);
       color_empty_pathitem();
       delete_group();
       delete_group1();
        ungroup_units();
         autoColor_updation();
         AAA_check1();
            Check_battery_AAA();
         ungroup_units1();          
            remove_fuse_group();
           check_fuse_ungroup();         
            check_dot_repeat();
             check_connector();
              rename_fuse_group();
             reduce_opacity();
                 reduce_opacity_1();
                 
                 group_connector_name();
                  move_rectangle();
                  check_AAA_path_BCM();
                  
                        
                         
                         write_to_link();
                           error_check();
                           list_connector_names();
                          
                           break;
          
                }
            
      }
      }
      }
      }
      }
      }
      }
      
      
      
      
       function delete_group()
        {
       for(var i=0;i<sourceDoc.layers.length;i++)
      {
          for(var k=0;k<sourceDoc.layers[i].groupItems.length;k++)
          {
               theObj = sourceDoc.layers[i].groupItems[k].pageItems;
               if( theObj.length==1)
               {
              for(var z=0;z< theObj.length;z++)
              {
                  
                if (theObj[z].typename == "GroupItem") {
                 
                  theObj[z].moveBefore(theObj[z].parent);
                    }
                }
            }
        }}}
      
      
      
      
       function delete_group1()
        {
       for(var i=0;i<sourceDoc.layers.length;i++)
      {
          for(var k=0;k<sourceDoc.layers[i].groupItems.length;k++)
          {
      for(var z=0;z<sourceDoc.layers[i].groupItems[k].groupItems.length;z++)
      {
          var path_found=0;
          for(var zz=0;zz<sourceDoc.layers[i].groupItems[k].groupItems[z].groupItems.length;zz++)
          {
              if(sourceDoc.layers[i].groupItems[k].groupItems[z].groupItems[zz].name.slice(0,15)=="connectornumber")
              {
                  if(sourceDoc.layers[i].groupItems[k].groupItems[z].pathItems.length==0 || sourceDoc.layers[i].groupItems[k].groupItems[z].textFrames.length==0)
                  {
                  var path_found=1;
                  }
              }
          }
      }
      
      
        if(path_found==1)
        {
            
            for(var z=0;z<sourceDoc.layers[i].groupItems[k].groupItems.length;z++)
      {
      
      
          for(var zz=0;zz<sourceDoc.layers[i].groupItems[k].groupItems[z].groupItems.length;zz++)
          {
              sourceDoc.layers[i].groupItems[k].groupItems[z].groupItems[zz].moveBefore(sourceDoc.layers[i].groupItems[k].groupItems[z].groupItems[zz].parent)
              }
          }
      }
      }
      }
      }
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
         function check_artboard()
      {
         
      var abIdx = sourceDoc.artboards.getActiveArtboardIndex ();    
      var abSrc = sourceDoc.artboards[abIdx];  
      var moveX = 4000;    
      var moveY = 800;    
      if(abSrc.artboardRect[0]<0)
      {
      var abSrc_L = abSrc.artboardRect[0] + moveX;    
      var abSrc_T = abSrc.artboardRect[1]  + moveY  
        
        
      var abSrc_R = abSrc.artboardRect[2] + moveX ;    
      var abSrc_B = abSrc.artboardRect[3] +moveY  
      abSrc.artboardRect = [abSrc_L, abSrc_T, abSrc_R, abSrc_B];
      var layers = sourceDoc.layers;  
      for( var i = 0, ii = layers.length; i < ii; i++ ) {  
          // clear any current selection  
          sourceDoc.selection = null;  
            for(var k=0;k<layers[i].groupItems.length;k++)
            {
          
            
          // translate them using the moveX and moveY variables  
          var curGroup = layers[i].groupItems[k];  
          curGroup.translate( moveX, moveY );  
            
          }
      for(var s=0;s<layers[i].pathItems.length;s++)
      {
             var curGroup = layers[i].pathItems[s];  
          curGroup.translate( moveX, moveY );  
            
          }
      
      
      for(var t=0;t<layers[i].textFrames.length;t++)
      {
             var curGroup = layers[i].textFrames[t];  
          curGroup.translate( moveX, moveY );  
            
          }
      
      
          
          }
          
          }
      
      
      
      
      
      
      
      
      }
      
      
      
      
      
      
      
      
      function unlock ( items ) {  
          var i = items.length;  
          if ( i ) {  
           while ( i-- ) {  
                  items[i].locked = false;  
                  if ( items[i].typename === 'GroupItem' ) {  
                      unlock( items[i].pageItems );              }  
                      else if ( items[i].typename === 'Layer' ) {  
                         unlock( items[i].layers );  
                         unlock( items[i].pageItems );  
                     }  
             }  
         }  
      } 
      
      
      
      
      
      
      function check_circle_ungroup_CAN()
      {
           for(var layer_item_index=0;layer_item_index<sourceDoc.layers.length;layer_item_index++)
          {
              if(sourceDoc.layers[layer_item_index].pageItems.length>0)
              {
                  layer_grp_item=sourceDoc.layers[layer_item_index].groupItems;
             
          for(var grp_main_index=0;grp_main_index<layer_grp_item.length;grp_main_index++)
          {
              
      child_path_item_main=layer_grp_item[grp_main_index].pathItems;
        child_group_item=layer_grp_item[grp_main_index].groupItems;
          var count_groupfound=0;
       mainloopline:  
        for(var grp_main_index1=0;grp_main_index1< child_group_item.length;grp_main_index1++)
        {
            if(child_group_item[grp_main_index1].name.slice(0,15)=="connectornumber" )
            {
                 count_groupfound=1;
                break mainloopline;
                }}
         if(count_groupfound==0)
            {
                 mainloopline:  
                   for(var grp_main_index1=0;grp_main_index1< child_group_item.length;grp_main_index1++)
        {
            child_path_item_main1=child_group_item[grp_main_index1].pathItems;
            for(var path_1=0;path_1<child_path_item_main1.length;path_1++)
            {
                 var  path_type = type_of_path(child_path_item_main1[path_1]);
                 if(path_type=="Line Type 1" || path_type=="Line Type 2"  || path_type=="Line Type 3" || path_type=="Line Type 4"  || path_type=="Line Type 10" || path_type=="Circle Type 1"
                 || path_type=="Circle Type 2" || path_type=="Circle Type 3"|| path_type=="Circle Type 4"|| path_type=="Circle Type 5"
                 || path_type=="Circle Type 6"|| path_type=="Line Type 12")    
                 {
                   
                     theObj=layer_grp_item[grp_main_index].pageItems;
                     
                       for(var z=theObj.length-1;z>=0 ;z--)
              {
                  
                if (theObj[z].typename == "GroupItem") {
                   for (i=theObj[z].pageItems.length-1; i>=0; i--)
                   {
                  theObj[z].pageItems[i].moveAfter(theObj[z].pageItems[i].parent);
       }
      }
              
              }
          break mainloopline;
          }
      }
      }
      }
      }
      }
      }
      }
      
      
      
      
      function check_circle_ungroup()
      {
           for(var layer_item_index=0;layer_item_index<sourceDoc.layers.length;layer_item_index++)
          {
              if(sourceDoc.layers[layer_item_index].pageItems.length>0)
              {
                  layer_grp_item=sourceDoc.layers[layer_item_index].groupItems;
             
          for(var grp_main_index=0;grp_main_index<layer_grp_item.length;grp_main_index++)
          {
              
      child_path_item_main=layer_grp_item[grp_main_index].pathItems;
        child_group_item=layer_grp_item[grp_main_index].groupItems;
        var count_groupfound=0;
       mainloopline:  
        for(var grp_main_index1=0;grp_main_index1< child_group_item.length;grp_main_index1++)
        {
            if(child_group_item[grp_main_index1].name.slice(0,15)=="connectornumber")
            {
               
                count_groupfound=1;
                 break mainloopline;
                }}
      if(count_groupfound==0)
      {
           mainloopline:  
           for(var grp_main_index1=0;grp_main_index1< child_group_item.length;grp_main_index1++)
        {
            {
            child_path_item_main1=child_group_item[grp_main_index1].pathItems;
            for(var path_1=0;path_1<child_path_item_main1.length;path_1++)
            {
                 var  path_type = type_of_path(child_path_item_main1[path_1]);
                 if(path_type=="Line Type 1" || path_type=="Line Type 2"  || path_type=="Line Type 3" || path_type=="Circle Type 1"
                 || path_type=="Circle Type 2" || path_type=="Circle Type 3"|| path_type=="Circle Type 4"|| path_type=="Circle Type 5"
                 || path_type=="Circle Type 6"|| path_type=="Line Type 12")    
                 {
                   
                     theObj=layer_grp_item[grp_main_index].pageItems;
                     
                       for(var z=theObj.length-1;z>=0 ;z--)
              {
                  
                if (theObj[z].typename == "GroupItem") {
                   for (i=theObj[z].pageItems.length-1; i>=0; i--)
                   {
                  theObj[z].pageItems[i].moveAfter(theObj[z].pageItems[i].parent);
       }
      }
              
              }
          break mainloopline;
          }
      }
      }
      }
      }
      }
      }
      }
      }
      function remove_fuse_group()
      {
      for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
      {
          for(var group1=0;group1<sourceDoc.layers[lays1].groupItems.length;group1++)
          {
             var text_found=0;
              for(var group2=0;group2<sourceDoc.layers[lays1].groupItems[group1].groupItems.length;group2++)
              {
                  for(var text1=0;text1<sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].textFrames.length;text1++)
                  {
                if(!sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].textFrames[text1].contents.match(/[A-Z][0-9]{1,3}$/)) continue; 
                
                 text_found=1;
                 }
             }
         if( text_found==1)
         {
             for(var group3=0;group3<sourceDoc.layers[lays1].groupItems[group1].groupItems.length;group3++)
             {
                 for(var path1=0;path1<sourceDoc.layers[lays1].groupItems[group1].groupItems[group3].pathItems.length;path1++)
                 {
                     var path_type=type_of_path(sourceDoc.layers[lays1].groupItems[group1].groupItems[group3].pathItems[path1])
                     if(path_type=="Rectangle Type 3")
                     {
                         
                         sourceDoc.layers[lays1].groupItems[group1].groupItems[group3].moveToBeginning(sourceDoc.layers[lays1]);
                         break;
                         }
                     }
                 }
             }
         }
      }
      }
      function ungroup_group()
      {
      for(var i=0;i<sourceDoc.layers.length;i++)
      {
          for(var k=0;k<sourceDoc.layers[i].groupItems.length;k++)
          {
              var count=0;
             var count_group=0;
               theObj = sourceDoc.layers[i].groupItems[k].pageItems;
      for(var z=0;z<theObj.length;z++)
      {
          if(theObj[z].typename=="PathItem" || theObj[z].typename=="TextFrame")
          {
              count++;
              }
          }
      for(var zzz=0;zzz<theObj.length;zzz++)
      {
           if(theObj[zzz].typename=="GroupItem")
           {
               count_group++;
               }
           }
               
      if(count==0 || (count==1 && count_group==1))
      {
          for(var zz=0;zz<theObj.length;zz++)
          {
             
               if(theObj[zz].typename=="GroupItem")
               {
                    var count_text=0;
                   for(var zzzz=0;zzzz<theObj[zz].pageItems.length;zzzz++)
                   {
                       if(theObj[zz].pageItems[zzzz].typename=="PathItem" || theObj[zz].pageItems[zzzz].typename=="TextFrame" )
                       {
                           count_text=1;
                           }}
                   if(count_text==0)
                   {
             for(var zzzz=0;zzzz<theObj[zz].pageItems.length;zzzz++)
                   {
                       theObj[zz].pageItems[zzzz].moveBefore(theObj[zz].parent)
                       }
              }
          else
          {
              theObj[zz].moveBefore(theObj[zz].parent)
               
                   }
              }
          }
      }
      }
      }
      }
      
      
      function ungroup_group_subgroup()
      {
          for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
      {
          for(var group1=0;group1<sourceDoc.layers[lays1].groupItems.length;group1++)
          {
              for(var group2=0;group2<sourceDoc.layers[lays1].groupItems[group1].groupItems.length;group2++)
              {
                  for(var group3=0;group3<sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].groupItems.length;group3++)
                  {
                      
                      for(var group4=0;group4<sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].groupItems[group3].groupItems.length;group4++)
                      {
                          if(sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].groupItems[group3].groupItems[group4].name.slice(0,15)=="connectornumber")
                          {
                              sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].groupItems[group3].moveToBeginning(sourceDoc.layers[lays1]);
                              break;
                              }
                          }
                      }
                  }
              }
          }
      }
      
      
      function ungroup_units()
      {
           for(var layer_item_index=0;layer_item_index<sourceDoc.layers.length;layer_item_index++)
          {
              if(sourceDoc.layers[layer_item_index].pageItems.length>0)
              {
                  layer_grp_item=sourceDoc.layers[layer_item_index].groupItems;
              
          for(var grp_main_index=0;grp_main_index<layer_grp_item.length;grp_main_index++)
          {
               
      child_path_item_main=layer_grp_item[grp_main_index].pathItems;
        child_group_item=layer_grp_item[grp_main_index].groupItems;
      
        for(var grp_main_index1=0;grp_main_index1< child_group_item.length;grp_main_index1++)
        {
            child_path_item_main1=child_group_item[grp_main_index1].pathItems;
       theObj=child_group_item[grp_main_index1].pageItems;
         for(var z=0;z< theObj.length;z++)
              {
                  
                if (theObj[z].typename == "GroupItem") {
                   for (i=theObj[z].pageItems.length-1; i>=0; i--)
                   {
                  theObj[z].pageItems[i].moveAfter(theObj[z].pageItems[i].parent);
       }
      }
      }
      }
      }
      }
      }
      }
                        
                        
        function AAA_check1()
          {
                for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
      {
          var count=0;
          for(var group1=0;group1<sourceDoc.layers[lays1].groupItems.length;group1++)
          {
              
              if(sourceDoc.layers[lays1].groupItems[group1].name=="AAA")
              {    count =group1;
                  break;
                  }
            }
      
      
        for(var group2=sourceDoc.layers[lays1].groupItems.length-1;group2>=0;group2--)
          {
              
              if(sourceDoc.layers[lays1].groupItems[group2].name=="AAA")
              {
                
                  if(count==group2)
                  {
                  }
              else
              {
                  sourceDoc.layers[lays1].groupItems[group2].moveToBeginning(sourceDoc.layers[lays1].groupItems[count])
                  
                  }
              }
          }}
      }
      
      
      
      
       function ungroup_units1()
      {
           for(var layer_item_index=0;layer_item_index<sourceDoc.layers.length;layer_item_index++)
          {
              if(sourceDoc.layers[layer_item_index].pageItems.length>0)
              {
                  layer_grp_item=sourceDoc.layers[layer_item_index].groupItems;
             for(var k=0;k<layer_grp_item.length;k++)
             {
       if( layer_grp_item[k].name=="AAA")
       {
           theObj =layer_grp_item[k].pageItems;
              
              for(var z=0;z< theObj.length;z++)
              {
                  
                if (theObj[z].typename == "GroupItem") {
                   for (i=theObj[z].pageItems.length-1; i>=0; i--)
                   {
                  theObj[z].pageItems[i].moveAfter( theObj[z].pageItems[i].parent);
           }
      }
      }
      }
      }
      }
      }
      }
                        
       function check_dot_repeat()
      {
          for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
      {
          for(var group1=0;group1<sourceDoc.layers[lays1].groupItems.length;group1++)
          {
              var arr=[];
              arr.length=0;
              if(sourceDoc.layers[lays1].groupItems[group1].name!="AAA")
              {
                  for(var group2=0;group2<sourceDoc.layers[lays1].groupItems[group1].pathItems.length;group2++)
                  {
                      if(sourceDoc.layers[lays1].groupItems[group1].pathItems[group2].name.slice(0,3)=="pin")
                      {
                          arr.push(sourceDoc.layers[lays1].groupItems[group1].pathItems[group2].name);
                          }
                      }
        
                  if(arr.length>1)
                  {
                      var sorted_arr = arr.slice().sort(); 
                                          
      var results = [];
      results.length=0;
      for (var i = 0; i < arr.length - 1; i++) {
          if (sorted_arr[i + 1] == sorted_arr[i]) {
              results.push(sorted_arr[i]);
          }
      }
      
      
      
      
      if( results.length>=1)
      {
          for(var k=0;k<results.length;k++)
          {
              for(var group3=0;group3<sourceDoc.layers[lays1].groupItems[group1].pathItems.length;group3++)
              {
                   if(sourceDoc.layers[lays1].groupItems[group1].pathItems[group3].name==  results[k])
                   {
                       sourceDoc.layers[lays1].groupItems[group1].pathItems[group3].remove();
                       break;
                       }
                   }
               }
           }
       }
      }
      }
      }
      }
      
      
       function check_connector()
        {
      
      
            for(var lays=0;lays<sourceDoc.layers.length;lays++)
      {
                var arr=[];
      var arr1=[];
          for(var group1=0;group1<sourceDoc.layers[lays].groupItems.length;group1++)
          {
                   arr.length=0;
      arr1.length=0;
              for(var group2=0;group2<sourceDoc.layers[lays].groupItems[group1].groupItems.length;group2++)
              {
                  for(var text1=0;text1<sourceDoc.layers[lays].groupItems[group1].groupItems[group2].textFrames.length;text1++)
                  {
                      if(!sourceDoc.layers[lays].groupItems[group1].groupItems[group2].textFrames[text1].contents.match(/[A-Z][0-9]{1,3}$/)) continue; 
                      {
                          arr.push(sourceDoc.layers[lays].groupItems[group1].groupItems[group2].textFrames[text1])
                          }
                      }
                  }
              if(arr.length>1)
              {
                 
              for(var sd=0;sd<arr.length;sd++)
              {
                  
         
                  for(csv_iter = 0;csv_iter < fileArray_SM_name.length; csv_iter++)
                  {
                    if(arr[sd].contents== fileArray_SM_name[csv_iter][0])
                      {
                          
                          arr1.push( fileArray_SM_name[csv_iter][1])
                          break ;
                          }
                      
                      }
                  }
              
              
      
      
          for(var sd1=0;sd1<arr1.length;sd1++)
          {
             
              if(arr1[0]==arr1[sd1])
              {
                 
                  }
              else
              {
                  var count_error=0;
                  group_main=sourceDoc.layers[lays].groupItems[group1];
                        for(var error=0;error<sourceDoc.layers[lays].groupItems[group1].groupItems.length;error++)
                                {
                                    if(group_main.groupItems[error].name==group_main.name+ "Error:")
                                    {
                                         var max_area_path=find_rectangle_path_with_large_area(group_main);
        var x_axis=Math.abs(max_area_path.pathPoints[0].anchor[0]);
                        var y_axis=Math.abs(max_area_path.pathPoints[0].anchor[1]);
                        var textRef =group_main.groupItems[error].textFrames.add(); 
      textRef.contents =arr[sd1].contents+" Different unit present inside the group" ;
      textRef.top =y_axis ; 
      textRef.left = x_axis+20 ; 
      textRef.textRange.characterAttributes.size = 10; 
      count_error++;
      }
      }
      
      
      
      
      
      
      
      
      if(count_error==1)
      {
          }
      else
      {
           
                                     var newGroup  =group_main.groupItems.add(); 
                                  newGroup.name = group_main.name+ "Error:";  
                                   var max_area_path=find_rectangle_path_with_large_area(group_main);
        var x_axis=Math.abs(max_area_path.pathPoints[0].anchor[0]);
                        var y_axis=Math.abs(max_area_path.pathPoints[0].anchor[1]);
                        var textRef = newGroup.textFrames.add(); 
      textRef.contents =arr[sd1].contents+" Different unit present inside the group" ;
      textRef.top =y_axis ; 
      textRef.left = x_axis+20 ; 
      textRef.textRange.characterAttributes.size = 10; 
      newGroup.moveToEnd(group_main);
      }
      
      
          }
                  }
              }
          }
          arr.length=0;
      arr1.length=0;
      }
      }
      
      
      
      
                        
         
                        
      
      
      function check_fuse_ungroup()
      {
          var layer_item=sourceDoc.layers
           for(var layer_item_index=0;layer_item_index<layer_item.length;layer_item_index++)
          {
              if(layer_item[layer_item_index].pageItems.length>0)
              {
                  layer_grp_item=layer_item[layer_item_index].groupItems;
             
          for(var grp_main_index=0;grp_main_index<layer_grp_item.length;grp_main_index++)
          {
              
      child_path_item_main=layer_grp_item[grp_main_index].pathItems;
        child_group_item=layer_grp_item[grp_main_index].groupItems;
       mainloopfuse:  
        for(var grp_main_index1=0;grp_main_index1< child_group_item.length;grp_main_index1++)
        {
            child_path_item_main1=child_group_item[grp_main_index1].pathItems;
            for(var path_1=0;path_1<child_path_item_main1.length;path_1++)
            {
                 var  path_type = type_of_path(child_path_item_main1[path_1]);
                 if(path_type=="Rectangle Type 3")    
                 {
                   
                     theObj=layer_grp_item[grp_main_index].pageItems;
                     
                       for(var z=theObj.length-1;z>=0 ;z--)
              {
                  
                if (theObj[z].typename == "GroupItem") {
                   for (i=theObj[z].pageItems.length-1; i>=0; i--)
                   {
                  theObj[z].pageItems[i].moveAfter(theObj[z].pageItems[i].parent);
       }
      }
              
              }
          break mainloopfuse;
          }
      }
      }
      }
      }
      }
      }    
                        
        function line_check1_unit_CAN()
          {
                for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
      {
          var count=0;
          for(var group1=0;group1<sourceDoc.layers[lays1].groupItems.length;group1++)
          {
              mainloop12:
              
              if(sourceDoc.layers[lays1].groupItems[group1].name!="AAA")
              {
                  for(var group2=0;group2<sourceDoc.layers[lays1].groupItems[group1].groupItems.length;group2++)
                  {
                      for(var path=0;path<sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].pathItems.length;path++)
                      {
                          var path_type = type_of_path(sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].pathItems[path]);
                          if(path_type=="Line Type 1" || path_type=="Line Type 2" || path_type=="Line Type 3"  )
                          {
                              for(var group3=0;group3<sourceDoc.layers[lays1].groupItems[group1].groupItems.length;group3++)
                  {
                              for(var text=0;text<sourceDoc.layers[lays1].groupItems[group1].groupItems[group3].textFrames.length;text++)
                              {
                                  if(!sourceDoc.layers[lays1].groupItems[group1].groupItems[group3].textFrames[text].contents.match(/[A-Z][0-9]{1,3}$/)) continue; 
                                  {
                                      var count_error=0;
                  group_main=sourceDoc.layers[lays1].groupItems[group1];
                        for(var error=0;error<sourceDoc.layers[lays1].groupItems[group1].groupItems.length;error++)
                                {
                                    if(group_main.groupItems[error].name==group_main.name+ "Error:")
                                    {
                                         var max_area_path=find_rectangle_path_with_large_area(group_main);
        var x_axis=Math.abs(max_area_path.pathPoints[0].anchor[0]);
                        var y_axis=Math.abs(max_area_path.pathPoints[0].anchor[1]);
                        var textRef =group_main.groupItems[error].textFrames.add(); 
      textRef.contents ="Unwanted line present inside the group" ;
      textRef.top =y_axis ; 
      textRef.left = x_axis+20 ; 
      textRef.textRange.characterAttributes.size = 10; 
      count_error++;
      }
      }
      
      
      
      
      
      
      
      
      if(count_error==1)
      {
          }
      else
      {
           
                                     var newGroup  =group_main.groupItems.add(); 
                                  newGroup.name = group_main.name+ "Error:";  
                                   var max_area_path=find_rectangle_path_with_large_area(group_main);
        var x_axis=Math.abs(max_area_path.pathPoints[0].anchor[0]);
                        var y_axis=Math.abs(max_area_path.pathPoints[0].anchor[1]);
                        var textRef = newGroup.textFrames.add(); 
      textRef.contents ="Unwanted line present inside the group" ;
      textRef.top =y_axis ; 
      textRef.left = x_axis+20 ; 
      textRef.textRange.characterAttributes.size = 10; 
      newGroup.moveToEnd(group_main);
      }
      }
      break mainloop12;
      }
      }
      }
      }
      }
      }
      }
      }
      }                  
                        
       function line_check1_unit_2_CAN()
          {
                for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
      {
          
          for(var group1=0;group1<sourceDoc.layers[lays1].groupItems.length;group1++)
          {
              var count_group_found=0;
              
              if(sourceDoc.layers[lays1].groupItems[group1].name!="AAA")
              {
                mainloop12:
                 for(var group2=0;group2<sourceDoc.layers[lays1].groupItems[group1].groupItems.length;group2++)
                 {
                     if(sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].name.slice(0,15)=="connectornumber")
                     {
                         count_group_found=1;
                         break  mainloop12;
                         }
                     }
                 if(  count_group_found==1)
                 {
                     
                      for(var path=0;path<sourceDoc.layers[lays1].groupItems[group1].pathItems.length;path++)
                      {
                          var path_type = type_of_path(sourceDoc.layers[lays1].groupItems[group1].pathItems[path]);
                          if(path_type=="Line Type 1" || path_type=="Line Type 2" || path_type=="Line Type 3" )
                          {
                              var count_error=0;
                  group_main=sourceDoc.layers[lays1].groupItems[group1];
                        for(var error=0;error<sourceDoc.layers[lays1].groupItems[group1].groupItems.length;error++)
                                {
                                    if(group_main.groupItems[error].name==group_main.name+ "Error:")
                                    {
                                         var max_area_path=find_rectangle_path_with_large_area(group_main);
        var x_axis=Math.abs(max_area_path.pathPoints[0].anchor[0]);
                        var y_axis=Math.abs(max_area_path.pathPoints[0].anchor[1]);
                        var textRef =group_main.groupItems[error].textFrames.add(); 
      textRef.contents ="Unwanted line present inside the group" ;
      textRef.top =y_axis ; 
      textRef.left = x_axis+20 ; 
      textRef.textRange.characterAttributes.size = 10; 
      count_error++;
      }
      }
      
      
      
      
      
      
      
      
      if(count_error==1)
      {
          }
      else
      {
           
                                     var newGroup  =group_main.groupItems.add(); 
                                  newGroup.name = group_main.name+ "Error:";  
                                   var max_area_path=find_rectangle_path_with_large_area(group_main);
        var x_axis=Math.abs(max_area_path.pathPoints[0].anchor[0]);
                        var y_axis=Math.abs(max_area_path.pathPoints[0].anchor[1]);
                        var textRef = newGroup.textFrames.add(); 
      textRef.contents ="Unwanted line present inside the group" ;
      textRef.top =y_axis ; 
      textRef.left = x_axis+20 ; 
      textRef.textRange.characterAttributes.size = 10; 
      newGroup.moveToEnd(group_main);
      }
      }
      
      
      }
      }
      }
      }
      }
      }
      
      
      function reduce_opacity()
      {
          for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
          {
              for(var group1=0;group1<sourceDoc.layers[lays1].groupItems.length;group1++)
              {
                  for(var path1=sourceDoc.layers[lays1].groupItems[group1].pathItems.length-1;path1>=0;path1--)
                  {
                      var path_type = type_of_path(sourceDoc.layers[lays1].groupItems[group1].pathItems[path1]);
                      if(path_type=="Anchor point" && (sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].name.slice(0,3)=="pin" 
                      || sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].name.slice(0,4)=="FUSE" || sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].name.slice(0,2)=="FL"))
                      {
                          sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].opacity=0;
                          }
                      else if(path_type=="Anchor point" && sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].name=="")
                      {
                           sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].remove()
                          }
                      }
                      for(var group2=0;group2<sourceDoc.layers[lays1].groupItems[group1].groupItems.length;group2++)
                      {
                           for(var path2=sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].pathItems.length-1;path2>=0;path2--)
                  {
                      var path_type = type_of_path(sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].pathItems[path2]);
                      if(path_type=="Anchor point" && (sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].pathItems[path2].name.slice(0,3)=="pin"
                     || sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].pathItems[path2].name.slice(0,4)=="FUSE" || sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].pathItems[path2].name.slice(0,2)=="FL" ))
                      {
                          sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].pathItems[path2].opacity=0;
                          }
                      else if(path_type=="Anchor point" && sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].pathItems[path2].name=="")
                      {
                           sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].pathItems[path2].remove()
                          }
                      }
                  }
              }
          }
      }
      
      
      
      
      function reduce_opacity_1()
      {
          for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
          {
              for(var path1=0;path1<sourceDoc.layers[lays1].pathItems.length;path1++)
              {
                  var pathtype=type_of_path(sourceDoc.layers[lays1].pathItems[path1]);
                  if(pathtype=="Anchor point")
                  {
                     sourceDoc.layers[lays1].pathItems[path1].opacity=0;
                     }
                 }
             }
         }
      
      
      function circleFront()
      {
          for(var group=0;group<sourceDoc.groupItems.length;group++)
      {
          for(var path1=0;path1<sourceDoc.groupItems[group].pathItems.length;path1++)
          {
              var  path_type = type_of_path(sourceDoc.groupItems[group].pathItems[path1]);
              if(path_type=="Circle Type 1" || path_type=="Circle Type 2" || path_type=="Circle Type 3" || path_type=="Circle Type 4" || path_type=="Circle Type 5"
                || path_type=="Circle Type 6")
                {
                    
            sourceDoc.groupItems[group].pathItems[path1].moveToBeginning(sourceDoc.groupItems[group].pathItems[path1].parent);
            }
        }
      }
      }
      
      
      function group_Circle_name_CAN()
      {
          var count_group =1;
           for(var path=0;path<sourceDoc.pathItems.length;path++)
          {
                 var  path_type = type_of_path(sourceDoc.pathItems[path]);
                 if(path_type=="Circle Type 1" || path_type=="Circle Type 2" || path_type=="Circle Type 3" || path_type=="Circle Type 4"  || path_type=="Circle Type 5" 
                 || path_type=="Circle Type 6")
                 {
                     if((sourceDoc.pathItems[path].parent.name!="AAA" || sourceDoc.pathItems[path].parent.parent.name!="AAA")&& (sourceDoc.pathItems[path].parent.name=="") && (sourceDoc.pathItems[path].parent.name!="Shield") &&  (sourceDoc.pathItems[path].parent.name.slice(0,1)!="L"))
                     {
                           if(sourceDoc.pathItems[path].parent.pathItems.length>=3)
                           {
                               sourceDoc.pathItems[path].parent.name="CircleGroup"+count_group;
                               count_group++
                               }
                           else if(sourceDoc.pathItems[path].parent.pathItems.length<3)
                           {
                               for(var path1=0;path1<sourceDoc.pathItems[path].parent.pathItems.length;path1++)
                               {
                                   sourceDoc.pathItems[path].parent.pathItems[path1].strokeColor=magentaColor1;
                                  
                                      sourceDoc.pathItems[path].parent.pathItems[path1].strokeWidth=3;
                                   }
                               }
                           else
                           {
                               }}
                           else if(sourceDoc.pathItems[path].parent.name=="Shield")
                           {
                                 if(sourceDoc.pathItems[path].parent.pathItems.length>=3)
                           {
                               sourceDoc.pathItems[path].parent.name="Shield"+count_group;
                               count_group++
                               }
                           else if(sourceDoc.pathItems[path].parent.pathItems.length<3)
                           {
                               for(var path1=0;path1<sourceDoc.pathItems[path].parent.pathItems.length;path1++)
                               {
                                   sourceDoc.pathItems[path].parent.pathItems[path1].strokeColor=magentaColor1;
                                     
                                       sourceDoc.pathItems[path].parent.pathItems[path1].strokeWidth=3;
                                   }
                               }
                           }
                       else {
                           }
                       }
                   }
               }
           
           function group_name_normal()
      {
          var count_group =1
           for(var path=0;path<sourceDoc.pathItems.length;path++)
          {
                 var  path_type = type_of_path(sourceDoc.pathItems[path]);
                 if(path_type=="Circle Type 1" || path_type=="Circle Type 2" || path_type=="Circle Type 3" || path_type=="Circle Type 4"  || path_type=="Circle Type 5" 
                 || path_type=="Circle Type 6")
                 {
                     if((sourceDoc.pathItems[path].parent.name!="AAA" || sourceDoc.pathItems[path].parent.parent.name!="AAA")&& (sourceDoc.pathItems[path].parent.name=="") && (sourceDoc.pathItems[path].parent.name!="Shield") )
                     {
                           if(sourceDoc.pathItems[path].parent.pathItems.length>=3)
                           {
                               sourceDoc.pathItems[path].parent.name="CircleGroup"+count_group;
                               count_group++
                               }
                           else if(sourceDoc.pathItems[path].parent.pathItems.length<3)
                           {
                               for(var path1=0;path1<sourceDoc.pathItems[path].parent.pathItems.length;path1++)
                               {
                                   sourceDoc.pathItems[path].parent.pathItems[path1].strokeColor=magentaColor1;
                                   
                                      sourceDoc.pathItems[path].parent.pathItems[path1].strokeWidth=3;
                                   }
                               }
                           else
                           {
                               }}
                           else if(sourceDoc.pathItems[path].parent.name=="Shield")
                           {
                                 if(sourceDoc.pathItems[path].parent.pathItems.length>=3)
                           {
                               sourceDoc.pathItems[path].parent.name="Shield"+count_group;
                               count_group++
                               }
                           else if(sourceDoc.pathItems[path].parent.pathItems.length<3)
                           {
                               for(var path1=0;path1<sourceDoc.pathItems[path].parent.pathItems.length;path1++)
                               {
                                   sourceDoc.pathItems[path].parent.pathItems[path1].strokeColor=magentaColor1;
                                 
                                       sourceDoc.pathItems[path].parent.pathItems[path1].strokeWidth=3;
                                   }
                               }
                           }
                       else {
                           }
                       }
                   }
               }
      
      
      
      
        function checking_circleGroup_CAN()
      {
          for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
          {
            for(var path=0;path<sourceDoc.layers[lays1].groupItems.length;path++)
          {
              if(sourceDoc.layers[lays1].groupItems[path].name.slice(0,11)=="CircleGroup" || sourceDoc.layers[lays1].groupItems[path].name.slice(0,6)=="Shield" || sourceDoc.layers[lays1].groupItems[path].name.slice(0,3)=="AAA" || sourceDoc.layers[lays1].groupItems[path].name.slice(0,1)=="L"  )
              {
              for(var path_group=0;path_group<sourceDoc.layers[lays1].groupItems[path].pathItems.length;path_group++)
              {
                 var  path_type = type_of_path(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group]);
                {
                 if(path_type=="Circle Type 2" || path_type=="Circle Type 5")
                 {
                     var x_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[0]));
                     var y_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[1]));
                    var x_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[0]));
                     var y_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[1]));
                     var x_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[0]));
                     var y_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[1]));
                     var x_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[0]));
                     var y_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[1]));
                     
                     if(x_pathtype< x_pathtype2)
                     {
                      x_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[0]))  ;
                     y_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[1])); 
                     x_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[0]));
                     y_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[1]));
                     }
                 
                 if(y_pathtype1<y_pathtype3)
                 {
                     y_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[1]));
                     x_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[0]));
                     y_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[1]));
                      x_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[0]));
                 }
             
             if(x_pathtype== x_pathtype2)
             {
                 var x_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[0]));
                 var y_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[1]));
                  var x_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[0]));
                     var y_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[1]));
                      var x_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[0]));
                     var y_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[1]));
                       var x_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[0]));
                     var y_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[1]));
                     if(y_pathtype1<y_pathtype3)
                     {
                         var y_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[1]));
                         var y_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[1]));
                         }
                       if(x_pathtype< x_pathtype2)
                       {
                            var x_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[0]));
                              var x_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[0]));
                         
                    }
                }
                     
                   for(var lays2=0;lays2<sourceDoc.layers[lays2].layers.length;lays2++)
                    {
                     for(var path1=0;path1<sourceDoc.layers[lays2].layers[lays2].groupItems.length;path1++)
                     {
                     
                       for(var path_group1=0;path_group1<sourceDoc.layers[lays2].layers[lays2].groupItems[path1].pathItems.length;path_group1++)
              {  
                          var  path_type1 = type_of_path(sourceDoc.layers[lays2].layers[lays2].groupItems[path1].pathItems[path_group1]);
                          if(path_type1=="Line Type 2" || path_type1== "Rectangle Type 5")
                          {
                              for(var path_points=0;path_points<(sourceDoc.layers[lays2].layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints.length-1);path_points++)
                              {
                                  var x_pathline=Math.abs(Math.round(sourceDoc.layers[lays2].layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points].anchor[0]));
                                  var y_pathline=Math.abs(Math.round(sourceDoc.layers[lays2].layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points].anchor[1]));
                        
                                 
                                  
                                 if((x_pathline> x_pathtype2) &&    (x_pathline<x_pathtype) && (y_pathline> y_pathtype3) &&    (y_pathline<y_pathtype1) )
                                 {
                                       if(sourceDoc.layers[lays2].layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                        sourceDoc.layers[lays2].layers[lays2].groupItems[path1].pathItems[path_group1].name="Blue Color Line"
                                        sourceDoc.layers[lays2].layers[lays2].groupItems[path].pathItems[path_group].name="Blue Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;  
                                           
                                             sourceDoc.layers[lays2].layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;  
                                             
                                           }}
                                  else if((x_pathline> x_pathtype2) &&    (x_pathline<x_pathtype) )
                                  {
                                      if(y_pathline< y_pathtype3)
                                      {
                                          var x_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[0]));
                                  var y_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[1]));
                                 
                                  if((x_pathline1>x_pathtype2) && (x_pathline1<x_pathtype))
                                  {
                                      if((y_pathline1>  y_pathtype3)&&(y_pathline1>  y_pathtype1))
                                      {
                                            if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                        sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Blue Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Blue Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;
                                          
                                             sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;
                                            
                                           }}
                                       else if((y_pathline1> y_pathtype3) &&(y_pathline1< y_pathtype1))
                                       {
                                           
                                           if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Blue Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Blue Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;  
                                          
                                             sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;  
                                           }
                                       }
                                   }
                               }
                           else if(y_pathline> y_pathtype3)
                           {
                              var x_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[0]));
                                  var y_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[1]));
                                  if((x_pathline1>x_pathtype2) && (x_pathline1<x_pathtype))
                                  { 
                                 if((y_pathline1>  y_pathtype3)&&(y_pathline1<y_pathtype1))
                                      {
                                        if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Blue Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Blue Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1; 
                                        
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3; 
                                           
                                           }}
                                       else if((y_pathline1<y_pathtype3) &&(y_pathline1<  y_pathtype1))
                                       {
                                           
                                           if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Blue Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Blue Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1; 
                                          
                                             sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3; 
                                           
                                           }
                                       }
                                   }
                               }  
                                }
                         
                            else if((y_pathline> y_pathtype3) &&    (y_pathline<y_pathtype1) )
                               {
                                      if(x_pathline< x_pathtype2)
                                      {
                                          var x_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[0]));
                                  var y_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[1]));
                                
                                if((y_pathline1>y_pathtype3) && (y_pathline1<y_pathtype1))
                                  {
                               
                                      if((x_pathline1>  x_pathtype2)&&(x_pathline1>  x_pathtype))
                                      {
                                            if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Blue Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Blue Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;
                                       
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;
                                           
                                           }}
                                       else if((x_pathline1> x_pathtype2) &&(x_pathline1< x_pathtype))
                                       {
                                           
                                           if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Blue Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Blue Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1; 
                                           
                                             sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokewidth =3; 
                                           }
                                       }
                                   }
                               }
                             else if(x_pathline> x_pathtype2)
                           {
                              var x_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[0]));
                                  var y_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[1]));
                                if((y_pathline1>y_pathtype3) && (y_pathline1<y_pathtype1))
                                  {
                                      if((x_pathline1<  x_pathtype2)&&(x_pathline1<  x_pathtype))
                                      {
                                            if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Blue Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Blue Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1; 
                                          
                                             sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;
                                           }}
                                       else if((x_pathline1> x_pathtype2) &&(x_pathline1< x_pathtype))
                                       {
                                           
                                           if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Blue Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Blue Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1; 
                                        
                                            sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3; 
                                            
                                           }
                                       }
                                   }
                               }
                           }
                     
                                   }
                               }
                           }
                       }
                   
                  }
              }
               else if(path_type=="Circle Type 1" || path_type=="Circle Type 4")
                 {
                       var x_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[0]));
                     var y_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[1]));
                    var x_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[0]));
                     var y_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[1]));
                     var x_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[0]));
                     var y_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[1]));
                     var x_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[0]));
                     var y_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[1]));
                     
                     if(x_pathtype< x_pathtype2)
                     {
                      x_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[0]))  ;
                     y_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[1])); 
                     x_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[0]));
                     y_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[1]));
                     }
                 
                 if(y_pathtype1<y_pathtype3)
                 {
                     y_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[1]));
                     x_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[0]));
                     y_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[1]));
                      x_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[0]));
                 }
             
             if(x_pathtype== x_pathtype2)
             {
                 var x_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[0]));
                 var y_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[1]));
                  var x_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[0]));
                     var y_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[1]));
                      var x_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[0]));
                     var y_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[1]));
                       var x_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[0]));
                     var y_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[1]));
                     if(y_pathtype1<y_pathtype3)
                     {
                         var y_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[1]));
                         var y_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[1]));
                         }
                       if(x_pathtype< x_pathtype2)
                       {
                            var x_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[0]));
                              var x_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[0]));
                         
                    }
                }
         
                     
                    
                      for(var lays2=0;lays2<sourceDoc.layers.length;lays2++)
                    {
                     for(var path1=0;path1<sourceDoc.layers[lays2].groupItems.length;path1++)
                     {
                     
                       for(var path_group1=0;path_group1<sourceDoc.layers[lays2].groupItems[path1].pathItems.length;path_group1++)
              {  
                          var  path_type1 = type_of_path(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1]);
                          if(path_type1=="Line Type 1" || path_type1== "Rectangle Type 11" || path_type1== "Line Type 10" || path_type1== "Line Type 4")
                          {
                              found_line:
                              for(var path_points=0;path_points<(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints.length-1);path_points++)
                              {
                                  var x_pathline=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points].anchor[0]));
                                  var y_pathline=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points].anchor[1]));
                                  var x_pathlast=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints.length-1].anchor[0]));
                                   var y_pathlast=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints.length-1].anchor[1]));
                                  
                                 if((x_pathline> x_pathtype2) &&    (x_pathline<x_pathtype) && (y_pathline> y_pathtype3) &&    (y_pathline<y_pathtype1) )
                                 {
                                       if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                        sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Black Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Black Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;  
                                           
                                               sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;  
                                           }}
                                   else if((x_pathlast> x_pathtype2) &&    (x_pathlast<x_pathtype) && (y_pathlast> y_pathtype3) &&    (y_pathlast<y_pathtype1) )
                                   {
                                        if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                        sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Black Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Black Color Circle"
                                        break found_line;
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;  
                                           
                                               sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;  
                                           }}
                                  else if((x_pathline> x_pathtype2) &&    (x_pathline<x_pathtype) )
                                  {
                                      if(y_pathline< y_pathtype3)
                                      {
                                          var x_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[0]));
                                  var y_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[1]));
                                 
                                  if((x_pathline1>x_pathtype2) && (x_pathline1<x_pathtype))
                                  {
                                      if((y_pathline1>  y_pathtype3)&&(y_pathline1>  y_pathtype1))
                                      {
                                            if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Black Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Black Color Circle"
                                        
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1; 
                                         
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3; 
                                           }}
                                       else if((y_pathline1> y_pathtype3) &&(y_pathline1< y_pathtype1))
                                       {
                                           
                                           if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Black Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Black Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;
                                           
                                             sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;
                                           }
                                       }
                                   }
                               }
                           else if(y_pathline> y_pathtype3)
                           {
                              var x_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[0]));
                                  var y_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[1]));
                                  if((x_pathline1>x_pathtype2) && (x_pathline1<x_pathtype))
                                  { 
                                 if((y_pathline1>  y_pathtype3)&&(y_pathline1<y_pathtype1))
                                      {
                                        if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Black Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Black Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;
                                        
                                             sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;
                                           }}
                                       else if((y_pathline1< y_pathtype3) &&(y_pathline1<  y_pathtype1))
                                       {
                                           
                                           if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Black Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Black Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;  
                                          
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;  
                                           }
                                       }
                                   }
                               }  
                                }
                            else if((y_pathline> y_pathtype3) &&    (y_pathline<y_pathtype1) )
                               {
                                      if(x_pathline< x_pathtype2)
                                      {
                                          var x_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[0]));
                                  var y_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[1]));
                                if((y_pathline1>y_pathtype3) && (y_pathline1<y_pathtype1))
                                  {
                                      if((x_pathline1>  x_pathtype2)&&(x_pathline1>  x_pathtype))
                                      {
                                            if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Black Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Black Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;
                                           
                                             sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;
                                           }}
                                       else if((x_pathline1> x_pathtype2) &&(x_pathline1< x_pathtype))
                                       {
                                           
                                           if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="BlackColor Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Black Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;  
                                         
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;  
                                           }
                                       }
                                   }
                               }
                             else if(x_pathline> x_pathtype2)
                           {
                              var x_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[0]));
                                  var y_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[1]));
                                if((y_pathline1>y_pathtype3) && (y_pathline1<y_pathtype1))
                                  {
                                      if((x_pathline1<  x_pathtype2)&&(x_pathline1<  x_pathtype))
                                      {
                                            if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Black Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Black Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;
                                          
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;
                                           }}
                                       else if((x_pathline1> x_pathtype2) &&(x_pathline1< x_pathtype))
                                       {
                                           
                                           if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Black Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Black Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1; 
                                        
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3; 
                                           
                                           }
                                       }
                                   }
                               }
                           }
                     
                                   }
                               }
                           }
                       }
                   
                  }
              }
              
              else if(path_type=="Circle Type 3" || path_type=="Circle Type 6")
                 {
                       var x_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[0]));
                     var y_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[1]));
                    var x_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[0]));
                     var y_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[1]));
                     var x_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[0]));
                     var y_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[1]));
                     var x_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[0]));
                     var y_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[1]));
                     
                     if(x_pathtype< x_pathtype2)
                     {
                      x_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[0]))  ;
                     y_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[1])); 
                     x_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[0]));
                     y_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[1]));
                     }
                 
                 if(y_pathtype1<y_pathtype3)
                 {
                     y_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[1]));
                     x_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[0]));
                     y_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[1]));
                      x_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[0]));
                 }
             
             if(x_pathtype== x_pathtype2)
             {
                 var x_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[0]));
                 var y_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[1]));
                  var x_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[0]));
                     var y_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[1]));
                      var x_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[0]));
                     var y_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[1]));
                       var x_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[0]));
                     var y_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[1]));
                     if(y_pathtype1<y_pathtype3)
                     {
                         var y_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[1]));
                         var y_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[1]));
                         }
                       if(x_pathtype< x_pathtype2)
                       {
                            var x_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[0]));
                              var x_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[0]));
                         
                    }
                }
                     
                      for(var lays2=0;lays2<sourceDoc.layers.length;lays2++)
                    {
                    
                     for(var path1=0;path1<sourceDoc.layers[lays2].groupItems.length;path1++)
                     {
                     
                       for(var path_group1=0;path_group1<sourceDoc.layers[lays2].groupItems[path1].pathItems.length;path_group1++)
              {  
                          var  path_type1 = type_of_path(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1]);
                          if(path_type1=="Line Type 3" || path_type1== "Rectangle Type 5")
                          {
                              for(var path_points=0;path_points<(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints.length-1);path_points++)
                              {
                                  var x_pathline=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points].anchor[0]));
                                  var y_pathline=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points].anchor[1]));
                                 
                                  
                                 if((x_pathline> x_pathtype2) &&    (x_pathline<x_pathtype) && (y_pathline> y_pathtype3) &&    (y_pathline<y_pathtype1) )
                                 {
                                       if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                        sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Red Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Red Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;  
                                           
                                             sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;  
                                           }}
                                  else if((x_pathline> x_pathtype2) &&    (x_pathline<x_pathtype) )
                                  {
                                      if(y_pathline< y_pathtype3)
                                      {
                                          var x_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[0]));
                                  var y_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[1]));
                                 
                                  if((x_pathline1>x_pathtype2) && (x_pathline1<x_pathtype))
                                  {
                                      if((y_pathline1>  y_pathtype3)&&(y_pathline1>  y_pathtype1))
                                      {
                                            if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                        sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Red Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Red Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;  
                                           
                                             sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;  
                                           }}
                                       else if((y_pathline1> y_pathtype3) &&(y_pathline1< y_pathtype1))
                                       {
                                           
                                           if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Red Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Red Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;
                                       
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;
                                           
                                           }
                                       }
                                   }
                               }
                           else if(y_pathline> y_pathtype3)
                           {
                              var x_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[0]));
                                  var y_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[1]));
                                  if((x_pathline1>x_pathtype2) && (x_pathline1<x_pathtype))
                                  { 
                                 if((y_pathline1>  y_pathtype3)&&(y_pathline1<y_pathtype1))
                                      {
                                        if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Red Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Red Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;  
                                           
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;  
                                           }}
                                       else if((y_pathline1< y_pathtype3) &&(y_pathline1<  y_pathtype1))
                                       {
                                           
                                           if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Red Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Red Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;  
                                           
                                             sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;  
                                           }
                                       }
                                   }
                               }  
                                }
                         
                            else if((y_pathline> y_pathtype3) &&    (y_pathline<y_pathtype1) )
                               {
                                      if(x_pathline< x_pathtype2)
                                      {
                                          var x_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[0]));
                                  var y_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[1]));
                                
                                if((y_pathline1>y_pathtype3) && (y_pathline1<y_pathtype1))
                                  {
                               
                                      if((x_pathline1>  x_pathtype2)&&(x_pathline1>  x_pathtype))
                                      {
                                            if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Red Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Red Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1; 
                                       
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3; 
                                           }}
                                       else if((x_pathline1> x_pathtype2) &&(x_pathline1< x_pathtype))
                                       {
                                           
                                           if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Red Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Red Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;
                                          
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;
                                           }
                                       }
                                   }
                               }
                             else if(x_pathline> x_pathtype2)
                           {
                              var x_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[0]));
                                  var y_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[1]));
                                if((y_pathline1>y_pathtype3) && (y_pathline1<y_pathtype1))
                                  {
                                      if((x_pathline1<  x_pathtype2)&&(x_pathline1<  x_pathtype))
                                      {
                                            if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Red Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Red Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;
                                           
                                             sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;
                                           }}
                                       else if((x_pathline1> x_pathtype2) &&(x_pathline1< x_pathtype))
                                       {
                                           
                                           if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Red Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Red Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;
                                           
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;
                                           }
                                       }
                                       }
                                   }
                               }
                           }
                     
                                   }
                               }
                           }
                       }
                   
                  }
               }
           }
       }
          }
      }   
      }
      
      
           function checking_circleGroup_normal()
      {
          for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
          {
            for(var path=0;path<sourceDoc.layers[lays1].groupItems.length;path++)
          {
              if(sourceDoc.layers[lays1].groupItems[path].name.slice(0,11)=="CircleGroup" || sourceDoc.layers[lays1].groupItems[path].name.slice(0,6)=="Shield" || sourceDoc.layers[lays1].groupItems[path].name.slice(0,3)=="AAA" || sourceDoc.layers[lays1].groupItems[path].name.slice(0,1)=="L"  )
              {
              for(var path_group=0;path_group<sourceDoc.layers[lays1].groupItems[path].pathItems.length;path_group++)
              {
                 var  path_type = type_of_path(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group]);
                {
                 if(path_type=="Circle Type 2" || path_type=="Circle Type 5")
                 {
                     var x_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[0]));
                     var y_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[1]));
                    var x_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[0]));
                     var y_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[1]));
                     var x_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[0]));
                     var y_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[1]));
                     var x_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[0]));
                     var y_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[1]));
                     
                     if(x_pathtype< x_pathtype2)
                     {
                      x_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[0]))  ;
                     y_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[1])); 
                     x_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[0]));
                     y_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[1]));
                     }
                 
                 if(y_pathtype1<y_pathtype3)
                 {
                     y_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[1]));
                     x_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[0]));
                     y_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[1]));
                      x_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[0]));
                 }
             
             if(x_pathtype== x_pathtype2)
             {
                 var x_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[0]));
                 var y_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[1]));
                  var x_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[0]));
                     var y_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[1]));
                      var x_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[0]));
                     var y_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[1]));
                       var x_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[0]));
                     var y_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[1]));
                     if(y_pathtype1<y_pathtype3)
                     {
                         var y_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[1]));
                         var y_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[1]));
                         }
                       if(x_pathtype< x_pathtype2)
                       {
                            var x_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[0]));
                              var x_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[0]));
                         
                    }
                }
                     
                   for(var lays2=0;lays2<sourceDoc.layers[lays2].layers.length;lays2++)
                    {
                     for(var path1=0;path1<sourceDoc.layers[lays2].layers[lays2].groupItems.length;path1++)
                     {
                     
                       for(var path_group1=0;path_group1<sourceDoc.layers[lays2].layers[lays2].groupItems[path1].pathItems.length;path_group1++)
              {  
                          var  path_type1 = type_of_path(sourceDoc.layers[lays2].layers[lays2].groupItems[path1].pathItems[path_group1]);
                          if(path_type1=="Line Type 2" || path_type1== "Rectangle Type 5")
                          {
                              for(var path_points=0;path_points<(sourceDoc.layers[lays2].layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints.length-1);path_points++)
                              {
                                  var x_pathline=Math.abs(Math.round(sourceDoc.layers[lays2].layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points].anchor[0]));
                                  var y_pathline=Math.abs(Math.round(sourceDoc.layers[lays2].layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points].anchor[1]));
                        
                                 
                                  
                                 if((x_pathline> x_pathtype2) &&    (x_pathline<x_pathtype) && (y_pathline> y_pathtype3) &&    (y_pathline<y_pathtype1) )
                                 {
                                       if(sourceDoc.layers[lays2].layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                        sourceDoc.layers[lays2].layers[lays2].groupItems[path1].pathItems[path_group1].name="Blue Color Line"
                                        sourceDoc.layers[lays2].layers[lays2].groupItems[path].pathItems[path_group].name="Blue Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;  
                                           
                                             sourceDoc.layers[lays2].layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;  
                                             
                                           }}
                                  else if((x_pathline> x_pathtype2) &&    (x_pathline<x_pathtype) )
                                  {
                                      if(y_pathline< y_pathtype3)
                                      {
                                          var x_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[0]));
                                  var y_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[1]));
                                 
                                  if((x_pathline1>x_pathtype2) && (x_pathline1<x_pathtype))
                                  {
                                      if((y_pathline1>  y_pathtype3)&&(y_pathline1>  y_pathtype1))
                                      {
                                            if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                        sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Blue Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Blue Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;
                                          
                                             sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;
                                            
                                           }}
                                       else if((y_pathline1> y_pathtype3) &&(y_pathline1< y_pathtype1))
                                       {
                                           
                                           if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Blue Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Blue Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;  
                                          
                                             sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;  
                                           }
                                       }
                                   }
                               }
                           else if(y_pathline> y_pathtype3)
                           {
                              var x_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[0]));
                                  var y_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[1]));
                                  if((x_pathline1>x_pathtype2) && (x_pathline1<x_pathtype))
                                  { 
                                 if((y_pathline1>  y_pathtype3)&&(y_pathline1<y_pathtype1))
                                      {
                                        if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Blue Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Blue Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1; 
                                        
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3; 
                                           
                                           }}
                                       else if((y_pathline1<y_pathtype3) &&(y_pathline1<  y_pathtype1))
                                       {
                                           
                                           if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Blue Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Blue Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1; 
                                          
                                             sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3; 
                                           
                                           }
                                       }
                                   }
                               }  
                                }
                         
                            else if((y_pathline> y_pathtype3) &&    (y_pathline<y_pathtype1) )
                               {
                                      if(x_pathline< x_pathtype2)
                                      {
                                          var x_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[0]));
                                  var y_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[1]));
                                
                                if((y_pathline1>y_pathtype3) && (y_pathline1<y_pathtype1))
                                  {
                               
                                      if((x_pathline1>  x_pathtype2)&&(x_pathline1>  x_pathtype))
                                      {
                                            if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Blue Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Blue Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;
                                       
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;
                                           
                                           }}
                                       else if((x_pathline1> x_pathtype2) &&(x_pathline1< x_pathtype))
                                       {
                                           
                                           if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Blue Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Blue Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1; 
                                           
                                             sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokewidth =3; 
                                           }
                                       }
                                   }
                               }
                             else if(x_pathline> x_pathtype2)
                           {
                              var x_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[0]));
                                  var y_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[1]));
                                if((y_pathline1>y_pathtype3) && (y_pathline1<y_pathtype1))
                                  {
                                      if((x_pathline1<  x_pathtype2)&&(x_pathline1<  x_pathtype))
                                      {
                                            if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Blue Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Blue Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1; 
                                          
                                             sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;
                                           }}
                                       else if((x_pathline1> x_pathtype2) &&(x_pathline1< x_pathtype))
                                       {
                                           
                                           if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Blue Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Blue Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1; 
                                        
                                            sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3; 
                                            
                                           }
                                       }
                                   }
                               }
                           }
                     
                                   }
                               }
                           }
                       }
                   
                  }
              }
               else if(path_type=="Circle Type 1" || path_type=="Circle Type 4")
                 {
                       var x_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[0]));
                     var y_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[1]));
                    var x_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[0]));
                     var y_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[1]));
                     var x_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[0]));
                     var y_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[1]));
                     var x_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[0]));
                     var y_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[1]));
                     
                     if(x_pathtype< x_pathtype2)
                     {
                      x_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[0]))  ;
                     y_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[1])); 
                     x_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[0]));
                     y_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[1]));
                     }
                 
                 if(y_pathtype1<y_pathtype3)
                 {
                     y_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[1]));
                     x_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[0]));
                     y_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[1]));
                      x_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[0]));
                 }
             
             if(x_pathtype== x_pathtype2)
             {
                 var x_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[0]));
                 var y_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[1]));
                  var x_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[0]));
                     var y_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[1]));
                      var x_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[0]));
                     var y_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[1]));
                       var x_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[0]));
                     var y_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[1]));
                     if(y_pathtype1<y_pathtype3)
                     {
                         var y_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[1]));
                         var y_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[1]));
                         }
                       if(x_pathtype< x_pathtype2)
                       {
                            var x_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[0]));
                              var x_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[0]));
                         
                    }
                }
         
                     
                    
                      for(var lays2=0;lays2<sourceDoc.layers.length;lays2++)
                    {
                     for(var path1=0;path1<sourceDoc.layers[lays2].groupItems.length;path1++)
                     {
                     
                       for(var path_group1=0;path_group1<sourceDoc.layers[lays2].groupItems[path1].pathItems.length;path_group1++)
              {  
                          var  path_type1 = type_of_path(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1]);
                          if(path_type1=="Line Type 1" || path_type1== "Rectangle Type 11")
                          {
                              found_line:
                              for(var path_points=0;path_points<(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints.length-1);path_points++)
                              {
                                  var x_pathline=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points].anchor[0]));
                                  var y_pathline=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points].anchor[1]));
                                  var x_pathlast=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints.length-1].anchor[0]));
                                   var y_pathlast=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints.length-1].anchor[1]));
                                  
                                 if((x_pathline> x_pathtype2) &&    (x_pathline<x_pathtype) && (y_pathline> y_pathtype3) &&    (y_pathline<y_pathtype1) )
                                 {
                                       if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                        sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Black Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Black Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;  
                                           
                                               sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;  
                                           }}
                                
                                  else if((x_pathline> x_pathtype2) &&    (x_pathline<x_pathtype) )
                                  {
                                      if(y_pathline< y_pathtype3)
                                      {
                                          var x_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[0]));
                                  var y_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[1]));
                                 
                                  if((x_pathline1>x_pathtype2) && (x_pathline1<x_pathtype))
                                  {
                                      if((y_pathline1>  y_pathtype3)&&(y_pathline1>  y_pathtype1))
                                      {
                                            if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Black Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Black Color Circle"
                                        
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1; 
                                         
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3; 
                                           }}
                                       else if((y_pathline1> y_pathtype3) &&(y_pathline1< y_pathtype1))
                                       {
                                           
                                           if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Black Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Black Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;
                                           
                                             sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;
                                           }
                                       }
                                   }
                               }
                           else if(y_pathline> y_pathtype3)
                           {
                              var x_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[0]));
                                  var y_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[1]));
                                  if((x_pathline1>x_pathtype2) && (x_pathline1<x_pathtype))
                                  { 
                                 if((y_pathline1>  y_pathtype3)&&(y_pathline1<y_pathtype1))
                                      {
                                        if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Black Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Black Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;
                                        
                                             sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;
                                           }}
                                       else if((y_pathline1< y_pathtype3) &&(y_pathline1<  y_pathtype1))
                                       {
                                           
                                           if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Black Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Black Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;  
                                          
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;  
                                           }
                                       }
                                   }
                               }  
                                }
                            else if((y_pathline> y_pathtype3) &&    (y_pathline<y_pathtype1) )
                               {
                                      if(x_pathline< x_pathtype2)
                                      {
                                          var x_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[0]));
                                  var y_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[1]));
                                if((y_pathline1>y_pathtype3) && (y_pathline1<y_pathtype1))
                                  {
                                      if((x_pathline1>  x_pathtype2)&&(x_pathline1>  x_pathtype))
                                      {
                                            if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Black Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Black Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;
                                           
                                             sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;
                                           }}
                                       else if((x_pathline1> x_pathtype2) &&(x_pathline1< x_pathtype))
                                       {
                                           
                                           if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="BlackColor Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Black Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;  
                                         
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;  
                                           }
                                       }
                                   }
                               }
                             else if(x_pathline> x_pathtype2)
                           {
                              var x_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[0]));
                                  var y_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[1]));
                                if((y_pathline1>y_pathtype3) && (y_pathline1<y_pathtype1))
                                  {
                                      if((x_pathline1<  x_pathtype2)&&(x_pathline1<  x_pathtype))
                                      {
                                            if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Black Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Black Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;
                                          
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;
                                           }}
                                       else if((x_pathline1> x_pathtype2) &&(x_pathline1< x_pathtype))
                                       {
                                           
                                           if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Black Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Black Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1; 
                                        
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3; 
                                           
                                           }
                                       }
                                   }
                               }
                           }
                     
                                   }
                               }
                           }
                       }
                   
                  }
              }
              
              else if(path_type=="Circle Type 3" || path_type=="Circle Type 6")
                 {
                       var x_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[0]));
                     var y_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[1]));
                    var x_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[0]));
                     var y_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[1]));
                     var x_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[0]));
                     var y_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[1]));
                     var x_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[0]));
                     var y_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[1]));
                     
                     if(x_pathtype< x_pathtype2)
                     {
                      x_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[0]))  ;
                     y_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[1])); 
                     x_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[0]));
                     y_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[1]));
                     }
                 
                 if(y_pathtype1<y_pathtype3)
                 {
                     y_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[1]));
                     x_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[0]));
                     y_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[1]));
                      x_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[0]));
                 }
             
             if(x_pathtype== x_pathtype2)
             {
                 var x_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[0]));
                 var y_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[1]));
                  var x_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[0]));
                     var y_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[1]));
                      var x_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[0]));
                     var y_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[1]));
                       var x_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[0]));
                     var y_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[1]));
                     if(y_pathtype1<y_pathtype3)
                     {
                         var y_pathtype3=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[2].anchor[1]));
                         var y_pathtype1=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[0].anchor[1]));
                         }
                       if(x_pathtype< x_pathtype2)
                       {
                            var x_pathtype=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[3].anchor[0]));
                              var x_pathtype2=Math.abs(Math.round(sourceDoc.layers[lays1].groupItems[path].pathItems[path_group].pathPoints[1].anchor[0]));
                         
                    }
                }
                     
                      for(var lays2=0;lays2<sourceDoc.layers.length;lays2++)
                    {
                    
                     for(var path1=0;path1<sourceDoc.layers[lays2].groupItems.length;path1++)
                     {
                     
                       for(var path_group1=0;path_group1<sourceDoc.layers[lays2].groupItems[path1].pathItems.length;path_group1++)
              {  
                          var  path_type1 = type_of_path(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1]);
                          if(path_type1=="Line Type 3" || path_type1== "Rectangle Type 5")
                          {
                              for(var path_points=0;path_points<(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints.length-1);path_points++)
                              {
                                  var x_pathline=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points].anchor[0]));
                                  var y_pathline=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points].anchor[1]));
                                 
                                  
                                 if((x_pathline> x_pathtype2) &&    (x_pathline<x_pathtype) && (y_pathline> y_pathtype3) &&    (y_pathline<y_pathtype1) )
                                 {
                                       if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                        sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Red Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Red Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;  
                                           
                                             sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;  
                                           }}
                                  else if((x_pathline> x_pathtype2) &&    (x_pathline<x_pathtype) )
                                  {
                                      if(y_pathline< y_pathtype3)
                                      {
                                          var x_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[0]));
                                  var y_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[1]));
                                 
                                  if((x_pathline1>x_pathtype2) && (x_pathline1<x_pathtype))
                                  {
                                      if((y_pathline1>  y_pathtype3)&&(y_pathline1>  y_pathtype1))
                                      {
                                            if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                        sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Red Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Red Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;  
                                           
                                             sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;  
                                           }}
                                       else if((y_pathline1> y_pathtype3) &&(y_pathline1< y_pathtype1))
                                       {
                                           
                                           if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Red Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Red Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;
                                       
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;
                                           
                                           }
                                       }
                                   }
                               }
                           else if(y_pathline> y_pathtype3)
                           {
                              var x_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[0]));
                                  var y_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[1]));
                                  if((x_pathline1>x_pathtype2) && (x_pathline1<x_pathtype))
                                  { 
                                 if((y_pathline1>  y_pathtype3)&&(y_pathline1<y_pathtype1))
                                      {
                                        if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Red Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Red Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;  
                                           
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;  
                                           }}
                                       else if((y_pathline1< y_pathtype3) &&(y_pathline1<  y_pathtype1))
                                       {
                                           
                                           if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Red Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Red Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;  
                                           
                                             sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;  
                                           }
                                       }
                                   }
                               }  
                                }
                         
                            else if((y_pathline> y_pathtype3) &&    (y_pathline<y_pathtype1) )
                               {
                                      if(x_pathline< x_pathtype2)
                                      {
                                          var x_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[0]));
                                  var y_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[1]));
                                
                                if((y_pathline1>y_pathtype3) && (y_pathline1<y_pathtype1))
                                  {
                               
                                      if((x_pathline1>  x_pathtype2)&&(x_pathline1>  x_pathtype))
                                      {
                                            if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Red Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Red Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1; 
                                       
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3; 
                                           }}
                                       else if((x_pathline1> x_pathtype2) &&(x_pathline1< x_pathtype))
                                       {
                                           
                                           if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Red Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Red Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;
                                          
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;
                                           }
                                       }
                                   }
                               }
                             else if(x_pathline> x_pathtype2)
                           {
                              var x_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[0]));
                                  var y_pathline1=Math.abs(Math.round(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].pathPoints[path_points+1].anchor[1]));
                                if((y_pathline1>y_pathtype3) && (y_pathline1<y_pathtype1))
                                  {
                                      if((x_pathline1<  x_pathtype2)&&(x_pathline1<  x_pathtype))
                                      {
                                            if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Red Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Red Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;
                                           
                                             sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;
                                           }}
                                       else if((x_pathline1> x_pathtype2) &&(x_pathline1< x_pathtype))
                                       {
                                           
                                           if(sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].parent.name==sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].parent.name)
                                    {
                                         sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].name="Red Color Line"
                                        sourceDoc.layers[lays2].groupItems[path].pathItems[path_group].name="Red Color Circle"
                                        }
                                       else 
                                       {
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeColor =magentaColor1;
                                           
                                           sourceDoc.layers[lays2].groupItems[path1].pathItems[path_group1].strokeWidth =3;
                                           }
                                       }
                                       }
                                   }
                               }
                           }
                     
                                   }
                               }
                           }
                       }
                   
                  }
               }
           }
       }
          }
      }   
      }
      
       function check_unwantedline_CAN()
      {
          for(var path1=0;path1<sourceDoc.pathItems.length;path1++)
      {
          if(sourceDoc.pathItems[path1].name=="Black Color Circle" || sourceDoc.pathItems[path1].name=="Blue Color Circle" || sourceDoc.pathItems[path1].name=="Red Color Circle")
          {
              var group2=sourceDoc.pathItems[path1].parent;
              for(var group3=0;group3<group2.pathItems.length;group3++)
              {
                  var path_type=type_of_path(group2.pathItems[group3]);
                  {
                        if(path_type=="Line Type 1" || path_type=="Line Type 2" || path_type=="Line Type 3" || path_type=="Line Type 4" || path_type=="Line Type 10") 
                        {
                            if(group2.pathItems[group3].name=="")
                            {
                                 group2.pathItems[group3].strokeColor=magentaColor3;
                        group2.pathItems[group3].strokeWidth=5;
                        }
                    }
                }
            }
        }
      }
      }    
      
      
      
      
      
      
      function check_unwantedline_normal()
      {
          for(var path1=0;path1<sourceDoc.pathItems.length;path1++)
      {
          if(sourceDoc.pathItems[path1].name=="Black Color Circle" || sourceDoc.pathItems[path1].name=="Blue Color Circle" || sourceDoc.pathItems[path1].name=="Red Color Circle")
          {
              var group2=sourceDoc.pathItems[path1].parent;
              for(var group3=0;group3<group2.pathItems.length;group3++)
              {
                  var path_type=type_of_path(group2.pathItems[group3]);
                  {
                        if(path_type=="Line Type 1" || path_type=="Line Type 2" || path_type=="Line Type 3") 
                        {
                            if(group2.pathItems[group3].name=="")
                            {
                                 group2.pathItems[group3].strokeColor=magentaColor3;
                        group2.pathItems[group3].strokeWidth=5;
                        }
                    }
                }
            }
        }
      }
      }    
            
            
            function  renaming_path()
            {
                for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
                {
                    for(var group1=0;group1<sourceDoc.layers[lays1].groupItems.length;group1++)
                    {
                       
                        
                    for(var path1=0;path1<sourceDoc.layers[lays1].groupItems[group1].pathItems.length;path1++)
                    {
                       var path_type=type_of_path(sourceDoc.layers[lays1].groupItems[group1].pathItems[path1]);
                       if(path_type=="Rectangle Type 5" || path_type=="Rectangle Type 11" || path_type=="Circle Type 1" || path_type=="Circle Type 2"
                       || path_type=="Circle Type 3" || path_type=="Circle Type 4" || path_type=="Circle Type 5" || path_type=="Circle Type 6" ||
                        path_type=="Line Type 1" || path_type=="Line Type 2" || path_type=="Line Type 3" || path_type=="Line Type 4" ||
                        path_type=="Line Type 10")
                        {
                            if(sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].name!="")
                            {
                               sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].name=""
                                }
                            }
                        }
                    }
                }
            }
        
            
            
            function  renaming_CAN()
            {
                var count_line=1;
                 for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
                {
                    for(var group1=0;group1<sourceDoc.layers[lays1].groupItems.length;group1++)
                    {
                        
                        if(sourceDoc.layers[lays1].groupItems[group1].name=="AAA")
                        {
                            }
                           else if(check (sourceDoc.layers[lays1].groupItems[group1].name))
                        {
                            }
                        else
                        {
                    for(var path1=0;path1<sourceDoc.layers[lays1].groupItems[group1].pathItems.length;path1++)
                    {
                       var path_type=type_of_path(sourceDoc.layers[lays1].groupItems[group1].pathItems[path1]);
                       if(path_type=="Rectangle Type 5" || path_type=="Rectangle Type 11" || path_type=="Circle Type 1" || path_type=="Circle Type 2"
                       || path_type=="Circle Type 3" || path_type=="Circle Type 4" || path_type=="Circle Type 5" || path_type=="Circle Type 6" ||
                        path_type=="Line Type 1" || path_type=="Line Type 2" || path_type=="Line Type 3" || path_type=="Line Type 4" ||
                        path_type=="Line Type 10" || path_type=="Line Type 12" )
                        {
                            sourceDoc.layers[lays1].groupItems[group1].name="L"+count_line;
                            count_line++;
                            break;
                            }
                        }
                    }
                }
            }
        }
        
        
        function error_check()
      {
      for (var lay=0;lay<sourceDoc.layers.length;lay++)
      {
          
         for(var group=0;group<sourceDoc.layers[lay].groupItems.length;group++)
         {
             for(var group1=0;group1<sourceDoc.layers[lay].groupItems[group].groupItems.length;group1++)
             {
                 if(sourceDoc.layers[lay].groupItems[group].groupItems[group1].name==sourceDoc.layers[lay].groupItems[group].name+"Error:")
                 {
                     var max_area_path=find_rectangle_path_with_large_area(sourceDoc.layers[lay].groupItems[group]);
                    
                     if (max_area_path=="[PathItem ]")
                     {
                         max_area_path.strokeColor=magentaColor6;
                         max_area_path.strokeWidth=3;
                         for(var text=0;text<sourceDoc.layers[lay].groupItems[group].groupItems[group1].textFrames.length;text++)
                         {
                          sourceDoc.layers[lay].groupItems[group].groupItems[group1].textFrames[text].hidden=true ;
                     
                     }
                 }
             else 
             {
                 for(var i=0;i<sourceDoc.layers[lay].groupItems[group].textFrames.length;i++)
                 {
                     sourceDoc.layers[lay].groupItems[group].textFrames[i].textRange.characterAttributes.fillColor=magentaColor6;
                     }
                   for(var text=0;text<sourceDoc.layers[lay].groupItems[group].groupItems[group1].textFrames.length;text++)
                         {
                          sourceDoc.layers[lay].groupItems[group].groupItems[group1].textFrames[text].hidden=true ;
                     
                     }
                 }
             }
         }
      }
      }
      }                    
                            
         function line_pathitem_inside_CAN()
         {
             for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
             {
             for(var group1=0;group1<sourceDoc.layers[lays1].groupItems.length;group1++)
      {
          if(check(sourceDoc.layers[lays1].groupItems[group1].name))
          {
          for(var path1=0;path1<sourceDoc.layers[lays1].groupItems[group1].pathItems.length;path1++)
          {
      var path_type= type_of_path(sourceDoc.layers[lays1].groupItems[group1].pathItems[path1]);
      if(path_type=="Rectangle Type 2" || path_type=="Rectangle Type 10")
      {
      var x_path=Math.round(sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].visibleBounds[0]);
       var y_path=Math.round(sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].visibleBounds[1]);
       var x_path1=Math.round(sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].visibleBounds[2]);
      var y_path1=Math.round(sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].visibleBounds[3]);
         for(var lays2=0;lays2<sourceDoc.layers.length;lays2++)
         {
      for(var group2=0;group2<sourceDoc.layers[lays2].groupItems.length;group2++)
      {
          if(check1(sourceDoc.layers[lays2].groupItems[group2].name))
          {
          for(var path2=0;path2<sourceDoc.layers[lays2].groupItems[group2].pathItems.length;path2++)
          {
              var path_type1=type_of_path(sourceDoc.layers[lays2].groupItems[group2].pathItems[path2])
              if( path_type1=="Line Type 1" ||  path_type1=="Line Type 2" ||  path_type1=="Line Type 3" ||  path_type1=="Line Type 4" ||  
              path_type1=="Line Type 10")
              {
                  for(var point1=0;point1<(sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].pathPoints.length-1);point1++)
                  {
                      var x_point=Math.round(sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].pathPoints[point1].anchor[0]);
                      var y_point=Math.round(sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].pathPoints[point1].anchor[1]);
                   
                      if(x_point> x_path && x_point<x_path1 && y_point<y_path1)
                      {
                           var x_point1=Math.round(sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].pathPoints[point1+1].anchor[0]);
                      var y_point1=Math.round(sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].pathPoints[point1+1].anchor[1]);
                      if(x_point1> x_path && x_point1<x_path1 &&   y_point1>y_path)
                      {
                             
                          sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].strokeColor=magentaColor10;
                         sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].strokeWidth=5
                          }
                      }
                  else if(x_point> x_path && x_point<x_path1 && y_point>y_path)
                  {
                       var x_point1=Math.round(sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].pathPoints[point1+1].anchor[0]);
                      var y_point1=Math.round(sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].pathPoints[point1+1].anchor[1]);
                      if(x_point1> x_path && x_point1<x_path1 &&   y_point1<y_path1)
                      {
                           
                         sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].strokeColor=magentaColor10;
                          sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].strokeWidth=5
                          }
                      }
                  
                  else if(y_point<y_path && y_point>y_path1 &&  x_point<x_path)
                  {
                       var x_point1=Math.round(sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].pathPoints[point1+1].anchor[0]);
                      var y_point1=Math.round(sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].pathPoints[point1+1].anchor[1]);
                      if(y_point1<y_path && y_point1>y_path1 &&  x_point1>x_path1)
                      {
                            
                          sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].strokeColor=magentaColor10;
                          sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].strokeWidth=5
                          }
                      }
                    else if(y_point<y_path && y_point>y_path1 &&  x_point>x_path1)
                  {
                       var x_point1=Math.round(sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].pathPoints[point1+1].anchor[0]);
                      var y_point1=Math.round(sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].pathPoints[point1+1].anchor[1]);
                      if(y_point1<y_path && y_point1>y_path1 &&  x_point1<x_path)
                      {
                         
                          sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].strokeColor=magentaColor10;
                          sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].strokeWidth=5
                          }
                      }
                    
                  }
              }
          }
      }
      }
      }
      }
      }
      }
      }
      }
      }
       function line_pathitem_inside_normal()
         {
             for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
             {
             for(var group1=0;group1<sourceDoc.layers[lays1].groupItems.length;group1++)
      {
          if(check(sourceDoc.layers[lays1].groupItems[group1].name))
          {
          for(var path1=0;path1<sourceDoc.layers[lays1].groupItems[group1].pathItems.length;path1++)
          {
      var path_type= type_of_path(sourceDoc.layers[lays1].groupItems[group1].pathItems[path1]);
      if(path_type=="Rectangle Type 2" || path_type=="Rectangle Type 10")
      {
      var x_path=Math.round(sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].visibleBounds[0]);
       var y_path=Math.round(sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].visibleBounds[1]);
       var x_path1=Math.round(sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].visibleBounds[2]);
      var y_path1=Math.round(sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].visibleBounds[3]);
         for(var lays2=0;lays2<sourceDoc.layers.length;lays2++)
         {
      for(var group2=0;group2<sourceDoc.layers[lays2].groupItems.length;group2++)
      {
          if(check1(sourceDoc.layers[lays2].groupItems[group2].name))
          {
          for(var path2=0;path2<sourceDoc.layers[lays2].groupItems[group2].pathItems.length;path2++)
          {
              var path_type1=type_of_path(sourceDoc.layers[lays2].groupItems[group2].pathItems[path2])
              if( path_type1=="Line Type 1" ||  path_type1=="Line Type 2" ||  path_type1=="Line Type 3" )
             
              {
                  for(var point1=0;point1<(sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].pathPoints.length-1);point1++)
                  {
                      var x_point=Math.round(sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].pathPoints[point1].anchor[0]);
                      var y_point=Math.round(sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].pathPoints[point1].anchor[1]);
                   
                      if(x_point> x_path && x_point<x_path1 && y_point<y_path1)
                      {
                           var x_point1=Math.round(sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].pathPoints[point1+1].anchor[0]);
                      var y_point1=Math.round(sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].pathPoints[point1+1].anchor[1]);
                      if(x_point1> x_path && x_point1<x_path1 &&   y_point1>y_path)
                      {
                             
                          sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].strokeColor=magentaColor10;
                         sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].strokeWidth=5
                          }
                      }
                  else if(x_point> x_path && x_point<x_path1 && y_point>y_path)
                  {
                       var x_point1=Math.round(sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].pathPoints[point1+1].anchor[0]);
                      var y_point1=Math.round(sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].pathPoints[point1+1].anchor[1]);
                      if(x_point1> x_path && x_point1<x_path1 &&   y_point1<y_path1)
                      {
                           
                         sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].strokeColor=magentaColor10;
                          sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].strokeWidth=5
                          }
                      }
                  
                  else if(y_point<y_path && y_point>y_path1 &&  x_point<x_path)
                  {
                       var x_point1=Math.round(sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].pathPoints[point1+1].anchor[0]);
                      var y_point1=Math.round(sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].pathPoints[point1+1].anchor[1]);
                      if(y_point1<y_path && y_point1>y_path1 &&  x_point1>x_path1)
                      {
                            
                          sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].strokeColor=magentaColor10;
                          sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].strokeWidth=5
                          }
                      }
                    else if(y_point<y_path && y_point>y_path1 &&  x_point>x_path1)
                  {
                       var x_point1=Math.round(sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].pathPoints[point1+1].anchor[0]);
                      var y_point1=Math.round(sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].pathPoints[point1+1].anchor[1]);
                      if(y_point1<y_path && y_point1>y_path1 &&  x_point1<x_path)
                      {
                         
                          sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].strokeColor=magentaColor10;
                          sourceDoc.layers[lays2].groupItems[group2].pathItems[path2].strokeWidth=5
                          }
                      }
                    
                  }
              }
          }
      }
      }
      }
      }
      }
      }
      }
      }
      }
      function check (nme) {  
          if( (/^([A,B,C,D,E,F,H,K,M,N,R,T,Y][0-9]{1,3}:){1,9}$/).test( nme ) == false) {  
              return false; }  
          return true;  
      }  
      
      
      
      
      function check1 (nme) 
      {  
          if( (/^([L][0-9]{1,3}:){1,9}$/).test( nme ) == false) {  
              return false; }  
          return true;  
      }  
      function line_cross()
      {
      for(var lays2=0;lays2<sourceDoc.layers.length;lays2++)
      {
      
          for(var group1=0;group1<sourceDoc.layers[lays2].groupItems.length;group1++)
          {
              if(sourceDoc.layers[lays2].groupItems[group1].name!= "AAA")
              {
                  var reg=/([L][0-9]{1,3})$/  
            
                     if(reg.test(sourceDoc.layers[lays2].groupItems[group1].name.slice(0,sourceDoc.layers[lays2].groupItems[group1].name.length)))
                              {
                                
                  for(var path1=0;path1<sourceDoc.layers[lays2].groupItems[group1].pathItems.length;path1++)
                  {
                      var path_type=type_of_path(sourceDoc.layers[lays2].groupItems[group1].pathItems[path1]);
                      {
                          if(path_type=="Line Type 1" || path_type=="Line Type 2" || path_type=="Line Type 3" || path_type=="Line Type 10" || path_type=="Line Type 12")
                          {
                              
                             var count_liner=check_line_points_end(sourceDoc.layers[lays2].groupItems[group1].pathItems[path1],sourceDoc.layers[lays2].groupItems[group1]);
                             if(count_liner==2)
                             {
                                 }
                             else
                             {
                                 sourceDoc.layers[lays2].groupItems[group1].pathItems[path1].strokeColor=magentaColor6;
                                 }
                              }
                          }
                      }
                  }
              }
          }
      }
      }
      
      
      
      
       function check_line_points_end(Line_item,line_item2)
       {
           var  count_linecheck=0;
            var x_point= Math.round(Line_item.pathPoints[0].anchor[0]);
                                  var y_point=Math.round(Line_item.pathPoints[0].anchor[1]);
                                    var x_point1= Math.round(Line_item.pathPoints[(Line_item.pathPoints.length)-1].anchor[0]);
                                  var y_point1=Math.round(Line_item.pathPoints[(Line_item.pathPoints.length)-1].anchor[1]);
                      for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
                      {
                          for(var group2=0;group2<sourceDoc.layers[lays1].groupItems.length;group2++)
                          {
                              for(var path2=0;path2<sourceDoc.layers[lays1].groupItems[group2].pathItems.length;path2++)
                              {
                                  var path_type1=type_of_path(sourceDoc.layers[lays1].groupItems[group2].pathItems[path2]);
                                  
                                 if(path_type1=="Anchor point" || path_type1=="Circle Type 1"  || path_type1=="Circle Type 2" ||  path_type1=="Circle Type 3" ||  path_type1=="Circle Type 4"
                                     ||  path_type1=="Circle Type 5" ||  path_type1=="Circle Type 6" || path_type1=="Rectangle Type 8"  )
                     {
                         
                         if(path_type1=="Anchor point")
                         {
                                     var x_point1dot= Math.round(sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].pathPoints[0].anchor[0]);
                                  var y_point1dot=Math.round(sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].pathPoints[0].anchor[1]);
                                  var xdiff=Math.abs(Math.abs(x_point)-Math.abs(x_point1dot));
      var ydiff=Math.abs(Math.abs(y_point)-Math.abs(y_point1dot));
      var xdiff1=Math.abs(Math.abs(x_point1)-Math.abs(x_point1dot));
      var ydiff1=Math.abs(Math.abs(y_point1)-Math.abs(y_point1dot));
      if(((xdiff>=0&&xdiff<=1.8)&&(ydiff>=0&&ydiff<=1.8) )|| ((xdiff1>=0&&xdiff1<=1.8)&&(ydiff1>=0&&ydiff1<=1.8) ))
      {
          count_linecheck++;
            if(sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].name.slice(0,3)=="pin" && sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].name.slice(0,4)!="pinx" && (sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].name.substr(4,1)!="*") 
            && (sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].name.substr(4,1)!="@"))
          {
              var rect=rectangle_function_decide(sourceDoc.layers[lays1].groupItems[group2],sourceDoc.layers[lays1].groupItems[group2].pathItems[path2]);
           
              if(rect!=0)
              {
                  
                  if(rect.fillColor.cyan==0 && rect.fillColor.magenta==0 &&  rect.fillColor.yellow==25 && rect.fillColor.black==0)
                  {
                      var text= text_matching(sourceDoc.layers[lays1].groupItems[group2],sourceDoc.layers[lays1].groupItems[group2].pathItems[path2],rect);
              
                       if(text!=0 && text!=1)
           {
               
               var compound=check_compound_path(sourceDoc.layers[lays1].groupItems[group2],sourceDoc.layers[lays1].groupItems[group2].pathItems[path2],rect,text);
                  if(compound==0)
               {
                   var cil_text=check_cil(sourceDoc.layers[lays1].groupItems[group2],sourceDoc.layers[lays1].groupItems[group2].pathItems[path2],rect,text);
                 
                      
                      if(cil_text!=0 )
                      {
                          file_output.writeln(sourceDoc.name+","+line_item2.name+","+"L"+","+cil_text+","+text.contents)
                          }
                      else
                      {
                          sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].strokeColor=magentaColor6;
                          sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].opacity=50;
                          }
                      }
                  else
                  {
                      sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].strokeColor=magentaColor10;
                          sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].opacity=50;
                          }
                      }
                  else if(text==1)
                  {
                      var cil_text=check_cil_ground(sourceDoc.layers[lays1].groupItems[group2],sourceDoc.layers[lays1].groupItems[group2].pathItems[path2],rect,text);
                        if(cil_text!=0 )
                      {
                          file_output.writeln(sourceDoc.name+","+line_item2.name+","+"L"+","+cil_text+","+text)
                          }
                      else
                      {
                          sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].strokeColor=magentaColor6;
                          sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].opacity=50;
                          }
                      }
                 
                  else
                  {
                       sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].strokeColor=magentaColor3;
                          sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].opacity=50;
                          }
                      }
                  else if(rect.fillColor.cyan==0 && rect.fillColor.magenta==25 &&  rect.fillColor.yellow==25 && rect.fillColor.black==0)
                  {
                       var text= text_matching_fuse(sourceDoc.layers[lays1].groupItems[group2],sourceDoc.layers[lays1].groupItems[group2].pathItems[path2],rect);
                          
                          if(text!=0)
                          {
                              if(text.contents.match(/^[A-Z]*$/))
                              {
                                  var cil_text="FL-"+text.contents;
                                   file_output.writeln(sourceDoc.name+","+line_item2.name+","+"L"+","+cil_text+","+text.contents)
                                   }
                               else if(text.contents.match(/^\d{1,4}$/))
                               {
                                    var cil_text="FUSE"+text.contents;
                                   file_output.writeln(sourceDoc.name+","+line_item2.name+","+"L"+","+cil_text+","+text.contents)
                                   }
                               else
                               {
                                    sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].strokeColor=magentaColor3;
                          sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].opacity=50;
                          }
                      }
                  }
              }
              else
              {
                    sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].strokeColor=magentaColor4;
                          sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].opacity=50;
                          }
                      }
                  else if(sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].name.slice(0,3)=="pin" && sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].name.slice(0,4)!="pinx" && (sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].name.substr(4,1)=="*") 
            && (sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].name.substr(4,1)!="@"))
            {
                  var rect=rectangle_function_decide(sourceDoc.layers[lays1].groupItems[group2],sourceDoc.layers[lays1].groupItems[group2].pathItems[path2]);
              if(rect!=0 )
              {
                   var text= text_matching_star(sourceDoc.layers[lays1].groupItems[group2],sourceDoc.layers[lays1].groupItems[group2].pathItems[path2],rect);
                      if(text!=0)
           {
               var compound=check_compound_path(sourceDoc.layers[lays1].groupItems[group2],sourceDoc.layers[lays1].groupItems[group2].pathItems[path2],rect,text);
                   if(compound==1)
               {
                   var  cil_text=[];
                   var cil_text=check_cil_star(sourceDoc.layers[lays1].groupItems[group2],sourceDoc.layers[lays1].groupItems[group2].pathItems[path2],rect,text);
                
                     if(cil_text!=0 )
                      {
                          var connector_number_text=[];
                   var connector_number_text=check_connect_csv(sourceDoc.layers[lays1].groupItems[group2],sourceDoc.layers[lays1].groupItems[group2].pathItems[path2],rect,text,cil_text[0],cil_text[1]);
                 if(connector_number_text!=0)
                 {
               
                     file_output.writeln(sourceDoc.name+","+line_item2.name+","+"L"+","+connector_number_text[0]+","+cil_text[0])
                          file_output.writeln(sourceDoc.name+","+line_item2.name+","+"L"+","+connector_number_text[1]+","+cil_text[1])
                         
                         
                          }
                      else
                      {
                          sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].strokeColor=magentaColor6;
                          sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].opacity=50;
                          }
                      }
                  else
                  {
                      sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].strokeColor=magentaColor6;
                          sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].opacity=50;
                          }
                      }
                  else
                  {
                      sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].strokeColor=magentaColor10;
                          sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].opacity=50;
                          }
                      }
                  else
                  {
                       sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].strokeColor=magentaColor3;
                          sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].opacity=50;
                          }
                      }
                              
                else
              {
                    sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].strokeColor=magentaColor4;
                          sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].opacity=50;
                          }
                      }
                  
              else if(sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].name.slice(0,4)=="FUSE" || sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].name.slice(0,2)=="FL")
              {
                  var rect=rectangle_function_decide(sourceDoc.layers[lays1].groupItems[group2],sourceDoc.layers[lays1].groupItems[group2].pathItems[path2]);
              if(rect!=0 )
              {
                  var text=rectangle_function_decide_fuse(sourceDoc.layers[lays1].groupItems[group2],sourceDoc.layers[lays1].groupItems[group2].pathItems[path2],rect);
              
              if(text!=0  )
              {
                    if(text.contents.match(/^[A-Z]*$/))
                              {
                   var cil_text="FL-"+text.contents;
                                   file_output.writeln(sourceDoc.name+","+line_item2.name+","+"L"+","+cil_text+","+text.contents)
                                   }
                               
                               else if(text.contents.match(/^\d{1,4}$/))
                               {
                                    var cil_text="FUSE"+text.contents;
                                   file_output.writeln(sourceDoc.name+","+line_item2.name+","+"L"+","+cil_text+","+text.contents)
                                   }}
                               else
                               {
                                    sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].strokeColor=magentaColor3;
                          sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].opacity=50;
                          }
                      }
                  else
                  {
                       sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].strokeColor=magentaColor4;
                          sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].opacity=50;
                          }
                      }
                  else if(sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].name=="pinx")
                  {
                        file_output.writeln(sourceDoc.name+","+line_item2.name+","+"L"+","+"-"+","+"-")
                        }
                    else if(sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].name.substr(4,1)=="@")
                    {
                        
                  file_output.writeln(sourceDoc.name+","+line_item2.name+","+"L"+","+"-"+","+"-")
                        }
                    }
                }
             if(path_type1=="Circle Type 1"  || path_type1=="Circle Type 2" ||  path_type1=="Circle Type 3" ||  path_type1=="Circle Type 4"
                                     ||  path_type1=="Circle Type 5" ||  path_type1=="Circle Type 6")
                                     {
                                       var x_pathtype2=Math.round(sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].visibleBounds[0]);
                                       var x_pathtype=Math.round(sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].visibleBounds[2]);
                                       var y_pathtype1=Math.round(sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].visibleBounds[3]);
                                       var y_pathtype3=Math.round(sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].visibleBounds[1]);
                                       
          
                
                if(((x_point>= x_pathtype2)&&(x_point<= x_pathtype) &&(y_point<=y_pathtype3) && (y_point>=y_pathtype1)) ||
      ((x_point1>= x_pathtype2)&&(x_point1<= x_pathtype) &&(y_point1<=y_pathtype3) && (y_point1>=y_pathtype1)))
      {
          count_linecheck++;
          }
                }
            
            if(path_type1=="Rectangle Type 8")
        {
            var arrow_x=Math.round(sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].pathPoints[0].anchor[0]);
            var arrow_y=Math.round(sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].pathPoints[0].anchor[1]);
             var arrow_x1=Math.round(sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].pathPoints[1].anchor[0]);
            var arrow_y1=Math.round(sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].pathPoints[1].anchor[1]);
             var arrow_x2=Math.round(sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].pathPoints[2].anchor[0]);
            var arrow_y2=Math.round(sourceDoc.layers[lays1].groupItems[group2].pathItems[path2].pathPoints[2].anchor[1]);
          if(arrow_x==arrow_x1)
          {
              if(arrow_y>arrow_y1)
              {
                  if(((x_point>=arrow_x)&&(x_point<=arrow_x2 || x_point>=arrow_x2)&&(y_point>=arrow_y1) &&(y_point<=arrow_y)) || 
        ((x_point1>=arrow_x)&&(x_point1<=arrow_x2 || x_point1>=arrow_x2)&&(y_point1>=arrow_y1) &&(y_point1<=arrow_y)))
        {
            count_linecheck++;
            }
        }
        else if(arrow_y<arrow_y1)
        {
           
             if(((x_point<=arrow_x2 ||x_point>=arrow_x2 )&&(y_point>=arrow_y) &&(y_point<=arrow_y1)) || 
        ((x_point1<=arrow_x2 ||x_point1>=arrow_x2 )&&(y_point1>=arrow_y) &&(y_point1<=arrow_y1)))
        {
            count_linecheck++;
            }
        }
      }
      else
      {
          if(arrow_y==arrow_y1)
          {
             if(((x_point>=arrow_x1)&&(x_point<=arrow_x)&&(y_point>=arrow_y2) &&(y_point<=arrow_y1)) || 
        ((x_point1>=arrow_x1)&&(x_point1<=arrow_x)&&(y_point1>=arrow_y2) &&(y_point1<=arrow_y1)))
        {  
           count_linecheck++;
           }
       }
      }
      }
      }
      }
      }
      
      
      }
      return count_linecheck;
      }
      
      
      
      
      
      
      
      
              
              
              
              
              
              
              
              
              
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      function rectangle_function_decide(main_group_path,pindot)
      {
          var main_grp_path_flag=0;
      var sub_grp_path_flag=0;
      var wire_to_wire_rect=[];
      var wire_to_wire_rect_fuse=[];
      
      
          for(var path1=0;path1<main_group_path.pathItems.length;path1++)
          {
             
              var path_type= type_of_path(main_group_path.pathItems[path1]);
              if( path_type=="Rectangle Type 2" || path_type=="Rectangle Type 10")
              {
                  var x_path=Math.round(main_group_path.pathItems[path1].visibleBounds[0]);
       var y_path=Math.round(main_group_path.pathItems[path1].visibleBounds[1]);
       var x_path1=Math.round(main_group_path.pathItems[path1].visibleBounds[2]);
      var y_path1=Math.round(main_group_path.pathItems[path1].visibleBounds[3]);
      var x_point=Math.round(pindot.pathPoints[0].anchor[0]);
      var y_point=Math.round(pindot.pathPoints[0].anchor[1]);
      if(x_point>=x_path && x_point<=x_path1 && y_point<=y_path && y_point>=y_path1)
      {
          
      main_grp_path_flag=1;
      wire_to_wire_rect.push(main_group_path.pathItems[path1]);
      }
      }
      else if( path_type=="Rectangle Type 3")
      {
            var x_path=Math.round(main_group_path.pathItems[path1].visibleBounds[0]);
       var y_path=Math.round(main_group_path.pathItems[path1].visibleBounds[1]);
       var x_path1=Math.round(main_group_path.pathItems[path1].visibleBounds[2]);
      var y_path1=Math.round(main_group_path.pathItems[path1].visibleBounds[3]);
      var x_point=Math.round(pindot.pathPoints[0].anchor[0]);
      var y_point=Math.round(pindot.pathPoints[0].anchor[1]);
      if(x_point>=x_path && x_point<=x_path1 && y_point<=y_path && y_point>=y_path1)
      {
          
      main_grp_path_flag=1;
      wire_to_wire_rect_fuse.push(main_group_path.pathItems[path1]);
      }
      }
      }
      for(var group1=0;group1<main_group_path.groupItems.length;group1++)
      {
            for(var path1=0;path1<main_group_path.groupItems[group1].pathItems.length;path1++)
          {
             
              var path_type= type_of_path(main_group_path.groupItems[group1].pathItems[path1]);
              if( path_type=="Rectangle Type 2" || path_type=="Rectangle Type 10")
              {
                  var x_path=Math.round(main_group_path.groupItems[group1].pathItems[path1].visibleBounds[0]);
       var y_path=Math.round(main_group_path.groupItems[group1].pathItems[path1].visibleBounds[1]);
       var x_path1=Math.round(main_group_path.groupItems[group1].pathItems[path1].visibleBounds[2]);
      var y_path1=Math.round(main_group_path.groupItems[group1].pathItems[path1].visibleBounds[3]);
      var x_point=Math.round(pindot.pathPoints[0].anchor[0]);
      var y_point=Math.round(pindot.pathPoints[0].anchor[1]);
      if(x_point>=x_path && x_point<=x_path1 && y_point<=y_path && y_point>=y_path1)
      {
          
       sub_grp_path_flag=1;
      
      
       wire_to_wire_rect.push(main_group_path.groupItems[group1].pathItems[path1]);
      }
      }
      else if(path_type=="Rectangle Type 3")
      {
        var x_path=Math.round(main_group_path.groupItems[group1].pathItems[path1].visibleBounds[0]);
       var y_path=Math.round(main_group_path.groupItems[group1].pathItems[path1].visibleBounds[1]);
       var x_path1=Math.round(main_group_path.groupItems[group1].pathItems[path1].visibleBounds[2]);
      var y_path1=Math.round(main_group_path.groupItems[group1].pathItems[path1].visibleBounds[3]);
      var x_point=Math.round(pindot.pathPoints[0].anchor[0]);
      var y_point=Math.round(pindot.pathPoints[0].anchor[1]);
      if(x_point>=x_path && x_point<=x_path1 && y_point<=y_path && y_point>=y_path1)
      {
          
       sub_grp_path_flag=1;
      
      wire_to_wire_rect_fuse.push(main_group_path.groupItems[group1].pathItems[path1]);
      }
      }   
      }
      }
      
      
      
      
      if((main_grp_path_flag==1 || sub_grp_path_flag==1) && wire_to_wire_rect.length==1)
      {
        return wire_to_wire_rect[0];
          }
      else if((main_grp_path_flag==1 || sub_grp_path_flag==1) && wire_to_wire_rect_fuse.length==1)
      {
          return  wire_to_wire_rect_fuse[0];
          }
      else
      {
          return 0;
          }
      }
      
      
       function text_matching(main_group_path,pindot,rect)
      
      
      {
          var wire_to_wire_text=[];
          var count_text_found=0;
          var count_path=0;
          for(var text=0;text<main_group_path.textFrames.length;text++)
          {
              
              if(main_group_path.textFrames[text].contents.match(/^\d{1,3}[A-Z]$/) || main_group_path.textFrames[text].contents.match(/^\d{1,4}$/))
             
              {
               
                  if(main_group_path.textFrames[text].contents==(pindot.name.slice(4,pindot.name.length)))
                  {
                  
                    var x_text=Math.round(main_group_path.textFrames[text].anchor[0]);
                    var y_text=Math.round(main_group_path.textFrames[text].anchor[1]);
                     var x_pindot=Math.round(pindot.pathPoints[0].anchor[0]);
                     var y_pindot=Math.round(pindot.pathPoints[0].anchor[1]);
                     var x_diff=Math.abs(x_text- x_pindot);
                     var y_diff=Math.abs(y_text-y_pindot);
                     if((x_diff>=0 && x_diff<=14) && (y_diff>=0 && y_diff<=12))
                     {
                         count_text_found=1;
                         wire_to_wire_text.push(main_group_path.textFrames[text]);
                      
                      
                      }
                  }
              }
          }
      
      
      for(var path=0;path<main_group_path.pathItems.length;path++)
      {
        
          var path_type=type_of_path(main_group_path.pathItems[path]);
          if(path_type=="Anchor point")
          {
              count_path++;
              }
          }
      
      
      if(count_path==1 && main_group_path.textFrames.length==0)
      {
          return 1;
          }
          else if(count_text_found==1 && wire_to_wire_text.length==1)
          {
              return wire_to_wire_text[0];
              }
          else
          {
              return 0;
              }
          }                           
          
          
          function text_matching_star(main_group_path,pindot,rect)
      
      
      {
          var wire_to_wire_text=[];
          var count_text_found=0;
          for(var text=0;text<main_group_path.textFrames.length;text++)
          {
              if(main_group_path.textFrames[text].contents.match(/^\d{1,3}[A-Z]$/) || main_group_path.textFrames[text].contents.match(/^\d{1,4}$/))
             
              {
                  if(main_group_path.textFrames[text].contents==(pindot.name.slice(5,pindot.name.length)))
                  {
                  
                    var x_text=Math.round(main_group_path.textFrames[text].anchor[0]);
                    var y_text=Math.round(main_group_path.textFrames[text].anchor[1]);
                     var x_pindot=Math.round(pindot.pathPoints[0].anchor[0]);
                     var y_pindot=Math.round(pindot.pathPoints[0].anchor[1]);
                     var x_diff=Math.abs(x_text- x_pindot);
                     var y_diff=Math.abs(y_text-y_pindot);
                     if((x_diff>=0 && x_diff<=14) && (y_diff>=0 && y_diff<=12))
                     {
                         count_text_found=1;
                         wire_to_wire_text.push(main_group_path.textFrames[text]);
                      
                      
                      }
                  }
              }
          }
      for(var path=0;path<main_group_path.pathItems.length;path++)
      {
          var count_path=0;
          var path_type=type_of_path(main_group_path.pathItems[path]);
          if(path_type=="Anchor point")
          {
              count_path++;
              }
          }
      if(count_path==1 && main_group_path.textFrames.length==0)
      {
          return 1;
          }
          if(count_text_found==1 && wire_to_wire_text.length==1)
          {
              return wire_to_wire_text[0];
              }
          else
          {
              return 0;
              }
          }  
      function check_compound_path(main_group_path,pindot,rect,text_item)
      {
          var compound_path_present=0;
          for(var compound=0;compound<main_group_path.pageItems.length;compound++)
          {
              if(main_group_path.pageItems[compound].typename=="CompoundPathItem")
              {
                    var x_path= Math.abs(Math.round(main_group_path.pageItems[compound].position[0]));  
                  var y_path=Math.abs(Math.round(main_group_path.pageItems[compound].position[1]));  
                    var x_text=Math.abs(Math.round(text_item.anchor[0]));
                      var y_text=Math.abs(Math.round(text_item.anchor[1]));
                        if( (x_text-x_path)>0 && (x_text-x_path)<15)
                        {
                             if((Math.abs(y_text-y_path)>0 && Math.abs(y_text-y_path)<6))
                        {
                            compound_path_present=1;
                            }
                        }
                    }
                }
                for(var group=0;group<main_group_path.groupItems.length;group++)
                {
                    for(var compound=0;compound<main_group_path.groupItems[group].pageItems.length;compound++)
                    {
                        if(main_group_path.groupItems[group].pageItems[compound].typename=="CompoundPathItem")
                        {
                            var x_path= Math.abs(Math.round(main_group_path.groupItems[group].pageItems[compound].position[0]));  
                  var y_path=Math.abs(Math.round(main_group_path.groupItems[group].pageItems[compound].position[1]));  
                    var x_text=Math.abs(Math.round(text_item.anchor[0]));
                      var y_text=Math.abs(Math.round(text_item.anchor[1]));
                        if( (x_text-x_path)>0 && (x_text-x_path)<15)
                        {
                             if((Math.abs(y_text-y_path)>0 && Math.abs(y_text-y_path)<6))
                        {
                            compound_path_present=1;
                            }
                        }
                    }
                }
            }
            if(compound_path_present==1)
            {
                return 1;
                }
            else
            {
                return 0;
                }
            }
        
        
        function check_cil_ground(main_group_path,pindot,rect,text_item)
      {
          var s=[];
          
          var array = main_group_path.name.split(":");
         
          if(array==null)
          {
              return 0;
              }
          else
          {
              main_loop1:
              for(var jj=0;jj<array.length;jj++)
              {
                   for(csv_iter = 0;csv_iter < fileArray_SM_name.length; csv_iter++)
          {
              if(array[jj] == fileArray_SM_name[csv_iter][0])
              {
                  if(text_item==fileArray_SM_name[csv_iter][2])
                  {
                      var terminal_found=1;
                      s.push(fileArray_SM_name[csv_iter][0]);
                      break  main_loop1;
                      }
                  }
              }
          }
      }
      
      
      if(terminal_found==1 && s.length==1)
      {
          
          return s[0];
          }
      else
      {
          return 0;
          }
      }
      
      
        function check_cil(main_group_path,pindot,rect,text_item)
      {
          var s=[];
          var array = main_group_path.name.split(":");
          if(array==null)
          {
              return 0;
              }
          
          else
          {
              main_loop1:
              for(var jj=0;jj<array.length;jj++)
              {
                   for(csv_iter = 0;csv_iter < fileArray_SM_name.length; csv_iter++)
          {
              if(array[jj] == fileArray_SM_name[csv_iter][0])
              {
                  if(fileArray_SM_name[csv_iter][1]=="WIRE TO WIRE")
                  {
                     
                        if(text_item.contents==fileArray_SM_name[csv_iter][2])
                             {
                                 
                      if(array.length==3)
                      {
                      var x_rect=Math.round(rect.visibleBounds[0]);
                      var y_rect=Math.round(rect.visibleBounds[1]);
                      var x_rect1=Math.round(rect.visibleBounds[2]);
                      var y_rect1=Math.round(rect.visibleBounds[3]);
                      var x_dot=Math.round(pindot.pathPoints[0].anchor[0]);
                      var y_dot=Math.round(pindot.pathPoints[0].anchor[1]);
                      var y_diff=Math.abs(y_dot-y_rect);
                       var y_diff1=Math.abs(y_dot-y_rect1);
                      var x_diff=Math.abs(x_dot-x_rect);
                      var x_diff1=Math.abs(x_dot-x_rect1);
                      var arr_x=Math.round(array[0].anchor[0]);
                      var arr_y=Math.round(array[0].anchor[1]);
                      var arr1_x=Math.round(array[1].anchor[0]);
                      var arr1_y=Math.round(array[1].anchor[1]);
                     
                      if(x_dot>=x_rect && x_dot<=x_rect1 && y_diff>=0 && y_diff<=2)
                      {
                           
                                 if(arr_y>arr1_y)
                                 {
                                  var terminal_found=1;
                      s.push(array[0]);
                      break  main_loop1;
                      }
                  else
                  {
                         var terminal_found=1;
                      s.push(array[1]);
                      break  main_loop1;
                      }
                  }
          
              else if(x_dot>=x_rect && x_dot<=x_rect1 && y_diff1>=0 && y_diff1<=2)
              {
                    if(arr_y<arr1_y)
                                 {
                                  var terminal_found=1;
                      s.push(array[1]);
                      break  main_loop1;
                      }
                  else
                  {
                         var terminal_found=1;
                      s.push(array[0]);
                      break  main_loop1;
                      }
                  }
              else if(y_dot>=y_rect1 && y_dot<=y_rect && x_diff1>=0 && x_diff1<=2)
              {
                  if(arr_x>arr1_x)
                  {
                              var terminal_found=1;
                      s.push(array[0]);
                      break  main_loop1;
                      }
                else
                {
                    var terminal_found=1;
                      s.push(array[1]);
                      break  main_loop1;
                      } 
                  }
              
               else if(y_dot>=y_rect1 && y_dot<=y_rect && x_diff>=0 && x_diff<=2)
              {
                  if(arr_x<arr1_x)
                  {
                              var terminal_found=1;
                      s.push(array[1]);
                      break  main_loop1;
                      }
                else
                {
                    var terminal_found=1;
                      s.push(array[0]);
                      break  main_loop1;
                      } 
                  }
              }
          else
          {
                break  main_loop1;
                }
            }
        }
              
              
              
              else
              {
                
                  if(text_item.contents==fileArray_SM_name[csv_iter][2])
                  {
                      var terminal_found=1;
                      s.push(fileArray_SM_name[csv_iter][0]);
                      break  main_loop1;
                      }
                  }
              }
          }
      }
      }
      
      
      if(terminal_found==1 && s.length==1)
      {
          return s[0];
          }
      else
      {
          return 0;
          }
      }
         function text_matching_fuse(main_group_path,pindot,rect)
      
      
      {
          var wire_to_wire_text=[];
          var count_text_found=0;
          for(var text=0;text<main_group_path.textFrames.length;text++)
          {
              if(main_group_path.textFrames[text].contents.match(/^[A-Z]*$/)  || main_group_path.textFrames[text].contents.match(/^\d{1,4}$/))
             
              {
                  if(main_group_path.textFrames[text].contents==(pindot.name.slice(4,pindot.name.length)))
                  {
                  
                  
                         count_text_found=1;
                         wire_to_wire_text.push(main_group_path.textFrames[text]);
                      
                      
                      }
                  }
              
              }
          
          if(count_text_found==1 && wire_to_wire_text.length==1)
          {
              return wire_to_wire_text[0];
              }
          else
          {
              return 0;
              }
          }                  
                 
      function rectangle_function_decide_fuse(main_group_path,pindot,rect)
      {
           var x_path=Math.round(rect.visibleBounds[0]);
                 var y_path=Math.round(rect.visibleBounds[1]);
                 var x_path1=Math.round(rect.visibleBounds[2]);
                 var y_path1=Math.round(rect.visibleBounds[3]);
                 var x_dot=Math.round(pindot.pathPoints[0].anchor[0]);
                 var y_dot=Math.round(pindot.pathPoints[0].anchor[1]);
          for(var group1=0;group1<main_group_path.groupItems.length;group1++)
          {
              for(var path1=0;path1<main_group_path.groupItems[group1].pathItems.length;path1++)
              {
                  var path_type=type_of_path(main_group_path.groupItems[group1].pathItems[path1]);
                  if(path_type=="Line Type 5" || path_type=="Line Type 6")
                  {
                          var x_line=Math.round(main_group_path.groupItems[group1].pathItems[path1].pathPoints[0].anchor[0]);
                             var y_line=Math.round(main_group_path.groupItems[group1].pathItems[path1].pathPoints[0].anchor[1]);
                             var x_line1=Math.round(main_group_path.groupItems[group1].pathItems[path1].pathPoints[(main_group_path.groupItems[group1].pathItems[path1].pathPoints.length)-1].anchor[0]);
                             var y_line1=Math.round(main_group_path.groupItems[group1].pathItems[path1].pathPoints[(main_group_path.groupItems[group1].pathItems[path1].pathPoints.length)-1].anchor[1]);
                             var x_diff_dot=Math.abs(x_dot-x_line);
                             var y_diff_dot=Math.abs(y_dot-y_line);
                               var x_diff_dot1=Math.abs(x_dot-x_line1);
                             var y_diff_dot1=Math.abs(y_dot-y_line1);
                             
                             if(x_line>= x_path && x_line<=x_path1 && y_line>=y_path1 && y_line<=y_path)
                             {
                                 if((( x_diff_dot>=0 &&  x_diff_dot<=3) && (y_diff_dot>=0 && y_diff_dot<=3)))
                                 {
                                     x_line2=Math.round(main_group_path.groupItems[group1].pathItems[path1].pathPoints[(main_group_path.groupItems[group1].pathItems[path1].pathPoints.length)-1].anchor[0]);
                                     y_line2=Math.round(main_group_path.groupItems[group1].pathItems[path1].pathPoints[(main_group_path.groupItems[group1].pathItems[path1].pathPoints.length)-1].anchor[1]);
                                     for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
                                     {
                                         for(var group2=0;group2<sourceDoc.layers[lays1].groupItems.length;group2++)
                                         {
                                             if(sourceDoc.layers[lays1].groupItems[group2].name.slice(0,4)=="FUSE" || sourceDoc.layers[lays1].groupItems[group2].name.slice(0,2)=="FL")
                                             {
                                             for(var path4=0;path4<sourceDoc.layers[lays1].groupItems[group2].pathItems.length;path4++)
                                             {
                                                 var path_type3=type_of_path(sourceDoc.layers[lays1].groupItems[group2].pathItems[path4]);
                                                 if(path_type3=="Rectangle Type 3")
                                                 {
                                                     var x_fuse_point=Math.round(sourceDoc.layers[lays1].groupItems[group2].pathItems[path4].visibleBounds[0]);
                              var y_fuse_point=Math.round(sourceDoc.layers[lays1].groupItems[group2].pathItems[path4].visibleBounds[1]);
                                var x_fuse_point1=Math.round(sourceDoc.layers[lays1].groupItems[group2].pathItems[path4].visibleBounds[2]);
                              var y_fuse_point1=Math.round(sourceDoc.layers[lays1].groupItems[group2].pathItems[path4].visibleBounds[3]);
                               var diff_fuse_y1=Math.abs(Math.abs(y_fuse_point)- Math.abs( y_line2))
                              var diff_fuse_y2=Math.abs(Math.abs(y_fuse_point1)- Math.abs( y_line2))
                              if(x_fuse_point>x_path && x_fuse_point<x_path1 && y_fuse_point>y_path1 &&  y_fuse_point<y_path)
                              {
                                   if(((x_fuse_point< x_line2) && (x_fuse_point1>x_line2)) && (diff_fuse_y2>=0 && diff_fuse_y2<=2))
                                   {
                                       for(var text=0;text<sourceDoc.layers[lays1].groupItems[group2].textFrames.length;text++)
                                       {
                                           if(sourceDoc.layers[lays1].groupItems[group2].textFrames[text].contents.match(/^[A-Z]*$/))
                                           {
                                               if(pindot.name==("FL"+sourceDoc.layers[lays1].groupItems[group2].textFrames[text].contents))
                                               {
                                                   return sourceDoc.layers[lays1].groupItems[group2].textFrames[text];
                                                   }
                                               }
                                           else if(sourceDoc.layers[lays1].groupItems[group2].textFrames[text].contents.match(/^\d{1,4}$/))
                                           {
                                                 if(pindot.name==("FUSE"+sourceDoc.layers[lays1].groupItems[group2].textFrames[text].contents))
                                               {
                                                   return sourceDoc.layers[lays1].groupItems[group2].textFrames[text] ;
                                                   }
                                               }
                                           }
                                       }
                                   }
                               }
                           }
                       }
                   }
               }
           }
               else if((( x_diff_dot1>=0 &&  x_diff_dot1<=3) && (y_diff_dot1>=0 && y_diff_dot1<=3)))
               {
                   x_line2=Math.round(main_group_path.groupItems[group1].pathItems[path1].pathPoints[0].anchor[0]);
                                     y_line2=Math.round(main_group_path.groupItems[group1].pathItems[path1].pathPoints[0].anchor[1]);
                                     for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
                                     {
                                         for(var group2=0;group2<sourceDoc.layers[lays1].groupItems.length;group2++)
                                         {
                                             if(sourceDoc.layers[lays1].groupItems[group2].name.slice(0,4)=="FUSE" || sourceDoc.layers[lays1].groupItems[group2].name.slice(0,2)=="FL")
                                             {
                                             for(var path4=0;path4<sourceDoc.layers[lays1].groupItems[group2].pathItems.length;path4++)
                                             {
                                                 var path_type3=type_of_path(sourceDoc.layers[lays1].groupItems[group2].pathItems[path4]);
                                                 if(path_type3=="Rectangle Type 3")
                                                 {
                                                     var x_fuse_point=Math.round(sourceDoc.layers[lays1].groupItems[group2].pathItems[path4].visibleBounds[0]);
                              var y_fuse_point=Math.round(sourceDoc.layers[lays1].groupItems[group2].pathItems[path4].visibleBounds[1]);
                                var x_fuse_point1=Math.round(sourceDoc.layers[lays1].groupItems[group2].pathItems[path4].visibleBounds[2]);
                              var y_fuse_point1=Math.round(sourceDoc.layers[lays1].groupItems[group2].pathItems[path4].visibleBounds[3]);
                               var diff_fuse_y1=Math.abs(Math.abs(y_fuse_point)- Math.abs( y_line2))
                              var diff_fuse_y2=Math.abs(Math.abs(y_fuse_point1)- Math.abs( y_line2))
                              if(x_fuse_point>x_path && x_fuse_point<x_path1 && y_fuse_point>y_path1 &&  y_fuse_point<y_path)
                              {
                                   if(((x_fuse_point< x_line2) && (x_fuse_point1>x_line2)) && (diff_fuse_y2>=0 && diff_fuse_y2<=2))
                                   {
                                       for(var text=0;text<sourceDoc.layers[lays1].groupItems[group2].textFrames.length;text++)
                                       {
                                           if(sourceDoc.layers[lays1].groupItems[group2].textFrames[text].contents.match(/^\d{1,4}$/))
                                           {
                                               if(pindot.name==("FUSE"+sourceDoc.layers[lays1].groupItems[group2].textFrames[text].contents))
                                               {
                                                   return sourceDoc.layers[lays1].groupItems[group2].textFrames[text];
                                                   }
                                               }
                                            else if(sourceDoc.layers[lays1].groupItems[group2].textFrames[text].contents.match(/^[A-Z]*$/))
                                           {
                                               if(pindot.name==("FL"+sourceDoc.layers[lays1].groupItems[group2].textFrames[text].contents))
                                               {
                                                   return sourceDoc.layers[lays1].groupItems[group2].textFrames[text];
                                                   }
                                               }
                                           }
                                       }
                                   }
                               }
                           }
                       }
                   }
               }
           } 
       else
       {
           return 0;
           }
       }
      }
      }
      }
      }
      
      
      
      
      
      
      function check_cil_star(main_group,pindot,rect1,text1)
      {
          for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
          {
             var arr1=[];
                  mainloop4:
                  for(var group1=0;group1<sourceDoc.layers[lays1].groupItems.length;group1++)
                  {
                      
                      if(sourceDoc.layers[lays1].groupItems[group1].name=="Variant Terminal")
                      {
                          for(var group2=0;group2<sourceDoc.layers[lays1].groupItems[group1].groupItems.length;group2++)
                          {
                              if(sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].name=="Star Terminal")
                              {
                                  
                                for(var text2=0;text2<sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].textFrames.length;text2++)
                                {
                                    if(text1.contents==sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].textFrames[text2].contents)
                                    {
                                        for(var text3=0;text3<sourceDoc.layers[lays1].groupItems[group1].textFrames.length;text3++)
                                        {
                                            if(sourceDoc.layers[lays1].groupItems[group1].textFrames[text3].contents.match(/^\d{1,3}[A-Z]$/) || sourceDoc.layers[lays1].groupItems[group1].textFrames[text3].contents.match(/^\d{1,4}$/))
                                            {
                                                arr1.push(sourceDoc.layers[lays1].groupItems[group1].textFrames[text3].contents);
                                        }
                                    else
                                    {
                                        }
                                    }}
                                    
                                    else
                                    {
                                        continue mainloop4;
                                      }
                                  }
                              }
                          }
                      }
                  }}
      
      
          if(arr1.length==2)
          {
             
              return arr1;
              }
              
          else
          {
              return 0;
              }
          }
      
      
        function check_connect_csv(main_group_path,pindot,rect1,text1,ter1,ter2)
        {
          var s=[];
      
          var array = main_group_path.name.split(":");
         
          if(array==null)
          {
              return 0;
              }
          else
          {
              main_loop1:
              for(var jj=0;jj<array.length;jj++)
              {
                   for(csv_iter = 0;csv_iter < fileArray_SM_name.length; csv_iter++)
          {
              if(array[jj] == fileArray_SM_name[csv_iter][0])
              {
                  if(ter1==fileArray_SM_name[csv_iter][2])
                  {
                      var terminal_found=1;
                      s.push(fileArray_SM_name[csv_iter][0]);
                      break  main_loop1;  
                      }
                  }
              }
          }
      }
      
      
      
      
      
      
      var array1=main_group_path.name.split(":");
       if(array1==null)
          {
              return 0;
              }
          else
          {
              main_loop2:
              for(var jj=0;jj<array1.length;jj++)
              {
                   for(csv_iter = 0;csv_iter < fileArray_SM_name.length; csv_iter++)
          {
              if(array1[jj] == fileArray_SM_name[csv_iter][0])
              {
                  if(ter2==fileArray_SM_name[csv_iter][2])
                  {
                      var terminal_found1=1;
                      s.push(fileArray_SM_name[csv_iter][0]);
                      break  main_loop2;  
                      }
                  }
              }
          }
      }
      
      
      
      
      if(terminal_found1==1 && terminal_found==1  && s.length==2)
      {
         return s;
             
          }
      else
      {
          return 0;
          }
      }
                                     
                                 
                          
                          
      
      
      function find_rectangle_path_with_large_area(main_group)
      {
          var alll_path_array=[];
          var max_area_path=0;
          var max_path_item;
          for(big_path_index=0;big_path_index<main_group.pathItems.length;big_path_index++)
          {
              max_area_path=Math.abs(main_group.pathItems[0].area);
              max_path_item=main_group.pathItems[0];
            if(Math.abs(main_group.pathItems[big_path_index].area)>max_area_path)
            {
              max_path_item=main_group.pathItems[big_path_index];
                max_area_path=Math.abs(main_group.pathItems[big_path_index].area);
                }  
              
          }
          
          for(sub_group_big_group_index=0;sub_group_big_group_index<main_group.groupItems.length;sub_group_big_group_index++)
          {
              
              for(sub_group_path_item=0;sub_group_path_item<main_group.groupItems[sub_group_big_group_index].pathItems.length;sub_group_path_item++)
              {
              
          //    alll_path_array.push(main_group.groupItems[sub_group_big_group_index].pathItems)
           if(Math.abs(main_group.groupItems[sub_group_big_group_index].pathItems[sub_group_path_item].area)>max_area_path)
              {
                  max_path_item=main_group.groupItems[sub_group_big_group_index].pathItems[sub_group_path_item];
                max_area_path=Math.abs(main_group.groupItems[sub_group_big_group_index].pathItems[sub_group_path_item].area);
                  
                  }
              
              }
          
          
          
          }
          
          return max_path_item;
          
          }
      
      
      
      
      
      
      function group_connector_name()
      {
           for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
      {
          for(var group1=0;group1<sourceDoc.layers[lays1].groupItems.length;group1++)
          {
              if(sourceDoc.layers[lays1].groupItems[group1].name!="AAA")
              {
              var arr=[];
              for(var group2=sourceDoc.layers[lays1].groupItems[group1].groupItems.length-1;group2>=0;group2--)
              {
                 
                  for(var text=0;text<sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].textFrames.length;text++)
                  {
                      if(!sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].textFrames[text].contents.match(/[A,B,C,D,E,F,H,L,M,N,P,R,T][0-9]{1,3}$/)) continue; 
                      {
                          arr.push(sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].textFrames[text].contents)
                          }
                      }
                  }
              
              for(var text1=sourceDoc.layers[lays1].groupItems[group1].textFrames.length-1;text1>=0;text1--)
              {
                  if(!sourceDoc.layers[lays1].groupItems[group1].textFrames[text1].contents.match(/[A,B,C,D,E,F,H,L,M,N,P,R,T][0-9]{1,3}$/)) continue; 
                  {
                      arr.push(sourceDoc.layers[lays1].groupItems[group1].textFrames[text1].contents)
                      }
                  }
              if(arr.length==1)
              {
                  sourceDoc.layers[lays1].groupItems[group1].name=arr[0]+":"
                  }
             
               else if(arr.length>1)
                  {
              var sorted_arr= removeDuplicates(arr)       
                 
      
      
      
      
      for(var k=0;k<sorted_arr.length;k++)
      {
           if(k==0)
                {
                    var test=sorted_arr[k]+":"
                    }
                else
                {
                    var test=test+sorted_arr[k]+":"
                
                }
            }
        sourceDoc.layers[lays1].groupItems[group1].name=test
        }
      else
      {
          }
      
      
      }
      }
      }
      }
      function removeDuplicates(num) {
        var x,
            len=num.length,
            out=[],
            obj={};
      
        for (x=0; x<len; x++) {
          obj[num[x]]=0;
        }
        for (x in obj) {
          out.push(x);
        }
        return out;
      }       
      
      
      
      
      function rename_fuse_group()
      {
          for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
          {
              for(var group1=0;group1<sourceDoc.layers[lays1].groupItems.length;group1++)
              {
                  var fuse_path=0;
                  for(var path1=0;path1<sourceDoc.layers[lays1].groupItems[group1].pathItems.length;path1++)
                  {
                      var path_type=type_of_path(sourceDoc.layers[lays1].groupItems[group1].pathItems[path1]);
                      if(path_type=="Rectangle Type 3")
                      {
                          fuse_path=1;
                          break;
                          }
                      }
                  if(fuse_path==1)
                  {
                  var text_found=0;
                          for(var text=0;text<sourceDoc.layers[lays1].groupItems[group1].textFrames.length;text++)
                          {
                              if(sourceDoc.layers[lays1].groupItems[group1].textFrames[text].contents.match((/^[A-Z]*$/)))
                              {
                                  sourceDoc.layers[lays1].groupItems[group1].name=="FL-"+sourceDoc.layers[lays1].groupItems[group1].textFrames[text].contents+":";
                                  text_found=1;
                                 
                                  }
                              else if(sourceDoc.layers[lays1].groupItems[group1].textFrames[text].contents.match((/^\d{1,4}$/)))
                              {
                                  sourceDoc.layers[lays1].groupItems[group1].name=="FUSE"+sourceDoc.layers[lays1].groupItems[group1].textFrames[text].contents+":";
                                   text_found=1;
                                  }
                              }
                          
                          if(text_found==0)
                          {
                                var count_error=0;
                               var group_main=sourceDoc.layers[lays1].groupItems[group1];
                                                    
                        for(var error=0;error<group_main.groupItems.length;error++)
                                {
                                    if(group_main.groupItems[error].name==group_main.name+ "Error:")
                                    {
                                         var max_area_path=find_rectangle_path_with_large_area(group_main);
        var x_axis=Math.abs(max_area_path.pathPoints[0].anchor[0]);
                        var y_axis=Math.abs(max_area_path.pathPoints[0].anchor[1]);
                        var textRef =group_main.groupItems[error].textFrames.add(); 
      textRef.contents ="Fuse Terminal Number is not present" ;
      textRef.top =y_axis ; 
      textRef.left = x_axis+20 ; 
      textRef.textRange.characterAttributes.size = 10; 
      count_error++;
      }
      }
      
      
      
      
      
      
      
      
      if(count_error==1)
      {
          }
      else
      {
           
                                     var newGroup  =group_main.groupItems.add(); 
                                  newGroup.name = group_main.name+ "Error:";  
                                   var max_area_path=find_rectangle_path_with_large_area(group_main);
        var x_axis=Math.abs(max_area_path.pathPoints[0].anchor[0]);
                        var y_axis=Math.abs(max_area_path.pathPoints[0].anchor[1]);
                        var textRef = newGroup.textFrames.add(); 
      textRef.contents ="Fuse Terminal Number is not present" ;
      textRef.top =y_axis ; 
      textRef.left = x_axis+20 ; 
      textRef.textRange.characterAttributes.size = 10; 
      newGroup.moveToEnd(group_main);
      }
      }
      }
      }
      }
      }
      
      
      function move_rectangle()
      {
          for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
          {
              for(var group1=0;group1<sourceDoc.layers[lays1].groupItems.length;group1++)
              {
             for(var group2=0;group2<sourceDoc.layers[lays1].groupItems[group1].groupItems.length;group2++)
             {
                 for(path2=sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].pathItems.length-1;path2>=0;path2--)
                 {
                    
                      var  path_type = type_of_path(sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].pathItems[path2]);
                
                 if(path_type=="Rectangle Type 2" || path_type=="Rectangle Type 10")
                 {
                     sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].pathItems[path2].moveAfter(sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].pathItems[path2].parent)
                     }
                 }
             }
         }
      }
      }
      
      
      
      
      
      
      function Check_batteryline()
      {
         for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
          {
              for(var group1=sourceDoc.layers[lays1].groupItems.length-1;group1>=0;group1--)
              {
             
                      for(var path1=0;path1<sourceDoc.layers[lays1].groupItems[group1].pathItems.length;path1++)
                      {
                      var  path_type = type_of_path(sourceDoc.layers[lays1].groupItems[group1].pathItems[path1]);
                
                 if(path_type=="Rectangle Type 1" || path_type=="Rectangle Type 4" || path_type=="Rectangle Type 12" || path_type=="Rectangle Type 13" )
                 {
                   
                     var x_bat=sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].visibleBounds[0];
                     var y_bat=sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].visibleBounds[1];
                     var x_bat1=sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].visibleBounds[2];
                     var y_bat1=sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].visibleBounds[3];
                    for(var lays2=0;lays2<sourceDoc.layers.length;lays2++)
          {
                      for(var line=0;line<sourceDoc.layers[lays2].groupItems.length;line++)
                      {
                          for(var line1=0;line1<sourceDoc.layers[lays2].groupItems[line].pathItems.length;line1++)
                          {
                                var  path_type1 = type_of_path(sourceDoc.layers[lays2].groupItems[line].pathItems[line1]);
          
                 if(path_type1=="Line Type 1" || path_type1=="Line Type 3"  )
                 {
              
                     var x_line=sourceDoc.layers[lays2].groupItems[line].pathItems[line1].pathPoints[0].anchor[0];
                     var y_line=sourceDoc.layers[lays2].groupItems[line].pathItems[line1].pathPoints[0].anchor[1];
                     var x_line_end=sourceDoc.layers[lays2].groupItems[line].pathItems[line1].pathPoints[sourceDoc.layers[lays2].groupItems[line].pathItems[line1].pathPoints.length-1].anchor[0];
                     var y_line_end=sourceDoc.layers[lays2].groupItems[line].pathItems[line1].pathPoints[sourceDoc.layers[lays2].groupItems[line].pathItems[line1].pathPoints.length-1].anchor[1];
                     
                    
                     if(((x_line>x_bat) && (x_line<x_bat1) && (Math.abs(y_line-y_bat1))<=3)|| ((x_line_end>x_bat) && (x_line_end<x_bat1) && (Math.abs(y_line_end-y_bat1))<=3))
                     {
                         if(sourceDoc.layers[lays2].groupItems[line].pathItems[line1].parent.name=="AAA" || sourceDoc.layers[lays2].groupItems[line].pathItems[line1].parent.parent.name=="AAA")
                         {
                             }
                         else
                         {
                              for(var lays3=0;lays3<sourceDoc.layers.length;lays3++)
          {
              for(var group1=sourceDoc.layers[lays1].groupItems.length-1;group1>=0;group1--)
              
              {
                  
                  if(sourceDoc.layers[lays1].groupItems[group1].name=="AAA")
                  {
                      sourceDoc.layers[lays2].groupItems[line].pathItems[line1].moveToBeginning(sourceDoc.layers[lays1].groupItems[group1]);
                      }
                  }
              }
          }
                            
                             }
                        }
                    }
                }
            }
        }
      }
      }
      }
      }
      
      
      
      
      
      
      function Check_battery_AAA()
      {
         for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
          {
              for(var group1=sourceDoc.layers[lays1].groupItems.length-1;group1>=0;group1--)
              {
             
                      for(var path1=sourceDoc.layers[lays1].groupItems[group1].pathItems.length-1;path1>=0;path1--)
                      {
                      var  path_type=type_of_path(sourceDoc.layers[lays1].groupItems[group1].pathItems[path1])
                
                 if(path_type=="Rectangle Type 1" || path_type=="Rectangle Type 4" ||  path_type=="Rectangle Type 12" )
                 {
               
                     check_battery_path(sourceDoc.layers[lays1].groupItems[group1].pathItems[path1],group1)
                    
                     }
                 }
             }
         }
      }
      
      
      function check_battery_path(path_item,group_position)
      {
          for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
          {
          for(var group3=sourceDoc.layers[lays1].groupItems.length-1;group3>=0;group3--)
          {
              for(var text=0;text<sourceDoc.layers[lays1].groupItems[group3].textFrames.length;text++)
              {
                
                  if(sourceDoc.layers[lays1].groupItems[group3].textFrames[text].contents=="BATTERY" || sourceDoc.layers[lays1].groupItems[group3].textFrames[text].contents.slice(0,15)=="IGNITION SWITCH")
                  {
                       
                     if(group3==group_position)
                     {
                      
                         if(sourceDoc.layers[lays1].groupItems[group3].name=="AAA" || sourceDoc.groupItems[group3].parent.name=="AAA")
                         {
                             }
                         else
                         {
                             move_to_AAA_Battery(sourceDoc.layers[lays1].groupItems[group3]);
                             break;
                             }
                         }
                     }
             }
                
                 }
             }
         }
      
      
      function move_to_AAA_Battery(group_item)
      {
          for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
          {
              for(var group1=0;group1<sourceDoc.layers[lays1].groupItems.length;group1++)
              {
                  if(sourceDoc.layers[lays1].groupItems[group1].name=="AAA")
                  {
                      
                     group_item.moveToBeginning(sourceDoc.layers[lays1].groupItems[group1])
                     }
                 }
             }
         }
      
      
      
      
      function remove_dot_pathitem()
      {
          for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
          {
              for(var group1=sourceDoc.layers[lays1].groupItems.length-1;group1>=0;group1--)
              {
                  if(sourceDoc.layers[lays1].groupItems[group1].groupItems.length==0 && sourceDoc.layers[lays1].groupItems[group1].textFrames.length==0)
                  {
                      var path_found=0;
                      for(var path1=0;path1<sourceDoc.layers[lays1].groupItems[group1].pathItems.length;path1++)
                      {
                          
                         var path_type= type_of_path(sourceDoc.layers[lays1].groupItems[group1].pathItems[path1])
                         if(path_type!="Anchor point")
                         {
                              path_found=1;
                             }
                         }
                     }
                 if(path_found==0)
                 {
                     sourceDoc.layers[lays1].groupItems[group1].remove();
                     }
                 }
             }
         }
      
      
      
      
      
      
      function color_empty_pathitem()
      {
          for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
          {
              if(sourceDoc.layers[lays1].name=="Layer 1" || sourceDoc.layers[lays1].name=="ILLUST")
              {
       for(var path1=0;path1<sourceDoc.layers[lays1].pathItems.length;path1++)
       {
           if(sourceDoc.layers[lays1].pathItems[path1].name!="DocumentResizeTextFrame")
           {
               sourceDoc.layers[lays1].pathItems[path1].strokeColor=magentaColor3;
                sourceDoc.layers[lays1].pathItems[path1].strokeWidth=3;
                }
            }
        }
      }
      }
      
      
      
      
      function check_text_empty_high()
      {
          for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
          {
              for(var group1=0;group1<sourceDoc.layers[lays1].groupItems.length;group1++)
              {
                  if(sourceDoc.layers[lays1].groupItems[group1].groupItems.length==0 && sourceDoc.layers[lays1].groupItems[group1].pathItems.length==0)
                  {
               
                      if(sourceDoc.layers[lays1].groupItems[group1].textFrames.length==1)
                      {
                      if(sourceDoc.layers[lays1].groupItems[group1].textFrames[0].contents.slice(0,2)!="To")
                      {
                      if( sourceDoc.layers[lays1].groupItems[group1].textFrames[0].textRange.characterAttributes.size!=12)
                      {
                          
                          sourceDoc.layers[lays1].groupItems[group1].textFrames[0].textRange.characterAttributes.fillColor=magentaColor6;
                          sourceDoc.layers[lays1].groupItems[group1].textFrames[0].textRange.characterAttributes.size==7.5
                          }
                      }
                  }
              }
          }
      }
      }
      
      
      
      
        function line_check1_unit()
          {
                for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
      {
          var count=0;
          for(var group1=0;group1<sourceDoc.layers[lays1].groupItems.length;group1++)
          {
              mainloop12:
              
              if(sourceDoc.layers[lays1].groupItems[group1].name!="AAA")
              {
                  for(var group2=0;group2<sourceDoc.layers[lays1].groupItems[group1].groupItems.length;group2++)
                  {
                      for(var path=0;path<sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].pathItems.length;path++)
                      {
                          var path_type = type_of_path(sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].pathItems[path]);
                          if(path_type=="Line Type 1" || path_type=="Line Type 2" || path_type=="Line Type 3" || path_type=="Line Type 4" || path_type=="Line Type 10" )
                          {
                              for(var group3=0;group3<sourceDoc.layers[lays1].groupItems[group1].groupItems.length;group3++)
                  {
                              for(var text=0;text<sourceDoc.layers[lays1].groupItems[group1].groupItems[group3].textFrames.length;text++)
                              {
                                  if(!sourceDoc.layers[lays1].groupItems[group1].groupItems[group3].textFrames[text].contents.match(/[A-Z][0-9]{1,3}$/)) continue; 
                                  {
                                      var count_error=0;
                  group_main=sourceDoc.layers[lays1].groupItems[group1];
                        for(var error=0;error<sourceDoc.layers[lays1].groupItems[group1].groupItems.length;error++)
                                {
                                    if(group_main.groupItems[error].name==group_main.name+ "Error:")
                                    {
                                         var max_area_path=find_rectangle_path_with_large_area(group_main);
        var x_axis=Math.abs(max_area_path.pathPoints[0].anchor[0]);
                        var y_axis=Math.abs(max_area_path.pathPoints[0].anchor[1]);
                        var textRef =group_main.groupItems[error].textFrames.add(); 
      textRef.contents ="Unwanted line present inside the group" ;
      textRef.top =y_axis ; 
      textRef.left = x_axis+20 ; 
      textRef.textRange.characterAttributes.size = 10; 
      count_error++;
      }
      }
      
      
      
      
      
      
      
      
      if(count_error==1)
      {
          }
      else
      {
           
                                     var newGroup  =group_main.groupItems.add(); 
                                  newGroup.name = group_main.name+ "Error:";  
                                   var max_area_path=find_rectangle_path_with_large_area(group_main);
        var x_axis=Math.abs(max_area_path.pathPoints[0].anchor[0]);
                        var y_axis=Math.abs(max_area_path.pathPoints[0].anchor[1]);
                        var textRef = newGroup.textFrames.add(); 
      textRef.contents ="Unwanted line present inside the group" ;
      textRef.top =y_axis ; 
      textRef.left = x_axis+20 ; 
      textRef.textRange.characterAttributes.size = 10; 
      newGroup.moveToEnd(group_main);
      }
      }
      break mainloop12;
      }
      }
      }
      }
      }
      }
      }
      }
      }  
      
      
      
      
      
      
      
      
      
      
      function line_check1_unit_2()
          {
                for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
      {
          
          for(var group1=0;group1<sourceDoc.layers[lays1].groupItems.length;group1++)
          {
              var count_group_found=0;
              
              if(sourceDoc.layers[lays1].groupItems[group1].name!="AAA")
              {
                mainloop12:
                 for(var group2=0;group2<sourceDoc.layers[lays1].groupItems[group1].groupItems.length;group2++)
                 {
                     if(sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].name.slice(0,15)=="connectornumber")
                     {
                         count_group_found=1;
                         break  mainloop12;
                         }
                     }
                 if(  count_group_found==1)
                 {
                     
                      for(var path=0;path<sourceDoc.layers[lays1].groupItems[group1].pathItems.length;path++)
                      {
                          var path_type = type_of_path(sourceDoc.layers[lays1].groupItems[group1].pathItems[path]);
                          if(path_type=="Line Type 1" || path_type=="Line Type 2" || path_type=="Line Type 3" || path_type=="Line Type 4" || path_type=="Line Type 10" )
                          {
                              var count_error=0;
                  group_main=sourceDoc.layers[lays1].groupItems[group1];
                        for(var error=0;error<sourceDoc.layers[lays1].groupItems[group1].groupItems.length;error++)
                                {
                                    if(group_main.groupItems[error].name==group_main.name+ "Error:")
                                    {
                                         var max_area_path=find_rectangle_path_with_large_area(group_main);
        var x_axis=Math.abs(max_area_path.pathPoints[0].anchor[0]);
                        var y_axis=Math.abs(max_area_path.pathPoints[0].anchor[1]);
                        var textRef =group_main.groupItems[error].textFrames.add(); 
      textRef.contents ="Unwanted line present inside the group" ;
      textRef.top =y_axis ; 
      textRef.left = x_axis+20 ; 
      textRef.textRange.characterAttributes.size = 10; 
      count_error++;
      }
      }
      
      
      
      
      
      
      
      
      if(count_error==1)
      {
          }
      else
      {
           
                                     var newGroup  =group_main.groupItems.add(); 
                                  newGroup.name = group_main.name+ "Error:";  
                                   var max_area_path=find_rectangle_path_with_large_area(group_main);
        var x_axis=Math.abs(max_area_path.pathPoints[0].anchor[0]);
                        var y_axis=Math.abs(max_area_path.pathPoints[0].anchor[1]);
                        var textRef = newGroup.textFrames.add(); 
      textRef.contents ="Unwanted line present inside the group" ;
      textRef.top =y_axis ; 
      textRef.left = x_axis+20 ; 
      textRef.textRange.characterAttributes.size = 10; 
      newGroup.moveToEnd(group_main);
      }
      }
      
      
      }
      }
      }
      }
      }
      }
      
      
      
      
      
      
      function check_can_AAA_PATH()
      {
             for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
      {
          
          for(var group1=0;group1<sourceDoc.layers[lays1].groupItems.length;group1++)
          {
              for(var path1=0;path1<sourceDoc.layers[lays1].groupItems[group1].pathItems.length;path1++)
              {
                   var path_type=type_of_path(sourceDoc.layers[lays1].groupItems[group1].pathItems[path1]);
                   if(path_type=="Line Type 10")
                   {
                       if(sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].parent.name!="AAA"  )
                       {
                           sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].strokeColor=magentaColor3;
                           sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].strokeWidth=5;
                           }
                       }
                   }
               }
           }
       }
      
      
      
      
      function check_AAA_path_BCM()
      {
           for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
      {
          
          for(var group1=0;group1<sourceDoc.layers[lays1].groupItems.length;group1++)
          {
              for(var path1=0;path1<sourceDoc.layers[lays1].groupItems[group1].pathItems.length;path1++)
              {
                   var path_type=type_of_path(sourceDoc.layers[lays1].groupItems[group1].pathItems[path1]);
                   if(path_type=="Line Type 10" || path_type=="Line Type 1" || path_type=="Line Type 2" || path_type=="Line Type 3"  )
                   {
                       if(sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].parent.name!="AAA"  )
                       {
                           sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].strokeColor=magentaColor3;
                           sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].strokeWidth=5;
                           }
                       }
                   }
               }
           }
       }
      
      
      
      
      
      
      function write_to_link()
      {
            for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
      {
          for(var group1=0;group1<sourceDoc.layers[lays1].groupItems.length;group1++)
          {
              if(sourceDoc.layers[lays1].groupItems[group1].name=="Link")
              {
              for(var text=0;text<sourceDoc.layers[lays1].groupItems[group1].textFrames.length;text++)
              {
                  if(sourceDoc.layers[lays1].groupItems[group1].textFrames[text].contents.slice(0,2)=="To")
                  {
                     
                          var s=Checking_Link_group_properties_power(sourceDoc.layers[lays1].groupItems[group1].textFrames[text],sourceDoc.layers[lays1].groupItems[group1]);
                          if(s!=0 || s!=null)
                          {
                             
                            var tr=get_file_name_id(s);
                            if(tr!=null && tr!=0)
                            {
                                  file_output.writeln(sourceDoc.name+","+"L"+","+"L"+","+"-"+","+"-"+","+tr+","+s)
                                  }
                              }
                          }
                      }
                  }
              }
          }
      }
      
      
                                   
                          
                          
                          
                          
                          
                          
                          
                          
                          
                          
                          
                          
                          
                          
                          
                          
         function Checking_Link_group_properties_power(text_frames_to_check,main)
      {
          var result_to_link_check;
          var one_line_link_name_s="";
          var one_line_link_name="";
          var text_buffer_array="";
          if(text_frames_to_check!=null)
          {
             
          if(text_frames_to_check.lines.length>1)
          {
          one_line_link_name=Make_one_line(text_frames_to_check);
                 var text_buffer_array = one_line_link_name[0];
              for( array_iteration_value = 1 ;array_iteration_value<one_line_link_name.length; array_iteration_value++)
              {
                 
                 text_buffer_array = text_buffer_array+one_line_link_name[array_iteration_value];
          }
          one_line_link_name_s=one_line_link_name.toString();
          }
          else if(text_frames_to_check.lines.length==1)
          {
          text_buffer_array=text_frames_to_check.contents;
          }
          }
      
      
      
      
                  result_to_link_check =  title_checking_link(text_buffer_array); 
            
      
      
                              if(result_to_link_check != 0 || result_to_link_check != null )
                              {
                     
                              return result_to_link_check;
                                  
                        
                                    
                                 
                               }
                               else
                               {
                                   
                                  
                                            if(text_frames_to_check.parent.name == "Link")   
                                           {
                                            
                                             var x_axis=Math.abs(Math.round(text_frames_to_check.textPath.pathPoints[0].anchor[0]));
                        var y_axis=Math.abs(text_frames_to_check.textPath.pathPoints[0].anchor[1]);
                        var r=main.groupItems.add();
                          r.name=main.name+"Error:"
                                      var textRef = r.textFrames.add(); 
                                      textRef.contents =text_buffer_array+"_Mismatch";
      textRef.top =y_axis ; 
      textRef.left = x_axis+20 ; 
      textRef.textRange.characterAttributes.size = 10; 
      r.moveToEnd(main);
                                                   
                                       
                                                   
      
      
                                             }
                                    
                                              return 0;      
                                         
                                  
                                }
                                  
                          
      }
                                   
        function Make_one_line(SM_name_near_connector)
      {
        
          var temperory_index = 0;
          var temp,internaltextframe_index;
          var internaltextframe;
          internaltextframe = [];
          var internaltextframe_2;
          internaltextframe_2 = [];
         internaltextframe_index=0;
         var count_buff = 0;
         var temperory_string = "";
      
      
              for(line_len=0;line_len<SM_name_near_connector.lines.length;line_len++) 
              {
               
                  internaltextframe[internaltextframe_index] = SM_name_near_connector.lines[line_len].contents;
      
      
                  internaltextframe_index++;
               }
      
      
          for(assign_textframe = 0;assign_textframe<internaltextframe.length;assign_textframe++)
          {
              internaltextframe_2[assign_textframe] = [];
           }
               
              if(internaltextframe.length>1)
               {
                   
            for(text_iteration = 0;text_iteration<internaltextframe.length;text_iteration++)
           {
               var space_count_flag = 0;
          
            
               if(internaltextframe[text_iteration][internaltextframe[text_iteration].length-1] == " " )
               {
                 
                   for(internal_text_frame_length = internaltextframe[text_iteration].length-1;internal_text_frame_length>=0;internal_text_frame_length--)
                   {
                   
                       if(internaltextframe[text_iteration][internal_text_frame_length] == " " )
                       {
                          space_count_flag++;
                       }
                      else
                      {
                          break;
                       }
                   }
            
               for(internal_text_frame_length = 0;internal_text_frame_length< internaltextframe[text_iteration].length-space_count_flag;internal_text_frame_length++)
               {
                   internaltextframe_2[text_iteration][internal_text_frame_length] = internaltextframe[text_iteration][internal_text_frame_length];
                } 
        
          }
      
      
        
                  else
                  {
                
                    for(internal_text_frame_length = 0;internal_text_frame_length< internaltextframe[text_iteration].length;internal_text_frame_length++)
                    {
                       internaltextframe_2[text_iteration][internal_text_frame_length] = internaltextframe[text_iteration][internal_text_frame_length];
                    }
                    }
               }
      
      
              for(i=0;i<internaltextframe_2.length;i++)
              {
              var temp_str,temp_str_space;  
              if(i==0 )
              {
                 
              
                  space_value = String.fromCharCode (32);
                
                  temp_str = internaltextframe_2[i];
      
      
                  temp_str = temp_str.concat (space_value);
                }
              else if(i == internaltextframe_2.length-1 )
              {
           
                 internaltextframe_2[i].toString();
                  temp_str = temp_str.concat (internaltextframe_2[i]);
               }
              else 
              {
             
           
                  space_value = String.fromCharCode (32);
                temp = temp_str.concat (internaltextframe_2[i],space_value);
                  temp_str = temp;
        
                    }
              
      
      
              
              }
          
      
      
        temp_str = remove_hyphen(temp_str);
      
      
           temperory_string = temp_str;
      
      
      
      }
      else
      {
        
          temperory_string = SM_name_near_connector.contents;
       }
      
      
      
      
      
      
      
      
      
      
      return temperory_string;
      
      
      
      
      }
                        
        function title_checking_link(title_from_ai_file)
      {    
              
              title_new_ai = title_from_ai_file.toLowerCase();
              var title_ID="";
              var title_ID_with_to="";
              for(title_check_loop = 0;title_check_loop< fileArray_title.length; title_check_loop++)
              {
                  
                    if(fileArray_title[title_check_loop][0]!=null)
                      {
                      
                      title_ID = fileArray_title[title_check_loop][0].toLowerCase();
                      
                      title_ID_with_to = "to " + title_ID;
                 
                      if(title_ID_with_to ==    title_new_ai)
                      {
                              return fileArray_title[title_check_loop][0];   
                          
                       }
                   
                   }
                  
                 }
          
          return 0;      
          
      }               
                          
                          
                          
        function get_file_name_id(text)
        {
         
              for(title_check_loop = 0;title_check_loop< fileArray_title.length; title_check_loop++)
              {
                  
                      if(fileArray_title[title_check_loop][0]==text)
                      {
                              return fileArray_title[title_check_loop][1];
                              }
                          }
                      }
                          
                          
            function remove_hyphen(SM_name_with_hyphen)
      {
        
          var SM_name_with_hyphen_buffer = [];
       var hyphenchange_count = 0;
      for(assign_textframe = 0;assign_textframe<SM_name_with_hyphen.length;assign_textframe++)
      {
         
          if(SM_name_with_hyphen[assign_textframe-1] == "-" &&   SM_name_with_hyphen[assign_textframe] == " " )
          {
          
                 SM_name_with_hyphen_buffer[assign_textframe] =  SM_name_with_hyphen[assign_textframe+1];
                
      
      
           hyphenchange_count++;
      
      
      
      
          }
          else
          {
              SM_name_with_hyphen_buffer[assign_textframe - hyphenchange_count ] =  SM_name_with_hyphen[assign_textframe]
           }
       }
      
      
        return SM_name_with_hyphen_buffer;
        
        }  
      
      
      
      
      function autoColor_updation()
      {
          for(var group1=0;group1<sourceDoc.groupItems.length;group1++)
          {
              for(var path1=0;path1<sourceDoc.groupItems[group1].pathItems.length;path1++)
              {
                  var path_items_r=sourceDoc.groupItems[group1].pathItems[path1];
                  if((Math.round(path_items_r.strokeWidth*1000))>=500 && (Math.round(path_items_r.strokeWidth*1000))<=580 && path_items_r.fillColor.magenta>=55 && path_items_r.fillColor.magenta<=75 && path_items_r.fillColor.yellow>=50 && path_items_r.fillColor.yellow<=70 && path_items_r.closed==true && path_items_r.strokeDashes.length==0 
                 && (Math.round(path_items_r.area))!=25 && (Math.round(path_items_r.area))!=6)
                  {
                      path_items_r.strokeWidth=0.567;
                      path_items_r.strokeColor.black=100;
                       path_items_r.strokeColor.cyan=0;
                        path_items_r.strokeColor.magenta=0;
                         path_items_r.strokeColor.yellow=0;
                         path_items_r.fillColor.cyan=0;
                         path_items_r.fillColor.magenta=70;
                         path_items_r.fillColor.yellow=60;
                         path_items_r.fillColor.black=0;
                         }
                     else if((Math.round(path_items_r.strokeWidth*1000))>=500 && (Math.round(path_items_r.strokeWidth*1000))<=580 && path_items_r.fillColor.magenta>=0 && path_items_r.fillColor.magenta<=5 && path_items_r.fillColor.yellow>=10 && path_items_r.fillColor.yellow<=35 &&  path_items_r.closed==true && path_items_r.strokeDashes.length==0
                     && (Math.round(path_items_r.area))!=25 && (Math.round(path_items_r.area))!=6)
                  {
                      path_items_r.strokeWidth=0.567;
                      path_items_r.strokeColor.black=100;
                       path_items_r.strokeColor.cyan=0;
                        path_items_r.strokeColor.magenta=0;
                         path_items_r.strokeColor.yellow=0;
                         path_items_r.fillColor.cyan=0;
                         path_items_r.fillColor.magenta=0;
                         path_items_r.fillColor.yellow=25;
                         path_items_r.fillColor.black=0;
                         }
                     
                     else if((Math.round(path_items_r.strokeWidth*1000))>=500 && (Math.round(path_items_r.strokeWidth*1000))<=580 && path_items_r.fillColor.magenta>=10 && path_items_r.fillColor.magenta<=35 && path_items_r.fillColor.yellow>=10 && path_items_r.fillColor.yellow<=35 &&  path_items_r.closed==true && path_items_r.strokeDashes.length==0
                     && (Math.round(path_items_r.area))!=25 && (Math.round(path_items_r.area))!=6)
                  {
                      path_items_r.strokeWidth=0.567;
                      path_items_r.strokeColor.black=100;
                       path_items_r.strokeColor.cyan=0;
                        path_items_r.strokeColor.magenta=0;
                         path_items_r.strokeColor.yellow=0;
                         path_items_r.fillColor.cyan=0;
                         path_items_r.fillColor.magenta=25;
                         path_items_r.fillColor.yellow=25;
                         path_items_r.fillColor.black=0;
                         }
                      else if((Math.round(path_items_r.strokeWidth*1000))>=500 && (Math.round(path_items_r.strokeWidth*1000))<=580 && path_items_r.strokeColor.magenta>=25 && path_items_r.strokeColor.magenta<=60 && path_items_r.strokeColor.cyan>=75 && path_items_r.strokeColor.cyan<=100  && path_items_r.strokeDashes.length==2 
                      && path_items_r.filled==false)
                  {
                      path_items_r.strokeWidth=0.567;
                      path_items_r.strokeColor.black=0;
                       path_items_r.strokeColor.cyan=100;
                        path_items_r.strokeColor.magenta=50;
                         path_items_r.strokeColor.yellow=0;
                        path_items_r.filled=false;
                         }
                     
                     else if((Math.round(path_items_r.strokeWidth*1000))>=500 && (Math.round(path_items_r.strokeWidth*1000))<=580 && path_items_r.strokeColor.black>=75 && path_items_r.strokeColor.black<=100  && path_items_r.strokeDashes.length==2 
                      && path_items_r.filled==false)
                  {
                      path_items_r.strokeWidth=0.567;
                      path_items_r.strokeColor.black=100;
                       path_items_r.strokeColor.cyan=0;
                        path_items_r.strokeColor.magenta=0;
                         path_items_r.strokeColor.yellow=0;
                        path_items_r.filled=false;
                         }
                     else if((Math.round(path_items_r.strokeWidth*1000))>=500 && (Math.round(path_items_r.strokeWidth*1000))<=580 && path_items_r.strokeColor.black>=75 && path_items_r.strokeColor.black<=100 &&  path_items_r.closed==true && path_items_r.strokeDashes.length==0 &&  path_items_r.pathPoints.length==4
                    && path_items_r.filled==false) 
                  {
                      path_items_r.strokeWidth=0.567;
                      path_items_r.strokeColor.black=100;
                       path_items_r.strokeColor.cyan=0;
                        path_items_r.strokeColor.magenta=0;
                         path_items_r.strokeColor.yellow=0;
                         path_items_r.filled=false;
                         }
                                    else if((Math.round(path_items_r.strokeWidth*1000))>=500 && (Math.round(path_items_r.strokeWidth*1000))<=580 &&  path_items_r.closed==true  &&  path_items_r.pathPoints.length==4
                    && (Math.round(path_items_r.area))==25 && path_items_r.strokeColor.black>=75 && path_items_r.strokeColor.black<=100 && path_items_r.fillColor.black>=75 && path_items_r.fillColor.black<=100) 
                    {
                         path_items_r.strokeWidth=0.567;
                      path_items_r.strokeColor.black=100;
                       path_items_r.strokeColor.cyan=0;
                        path_items_r.strokeColor.magenta=0;
                         path_items_r.strokeColor.yellow=0;
                         path_items_r.fillColor.cyan=0;
                         path_items_r.fillColor.magenta=0;
                         path_items_r.fillColor.yellow=0;
                         path_items_r.fillColor.black=100;
                         }
                     
                     else if((Math.round(path_items_r.strokeWidth*1000))>=500 && (Math.round(path_items_r.strokeWidth*1000))<=580 &&  path_items_r.closed==true  &&  path_items_r.pathPoints.length==4
                    && (Math.round(path_items_r.area))==25 && path_items_r.strokeColor.black>=75 && path_items_r.strokeColor.black<=100 && path_items_r.fillColor.black>=0 && path_items_r.fillColor.black<=5) 
                    {
                         path_items_r.strokeWidth=0.567;
                      path_items_r.strokeColor.black=100;
                       path_items_r.strokeColor.cyan=0;
                        path_items_r.strokeColor.magenta=0;
                         path_items_r.strokeColor.yellow=0;
                         path_items_r.fillColor.cyan=0;
                         path_items_r.fillColor.magenta=0;
                         path_items_r.fillColor.yellow=0;
                         path_items_r.fillColor.black=0;
                         }
                     
                     
                     else if((Math.round(path_items_r.strokeWidth*1000))>=500 && (Math.round(path_items_r.strokeWidth*1000))<=580 &&  path_items_r.closed==true  &&  path_items_r.pathPoints.length==4
                    && (Math.round(path_items_r.area))==25 && path_items_r.strokeColor.cyan>=75 && path_items_r.strokeColor.cyan<=100 && path_items_r.strokeColor.magenta>=25 && path_items_r.strokeColor.magenta<=50 && path_items_r.fillColor.cyan>=75 && path_items_r.fillColor.cyan<=100
                    && path_items_r.fillColor.magenta>=25 && path_items_r.fillColor.magenta<=50) 
                    {
                         path_items_r.strokeWidth=0.567;
                      path_items_r.strokeColor.black=0;
                       path_items_r.strokeColor.cyan=100;
                        path_items_r.strokeColor.magenta=50;
                         path_items_r.strokeColor.yellow=0;
                         path_items_r.fillColor.cyan=100;
                         path_items_r.fillColor.magenta=50;
                         path_items_r.fillColor.yellow=0;
                         path_items_r.fillColor.black=0;
                         }
                     
                        else if((Math.round(path_items_r.strokeWidth*1000))>=500 && (Math.round(path_items_r.strokeWidth*1000))<=580 &&  path_items_r.closed==true  &&  path_items_r.pathPoints.length==4
                    && (Math.round(path_items_r.area))==25 && path_items_r.strokeColor.cyan>=75 && path_items_r.strokeColor.cyan<=100 && path_items_r.strokeColor.magenta>=25 && path_items_r.strokeColor.magenta<=50 && path_items_r.fillColor.cyan>=0 && path_items_r.fillColor.cyan<=5
                    && path_items_r.fillColor.magenta>=0 && path_items_r.fillColor.magenta<=5)
                    {
                         path_items_r.strokeWidth=0.567;
                      path_items_r.strokeColor.black=0;
                       path_items_r.strokeColor.cyan=100;
                        path_items_r.strokeColor.magenta=50;
                         path_items_r.strokeColor.yellow=0;
                         path_items_r.fillColor.cyan=0;
                         path_items_r.fillColor.magenta=0;
                         path_items_r.fillColor.yellow=0;
                         path_items_r.fillColor.black=0;
                         }
                     
                     
                       else if((Math.round(path_items_r.strokeWidth*1000))>=500 && (Math.round(path_items_r.strokeWidth*1000))<=580 &&  path_items_r.closed==true  &&  path_items_r.pathPoints.length==4
                    && (Math.round(path_items_r.area))==25 && path_items_r.strokeColor.yellow>=75 && path_items_r.strokeColor.yellow<=100 && path_items_r.strokeColor.magenta>=75 && path_items_r.strokeColor.magenta<=100 && path_items_r.fillColor.yellow>=75 && path_items_r.fillColor.yellow<=100
                    && path_items_r.fillColor.magenta>=75 && path_items_r.fillColor.magenta<=100) 
                    {
                         path_items_r.strokeWidth=0.567;
                      path_items_r.strokeColor.black=0;
                       path_items_r.strokeColor.cyan=0;
                        path_items_r.strokeColor.magenta=100;
                         path_items_r.strokeColor.yellow=100;
                         path_items_r.fillColor.cyan=0;
                         path_items_r.fillColor.magenta=100;
                         path_items_r.fillColor.yellow=100;
                         path_items_r.fillColor.black=0;
                         }
                     
                        else if((Math.round(path_items_r.strokeWidth*1000))>=500 && (Math.round(path_items_r.strokeWidth*1000))<=580 &&  path_items_r.closed==true  &&  path_items_r.pathPoints.length==4
                    && (Math.round(path_items_r.area))==25 && path_items_r.strokeColor.yellow>=75 && path_items_r.strokeColor.yellow<=100 && path_items_r.strokeColor.magenta>=75 && path_items_r.strokeColor.magenta<=100 && path_items_r.fillColor.yellow>=0 && path_items_r.fillColor.yellow<=5
                    && path_items_r.fillColor.magenta>=0 && path_items_r.fillColor.magenta<=5) 
                    {
                         path_items_r.strokeWidth=0.567;
                      path_items_r.strokeColor.black=0;
                       path_items_r.strokeColor.cyan=0;
                        path_items_r.strokeColor.magenta=100;
                         path_items_r.strokeColor.yellow=100;
                         path_items_r.fillColor.cyan=0;
                         path_items_r.fillColor.magenta=0;
                         path_items_r.fillColor.yellow=0;
                         path_items_r.fillColor.black=0;
                         }
                     
                      else if((Math.round(path_items_r.strokeWidth*1000))>=1100 && (Math.round(path_items_r.strokeWidth*1000))<=1700 && path_items_r.strokeColor.magenta>=25 && path_items_r.strokeColor.magenta<=60 && path_items_r.strokeColor.cyan>=75 && path_items_r.strokeColor.cyan<=100  && path_items_r.strokeDashes.length==0
                        && path_items_r.height!=6 )
                  {
                      path_items_r.strokeWidth=1.417;
                      path_items_r.strokeColor.black=0;
                       path_items_r.strokeColor.cyan=100;
                        path_items_r.strokeColor.magenta=50;
                         path_items_r.strokeColor.yellow=0;
                        path_items_r.filled=false;
                         }
                     
                     else if((Math.round(path_items_r.strokeWidth*1000))>=1100 && (Math.round(path_items_r.strokeWidth*1000))<=1700 && path_items_r.strokeColor.magenta>=25 && path_items_r.strokeColor.magenta<=60 && path_items_r.strokeColor.cyan>=75 && path_items_r.strokeColor.cyan<=100  && path_items_r.strokeDashes.length==0
                        && path_items_r.height==6 )
                  {
                      path_items_r.strokeWidth=1.417;
                      path_items_r.strokeColor.black=0;
                       path_items_r.strokeColor.cyan=100;
                        path_items_r.strokeColor.magenta=50;
                         path_items_r.strokeColor.yellow=0;
                        path_items_r.filled=false;
                         }
                        else if((Math.round(path_items_r.strokeWidth*1000))>=1100 && (Math.round(path_items_r.strokeWidth*1000))<=1700 && path_items_r.strokeColor.black>=75 && path_items_r.strokeColor.black<=100  && path_items_r.strokeDashes.length==0)
                        
                  {
                      path_items_r.strokeWidth=1.417;
                      path_items_r.strokeColor.black=100;
                       path_items_r.strokeColor.cyan=0;
                        path_items_r.strokeColor.magenta=0;
                         path_items_r.strokeColor.yellow=0;
                        path_items_r.filled=false;
                         } 
                     
                      else if((Math.round(path_items_r.strokeWidth*1000))>=1100 && (Math.round(path_items_r.strokeWidth*1000))<=1700  && path_items_r.strokeColor.magenta>=75 && path_items_r.strokeColor.magenta<=100 && path_items_r.strokeColor.yellow>=75 && path_items_r.strokeColor.yellow<=100  && path_items_r.strokeDashes.length==0)
                        
                  {
                      path_items_r.strokeWidth=1.417;
                      path_items_r.strokeColor.black=0;
                       path_items_r.strokeColor.cyan=0;
                        path_items_r.strokeColor.magenta=100;
                         path_items_r.strokeColor.yellow=100;
                        path_items_r.filled=false;
                         } 
                     
                       else if((Math.round(path_items_r.strokeWidth*1000))>=1100 && (Math.round(path_items_r.strokeWidth*1000))<=1700  && path_items_r.strokeColor.magenta>=0 && path_items_r.strokeColor.magenta<=5 && path_items_r.strokeColor.yellow>=0 && path_items_r.strokeColor.yellow<=5  && path_items_r.strokeDashes.length==2)
                        
                  {
                      path_items_r.strokeWidth=1.420;
                      path_items_r.strokeColor.black=0;
                       path_items_r.strokeColor.cyan=0;
                        path_items_r.strokeColor.magenta=0;
                         path_items_r.strokeColor.yellow=0;
                        path_items_r.filled=false;
                         } 
         else if((Math.round(path_items_r.strokeWidth*1000))>=2100 && (Math.round(path_items_r.strokeWidth*1000))<=3000  && path_items_r.strokeColor.black>=75 && path_items_r.strokeColor.black<=100   && path_items_r.strokeDashes.length==0)
                        
                  {
                      path_items_r.strokeWidth=2.268;
                      path_items_r.strokeColor.black=100;
                       path_items_r.strokeColor.cyan=0;
                        path_items_r.strokeColor.magenta=0;
                         path_items_r.strokeColor.yellow=0;
                        path_items_r.filled=false;
                         } 
                     else
                     {
                         }
                     }
                 }
             }
                    
      
      
                         
       function list_connector_names()
      {
          for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)
          {
              for(var group1=0;group1<sourceDoc.layers[lays1].groupItems.length;group1++)
              {
                   var arr=[];
                  if(sourceDoc.layers[lays1].groupItems[group1].name!="AAA")
                  {
                       if(check4(sourceDoc.layers[lays1].groupItems[group1].name))
          {
              var array=sourceDoc.layers[lays1].groupItems[group1].name.split(":")
              if(array.length==2)
              {
                  var text2=get_connector_name_cil(array[0]);
                  if(text2=="WIRE TO WIRE" || text2=="BODY GROUND" || text2=="ENGINE GROUND")
                  {
                     file_output1.writeln(array[0]+","+text2); 
                      }
                  else
                  {
                  var text3=match_AAA_text(text2);
                 
                  if(text3==1)
                  {
                     file_output1.writeln(array[0]+","+text2+","+sourceDoc.name)
                     }
                 else
                 {
                     var text_found=0;
                     for(var text_4=0;text_4<sourceDoc.layers[lays1].groupItems[group1].textFrames.length;text_4++)
                     {
                           if(sourceDoc.layers[lays1].groupItems[group1].textFrames[text_4].lines.length>1)
                          {
                              one_line_link_name=Make_one_line(sourceDoc.layers[lays1].groupItems[group1].textFrames[text_4]);
                               var text_buffer_array = one_line_link_name[0];
                                  for( array_iteration_value = 1 ;array_iteration_value<one_line_link_name.length; array_iteration_value++)
              {
                 
                 text_buffer_array = text_buffer_array+one_line_link_name[array_iteration_value];
          }
      }
      else if(sourceDoc.layers[lays1].groupItems[group1].textFrames[text_4].lines.length==1)
      {
          text_buffer_array=sourceDoc.layers[lays1].groupItems[group1].textFrames[text_4].contents;
          }
      var text_6=text_buffer_array.replace(/\s/g, "")
      var text_7=array[0].replace(/\s/g, "")
      if(text_6==text_7)
      {
          text_found=1;
          }
      }
        for(var group3=0;group3<sourceDoc.layers[lays1].groupItems[group1].groupItems.length;group3++)
                     {
                         for(var text_1=0;text_1<sourceDoc.layers[lays1].groupItems[group1].groupItems[group3].textFrames.length;text_1++)
                         {
                              if(sourceDoc.layers[lays1].groupItems[group1].groupItems[group3].textFrames[text_1].lines.length>1)
                          {
                              one_line_link_name=Make_one_line(sourceDoc.layers[lays1].groupItems[group1].groupItems[group3].textFrames[text_1]);
                               var text_buffer_array = one_line_link_name[0];
                                  for( array_iteration_value = 1 ;array_iteration_value<one_line_link_name.length; array_iteration_value++)
              {
                 
                 text_buffer_array = text_buffer_array+one_line_link_name[array_iteration_value];
          }
      }
      else if(sourceDoc.layers[lays1].groupItems[group1].groupItems[group3].textFrames[text_1].lines.length==1)
      {
          text_buffer_array=sourceDoc.layers[lays1].groupItems[group1].groupItems[group3].textFrames[text_1].contents;
          }
      var text_6=text_buffer_array.replace(/\s/g, "")
      var text_7=array[0].replace(/\s/g, "")
      if(text_6==text_7)
      {
          text_found=1;
          }
      }
      }
      
      
      if( text_found==0)
      {
                     mainloop3:
                     for(var group3=0;group3<sourceDoc.layers[lays1].groupItems[group1].groupItems.length;group3++)
                     {
                         for(var text_1=0;text_1<sourceDoc.layers[lays1].groupItems[group1].groupItems[group3].textFrames.length;text_1++)
                         {
                             if(!sourceDoc.layers[lays1].groupItems[group1].groupItems[group3].textFrames[text_1].contents.match(/[A,B,C,D,E,F,H,L,M,N,P,R,T][0-9]{1,3}$/)) continue; 
                             if(sourceDoc.layers[lays1].groupItems[group1].groupItems[group3].textFrames[text_1].contents==array[0])
                             {
                             sourceDoc.layers[lays1].groupItems[group1].groupItems[group3].textFrames[text_1].textRange.characterAttributes.fillColor=magentaColor6;
                             sourceDoc.layers[lays1].groupItems[group1].groupItems[group3].textFrames[text_1].textRange.characterAttributes.size=10;
                             break mainloop3;
                             }
                         }
                     }
                 }
             else
             {
                  file_output1.writeln(array[0]+","+text2+","+sourceDoc.name)
                  }
             }
         }
      }
         else if(array.length>2)
         {
             for(var k=0;k<array.length-1;k++)
             {
                   var text2=get_connector_name_cil(array[k]);
                  if(text2=="WIRE TO WIRE" || text2=="BODY GROUND" || text2=="ENGINE GROUND")
                  {
                     file_output1.writeln(array[k]+","+text2); 
                      }
                  else
                  {
                  var text3=match_AAA_text(text2);
                 
                  if(text3==1)
                  {
                     file_output1.writeln(array[k]+","+text2+","+sourceDoc.name)
                     }
                 else
                 {
                       var text_found=0;
                     for(var text_4=0;text_4<sourceDoc.layers[lays1].groupItems[group1].textFrames.length;text_4++)
                     {
                           if(sourceDoc.layers[lays1].groupItems[group1].textFrames[text_4].lines.length>1)
                          {
                              one_line_link_name=Make_one_line(sourceDoc.layers[lays1].groupItems[group1].textFrames[text_4]);
                               var text_buffer_array = one_line_link_name[0];
                                  for( array_iteration_value = 1 ;array_iteration_value<one_line_link_name.length; array_iteration_value++)
              {
                 
                 text_buffer_array = text_buffer_array+one_line_link_name[array_iteration_value];
          }
      }
      else if(sourceDoc.layers[lays1].groupItems[group1].textFrames[text_4].lines.length==1)
      {
          text_buffer_array=sourceDoc.layers[lays1].groupItems[group1].textFrames[text_4].contents;
          }
      var text_6=text_buffer_array.replace(/\s/g, "")
      var text_7=array[k].replace(/\s/g, "")
      if(text_6==text_7)
      {
          text_found=1;
          }
      }
        for(var group3=0;group3<sourceDoc.layers[lays1].groupItems[group1].groupItems.length;group3++)
                     {
                         for(var text_1=0;text_1<sourceDoc.layers[lays1].groupItems[group1].groupItems[group3].textFrames.length;text_1++)
                         {
                              if(sourceDoc.layers[lays1].groupItems[group1].groupItems[group3].textFrames[text_1].lines.length>1)
                          {
                              one_line_link_name=Make_one_line(sourceDoc.layers[lays1].groupItems[group1].groupItems[group3].textFrames[text_1]);
                               var text_buffer_array = one_line_link_name[0];
                                  for( array_iteration_value = 1 ;array_iteration_value<one_line_link_name.length; array_iteration_value++)
              {
                 
                 text_buffer_array = text_buffer_array+one_line_link_name[array_iteration_value];
          }
      }
      else if(sourceDoc.layers[lays1].groupItems[group1].groupItems[group3].textFrames[text_1].lines.length==1)
      {
          text_buffer_array=sourceDoc.layers[lays1].groupItems[group1].groupItems[group3].textFrames[text_1].contents;
          }
      var text_6=text_buffer_array.replace(/\s/g, "")
      var text_7=array[k].replace(/\s/g, "")
      if(text_6==text_7)
      {
          text_found=1;
          }
      }
      }
      
      
      if( text_found==0)
      {
                     mainloop3:
                     for(var group3=0;group3<sourceDoc.layers[lays1].groupItems[group1].groupItems.length;group3++)
                     {
                         for(var text_1=0;text_1<sourceDoc.layers[lays1].groupItems[group1].groupItems[group3].textFrames.length;text_1++)
                         {
                             if(!sourceDoc.layers[lays1].groupItems[group1].groupItems[group3].textFrames[text_1].contents.match(/[A,B,C,D,E,F,H,L,M,N,P,R,T][0-9]{1,3}$/)) continue; 
                               if(sourceDoc.layers[lays1].groupItems[group1].groupItems[group3].textFrames[text_1].contents==array[k])
                             {
                             sourceDoc.layers[lays1].groupItems[group1].groupItems[group3].textFrames[text_1].textRange.characterAttributes.fillColor=magentaColor6;
                             sourceDoc.layers[lays1].groupItems[group1].groupItems[group3].textFrames[text_1].textRange.characterAttributes.size=10;
                             break mainloop3;
                             }
                         }
                     }
                 }
             else
             {
                  file_output1.writeln(array[k]+","+text2+","+sourceDoc.name);
                  }
             }
         }
      }
      }
      else
      {
          }
      }
      }
      }
      }
      }
      
      
      
      
       function check4 (nme) 
       {  
          if( (/^([A,B,C,D,E,F,H,K,M,N,R,T,Y][0-9]{1,3}:){1,9}$/).test( nme ) == false) {  
              return false; }  
          return true;  
      }  
      
      
      
      
      
      
      function get_connector_name_cil(text)
      {
           for(csv_iter = 0;csv_iter < fileArray_SM_name.length; csv_iter++)
          {
              if(text== fileArray_SM_name[csv_iter][0])
              {
                  return fileArray_SM_name[csv_iter][1]
                  }
              }
          }
      
      
      
      
      function match_AAA_text(text3)
      {
         
          for(var lays2=0;lays2<sourceDoc.layers.length;lays2++)
          {
              for(var group3=0;group3<sourceDoc.layers[lays2].groupItems.length;group3++)
              {
                  if(sourceDoc.layers[lays2].groupItems[group3].name=="AAA")
                  {
                      var text_found=0;
                      var arr1=[];
                     mainloop1:
                      for(var text4=0;text4<sourceDoc.layers[lays2].groupItems[group3].textFrames.length;text4++)
                      {
                          if(sourceDoc.layers[lays2].groupItems[group3].textFrames[text4].lines.length>1)
                          {
                              one_line_link_name=Make_one_line(sourceDoc.layers[lays2].groupItems[group3].textFrames[text4]);
                               var text_buffer_array = one_line_link_name[0];
                                  for( array_iteration_value = 1 ;array_iteration_value<one_line_link_name.length; array_iteration_value++)
              {
                 
                 text_buffer_array = text_buffer_array+one_line_link_name[array_iteration_value];
          }
      }
      else if(sourceDoc.layers[lays2].groupItems[group3].textFrames[text4].lines.length==1)
      {
          text_buffer_array=sourceDoc.layers[lays2].groupItems[group3].textFrames[text4].contents;
          }
      
      
      var text5=text3.replace(/\s/g, "") 
      var text6=text_buffer_array.replace(/\s/g, "")
      
      
      
      
      if(text5==text6)
      {
      
      
          text_found=1;
          break mainloop1;
          }
      }
      if(text_found==0 )
      {
          return 0;
          }
      else
      {
      return 1;
      }
      }
      }
      }
      
      
      }
      
      
      
      
      function type_of_path(check_path_prop)
      {
          stroke_weight = Math.round(check_path_prop.strokeWidth*1000); 
          
          stroke_C = Math.round(check_path_prop.strokeColor.cyan);
        
          stroke_K = Math.round(check_path_prop.strokeColor.black);
          
          stroke_M = Math.round(check_path_prop.strokeColor.magenta);
          
          stroke_Y = Math.round(check_path_prop.strokeColor.yellow);
          
         
         
          Fill_C = Math.round(check_path_prop.fillColor.cyan);
         
          Fill_K = Math.round(check_path_prop.fillColor.black);
           
          Fill_M = Math.round(check_path_prop.fillColor.magenta);
            
          Fill_Y = Math.round(check_path_prop.fillColor.yellow);
            
             path_height = Math.round(check_path_prop.height); 
          path_area = Math.round(check_path_prop.area);
          
          path_area_rect = Math.round(check_path_prop.width*check_path_prop.height);
         
          path_area_circle= Math.round(3.14*(check_path_prop.height/2)*(check_path_prop.height/2));
        
               if(path_area<0)
               {
            path_area*=-1;
               }
         if(path_height<0)
               {
            path_height*=-1;
               }
      
      
              if(check_path_prop.filled == true)  
              {
                          
                       Filled_or_not = 2;
               }
               else
                {
                   
                      Filled_or_not = 1;
                 }
             
               if(check_path_prop.stroked == true)  
              {
                          
                       Stroked_or_not = 2;
               }
               else
                {
                   
                      Stroked_or_not = 1;
                 }
                  if(check_path_prop.closed == true)
             {
                 Is_closed=1;
              }
             else
             {
                 Is_closed=0;
               }
                            if(check_path_prop.strokeDashes.length == 2) 
                  {     
                  Is_dashed = 1;
                  stroke_dash1=Math.round(check_path_prop.strokeDashes[0]);
                  stroke_dash2=Math.round(check_path_prop.strokeDashes[1]);
                  }
                  else if(check_path_prop.strokeDashes.length  == 0)
                  {
                     
                     Is_dashed = 0;
                      
                   }
                   else
                   {
                              
                          Is_dashed = -1;    
                       
                    }
      
      
      
      
        if((check_path_prop.pathPoints.length == 1) &&(stroke_C == 0 && stroke_M == 0 && stroke_Y == 0 && stroke_K == 100)  && (Filled_or_not ==1) && (stroke_weight==1000))
        {
        return("Anchor point");//points
              }
      
      
      
      
        if(path_area==129)
        {
        if((stroke_weight>=560 && stroke_weight<=570)  && (stroke_C == 0 && stroke_M == 0 && stroke_Y == 0 && stroke_K == 100) && (Is_closed==1) && (Filled_or_not ==1))
        {
        return("Rounded Rectangle");//callout
        }
        }
      
      
      
      
        if((path_area==path_area_rect )&&(stroke_weight>=560 && stroke_weight<=570)&& (stroke_C == 0) && (stroke_M == 0) && (stroke_Y ==0 )&& (stroke_K == 100) &&(Is_closed==1) )
        {
        if( Fill_C == 0 && Fill_M == 70 && Fill_Y == 60 && Fill_K ==0)
        {
          return("Rectangle Type 1"); //Battery Color
        }
        else if ( Fill_C == 0 && Fill_M == 0 && Fill_Y == 25 && Fill_K == 0)
        {
          return("Rectangle Type 2");//unit color
        }
        else if ( Fill_C == 0 && Fill_M == 25 && Fill_Y == 25 && Fill_K == 0)
        {
          return("Rectangle Type 3");//fuse color
        }
        else if(Filled_or_not == 1 && (Is_dashed==0) && check_path_prop.pathPoints.length == 4 )
        {
            return("Rectangle Type 4");//ignition swithch
          
              }
          
       }
       if((stroke_weight>=560 && stroke_weight<=570)&& (stroke_C == 0) && (stroke_M == 0) && (stroke_Y ==0 )&& (stroke_K == 100) &&(Is_closed==1) && (Fill_C == 0 && Fill_M == 0 && Fill_Y == 25 && Fill_K == 0))
        {
          return("Rectangle Type 10"); //rectangle Color
        }
           if((stroke_weight>=560 && stroke_weight<=570)&& (stroke_C == 0) && (stroke_M == 0) && (stroke_Y ==0 )&& (stroke_K == 100) &&(Is_closed==1) && (Fill_C == 0 && Fill_M == 70 && Fill_Y == 60 && Fill_K == 0))
        {
          return("Rectangle Type 12"); //rectangle Color
        }
          if((stroke_weight>=560 && stroke_weight<=570)&& (stroke_C == 100) && (stroke_M == 50) && (stroke_Y ==0 )&& (stroke_K == 0) && (Is_dashed==1) && (Filled_or_not ==1) )
          {
              return("Rectangle Type 5");//shield unit
             }
        if((stroke_weight>=560 && stroke_weight<=570)&& (stroke_C == 0) && (stroke_M == 0) && (stroke_Y ==0 )&& (stroke_K == 100) && (Is_dashed==1) && (Filled_or_not ==1) )
          {
              return("Rectangle Type 11");//shield unit
             }
        
          if((stroke_weight>=560 && stroke_weight<=570)&& (stroke_C == 0) && (stroke_M == 0) && (stroke_Y ==0 )&& (stroke_K == 100) &&(Is_closed==1) && ( Fill_C == 0) && (Fill_M == 0) && (Fill_Y == 0) && (Fill_K ==0  ) && (path_area!=25) )
          {
              return("Rectangle Type 6");//Varient unit
             }
          if((stroke_weight>=560 && stroke_weight<=570)&& (stroke_C == 0) && (stroke_M == 0) && (stroke_Y ==0 )&& (stroke_K == 100) &&(Is_closed==1) && (Filled_or_not ==1) && check_path_prop.pathPoints.length == 4 )
          {
              return("Rectangle Type 13");//Varient unit
             }
           if((stroke_weight>=560 && stroke_weight<=570)&& (stroke_C == 0) && (stroke_M == 0) && (stroke_Y ==0 )&& (stroke_K == 100) &&(Is_closed==1) && (Filled_or_not ==1))
          {
              return("Rectangle Type 7");//Varient unit
             }
         
         
            if((stroke_weight>=560 && stroke_weight<=570)&& (stroke_C == 0) && (stroke_M == 0) && (stroke_Y ==0 )&& (stroke_K == 100) &&(Is_closed==1) && (Fill_C == 0 && Fill_M == 0 && Fill_Y == 0 && Fill_K == 100) && (check_path_prop.pathPoints.length==3) )
          {
              return("Rectangle Type 8");//Triangle
             }
         
          
            if((Filled_or_not ==1) && (Stroked_or_not ==1))
          {
              return("GuideLine");//Varient unit
             }
      
      
        if((path_area==25)&&(Is_closed==1) && (stroke_weight>=560 && stroke_weight<=570))
        {
      
      
        if((stroke_C == 0 && stroke_M == 0 && stroke_Y == 0 && stroke_K == 100) && (Fill_C == 0 && Fill_M == 0 && Fill_Y == 0 && Fill_K == 100))
        {
        return("Circle Type 1");//circle filled
        }
        else if((stroke_C == 100 && stroke_M == 50 && stroke_Y == 0 && stroke_K == 0) && (Fill_C == 100 && Fill_M == 50 && Fill_Y == 0 && Fill_K == 0))
        {
        return("Circle Type 2");//Ground unit color
        }
        else if((stroke_C == 0 && stroke_M == 100 && stroke_Y == 100 && stroke_K == 0) && (Fill_C == 0 && Fill_M == 100 && Fill_Y == 100 && Fill_K == 0))
        {
        return("Circle Type 3");//battery circle color
        }
        else if((stroke_C == 0 && stroke_M == 0 && stroke_Y == 0 && stroke_K == 100) && (Fill_C == 0 && Fill_M == 0 && Fill_Y == 0 && Fill_K == 0))
        {
        return("Circle Type 4");//unit not filled
        }
        else if((stroke_C == 100 && stroke_M == 50 && stroke_Y == 0 && stroke_K == 0)&& (Fill_C == 0 && Fill_M == 0 && Fill_Y == 0 && Fill_K == 0))
        {
        return("Circle Type 5");//ground not filled
        }
        else if((stroke_C == 0 && stroke_M == 100 && stroke_Y == 100 && stroke_K == 0) && (Fill_C == 0 && Fill_M == 0 && Fill_Y == 0 && Fill_K == 0))
        {
        return("Circle Type 6");// Battery Unit filled
        }
         
      
      
        }
      
      
        if((path_area==6)&&(Is_closed==1) && (stroke_weight>=560 && stroke_weight<=570))
        {
      
      
        if((stroke_C == 0 && stroke_M == 0 && stroke_Y == 0 && stroke_K == 100) && (Fill_C == 0 && Fill_M == 0 && Fill_Y == 0 && Fill_K == 100))
        {
        return("Circle Type 8");//circle filled
        }
        else if((stroke_C == 100 && stroke_M == 50 && stroke_Y == 0 && stroke_K == 0) && (Fill_C == 100 && Fill_M == 50 && Fill_Y == 0 && Fill_K == 0))
        {
        return("Circle Type 9");//Ground unit color
        }
        else if((stroke_C == 0 && stroke_M == 100 && stroke_Y == 100 && stroke_K == 0) && (Fill_C == 0 && Fill_M == 100 && Fill_Y == 100 && Fill_K == 0))
        {
        return("Circle Type 10");//battery circle color
                  
        }
          else if((stroke_C == 0 && stroke_M == 0 && stroke_Y == 0 && stroke_K == 100) && (Fill_C == 0 && Fill_M == 0 && Fill_Y == 25 && Fill_K == 0))
        {
        return("Circle Type 11")
                  }}
      // Checking Line Type
              
            if((stroke_weight>=1410 && stroke_weight<=1420 )&& (Filled_or_not == 1) && (Is_closed==0))
        {
        if(Is_dashed== 0)
          {
            if(stroke_C == 0 && stroke_M == 0 && stroke_Y == 0 && stroke_K == 100)
        {
          return("Line Type 1");//unit line color
        }
          else if (stroke_C == 100 && stroke_M == 50 && stroke_Y == 0 && stroke_K == 0 && (path_height!=6) )
        {
          return("Line Type 2");//ground line color
        }
              
              else if (stroke_C == 100 && stroke_M == 50 && stroke_Y == 0 && stroke_K == 0 && (path_height==6) )
        {
          return("Line Type 12");//ground line color
        }
          else if(stroke_C == 0 && stroke_M == 100 && stroke_Y == 100 && stroke_K == 0)
        {
          return("Line Type 3");//battery line color
        }
        }
        else if(Is_dashed==1)
        {
          if((stroke_C == 0 && stroke_M == 0 && stroke_Y == 0 && stroke_K == 0)  && (stroke_dash1==3 && stroke_dash2==6))
            {
        return("Line Type 4");//can line color
            }
            } 
           }
        if((stroke_weight>=560 && stroke_weight<=570 )&& (Filled_or_not == 1)&& (Is_closed==0))
        {
        if (Is_dashed== 0)
        {
        if(stroke_C == 0 && stroke_M == 0 && stroke_Y == 0 && stroke_K == 100)
        {
          return("Line Type 5");
        }
              else if((stroke_C == 100 && stroke_M == 50 && stroke_Y == 0 && stroke_K == 0))
        {
          return("Line Type 6");
        }
                  }
        else if(Is_dashed== 1)
        {
                 
                if((stroke_C == 0 && stroke_M == 0 && stroke_Y == 0 && stroke_K == 100) )
        {
          return("Line Type 7");
        }
        }
        }
      
      
       if((stroke_weight>=560 && stroke_weight<=570 )&& (Is_closed==0))
        {
        if (Is_dashed== 0)
        {
        if(stroke_C == 0 && stroke_M == 0 && stroke_Y == 0 && stroke_K == 100 && Fill_C == 0 && Fill_M == 0 && Fill_Y == 25 && Fill_K == 0)
        {
          return("Line Type 5");
        }
              else if((stroke_C == 100 && stroke_M == 50 && stroke_Y == 0 && stroke_K == 0 && Fill_C == 0 && Fill_M == 0 && Fill_Y == 0 && Fill_K == 100))
        {
          return("Line Type 6");
        }
                  }
                  }
      
      
       if((stroke_weight>=560 && stroke_weight<=570)&& (Is_closed==0) && (Is_dashed== 0))
        {
      
        if(stroke_C == 0 && stroke_M == 0 && stroke_Y == 0 && stroke_K == 100 && (Fill_C == 0 && Fill_M == 0 && Fill_Y == 0 && Fill_K ==100))
        {
          return("Line Type 8");
        }
            }
        if((stroke_weight>=2260 && stroke_weight<=2268)&& (Filled_or_not == 1) && (Is_closed==0))
        {
        if((stroke_C == 0 && stroke_M == 0 && stroke_Y == 0 && stroke_K == 100) )
        {
          return("Line Type 10");
        }
        }
       else
           {
               return("Incorrect Path Properties");
             }
      
      
      }
      
        • 1. Re: Adobe Illustrator not responding !!
          Silly-V Adobe Community Professional

          That is a lot of code, my own brain stopped responding after  just a few lines. My thought is- your files over 900KB may have some different art inside which may conflict with some of your script logic and cause an infinite loop somewhere.

          • 2. Re: Adobe Illustrator not responding !!
            williamadowling Level 4

            i have carpal tunnel just from reading blocks of code like this:

             

            for (var group4 = 0; group4 < sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].groupItems[group3].groupItems.length; group4++)
            {
              if (sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].groupItems[group3].groupItems[group4].name.slice(0, 15) == "connectornumber")
              {
                sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].groupItems[group3].moveToBeginning(sourceDoc.layers[lays1]);
                break;
              }
            }
            

             

            I'm curious why you seem to be minimizing the number of variables you use. In my opinion writing things this way makes it very difficult to debug anything.

             

            But to the root of your question, my guess is that the issue is related to some of your functions that have loops nested 4 or 5+ deep. And after spot checking several different functions, almost all of them start by looping all of the layers in the document. So it looks like every time you want to do something different, or check for another case, you start back at the beginning and begin looping through everything again. In files of any significant size, this is really going to eat away at resources and cause the kind of issues you're describing.

             

            It's quite difficult to figure out what is actually causing the problem here because i don't have the foggiest idea what these 6600 lines of code are trying to do (and it would take me a week at least to sift through it and figure that out). Perhaps more information on what you're trying to do might help. It's hard to say whether Silly-V is right that there's an infinite loop in there somewhere, but it's possible that there's a "virtual infinite loop" (just made that up) as a result of repeating deeply nested loops over and over causing all the resources to be gobbled up and then illustrator just can't cope.

             

             

            **EDIT**

             

            A possible culprit that i just noticed is that several times throughout the script you run loops using the loop variable "array_iteration_value" and you declare this variable as a global variable, like so:

             

            for(array_iteration_value = 1; array_iteration_value < something; array_iteration_value++)
            {
                 //do something
            }
            

             

            instead of using var to declare that variable within the current scope like so:

            for(var array_iteration_value = 1; array_iteration_value < something; array_iteration_value++)
            {
                 //do something
            }
            

             

            Perhaps some of your loop variables are tripping over one another and resulting in unexpectedly high iterations of some loops?

            1 person found this helpful
            • 3. Re: Adobe Illustrator not responding !!
              karth80472045 Level 1

              thank you so much for your advice and i am a beginner in java script so only i use this kind of initialisation.

              • 4. Re: Adobe Illustrator not responding !!
                williamadowling Level 4

                totally understand. Silly-V once politely chastised me for the same thing because i was getting errors as a result of doing the same thing.. in my case i was using nested loops where some loop variables overlapped and everything came crashing down.

                 

                I certainly wasn't trying to be mean or judgmental. Just seeing a lot of the mistakes that i did when i first started. though i never wrote anything nearly as complex as this appears to be, even to this day. The fact that you have this much code working on any file at all is a tremendous accomplishment for a beginner.

                 

                perhaps update your loops by initializing the loop variable with "var" and see whether that helps anything. The only other thing i can think of that might be relatively quick or easy, at least to glean some insight as to where things are going wrong, is to add some log messages to the beginning and end of each function, so you can see what was happening right before the script got hung up. that might help narrow it down to a few places rather than just kind of being completely in the dark.

                • 5. Re: Adobe Illustrator not responding !!
                  williamadowling Level 4

                  Another likely culprit is this function here:

                   

                  group_name_normal()

                   

                  this function loops every single pathItem in the document. this is almost always a bad idea because of the sheer number of pathItems that can exist in even a moderately sized document. Especially since it appears you're working with complex technical drawings, perhaps exploded views of automobile construction?

                  • 6. Re: Adobe Illustrator not responding !!
                    karth80472045 Level 1

                    Thank you so much for spending the time with my code , now i have got the logic how to write the code, now i modifying all the functions once it is completed i will let you know if there is any issues. if there is any issues i will contact you.

                    • 7. Re: Adobe Illustrator not responding !!
                      karth80472045 Level 1

                      hello sir,

                      now it is working fine but  i am getting parm error in illustrator, is there any solution to resolve parm error

                      • 8. Re: Adobe Illustrator not responding !!
                        williamadowling Level 4

                        Typically that error is caused by corrupted properties under the hood (for example, trying to read the 'name' property of a layer or groupItem). This error happens more frequently when you are opening/closing many files during execution, (for example, trying to batch a folder of files where the script opens one or more files, does some modification, then closes the files, and then opens one or more files, etc.)

                         

                        If the parm error is happening randomly and unpredictably, then it's likely that the above situation is the culprit. If it seems to be happening in the exact same spot every time, then there could be some other error in your code.. I don't know of all of the possible ways to generate this error, but a few examples are as follows:

                         

                        • trying to remove the only artboard in the document (a document must contain between 1 and 100 artboards)
                        • trying to add the 101st artboard (see above)
                        • trying to add a new artboard with invalid bounds. (see example below)
                          • var myArtboard = app.activeDocuments.artboards.add([0,0,50,50]);
                          • the artboard bounds are measured like this: [left,top,right,bottom]
                          • so in the example above, the bottom coordinate is higher than the top coordinate (top is 0, bottom is 50).
                          • to make this work, you'd need to make the last bound negative ([0,0,50,-50])
                        • Trying to duplicate/move an item from one document directly into a group in another document.. unfortunately, you need to duplicate the item into the other document and THEN move it into the desired group.. this particular issue is a thorn in my side for the last several days for a script that i'm working on... frustrating.

                         

                        There are more ways to reliably generate this error i'm sure, but i cannot recall them at this time.

                         

                        Hope this is helpful. Unfortunately the PARM/MRAP errors are NOT helpful as they don't say anything about why the error occurred.

                        • 9. Re: Adobe Illustrator not responding !!
                          karth80472045 Level 1

                          Thank you very much sir!!!

                           

                          function unlock()

                          {

                          for (var i = sourceDoc.pageItems.length - 1; i >= 0; i--) {

                              pItem = sourceDoc.pageItems[i];

                              if (pItem.locked == true) {

                                  pItem.locked = false;

                               

                              }

                           

                          };

                          }

                           

                           

                          or

                           

                           

                          function unlock ( items ) {

                              var i = items.length;

                              if ( i ) {

                               while ( i-- ) {

                                      items[i].locked = false;

                                      if ( items[i].typename === 'GroupItem' ) {

                                          unlock( items[i].pageItems );              }

                                          else if ( items[i].typename === 'Layer' ) {

                                             unlock( items[i].layers );

                                             unlock( items[i].pageItems );

                                         }

                                 }

                             }

                          }

                           

                           

                           

                          i am getting parm error on unlock pageitems if it is locked, i have tried in both ways but it shows parm error after looping for several files in a folder.

                          • 10. Re: Adobe Illustrator not responding !!
                            williamadowling Level 4

                            hmmm. it's hard to say what the issue might be. But as a general rule, it's always a bad idea to run a loop on sourceDoc.pageItems.length.

                             

                            Illustrator is sort of wonky with scope when it comes to elements of a document. Let's consider a document that has two rectangles that are grouped together, and this group lives on the first layer ( layer[0] ). So one group, containing only two simple pathItems.

                             

                            If you print out the length of the pathItems on that layer like so:

                            sourceDoc.layers[0].pathItems.length;

                            you will get 0. This is because in the scope of layers[0], there are no pathItems, there's only one groupItem. However, if you print the length of pathItems in the document like so:

                            sourceDoc.pathItems.length;

                            you'll get 2. When you look at any property of the document object as a whole (pathItems, groupItems, compoundPathItems, textFrames, placedItems.... By the way, pageItems encompasses all of these) you will see every single one that exists in the document, even if it is nested 100 levels deep inside different groups or layers.

                             

                            To further illustrate, let's expand the example above. again, with a single layer in the document, on that layer you have 1 simple path item, and one group item that contains 100 subgroups, and each subgroup contains two compound paths that are each comprised of two pathItems.

                             

                            sourceDoc.layers[0].pathItems.length; //returns 1

                            sourceDoc.pathItems.length; //returns 201

                             

                            and lastly, since pageItems encompasses all of the different elements that could be in a document, the numbers get even weirder. Using the exact same example (one path, one group with 100 groups), this is what those numbers would be:

                            sourceDoc.layers[0].pageItems.length; //returns 2, one pathItem and one groupItem

                            sourceDoc.pageItems.length; //returns 302, one pathItem, one groupItem, 100 compoundPathItems, 200 pathItems (two pathItems in each compoundPathItem).

                            So as you can see, every single constituent component of the document is counted when you run a loop over the pageItems in the context of the document object. And you can see that with an extremely simple document (1 layer, 1 path, 1 group) we're already up to 300+ individual items in the document. It's not difficult, especially when working with technical drawings or other complex artwork, to end up with 100,000+ individual items in the document. Not only does this take a long time to process, it eats up memory and makes you more susceptible to parm errors.

                             

                            All that to say, your second version of the unlock() function is much closer to the mark. You should be predetermining what should be unlocked, then pass in only those items to the unlock function. For example, your process dictates that everything that is contained in the layer called "My Locked Stuff" needs to be unlocked. So instead of accessing every pageItem in the document, you'll pass in the pageItems of the layer "My Locked Stuff" to the unlock function, so that only those things will be processed. Now, Since you're passing an array of pageItems, you don't need the conditional statement that determines whether the item is a layer. you already know it's a pageItem, therefore it cannot be a layer. If you're worried about potential sub layers that could have art on them that you need to unlock also, there's a different way to do that. Here's how i'd tackle this problem:

                             

                            function unlockLayer(layer)
                            {
                                //check for any subLayers
                                var layLen = layer.layers.length;
                                for(var x=0;x<layLen;x++)
                                {
                                    layer.layers[x].locked = false;
                                    unlockLayer(layer.layers[x]);
                                }
                            
                            
                                //all the sublayers have been unlocked,
                                //now unlock all pageItems recursively
                                var itemLen = layer.pageItems.length;
                                for(var x=0;x<itemLen;x++)
                                {
                                    unlockItem(layer.pageItems[x]);
                                }
                                
                            }
                            
                            
                            function unlockItem(item)
                            {
                                if(item.typename === "GroupItem")
                                {
                                    item.locked = false;
                                    var itemLen = item.pageItems.length;
                                    for(var x=0;x<itemLen;x++)
                                    {
                                        unlockItem(item.pageItems[x]);
                                    }
                                }
                                else
                                {
                                    item.locked = false;
                                }
                            
                            
                            }
                            
                            
                            unlockLayer(app.activeDocument.layers["My Locked Stuff"]);
                            
                            • 11. Re: Adobe Illustrator not responding !!
                              karth80472045 Level 1

                              Thanks for the reply , i will check and let you know

                              • 12. Re: Adobe Illustrator not responding !!
                                karth80472045 Level 1

                                Hello sir ,

                                parm error occurs after execution of 5 files out of 170 files in a folder , i have tried this one from this link[Illustrator] Relaunch AI to aviod "PARM" error · GitHub  but it process only one AI file in a folder other files it is not executing.

                                 

                                This is my tried code

                                 

                                var magentaColor6= new CMYKColor();

                                magentaColor6.cyan = 75;//orange

                                magentaColor6.magenta =100;

                                magentaColor6.yellow = 0;

                                magentaColor6.black = 0;

                                var magentaColor10 = new CMYKColor();

                                magentaColor10.cyan = 18.43;

                                magentaColor10.magenta =100;

                                magentaColor10.yellow = 100;

                                magentaColor10.black = 10.2;//Brown

                                 

                                 

                                var magentaColor9 = new CMYKColor();

                                magentaColor9.cyan = 0;

                                magentaColor9.magenta =99;

                                magentaColor9.yellow = 0;

                                magentaColor9.black = 0; //magenta 1

                                 

                                 

                                var magentaColor7 = new CMYKColor();

                                magentaColor7.cyan = 0;

                                magentaColor7.magenta =97;

                                magentaColor7.yellow = 0;

                                magentaColor7.black = 0;//magenta 2

                                 

                                 

                                var magentaColor8 = new CMYKColor();

                                magentaColor8.cyan = 0;

                                magentaColor8.magenta =95;

                                magentaColor8.yellow = 0;

                                magentaColor8.black = 0;//magenta 3

                                 

                                 

                                var magentaColor4 = new CMYKColor();

                                magentaColor4.cyan = 60.39;

                                magentaColor4.magenta =32.94;

                                magentaColor4.yellow = 100;

                                magentaColor4.black = 14.51;//Green

                                 

                                 

                                var magentaColor1 = new CMYKColor();

                                magentaColor1.cyan = 56.47;

                                magentaColor1.magenta =0;

                                magentaColor1.yellow = 63.92;

                                magentaColor1.black = 0;//LIGHT GREEN

                                 

                                 

                                var magentaColor2 = new CMYKColor();

                                magentaColor2.cyan = 19.61;

                                magentaColor2.magenta =100;

                                magentaColor2.yellow = 69.02;

                                magentaColor2.black = 8.63;//Dark Brown

                                 

                                 

                                var magentaColor3 = new CMYKColor();

                                magentaColor3.cyan = 0;

                                magentaColor3.magenta =69.8;

                                magentaColor3.yellow = 100;

                                magentaColor3.black = 0;//light orange

                                 

                                 

                                 

                                 

                                fileArray_SM_name = get_csvfile("Select CIL CSV List");

                                  fileArray_title = get_csvfile("Select ID List CSV");

                                 

                                 

                                     

                                   function get_csvfile(Str_File)

                                {

                                    var csv_file;

                                 

                                 

                                    csv_file = File.openDialog (Str_File);

                                   

                                   

                                 

                                 

                                    if(!csv_file.exists)

                                    {

                                      

                                 

                                        return;

                                     }

                                     else

                                    {

                                     

                                       fileArray_buffer = save_elements(csv_file);

                                      

                                     

                                     }

                                    return fileArray_buffer;

                                }

                                function save_elements( fileObj )

                                        var thisLine, csvArray; 

                                         fileArray_save_elements =[]; 

                                          fileObj.open( 'r' );

                                         while( !fileObj.eof )

                                         { 

                                            

                                                   thisLine = fileObj.readln(); 

                                                   csvArray = thisLine.split( ',' ); 

                                                   fileArray_save_elements.push( csvArray ); 

                                          }; 

                                    

                                       return fileArray_save_elements;

                                          fileObj.close(); 

                                       

                                }; 

                                rasterizeFolder(); 

                                 

                                /***************************************************************************************** ***/ 

                                function rasterizeFolder() 

                                    //Get the source and destination folders. 

                                    //If either window is cancelled, end the script. 

                                    var sourceFolder = getSourceFolder (); 

                                    if(sourceFolder == null){return;} 

                                    var destinationFolder = getDestinationFolder (); 

                                    if(destinationFolder == null){return;} 

                                   error_file_name=sourceFolder.path+'/Tabledata.csv';

                                       error_file_name1=sourceFolder.path+'/Connector Numbers.csv';

                                        file_output=new File (error_file_name);

                                    

                                        file_output.open ('e');

                                         file_output.writeln ("CircuitFileName"+","+"LineNumber"+","+"Type"+","+"ConnectorNumber"+","+"TerminalNumber" +","+"FileName"+","+"DisplayName");

                                           file_output1=new File (error_file_name1);

                                    

                                        file_output1.open ('e');

                                         file_output1.writeln ("Connector Number"+","+"file Name");

                                    //Stuff for statistics 

                                    var fileCount = 0; 

                                    var itemsProcessed = 0; 

                                    var itemsToReset = 9000;   //Used to periodically close and reopen Illustrator to avoid memory issues. 

                                    var startTime = new Date().getTime(); 

                                    var endTimeMS = 0; 

                                    var endSecs = 0; 

                                    var endMins = 0; 

                                 

                                    //Rasterize files by type. 

                                    rasterizeAllOfType ("*.ai"); 

                                    //rasterizeAllOfType ("*.pdf"); 

                                 

                                    //Get the time taken for the script in milliseconds, and convert to minutes and seconds. 

                                    endTimeMS = new Date().getTime() - startTime; 

                                    endSecs = Math.floor(endTimeMS/1000); 

                                    endMins = Math.floor(endSecs/60); 

                                    endSecs -= (endMins*60); 

                                 

                                 

                                 

                                    /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 

                                    function getSourceFolder(){ 

                                        var sourceFolder = Folder.selectDialog("Choose the folder you wish to rasterize."); 

                                 

                                        if(sourceFolder == null){ 

                                            //User cancelled, do nothing. 

                                            return; 

                                        } else if(sourceFolder.getFiles().length < 1){ 

                                            //The folder contains nothing, make the user select another. 

                                            alert("The source folder you selected contains no files. Select a different one."); 

                                            sourceFolder = getSourceFolder (); 

                                            return sourceFolder; 

                                        } else { 

                                            //We have a usable folder. 

                                            return sourceFolder; 

                                        } 

                                    }//End of getSourceFolder 

                                    /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 

                                    function getDestinationFolder(){ 

                                        var destinationFolder = Folder.selectDialog ("Where should the rasterized files go?"); 

                                 

                                        if(destinationFolder == null){ 

                                            //User cancelled, do nothing. 

                                            return; 

                                 

                                        } else if (destinationFolder.getFiles().length < 1){ 

                                            //The folder contains nothing and is therefore safe to use. 

                                            return destinationFolder; 

                                 

                                        } else if (sourceFolder.getFiles()[0].path == destinationFolder.getFiles()[0].path){ 

                                            //The user chose the same folder for the source and destination. 

                                            //See if it's okay to overwrite the files in there. 

                                            var OKtoOverwrite = confirm("Source and destination are the same. Files will be overwritten. Do you want to continue?"); 

                                 

                                            if (OKtoOverwrite == true){ 

                                                //Okay to overwrite, proceed. 

                                                return destinationFolder; 

                                            } else { 

                                                //Not okay, make a different choice. 

                                                destinationFolder = getDestinationFolder (); 

                                                return destinationFolder; 

                                            } 

                                 

                                        } else { 

                                            //Folder has contents, but turned out to be different than the source folder. 

                                            return destinationFolder; 

                                        } 

                                    }//End of getDestinationFolder 

                                    /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 

                                    function rasterizeAllOfType(filetype) 

                                    { 

                                        //Get all files of the type I'm working on 

                                        var fileList = new Array(); 

                                            fileList = sourceFolder.getFiles(filetype); 

                                 

                                        if(fileList.length > 0){ 

                                            //There are files to work with of this type. 

                                 

                                            //New code here. 

                                            var j = 0; 

                                            AIrasterize(fileList, destinationFolder, itemsProcessed, itemsToReset, filetype); 

                                            fileCount += fileList.length; 

                                            return; 

                                 

                                        } else { 

                                            //No files of this type are in the folder. 

                                            return;  

                                        } 

                                        /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 

                                     function AIrasterize(fileList, destinationFolder, itemsProcessed, itemsToReset) {

                                            /*

                                                NOTICE: If a function is sent via bridgetalk, either use <function>.toString()

                                                        or avoid using single-line comments in it. If just sent normally, it

                                                        will be read as if it is all one line, and thus break from comments.

                                              */

                                            var bt = new BridgeTalk();

                                            bt.target = 'illustrator';

                                            bt.body = rasterizeDoc.toString() + ";rasterizeDoc(" + fileList[j].toSource() + "," + destinationFolder.toSource() + "," + itemsProcessed + "," + itemsToReset + ");";

                                            bt.onResult = function(resultMsg) {

                                                //var myStatus = BridgeTalk.getStatus('illustrator');

                                                itemsProcessed = eval(resultMsg.body);

                                                if (!itemsProcessed) {

                                                    // waiting for illustrator to quit.

                                                    while (BridgeTalk.getStatus('illustrator') != 'ISNOTRUNNING') $.sleep(20);

                                                    // as the last opened file has not been processed, so go back to it.

                                                    j--;

                                                }

                                               

                                                ++j < fileList.length && AIrasterize(fileList, destinationFolder, itemsProcessed, itemsToReset);

                                                $.writeln(itemsProcessed);

                                               

                                                if (j == fileList.length) {

                                                    //Get the time taken for the script in milliseconds, and convert to minutes and seconds.

                                                    endTimeMS = new Date().getTime() - startTime;

                                                    endSecs = Math.floor(endTimeMS / 1000);

                                                    endMins = Math.floor(endSecs / 60);

                                                    endSecs -= (endMins * 60);

                                 

                                 

                                                    //Tell the user how long this took.

                                                    alert(fileCount + " files rasterized in " + endMins + " minutes, " + endSecs + " seconds.");

                                                }

                                            }

                                            bt.onError = function(a) {

                                                alert(a.body + "(" + a.headers["Error-Code"] + ")");

                                            }

                                            bt.send();

                                            //$.writeln(bt.body); //used to debug.

                                        } //End of AIrasterize

                                        /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 

                                        function rasterizeDoc(myDoc, destinationFolder, itemsProcessed, itemsToReset, filetype) 

                                        { 

                                            /*Open the file*/ 

                                            app.open(myDoc); 

                                             sourceDoc = app.activeDocument;

                                               itemsProcessed += sourceDoc.pageItems.length;

                                            if (itemsProcessed > itemsToReset) {

                                                sourceDoc.close(SaveOptions.DONOTSAVECHANGES);

                                                alert("Processed " + itemsProcessed + " objects. Resetting to clear memory");

                                                app.quit() /*Workaround for AIrasterize bug. BT only goes to the next when AI is closed. */

                                                /*reset itemsProcessed to 0*/

                                                return 0

                                            }

                                          

                                            var yog_lays=sourceDoc.layers;

                                  

                                           if( yog_lays.length==1)

                                           {

                                                  title_loop:

                                               for(var grp1=0;grp1<yog_lays[0].groupItems.length;grp1++)

                                            {

                                                if(yog_lays[0].groupItems[grp1].name=="<CIRCUIT TITLE>")

                                                {

                                        for (var tit=0;tit<yog_lays[0].groupItems[grp1].textFrames.length;tit++)

                                        {

                                            if(yog_lays[0].groupItems[grp1].textFrames[tit].kind ==  TextType.POINTTEXT)

                                            {

                                             if(yog_lays[0].groupItems[grp1].textFrames[tit].textRange.characterAttributes.size==12)

                                            {

                                                 if(yog_lays[0].groupItems[grp1].textFrames[tit].contents.slice(0,3)=="CAN")

                                                {

                                                      check_artboard();

                                                       unlockLayer(sourceDoc);

                                                        color_empty_pathitem();

                                                        delete_group();

                                                        delete_group1();

                                                         autoColor_updation();

                                                         check_circle_ungroup_CAN();

                                                         ungroup_group();

                                                         ungroup_units();

                                                          AAA_check1();

                                                          ungroup_units1();

                                                           remove_fuse_group1();

                                                            remove_fuse_group();

                                                            check_fuse_ungroup();

                                                             rename_fuse_group();

                                                             check_dot_repeat();

                                                              check_connector();

                                                              reduce_opacity();

                                                               reduce_opacity_1();

                                                                move_rectangle();

                                                                Check_batteryline();

                                                                  ungroup_units1();

                                                                   remove_dot_pathitem();

                                                                   color_empty_pathitem();

                                                                   check_text_empty_high();

                                                                   line_check1_unit_CAN();

                                                                   line_check1_unit_2_CAN();

                                                                   group_connector_name();

                                                                   check_rect_path_inside_check();

                                                                   rectangle_inside_path_items_check();

                                                                    variant_terminal_check();

                                                                     circleFront();

                                                                     group_Circle_name_CAN();

                                                                     checking_circleGroup_CAN()

                                                                     check_unwantedline_CAN();

                                                                     renaming_path();

                                                                     renaming_CAN();

                                                                      line_pathitem_inside_CAN();

                                                                      line_cross(file_output);

                                                                      write_to_link(file_output);

                                                                       list_connector_names(file_output1);

                                                                       check_AAA_names();

                                                                        error_check();  

                                                                         break title_loop;

                                                                         }

                                                                     else if(yog_lays[0].groupItems[grp1].textFrames[tit].contents.slice(0,7)=="CONSULT")

                                                                     {

                                                                         check_artboard();

                                                   

                                unlockLayer(sourceDoc);

                                 

                                 

                                color_empty_pathitem();

                                 

                                 

                                delete_group();

                                 

                                 

                                delete_group1();

                                 

                                 

                                  autoColor_updation();

                                 

                                check_circle_ungroup();

                                 

                                 

                                ungroup_group();

                                 

                                 

                                  ungroup_units();

                                 

                                  AAA_check1();

                                 

                                  ungroup_units1();

                                 

                                   remove_fuse_group1();

                                 

                                  remove_fuse_group();

                                 

                                  check_fuse_ungroup();

                                 

                                  rename_fuse_group();

                                 

                                  check_dot_repeat();

                                 

                                  check_connector();

                                 

                                       

                                       reduce_opacity();

                                     

                                           reduce_opacity_1();

                                         

                                           move_rectangle();

                                         

                                           Check_batteryline();

                                         

                                           ungroup_units1();

                                         

                                           remove_dot_pathitem();

                                         

                                             check_CAN_normal_AAA();

                                           

                                             color_empty_pathitem();

                                           

                                check_text_empty_high();

                                 

                                 

                                line_check1_unit();

                                 

                                 

                                line_check1_unit_2();

                                 

                                 

                                group_connector_name();

                                 

                                 

                                check_rect_path_inside_check();

                                 

                                 

                                rectangle_inside_path_items_check();

                                 

                                 

                                variant_terminal_check();

                                 

                                 

                                  circleFront();

                                 

                                  group_name_normal();

                                 

                                  checking_circleGroup_normal();

                                 

                                  check_unwantedline_normal();

                                 

                                  renaming_path();

                                 

                                  renaming_CAN();

                                 

                                  line_pathitem_inside_normal();

                                 

                                  line_cross(file_output);

                                 

                                  write_to_link(file_output);

                                 

                                  list_connector_names(file_output1);

                                 

                                   check_AAA_names();

                                 

                                   error_check();

                                       break title_loop;       

                                                   

                                                  

                                                    }

                                               

                                                 else if(yog_lays[0].groupItems[grp1].textFrames[tit].contents.slice(0,4)=="IPDM")

                                                {

                                                  unlockLayer(sourceDoc);

                                 

                                color_empty_pathitem();

                                 

                                delete_group();

                                 

                                delete_group1();

                                 

                                autoColor_updation();

                                 

                                  ungroup_units();

                                 

                                  

                                   AAA_check1();

                                  

                                      Check_battery_AAA();

                                     

                                   ungroup_units1();    

                                  

                                    remove_fuse_group1();

                                  

                                      remove_fuse_group();

                                     

                                     check_fuse_ungroup();

                                    

                                      check_dot_repeat();

                                     

                                       check_connector();

                                      

                                        rename_fuse_group();

                                       

                                       reduce_opacity();

                                      

                                           reduce_opacity_1();

                                          

                                          

                                           group_connector_name();

                                          

                                            move_rectangle();

                                           

                                            check_AAA_path_BCM();

                                           

                                            

                                                 

                                                 

                                                 

                                     

                                      list_connector_names(file_output1);

                                     

                                      error_check();

                                      break title_loop;

                                     }

                                 

                                 

                                  else if(yog_lays[0].groupItems[grp1].textFrames[tit].contents.slice(0,3)=="BCM")

                                              {

                                                  unlockLayer(sourceDoc);

                                                 

                                color_empty_pathitem();

                                 

                                delete_group();

                                 

                                delete_group1();

                                 

                                  ungroup_units();

                                 

                                   autoColor_updation();

                                  

                                   AAA_check1();

                                  

                                      Check_battery_AAA();

                                     

                                   ungroup_units1();

                                  

                                    remove_fuse_group1();

                                  

                                      remove_fuse_group();

                                     

                                     check_fuse_ungroup();    

                                    

                                      check_dot_repeat();

                                     

                                       check_connector();

                                      

                                        rename_fuse_group();

                                       

                                       reduce_opacity();

                                      

                                           reduce_opacity_1();

                                          

                                         

                                           group_connector_name();

                                          

                                            move_rectangle();

                                           

                                            check_AAA_path_BCM();

                                           

                                         

                                                 

                                                  

                                                  

                                                      

                                                       list_connector_names(file_output1);

                                                      

                                                       error_check();

                                                       break title_loop;

                                                  }

                                              else

                                              {

                                                 check_artboard();

                                                

                                unlockLayer(sourceDoc);

                                 

                                color_empty_pathitem();

                                 

                                delete_group();

                                 

                                delete_group1();

                                 

                                  autoColor_updation();

                                 

                                check_circle_ungroup();

                                 

                                ungroup_group();

                                 

                                  ungroup_units();

                                 

                                  AAA_check1();

                                 

                                  ungroup_units1();

                                 

                                   remove_fuse_group1();

                                  

                                  remove_fuse_group();

                                 

                                  check_fuse_ungroup();

                                 

                                  rename_fuse_group();

                                 

                                  check_dot_repeat();

                                 

                                  check_connector();

                                 

                                       

                                       reduce_opacity();

                                      

                                           reduce_opacity_1();

                                          

                                           move_rectangle();

                                          

                                          

                                           ungroup_units1();

                                          

                                           remove_dot_pathitem();

                                          

                                             check_CAN_normal_AAA();

                                            

                                            

                                check_text_empty_high();

                                 

                                 

                                line_check1_unit();

                                 

                                line_check1_unit_2();

                                 

                                group_connector_name();

                                 

                                check_rect_path_inside_check();

                                 

                                rectangle_inside_path_items_check();

                                 

                                variant_terminal_check();

                                 

                                circleFront();

                                 

                                  group_name_normal();

                                 

                                  checking_circleGroup_normal();

                                 

                                  check_unwantedline_normal();

                                 

                                  renaming_path();

                                 

                                  renaming_CAN();

                                 

                                  line_pathitem_inside_normal();

                                 

                                  line_cross(file_output);

                                 

                                  write_to_link(file_output);

                                 

                                  list_connector_names(file_output1);

                                 

                                   check_AAA_names();

                                  

                                   error_check();

                                  

                                   break title_loop;

                                                  

                                                   

                                                   }

                                               }

                                           }

                                       }

                                   }

                                }

                                }

                                          

                                          

                                           else if(yog_lays.length==3)

                                           {

                                              for( var lays1=0;lays1<yog_lays.length;lays1++)

                                              {

                                                  if(yog_lays[lays1].name=="RANGE" ||yog_lays[lays1].name=="ILLUST")

                                                  {

                                                        title_loop4:

                                         for (var tit=0;tit<yog_lays[lays1].textFrames.length;tit++)

                                        {

                                            if(yog_lays[lays1].textFrames[tit].kind ==  TextType.POINTTEXT)

                                            {

                                            if(yog_lays[lays1].textFrames[tit].textRange.characterAttributes.size==12)

                                            {

                                                   if(yog_lays[lays1].textFrames[tit].contents.slice(0,7)=="CONSULT")

                                                {

                                                        check_artboard();

                                                   

                                unlockLayer(sourceDoc);

                                 

                                 

                                color_empty_pathitem();

                                 

                                 

                                delete_group();

                                 

                                 

                                delete_group1();

                                 

                                 

                                  autoColor_updation();

                                 

                                check_circle_ungroup();

                                 

                                 

                                ungroup_group();

                                 

                                 

                                  ungroup_units();

                                 

                                  AAA_check1();

                                 

                                  ungroup_units1();

                                 

                                   remove_fuse_group1();

                                 

                                  remove_fuse_group();

                                 

                                  check_fuse_ungroup();

                                 

                                  rename_fuse_group();

                                 

                                  check_dot_repeat();

                                 

                                  check_connector();

                                 

                                       

                                       reduce_opacity();

                                     

                                           reduce_opacity_1();

                                         

                                           move_rectangle();

                                         

                                           Check_batteryline();

                                         

                                           ungroup_units1();

                                         

                                           remove_dot_pathitem();

                                         

                                             check_CAN_normal_AAA();

                                           

                                             color_empty_pathitem();

                                           

                                check_text_empty_high();

                                 

                                 

                                line_check1_unit();

                                 

                                 

                                line_check1_unit_2();

                                 

                                 

                                group_connector_name();

                                 

                                 

                                check_rect_path_inside_check();

                                 

                                 

                                rectangle_inside_path_items_check();

                                 

                                 

                                variant_terminal_check();

                                 

                                 

                                  circleFront();

                                 

                                  group_name_normal();

                                 

                                  checking_circleGroup_normal();

                                 

                                  check_unwantedline_normal();

                                 

                                  renaming_path();

                                 

                                  renaming_CAN();

                                 

                                  line_pathitem_inside_normal();

                                 

                                  line_cross(file_output);

                                 

                                  write_to_link(file_output);

                                 

                                  list_connector_names(file_output1);

                                 

                                   check_AAA_names();

                                 

                                   error_check();

                                       break  title_loop4;

                                       }

                                   else if(yog_lays[lays1].textFrames[tit].contents.slice(0,7)=="CAN")

                                   {

                                        check_artboard();

                                                       unlockLayer(sourceDoc);

                                                        color_empty_pathitem();

                                                        delete_group();

                                                        delete_group1();

                                                         autoColor_updation();

                                                         check_circle_ungroup_CAN();

                                                         ungroup_group();

                                                         ungroup_units();

                                                          AAA_check1();

                                                          ungroup_units1();

                                                           remove_fuse_group1();

                                                            remove_fuse_group();

                                                            check_fuse_ungroup();

                                                             rename_fuse_group();

                                                             check_dot_repeat();

                                                              check_connector();

                                                              reduce_opacity();

                                                               reduce_opacity_1();

                                                                move_rectangle();

                                                                Check_batteryline();

                                                                  ungroup_units1();

                                                                   remove_dot_pathitem();

                                                                   color_empty_pathitem();

                                                                   check_text_empty_high();

                                                                   line_check1_unit_CAN();

                                                                   line_check1_unit_2_CAN();

                                                                   group_connector_name();

                                                                   check_rect_path_inside_check();

                                                                   rectangle_inside_path_items_check();

                                                                    variant_terminal_check();

                                                                     circleFront();

                                                                     group_Circle_name_CAN();

                                                                     checking_circleGroup_CAN()

                                                                     check_unwantedline_CAN();

                                                                     renaming_path();

                                                                     renaming_CAN();

                                                                      line_pathitem_inside_CAN();

                                                                      line_cross(file_output);

                                                                      write_to_link(file_output);

                                                                       list_connector_names(file_output1);

                                                                       check_AAA_names();

                                                                        error_check();  

                                                                         break title_loop4;

                                                                         }

                                                                    

                                                                     else if(yog_lays[lays1].textFrames[tit].contents.slice(0,4)=="IPDM")

                                                                     {

                                                                          unlockLayer(sourceDoc);

                                 

                                color_empty_pathitem();

                                 

                                delete_group();

                                 

                                delete_group1();

                                 

                                autoColor_updation();

                                 

                                  ungroup_units();

                                 

                                  

                                   AAA_check1();

                                  

                                      Check_battery_AAA();

                                     

                                   ungroup_units1();    

                                  

                                    remove_fuse_group1();

                                  

                                      remove_fuse_group();

                                     

                                     check_fuse_ungroup();

                                    

                                      check_dot_repeat();

                                     

                                       check_connector();

                                      

                                        rename_fuse_group();

                                       

                                       reduce_opacity();

                                      

                                           reduce_opacity_1();

                                          

                                          

                                           group_connector_name();

                                          

                                            move_rectangle();

                                           

                                            check_AAA_path_BCM();

                                           

                                            

                                                 

                                                 

                                                 

                                     

                                      list_connector_names(file_output1);

                                     

                                      error_check();

                                      break title_loop4;

                                     }

                                 

                                      }

                                  }

                                }

                                }

                                }

                                }

                                 

                                 

                                sourceDoc.save();

                                sourceDoc.close();

                                app.quit();

                                }

                                 

                                 

                                }

                                }

                                 

                                 

                                                                    

                                                                    

                                                                    

                                  

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                                                    

                                function check_artboard()

                                {

                                   var yog_lays=sourceDoc.layers;

                                var abIdx = sourceDoc.artboards.getActiveArtboardIndex ();   

                                var abSrc = sourceDoc.artboards[abIdx]; 

                                var moveX = 4000;   

                                var moveY = 800;   

                                if(abSrc.artboardRect[0]<0)

                                {

                                var abSrc_L = abSrc.artboardRect[0] + moveX;   

                                var abSrc_T = abSrc.artboardRect[1]  + moveY 

                                 

                                 

                                var abSrc_R = abSrc.artboardRect[2] + moveX ;   

                                var abSrc_B = abSrc.artboardRect[3] +moveY 

                                abSrc.artboardRect = [abSrc_L, abSrc_T, abSrc_R, abSrc_B];

                                 

                                 

                                for( var i = 0, ii =yog_lays.length; i < ii; i++ ) { 

                                    // clear any current selection 

                                    sourceDoc.selection = null; 

                                      for(var k=0;k<yog_lays[i].groupItems.length;k++)

                                      {

                                   

                                     

                                    // translate them using the moveX and moveY variables 

                                    var curGroup = yog_lays[i].groupItems[k]; 

                                    curGroup.translate( moveX, moveY ); 

                                     

                                    }

                                for(var s=0;s<yog_lays[i].pathItems.length;s++)

                                {

                                       var curGroup = yog_lays[i].pathItems[s]; 

                                    curGroup.translate( moveX, moveY ); 

                                     

                                    }

                                 

                                 

                                for(var t=0;t<yog_lays[i].textFrames.length;t++)

                                {

                                       var curGroup = yog_lays[i].textFrames[t]; 

                                    curGroup.translate( moveX, moveY ); 

                                     

                                    }

                                 

                                 

                                   

                                    }

                                   

                                    }

                                 

                                 

                                 

                                 

                                 

                                 

                                 

                                 

                                }

                                 

                                 

                                 

                                 

                                 

                                 

                                 

                                 

                                 

                                 

                                 

                                 

                                function unlockLayer(layer) 

                                   //check for any subLayers 

                                   var layLen = layer.layers.length; 

                                   for(var x=0;x<layLen;x++) 

                                   { 

                                        layer.layers[x].locked = false; 

                                     unlockLayer(layer.layers[x]); 

                                    } 

                                 

                                 

                                   //all the sublayers have been unlocked, 

                                    //now unlock all pageItems recursively 

                                    var itemLen = layer.pageItems.length; 

                                  for(var x=0;x<itemLen;x++) 

                                   { 

                                        unlockItem(layer.pageItems[x]); 

                                   } 

                                    

                                 

                                 

                                 

                                 

                                function unlockItem(item) 

                                   if(item.typename === "GroupItem") 

                                    { 

                                        item.locked = false; 

                                        var itemLen = item.pageItems.length; 

                                        for(var x=0;x<itemLen;x++) 

                                       { 

                                            unlockItem(item.pageItems[x]); 

                                       } 

                                   } 

                                    else 

                                    { 

                                        item.locked = false; 

                                    } 

                                 

                                 

                                 

                                 

                                 

                                function delete_group()

                                  {

                                      var yog_lays=sourceDoc.layers;

                                for(var i=0;i<yog_lays.length;i++)

                                {

                                    for(var k=0;k<yog_lays[i].groupItems.length;k++)

                                    {

                                        var theObj = yog_lays[i].groupItems[k].pageItems;

                                         if( theObj.length==1)

                                         {

                                        for(var z=0;z< theObj.length;z++)

                                        {

                                           

                                          if (theObj[z].typename == "GroupItem") {

                                          

                                            theObj[z].moveBefore(theObj[z].parent);

                                              }

                                          }

                                      }

                                  }}}

                                 

                                 

                                 

                                 

                                 

                                 

                                function delete_group1()

                                  {

                                      var yog_lay=sourceDoc.layers;

                                for(var i=0;i<yog_lay.length;i++)

                                {

                                    for(var k=0;k<yog_lay[i].groupItems.length;k++)

                                    {

                                for(var z=0;z<yog_lay[i].groupItems[k].groupItems.length;z++)

                                {

                                    var yog_group1=yog_lay[i].groupItems[k].groupItems[z];

                                    var path_found=0;

                                    for(var zz=0;zz<yog_group1.groupItems.length;zz++)

                                    {

                                        if(yog_group1.groupItems[zz].name.slice(0,15)=="connectornumber")

                                        {

                                            if(yog_group1.pathItems.length==0 || yog_group1.textFrames.length==0)

                                            {

                                            var path_found=1;

                                            }

                                        }

                                    }

                                }

                                 

                                 

                                  if(path_found==1)

                                  {

                                     

                                      for(var z=0;z<yog_lay[i].groupItems[k].groupItems.length;z++)

                                {

                                 

                                 

                                    for(var zz=0;zz<yog_group1.groupItems.length;zz++)

                                    {

                                        yog_group1.groupItems[zz].moveBefore(yog_group1.groupItems[zz].parent)

                                        }

                                    }

                                }

                                }

                                }

                                }

                                 

                                 

                                 

                                 

                                 

                                 

                                function check_circle_ungroup_CAN()

                                {

                                     for(var layer_item_index=0;layer_item_index<sourceDoc.layers.length;layer_item_index++)

                                    {

                                        if(sourceDoc.layers[layer_item_index].pageItems.length>0)

                                        {

                                            layer_grp_item=sourceDoc.layers[layer_item_index].groupItems;

                                      

                                    for(var grp_main_index=0;grp_main_index<layer_grp_item.length;grp_main_index++)

                                    {

                                       

                                child_path_item_main=layer_grp_item[grp_main_index].pathItems;

                                  child_group_item=layer_grp_item[grp_main_index].groupItems;

                                    var count_groupfound=0;

                                mainloopline: 

                                  for(var grp_main_index1=0;grp_main_index1< child_group_item.length;grp_main_index1++)

                                  {

                                      if(child_group_item[grp_main_index1].name.slice(0,15)=="connectornumber" )

                                      {

                                           count_groupfound=1;

                                          break mainloopline;

                                          }}

                                   if(count_groupfound==0)

                                      {

                                           mainloopline: 

                                             for(var grp_main_index1=0;grp_main_index1< child_group_item.length;grp_main_index1++)

                                  {

                                      child_path_item_main1=child_group_item[grp_main_index1].pathItems;

                                      for(var path_1=0;path_1<child_path_item_main1.length;path_1++)

                                      {

                                           var  path_type = type_of_path(child_path_item_main1[path_1]);

                                           if(path_type=="Line Type 1" || path_type=="Line Type 2"  || path_type=="Line Type 3" || path_type=="Line Type 4"  || path_type=="Line Type 10" || path_type=="Circle Type 1"

                                           || path_type=="Circle Type 2" || path_type=="Circle Type 3"|| path_type=="Circle Type 4"|| path_type=="Circle Type 5"

                                           || path_type=="Circle Type 6"|| path_type=="Line Type 12")   

                                           {

                                            

                                               theObj=layer_grp_item[grp_main_index].pageItems;

                                              

                                                 for(var z=theObj.length-1;z>=0 ;z--)

                                        {

                                           

                                          if (theObj[z].typename == "GroupItem") {

                                             for (i=theObj[z].pageItems.length-1; i>=0; i--)

                                             {

                                            theObj[z].pageItems[i].moveAfter(theObj[z].pageItems[i].parent);

                                }

                                }

                                       

                                        }

                                    break mainloopline;

                                    }

                                }

                                }

                                }

                                }

                                }

                                }

                                }

                                 

                                 

                                 

                                 

                                function check_circle_ungroup()

                                {

                                     for(var layer_item_index=0;layer_item_index<sourceDoc.layers.length;layer_item_index++)

                                    {

                                        if(sourceDoc.layers[layer_item_index].pageItems.length>0)

                                        {

                                            layer_grp_item=sourceDoc.layers[layer_item_index].groupItems;

                                      

                                    for(var grp_main_index=0;grp_main_index<layer_grp_item.length;grp_main_index++)

                                    {

                                       

                                child_path_item_main=layer_grp_item[grp_main_index].pathItems;

                                  child_group_item=layer_grp_item[grp_main_index].groupItems;

                                  var count_groupfound=0;

                                mainloopline: 

                                  for(var grp_main_index1=0;grp_main_index1< child_group_item.length;grp_main_index1++)

                                  {

                                      if(child_group_item[grp_main_index1].name.slice(0,15)=="connectornumber")

                                      {

                                        

                                          count_groupfound=1;

                                           break mainloopline;

                                          }}

                                if(count_groupfound==0)

                                {

                                     mainloopline: 

                                     for(var grp_main_index1=0;grp_main_index1< child_group_item.length;grp_main_index1++)

                                  {

                                      {

                                      child_path_item_main1=child_group_item[grp_main_index1].pathItems;

                                      for(var path_1=0;path_1<child_path_item_main1.length;path_1++)

                                      {

                                           var  path_type = type_of_path(child_path_item_main1[path_1]);

                                           if(path_type=="Line Type 1" || path_type=="Line Type 2"  || path_type=="Line Type 3" || path_type=="Circle Type 1"

                                           || path_type=="Circle Type 2" || path_type=="Circle Type 3"|| path_type=="Circle Type 4"|| path_type=="Circle Type 5"

                                           || path_type=="Circle Type 6"|| path_type=="Line Type 12")   

                                           {

                                            

                                               theObj=layer_grp_item[grp_main_index].pageItems;

                                              

                                                 for(var z=theObj.length-1;z>=0 ;z--)

                                        {

                                           

                                          if (theObj[z].typename == "GroupItem") {

                                             for (i=theObj[z].pageItems.length-1; i>=0; i--)

                                             {

                                            theObj[z].pageItems[i].moveAfter(theObj[z].pageItems[i].parent);

                                }

                                }

                                       

                                        }

                                    break mainloopline;

                                    }

                                }

                                }

                                }

                                }

                                }

                                }

                                }

                                }

                                function remove_fuse_group1()

                                {

                                    var yog_layers=sourceDoc.layers;

                                for(var lays1=0;lays1<yog_layers.length;lays1++)

                                {

                                    for(var group1=0;group1<yog_layers[lays1].groupItems.length;group1++)

                                    {

                                        var yog_group=yog_layers[lays1].groupItems[group1];

                                        if(yog_group.name!="AAA")

                                        {

                                       var text_found=0;

                                 

                                 

                                       var r= find_rectangle_path_with_large_area(yog_group);

                                        for(var group2=0;group2<yog_group.groupItems.length;group2++)

                                        {

                                            for(var text1=0;text1<yog_group.groupItems[group2].pathItems.length;text1++)

                                            {

                                        var yog_path=yog_group.groupItems[group2].pathItems[text1];

                                        var path_type=type_of_path(yog_path)

                                      

                                        if(path_type=="Rectangle Type 2" || path_type=="Rectangle Type 10")

                                        {

                                            if((Math.abs(Math.round(yog_path.area)))==25 || (Math.abs(Math.round(yog_path.area)))==108)

                                            {

                                                }

                                            else

                                            {

                                           text_found=1;

                                           }

                                       }

                                   else if(path_type=="Rectangle Type 4" || path_type=="Rectangle Type 7" || path_type=="Rectangle Type 14" || path_type=="Rectangle Type 15")

                                   {

                                       if(r.area==yog_path.area)

                                       {

                                           text_found=0;

                                           }

                                       }

                                   else

                                   {

                                       text_found=0;

                                       }

                                   }

                                }

                                 

                                 

                                 

                                 

                                 

                                 

                                   if( text_found==1)

                                   {

                                       var count=0;

                                       for(var group3=0;group3<yog_group.groupItems.length;group3++)

                                       {

                                           for(var path1=yog_group.groupItems[group3].pathItems.length-1;path1>=0;path1--)

                                           {

                                                var yog_path3=yog_group.groupItems[group3].pathItems[path1];

                                               var path_type=type_of_path(yog_path3)

                                               if(path_type=="Rectangle Type 3")

                                               {

                                                  count=1;

                                              

                                                   }

                                               }

                                           }

                                       }

                                   if(count==1)

                                   {

                                         for(var group3=0;group3<yog_group.groupItems.length;group3++)

                                       {

                                           for(var path1=yog_group.groupItems[group3].pathItems.length-1;path1>=0;path1--)

                                           {

                                               var yog_path3=yog_group.groupItems[group3].pathItems[path1];

                                               var path_type=type_of_path(yog_path3)

                                               if(path_type=="Anchor point")

                                               {

                                                  

                                                   yog_path3.remove();

                                               }

                                           }

                                       }

                                   }

                                                  

                                   }

                                }

                                }

                                }

                                function remove_fuse_group()

                                {

                                    var yog_layers=sourceDoc.layers;

                                for(var lays1=0;lays1<yog_layers.length;lays1++)

                                {

                                    for(var group1=0;group1<yog_layers[lays1].groupItems.length;group1++)

                                    {

                                        var yog_group=yog_layers[lays1].groupItems[group1];

                                        if(yog_group.name!="AAA")

                                        {

                                       var text_found=0;

                                 

                                 

                                       var r= find_rectangle_path_with_large_area(yog_group);

                                        for(var group2=0;group2<yog_group.groupItems.length;group2++)

                                        {

                                            for(var text1=0;text1<yog_group.groupItems[group2].pathItems.length;text1++)

                                            {

                                        var yog_path=yog_group.groupItems[group2].pathItems[text1];

                                        var path_type=type_of_path(yog_path)

                                      

                                        if(path_type=="Rectangle Type 2" || path_type=="Rectangle Type 10")

                                        {

                                            if((Math.abs(Math.round(yog_path.area)))==25 || (Math.abs(Math.round(yog_path.area)))==108)

                                            {

                                                }

                                            else

                                            {

                                           text_found=1;

                                           }

                                       }

                                   else if(path_type=="Rectangle Type 4" || path_type=="Rectangle Type 7" || path_type=="Rectangle Type 14" || path_type=="Rectangle Type 15")

                                   {

                                       if(r.area==yog_path.area)

                                       {

                                           text_found=1;

                                           }

                                       }

                                   else

                                   {

                                       text_found=0;

                                       }

                                   }

                                }

                                 

                                 

                                 

                                 

                                 

                                 

                                   if( text_found==1)

                                   {

                                       for(var group3=0;group3<yog_group.groupItems.length;group3++)

                                       {

                                           for(var path1=0;path1<yog_group.groupItems[group3].pathItems.length;path1++)

                                           {

                                               var path_type=type_of_path(yog_group.groupItems[group3].pathItems[path1])

                                               if(path_type=="Rectangle Type 3")

                                               {

                                                  

                                                   yog_group.groupItems[group3].moveToBeginning(yog_layers[lays1]);

                                                   break;

                                                   }

                                               }

                                           }

                                       }

                                   }

                                }

                                }

                                }

                                function ungroup_group()

                                {

                                for(var i=0;i<sourceDoc.layers.length;i++)

                                {

                                    for(var k=0;k<sourceDoc.layers[i].groupItems.length;k++)

                                    {

                                        var count=0;

                                       var count_group=0;

                                         theObj = sourceDoc.layers[i].groupItems[k].pageItems;

                                for(var z=0;z<theObj.length;z++)

                                {

                                    if(theObj[z].typename=="PathItem" || theObj[z].typename=="TextFrame")

                                    {

                                        count++;

                                        }

                                    }

                                for(var zzz=0;zzz<theObj.length;zzz++)

                                {

                                     if(theObj[zzz].typename=="GroupItem")

                                     {

                                         count_group++;

                                         }

                                     }

                                        

                                if(count==0 || (count==1 && count_group==1))

                                {

                                    for(var zz=0;zz<theObj.length;zz++)

                                    {

                                      

                                         if(theObj[zz].typename=="GroupItem")

                                         {

                                              var count_text=0;

                                             for(var zzzz=0;zzzz<theObj[zz].pageItems.length;zzzz++)

                                             {

                                                 if(theObj[zz].pageItems[zzzz].typename=="PathItem" || theObj[zz].pageItems[zzzz].typename=="TextFrame" )

                                                 {

                                                     count_text=1;

                                                     }}

                                             if(count_text==0)

                                             {

                                       for(var zzzz=0;zzzz<theObj[zz].pageItems.length;zzzz++)

                                             {

                                                 theObj[zz].pageItems[zzzz].moveBefore(theObj[zz].parent)

                                                 }

                                        }

                                    else

                                    {

                                        theObj[zz].moveBefore(theObj[zz].parent)

                                        

                                             }

                                        }

                                    }

                                }

                                }

                                }

                                }

                                 

                                 

                                 

                                 

                                 

                                 

                                function ungroup_units()

                                {

                                     for(var layer_item_index=0;layer_item_index<sourceDoc.layers.length;layer_item_index++)

                                    {

                                        if(sourceDoc.layers[layer_item_index].pageItems.length>0)

                                        {

                                            layer_grp_item=sourceDoc.layers[layer_item_index].groupItems;

                                       

                                    for(var grp_main_index=0;grp_main_index<layer_grp_item.length;grp_main_index++)

                                    {

                                        

                                child_path_item_main=layer_grp_item[grp_main_index].pathItems;

                                  child_group_item=layer_grp_item[grp_main_index].groupItems;

                                 

                                  for(var grp_main_index1=0;grp_main_index1< child_group_item.length;grp_main_index1++)

                                  {

                                      child_path_item_main1=child_group_item[grp_main_index1].pathItems;

                                theObj=child_group_item[grp_main_index1].pageItems;

                                   for(var z=0;z< theObj.length;z++)

                                        {

                                           

                                          if (theObj[z].typename == "GroupItem") {

                                             for (i=theObj[z].pageItems.length-1; i>=0; i--)

                                             {

                                            theObj[z].pageItems[i].moveAfter(theObj[z].pageItems[i].parent);

                                }

                                }

                                }

                                }

                                }

                                }

                                }

                                }

                                                 

                                                 

                                  function AAA_check1()

                                    {

                                          for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)

                                {

                                    var count=0;

                                    for(var group1=0;group1<sourceDoc.layers[lays1].groupItems.length;group1++)

                                    {

                                       

                                        if(sourceDoc.layers[lays1].groupItems[group1].name=="AAA")

                                        {    count =group1;

                                            break;

                                            }

                                      }

                                 

                                 

                                  for(var group2=sourceDoc.layers[lays1].groupItems.length-1;group2>=0;group2--)

                                    {

                                       

                                        if(sourceDoc.layers[lays1].groupItems[group2].name=="AAA")

                                        {

                                         

                                            if(count==group2)

                                            {

                                            }

                                        else

                                        {

                                            sourceDoc.layers[lays1].groupItems[group2].moveToBeginning(sourceDoc.layers[lays1].groupI tems[count])

                                           

                                            }

                                        }

                                    }}

                                }

                                 

                                 

                                 

                                 

                                function ungroup_units1()

                                {

                                     for(var layer_item_index=0;layer_item_index<sourceDoc.layers.length;layer_item_index++)

                                    {

                                        if(sourceDoc.layers[layer_item_index].pageItems.length>0)

                                        {

                                            layer_grp_item=sourceDoc.layers[layer_item_index].groupItems;

                                       for(var k=0;k<layer_grp_item.length;k++)

                                       {

                                if( layer_grp_item[k].name=="AAA")

                                {

                                     theObj =layer_grp_item[k].pageItems;

                                       

                                        for(var z=0;z< theObj.length;z++)

                                        {

                                           

                                          if (theObj[z].typename == "GroupItem") {

                                             for (i=theObj[z].pageItems.length-1; i>=0; i--)

                                             {

                                            theObj[z].pageItems[i].moveAfter( theObj[z].pageItems[i].parent);

                                     }

                                }

                                }

                                }

                                }

                                }

                                }

                                }

                                                 

                                function check_dot_repeat()

                                {

                                    for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)

                                {

                                    for(var group1=0;group1<sourceDoc.layers[lays1].groupItems.length;group1++)

                                    {

                                        var arr=[];

                                        arr.length=0;

                                        if(sourceDoc.layers[lays1].groupItems[group1].name!="AAA")

                                        {

                                            for(var group2=0;group2<sourceDoc.layers[lays1].groupItems[group1].pathItems.length;group2++)

                                            {

                                                if(sourceDoc.layers[lays1].groupItems[group1].pathItems[group2].name.slice(0,3)=="pin")

                                                {

                                                    arr.push(sourceDoc.layers[lays1].groupItems[group1].pathItems[group2].name);

                                                    }

                                                }

                                 

                                            if(arr.length>1)

                                            {

                                                var sorted_arr = arr.slice().sort();

                                                                   

                                var results = [];

                                results.length=0;

                                for (var i = 0; i < arr.length - 1; i++) {

                                    if (sorted_arr[i + 1] == sorted_arr[i]) {

                                        results.push(sorted_arr[i]);

                                    }

                                }

                                 

                                 

                                 

                                 

                                if( results.length>=1)

                                {

                                    for(var k=0;k<results.length;k++)

                                    {

                                        for(var group3=0;group3<sourceDoc.layers[lays1].groupItems[group1].pathItems.length;group3++)

                                        {

                                             if(sourceDoc.layers[lays1].groupItems[group1].pathItems[group3].name==  results[k])

                                             {

                                                 sourceDoc.layers[lays1].groupItems[group1].pathItems[group3].remove();

                                                 break;

                                                 }

                                             }

                                         }

                                     }

                                }

                                }

                                }

                                }

                                }

                                 

                                 

                                function check_connector()

                                  {

                                 

                                 

                                      for(var lays=0;lays<sourceDoc.layers.length;lays++)

                                {

                                          var arr=[];

                                var arr1=[];

                                    for(var group1=0;group1<sourceDoc.layers[lays].groupItems.length;group1++)

                                    {

                                       

                                             arr.length=0;

                                arr1.length=0;

                                        for(var group2=0;group2<sourceDoc.layers[lays].groupItems[group1].groupItems.length;group2++)

                                        {

                                            for(var text1=0;text1<sourceDoc.layers[lays].groupItems[group1].groupItems[group2].textFrames.len gth;text1++)

                                            {

                                                if(!sourceDoc.layers[lays].groupItems[group1].groupItems[group2].textFrames[text1].conten ts.match(/[A-Z][0-9]{1,3}$/)) continue;

                                                {

                                                    arr.push(sourceDoc.layers[lays].groupItems[group1].groupItems[group2].textFrames[text1])

                                                    }

                                                }

                                            }

                                        if(arr.length>1)

                                        {

                                          

                                        for(var sd=0;sd<arr.length;sd++)

                                        {

                                           

                                  

                                            for(csv_iter = 0;csv_iter < fileArray_SM_name.length; csv_iter++)

                                            {

                                              if(arr[sd].contents== fileArray_SM_name[csv_iter][0])

                                                {

                                                   

                                                    arr1.push( fileArray_SM_name[csv_iter][1])

                                                    break ;

                                                    }

                                               

                                                }

                                            }

                                       

                                       

                                 

                                 

                                    for(var sd1=0;sd1<arr1.length;sd1++)

                                    {

                                      

                                        if(arr1[0]==arr1[sd1])

                                        {

                                          

                                            }

                                        else

                                        {

                                            var count_error=0;

                                            group_main=sourceDoc.layers[lays].groupItems[group1];

                                                  for(var error=0;error<sourceDoc.layers[lays].groupItems[group1].groupItems.length;error++)

                                                          {

                                                              if(group_main.groupItems[error].name==group_main.name+ "Error:")

                                                              {

                                                                   var max_area_path=find_rectangle_path_with_large_area(group_main);

                                  var x_axis=Math.abs(max_area_path.pathPoints[0].anchor[0]);

                                                  var y_axis=Math.abs(max_area_path.pathPoints[0].anchor[1]);

                                                  var textRef =group_main.groupItems[error].textFrames.add();

                                textRef.contents =arr[sd1].contents+" Different unit present inside the group" ;

                                textRef.top =y_axis ;

                                textRef.left = x_axis+20 ;

                                textRef.textRange.characterAttributes.size = 10;

                                count_error++;

                                }

                                }

                                 

                                 

                                 

                                 

                                 

                                 

                                 

                                 

                                if(count_error==1)

                                {

                                    }

                                else

                                {

                                    

                                                               var newGroup  =group_main.groupItems.add();

                                                            newGroup.name = group_main.name+ "Error:"; 

                                                             var max_area_path=find_rectangle_path_with_large_area(group_main);

                                  var x_axis=Math.abs(max_area_path.pathPoints[0].anchor[0]);

                                                  var y_axis=Math.abs(max_area_path.pathPoints[0].anchor[1]);

                                                  var textRef = newGroup.textFrames.add();

                                textRef.contents =arr[sd1].contents+" Different unit present inside the group" ;

                                textRef.top =y_axis ;

                                textRef.left = x_axis+20 ;

                                textRef.textRange.characterAttributes.size = 10;

                                newGroup.moveToEnd(group_main);

                                }

                                 

                                 

                                    }

                                            }

                                        }

                                    }

                                    arr.length=0;

                                arr1.length=0;

                                }

                                }

                                 

                                 

                                 

                                 

                                                 

                                  

                                                 

                                 

                                 

                                function check_fuse_ungroup()

                                {

                                    var layer_item=sourceDoc.layers

                                     for(var layer_item_index=0;layer_item_index<layer_item.length;layer_item_index++)

                                    {

                                        if(layer_item[layer_item_index].pageItems.length>0)

                                        {

                                            layer_grp_item=layer_item[layer_item_index].groupItems;

                                      

                                    for(var grp_main_index=0;grp_main_index<layer_grp_item.length;grp_main_index++)

                                    {

                                       

                                child_path_item_main=layer_grp_item[grp_main_index].pathItems;

                                  child_group_item=layer_grp_item[grp_main_index].groupItems;

                                mainloopfuse: 

                                  for(var grp_main_index1=0;grp_main_index1< child_group_item.length;grp_main_index1++)

                                  {

                                      child_path_item_main1=child_group_item[grp_main_index1].pathItems;

                                      for(var path_1=0;path_1<child_path_item_main1.length;path_1++)

                                      {

                                           var  path_type = type_of_path(child_path_item_main1[path_1]);

                                           if(path_type=="Rectangle Type 3")   

                                           {

                                            

                                               theObj=layer_grp_item[grp_main_index].pageItems;

                                              

                                                 for(var z=theObj.length-1;z>=0 ;z--)

                                        {

                                           

                                          if (theObj[z].typename == "GroupItem") {

                                             for (i=theObj[z].pageItems.length-1; i>=0; i--)

                                             {

                                            theObj[z].pageItems[i].moveAfter(theObj[z].pageItems[i].parent);

                                }

                                }

                                       

                                        }

                                    break mainloopfuse;

                                    }

                                }

                                }

                                }

                                }

                                }

                                }   

                                                 

                                  function line_check1_unit_CAN()

                                    {

                                          for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)

                                {

                                    var count=0;

                                    for(var group1=0;group1<sourceDoc.layers[lays1].groupItems.length;group1++)

                                    {

                                        mainloop12:

                                       

                                        if(sourceDoc.layers[lays1].groupItems[group1].name!="AAA")

                                        {

                                            for(var group2=0;group2<sourceDoc.layers[lays1].groupItems[group1].groupItems.length;group2++)

                                            {

                                                for(var path=0;path<sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].pathItems.lengt h;path++)

                                                {

                                                    var path_type = type_of_path(sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].pathItems[path ]);

                                                    if(path_type=="Line Type 1" || path_type=="Line Type 2" || path_type=="Line Type 3"  )

                                                    {

                                                        for(var group3=0;group3<sourceDoc.layers[lays1].groupItems[group1].groupItems.length;group3++)

                                            {

                                                        for(var text=0;text<sourceDoc.layers[lays1].groupItems[group1].groupItems[group3].textFrames.leng th;text++)

                                                        {

                                                            if(!sourceDoc.layers[lays1].groupItems[group1].groupItems[group3].textFrames[text].conten ts.match(/[A-Z][0-9]{1,3}$/)) continue;

                                                            {

                                                                var count_error=0;

                                            group_main=sourceDoc.layers[lays1].groupItems[group1];

                                                  for(var error=0;error<sourceDoc.layers[lays1].groupItems[group1].groupItems.length;error++)

                                                          {

                                                              if(group_main.groupItems[error].name==group_main.name+ "Error:")

                                                              {

                                                                   var max_area_path=find_rectangle_path_with_large_area(group_main);

                                  var x_axis=Math.abs(max_area_path.pathPoints[0].anchor[0]);

                                                  var y_axis=Math.abs(max_area_path.pathPoints[0].anchor[1]);

                                                  var textRef =group_main.groupItems[error].textFrames.add();

                                textRef.contents ="Unwanted line present inside the group" ;

                                textRef.top =y_axis ;

                                textRef.left = x_axis+20 ;

                                textRef.textRange.characterAttributes.size = 10;

                                count_error++;

                                }

                                }

                                 

                                 

                                 

                                 

                                 

                                 

                                 

                                 

                                if(count_error==1)

                                {

                                    }

                                else

                                {

                                    

                                                               var newGroup  =group_main.groupItems.add();

                                                            newGroup.name = group_main.name+ "Error:"; 

                                                             var max_area_path=find_rectangle_path_with_large_area(group_main);

                                  var x_axis=Math.abs(max_area_path.pathPoints[0].anchor[0]);

                                                  var y_axis=Math.abs(max_area_path.pathPoints[0].anchor[1]);

                                                  var textRef = newGroup.textFrames.add();

                                textRef.contents ="Unwanted line present inside the group" ;

                                textRef.top =y_axis ;

                                textRef.left = x_axis+20 ;

                                textRef.textRange.characterAttributes.size = 10;

                                newGroup.moveToEnd(group_main);

                                }

                                }

                                break mainloop12;

                                }

                                }

                                }

                                }

                                }

                                }

                                }

                                }

                                }                 

                                                 

                                function line_check1_unit_2_CAN()

                                    {

                                          for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)

                                {

                                   

                                    for(var group1=0;group1<sourceDoc.layers[lays1].groupItems.length;group1++)

                                    {

                                        var count_group_found=0;

                                       

                                        if(sourceDoc.layers[lays1].groupItems[group1].name!="AAA")

                                        {

                                          mainloop12:

                                           for(var group2=0;group2<sourceDoc.layers[lays1].groupItems[group1].groupItems.length;group2++)

                                           {

                                               if(sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].name.slice(0,15)=="conne ctornumber")

                                               {

                                                   count_group_found=1;

                                                   break  mainloop12;

                                                   }

                                               }

                                           if(  count_group_found==1)

                                           {

                                              

                                                for(var path=0;path<sourceDoc.layers[lays1].groupItems[group1].pathItems.length;path++)

                                                {

                                                    var path_type = type_of_path(sourceDoc.layers[lays1].groupItems[group1].pathItems[path]);

                                                    if(path_type=="Line Type 1" || path_type=="Line Type 2" || path_type=="Line Type 3" )

                                                    {

                                                        var count_error=0;

                                            group_main=sourceDoc.layers[lays1].groupItems[group1];

                                                  for(var error=0;error<sourceDoc.layers[lays1].groupItems[group1].groupItems.length;error++)

                                                          {

                                                              if(group_main.groupItems[error].name==group_main.name+ "Error:")

                                                              {

                                                                   var max_area_path=find_rectangle_path_with_large_area(group_main);

                                  var x_axis=Math.abs(max_area_path.pathPoints[0].anchor[0]);

                                                  var y_axis=Math.abs(max_area_path.pathPoints[0].anchor[1]);

                                                  var textRef =group_main.groupItems[error].textFrames.add();

                                textRef.contents ="Unwanted line present inside the group" ;

                                textRef.top =y_axis ;

                                textRef.left = x_axis+20 ;

                                textRef.textRange.characterAttributes.size = 10;

                                count_error++;

                                }

                                }

                                 

                                 

                                 

                                 

                                 

                                 

                                 

                                 

                                if(count_error==1)

                                {

                                    }

                                else

                                {

                                    

                                                               var newGroup  =group_main.groupItems.add();

                                                            newGroup.name = group_main.name+ "Error:"; 

                                                             var max_area_path=find_rectangle_path_with_large_area(group_main);

                                  var x_axis=Math.abs(max_area_path.pathPoints[0].anchor[0]);

                                                  var y_axis=Math.abs(max_area_path.pathPoints[0].anchor[1]);

                                                  var textRef = newGroup.textFrames.add();

                                textRef.contents ="Unwanted line present inside the group" ;

                                textRef.top =y_axis ;

                                textRef.left = x_axis+20 ;

                                textRef.textRange.characterAttributes.size = 10;

                                newGroup.moveToEnd(group_main);

                                }

                                }

                                 

                                 

                                }

                                }

                                }

                                }

                                }

                                }

                                 

                                 

                                function reduce_opacity()

                                {

                                    for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)

                                    {

                                        for(var group1=0;group1<sourceDoc.layers[lays1].groupItems.length;group1++)

                                        {

                                            for(var path1=sourceDoc.layers[lays1].groupItems[group1].pathItems.length-1;path1>=0;path1--)

                                            {

                                                var path_type = type_of_path(sourceDoc.layers[lays1].groupItems[group1].pathItems[path1]);

                                                if(path_type=="Anchor point" && (sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].name.slice(0,3)=="pin"

                                                || sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].name.slice(0,4)=="FUSE" || sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].name.slice(0,2)=="FL"))

                                                {

                                                    sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].opacity=0;

                                                    }

                                                else if(path_type=="Anchor point" && sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].name=="")

                                                {

                                                     sourceDoc.layers[lays1].groupItems[group1].pathItems[path1].remove()

                                                    }

                                                }

                                                for(var group2=0;group2<sourceDoc.layers[lays1].groupItems[group1].groupItems.length;group2++)

                                                {

                                                     for(var path2=sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].pathItems.length-1;pa th2>=0;path2--)

                                            {

                                                var path_type = type_of_path(sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].pathItems[path 2]);

                                                if(path_type=="Anchor point" && (sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].pathItems[path2].name.slic e(0,3)=="pin"

                                               || sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].pathItems[path2].name.slice (0,4)=="FUSE" || sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].pathItems[path2].name.slice (0,2)=="FL" ))

                                                {

                                                    sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].pathItems[path2].opacity=0;

                                                    }

                                                else if(path_type=="Anchor point" && sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].pathItems[path2].name=="")

                                                {

                                                     sourceDoc.layers[lays1].groupItems[group1].groupItems[group2].pathItems[path2].remove()

                                                    }

                                                }

                                            }

                                        }

                                    }

                                }

                                 

                                 

                                 

                                 

                                function reduce_opacity_1()

                                {

                                    for(var lays1=0;lays1<sourceDoc.layers.length;lays1++)

                                    {

                                        for(var path1=0;path1<sourceDoc.layers[lays1].pathItems.length;path1++)

                                        {

                                            var pathtype=type_of_path(sourceDoc.layers[lays1].pathItems[path1]);

                                            if(pathtype=="Anchor point")

                                            {

                                               sourceDoc.layers[lays1].pathItems[path1].opacity=0;

                                               }

                                           }

                                       }

                                   }

                                 

                                 

                                function circleFront()

                                {

                                    for(var group=0;group<sourceDoc.groupItems.length;group++)

                                {

                                    for(var path1=0;path1<sourceDoc.groupItems[group].pathItems.length;path1++)

                                    {

                                        var  path_type = type_of_path(sourceDoc.groupItems[group].pathItems[path1]);

                                        if(path_type=="Circle Type 1" || path_type=="Circle Type 2" || path_type=="Circle Type 3" || path_type=="Circle Type 4" || path_type=="Circle Type 5"

                                          || path_type=="Circle Type 6")

                                          {

                                             

                                      sourceDoc.groupItems[group].pathItems[path1].moveToBeginning(sourceDoc.groupItems[group]. pathItems[path1].parent);

                                      }

                                  }

                                }

                                }

                                 

                                 

                                function group_Circle_name_CAN()

                                {

                                    var count_group =1;

                                     for(var path=0;path<sourceDoc.pathItems.length;path++)

                                    {

                                           var  path_type = type_of_path(sourceDoc.pathItems[path]);

                                           if(path_type=="Circle Type 1" || path_type=="Circle Type 2" || path_type=="Circle Type 3" || path_type=="Circle Type 4"  || path_type=="Circle Type 5"

                                           || path_type=="Circle Type 6")

                                           {

                                               if((sourceDoc.pathItems[path].parent.name!="AAA" || sourceDoc.pathItems[path].parent.parent.name!="AAA")&& (sourceDoc.pathItems[path].parent.name=="") && (sourceDoc.pathItems[path].parent.name!="Shield") &&  (sourceDoc.pathItems[path].parent.name.slice(0,1)!="L"))

                                               {

                                                     if(sourceDoc.pathItems[path].parent.pathItems.length>=3)

                                                     {

                                                         sourceDoc.pathItems[path].parent.name="CircleGroup"+count_group;

                                                         count_group++

                                                         }

                                                     else if(sourceDoc.pathItems[path].parent.pathItems.length<3)

                                                     {

                                                         for(var path1=0;path1<sourceDoc.pathItems[path].parent.pathItems.length;path1++)

                                                         {

                                                             sourceDoc.pathItems[path].parent.pathItems[path1].strokeColor=magentaColor1;

                                                           

                                                                sourceDoc.pathItems[path].parent.pathItems[path1].strokeWidth=3;

                                                             }

                                                         }

                                                     else

                                                     {

                                                         }}

                                                     else if(sourceDoc.pathItems[path].parent.name=="Shield")

                                                     {

                                                           if(sourceDoc.pathItems[path].parent.pathItems.length>=3)

                                                     {

                                                         sourceDoc.pathItems[path].parent.name="Shield"+count_group;

                                                         count_group++

                                                         }

                                                     else if(sourceDoc.pathItems[path].parent.pathItems.length<3)

                                                     {

                                                         for(var path1=0;path1<sourceDoc.pathItems[path].parent.pathItems.length;path1++)

                                                         {

                                                             sourceDoc.pathItems[path].parent.pathItems[path1].strokeColor=magentaColor1;

                                                              

                                                                 sourceDoc.pathItems[path].parent.pathItems[path1].strokeWidth=3;

                                                             }

                                                         }

                                                     }

                                                 else {

                                                     }

                                                 }

                                             }

                                         }

                                    

                                     function group_name_normal()

                                {

                                    var count_group =1

                                     for(var path=0;path<sourceDoc.pathItems.length;path++)

                                    {

                                           var  path_type = type_of_path(sourceDoc.pathItems[path]);

                                           if(path_type=="Circle Type 1" || path_type=="Circle Type 2" || path_type=="Circle Type 3" || path_type=="Circle Type 4"  || path_type=="Circle Type 5"

                                           || path_type=="Circle Type 6")

                                           {

                                               if((sourceDoc.pathItems[path].parent.name!="AAA" || sourceDoc.pathItems[path].parent.parent.name!="AAA")&& (sourceDoc.pathItems[path].parent.name=="") && (sourceDoc.pathItems[path].parent.name!="Shield") )

                                               {

                                                     if(sourceDoc.pathItems[path].parent.pathItems.length>=3)

                                                     {

                                                         sourceDoc.pathItems[path].parent.name="CircleGroup"+count_group;

                                                         count_group++

                                                         }

                                                     else if(sourceDoc.pathItems[path].parent.pathItems.length<3)

                                                     {

                                                         for(var path1=0;path1<sourceDoc.pathItems[path].parent.pathItems.length;path1++)

                                                         {

                                                             sourceDoc.pathItems[path].parent.pathItems[path1].strokeColor=magentaColor1;

                                                            

                                                                sourceDoc.pathItems[path].parent.pathItems[path1].strokeWidth=3;

                                                             }

                                                         }

                                                     else

                                                     {

                                                         }}

                                                     else if(sourceDoc.pathItems[path].parent.name=="Shield")

                                                     {

                                                           if(sourceDoc.pathItems[path].parent.pathItems.length>=3)

                                                     {

                                                         sourceDoc.pathItems[path].parent.name="Shield"+count_group;

                                                         count_group++

                                                         }

                                                     else if(sourceDoc.pathItems[path].parent.pathItems.length<3)

                                                     {

                                                         for(var path1=0;path1<sourceDoc.pathItems[path].parent.pathItems.length;path1++)

                                                         {

                                                             sourceDoc.pathItems[path].parent.pathItems[path1].strokeColor=magentaColor1;

                                                          

                                                                 sourceDoc.pathItems[path].parent.pathItems[path1].strokeWidth=3;

                                                             }

                                                         }

                                                     }

                                                 else {

                                                     }

                                                 }

                                             }

                                         }

                                 

                                 

                                 

                                 

                                  function checking_circleGroup_CAN()

                                {

                                     var layer_yog=sourceDoc.layers;

                                    for(var lays1=0;lays1<layer_yog.length;lays1++)

                                    {

                                        var group_yog= layer_yog[lays1].groupItems;

                                      for(var path=group_yog.length-1;path>=0;path--)

                                    {

                                        if(group_yog[path].name.slice(0,11)=="CircleGroup" || group_yog[path].name.slice(0,6)=="Shield" || group_yog[path].name.slice(0,3)=="AAA"  || sourceDoc.layers[lays1].groupItems[path].name.slice(0,1)=="L")

                                        {

                                          

                                        for(var path_group=0;path_group<group_yog[path].pathItems.length;path_group++)

                                        {

                                             var path_yog=group_yog[path].pathItems[path_group];

                                           var  path_type = type_of_path(path_yog);

                                          {

                                           if(path_type=="Circle Type 2" || path_type=="Circle Type 5")

                                           {

                                               var x_pathtype=Math.round(path_yog.visibleBounds[2]);

                                             

                                            

                                               var y_pathtype1=Math.round(path_yog.visibleBounds[1]);

                                               var x_pathtype2=Math.round(path_yog.visibleBounds[0]);

                                            

                                             

                                               var y_pathtype3=Math.round(path_yog.visibleBounds[3]);

                                              

                                          

                                              

                                             for(var lays2=0;lays2<layer_yog.length;lays2++)

                                              {

                                               for(var path1=layer_yog[lays2].groupItems.length-1;path1>=0;path1--)

                                               {

                                              

                                                 for(var path_group1=0;path_group1<layer_yog[lays2].groupItems[path1].pathItems.length;path_group1 ++)

                                        { 

                                            var path1_yog=layer_yog[lays2].groupItems[path1].pathItems[path_group1];

                                                    var  path_type1 = type_of_path(path1_yog);

                                                    if(path_type1=="Line Type 2" || path_type1== "Rectangle Type 5")

                                                    {

                                                        for(var path_points=0;path_points<(path1_yog.pathPoints.length-1);path_points++)

                                                        {

                                                            var x_pathline=Math.round(path1_yog.pathPoints[path_points].anchor[0]);

                                                            var y_pathline=Math.round(path1_yog.pathPoints[path_points].anchor[1]);

                                                 

                                                          

                                                           

                                                           if((x_pathline> x_pathtype2) &&    (x_pathline<x_pathtype) && (y_pathline> y_pathtype3) &&    (y_pathline<y_pathtype1) )

                                                           {

                                                                 if(path1_yog.parent.name==layer_yog[lays2].groupItems[path].pathItems[path_group].parent. name)

                                                              {

                                                                  path1_yog.name="Blue Color Line"

                                                                  layer_yog[lays2].groupItems[path].pathItems[path_group].name="Blue Color Circle"

                                                                  }

                                                                 else

                                                                 {

                                                                     path1_yog.strokeColor =magentaColor1; 

                                                                    

                                                                       path1_yog.strokeWidth =3; 

                                                                      

                                                                     }}

                                                            else if((x_pathline> x_pathtype2) &&    (x_pathline<x_pathtype) )

                                                            {

                                                                if(y_pathline< y_pathtype3)

                                                                {

                                                                    var x_pathline1=Math.round(path1_yog.pathPoints[path_points+1].anchor[0]);

                                                            var y_pathline1=Math.round(path1_yog.pathPoints[path_points+1].anchor[1]);

                                                          

                                                            if((x_pathline1>x_pathtype2) && (x_pathline1<x_pathtype))

                                                            {

                                                                if((y_pathline1>  y_pathtype3)&&(y_pathline1>  y_pathtype1))

                                                                {

                                                                      if(path1_yog.parent.name==layer_yog[lays2].groupItems[path].pathItems[path_group].parent. name)

                                                              {

                                                                  path1_yog.name="Blue Color Line"

                                                                  layer_yog[lays2].groupItems[path].pathItems[path_group].name="Blue Color Circle"

                                                                  }

                                                                 else

                                                                 {

                                                                     path1_yog.strokeColor =magentaColor1;

                                                                   

                                                                       path1_yog.strokeWidth =3;

                                                                     

                                                                     }}

                                                                 else if((y_pathline1> y_pathtype3) &&(y_pathline1< y_pathtype1))

                                                                 {

                                                                    

                                                                     if(path1_yog.parent.name==layer_yog[lays2].groupItems[path].pathItems[path_group].parent. name)

                                                              {

                                                                   path1_yog.name="Blue Color Line"

                                                                  layer_yog[lays2].groupItems[path].pathItems[path_group].name="Blue Color Circle"

                                                                  }

                                                                 else

                                                                 {

                                                                     path1_yog.strokeColor =magentaColor1; 

                                                                   

                                                                       path1_yog.strokeWidth =3; 

                                                                     }

                                                                 }

                                                             }

                                                         }

                                                     else if(y_pathline> y_pathtype3)

                                                     {

                                                        var x_pathline1=Math.round(path1_yog.pathPoints[path_points+1].anchor[0]);

                                                            var y_pathline1=Math.round(path1_yog.pathPoints[path_points+1].anchor[1]);

                                                            if((x_pathline1>x_pathtype2) && (x_pathline1<x_pathtype))

                                                            {

                                                           if((y_pathline1>  y_pathtype3)&&(y_pathline1<y_pathtype1))

                                                                {

                                                                  if(path1_yog.parent.name==layer_yog[lays2].groupItems[path].pathItems[path_group].parent. name)

                                                              {

                                                                   path1_yog.name="Blue Color Line"

                                                                  layer_yog[lays2].groupItems[path].pathItems[path_group].name="Blue Color Circle"

                                                                  }

                                                                 else

                                                                 {

                                                                     path1_yog.strokeColor =magentaColor1;

                                                                 

                                                                     path1_yog.strokeWidth =3;

                                                                    

                                                                     }}

                                                                 else if((y_pathline1<y_pathtype3) &&(y_pathline1<  y_pathtype1))

                                                                 {

                                                                    

                                                                     if(path1_yog.parent.name==layer_yog[lays2].groupItems[path].pathItems[path_group].parent. name)

                                                              {

                                                                   path1_yog.name="Blue Color Line"

                                                                  layer_yog[lays2].groupItems[path].pathItems[path_group].name="Blue Color Circle"

                                                                  }

                                                                 else

                                                                 {

                                                                     path1_yog.strokeColor =magentaColor1;

                                                                   

                                                                       path1_yog.strokeWidth =3;

                                                                    

                                                                     }

                                                                 }

                                                             }

                                                         } 

                                                          }

                                                  

                                                      else if((y_pathline> y_pathtype3) &&    (y_pathline<y_pathtype1) )

                                                         {

                                                                if(x_pathline< x_pathtype2)

                                                                {

                                                                    var x_pathline1=Math.round(path1_yog.pathPoints[path_points+1].anchor[0]);

                                                            var y_pathline1=Math.round(path1_yog.pathPoints[path_points+1].anchor[1]);

                                                         

                                                          if((y_pathline1>y_pathtype3) && (y_pathline1<y_pathtype1))

                                                            {

                                                        

                                                                if((x_pathline1>  x_pathtype2)&&(x_pathline1>  x_pathtype))

                                                                {

                                                                      if(path1_yog.parent.name==layer_yog[lays2].groupItems[path].pathItems[path_group].parent. name)

                                                              {

                                                                   path1_yog.name="Blue Color Line"

                                                                  layer_yog[lays2].groupItems[path].pathItems[path_group].name="Blue Color Circle"

                                                                  }

                                                                 else

                                                                 {

                                                                     path1_yog.strokeColor =magentaColor1;

                                                                

                                                                     path1_yog.strokeWidth =3;

                                                                    

                                                                     }}

                                                                 else if((x_pathline1> x_pathtype2) &&(x_pathline1< x_pathtype))

                                                                 {