-         CString full_file_path_name =  curDoc()->database()->fileName(); 
-          
-         CString dsd = full_file_path_name; 
-         dsd.Replace(_T("dwg"),_T("dsd")); 
-   
-         WORD wBOM = 0xFEFF; 
-         DWORD NumberOfBytesWritten; 
-   
-         HANDLE hFile = ::CreateFile(dsd, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); //for UTF16 little endian 
-        ::WriteFile(hFile, &wBOM, sizeof(WORD), &NumberOfBytesWritten, NULL); 
-        ::CloseHandle(hFile); 
-   
-         AcDbObjectId objDictId = acdbHostApplicationServices()->workingDatabase()->layoutDictionaryId(); 
-         AcDbDictionary *pDict; 
-         acdbOpenObject(pDict, objDictId, AcDb::kForRead); 
-         AcDbDictionaryIterator *pI = pDict->newIterator(); 
-         pDict->close(); 
-   
-         while(!pI->done()) 
-         { 
-                 WritePrivateProfileString(_T("DWF6Sheet:")+file_name+_T("-")+pI->name(),_T("DWG"),full_file_path_name,dsd); 
-                 WritePrivateProfileString(_T("DWF6Sheet:")+file_name+_T("-")+pI->name(),_T("Layout"),pI->name(),dsd); 
-                 pI->next(); 
-         } 
-         delete pI; 
-                  
-         full_file_path_name.Replace(_T("dsd"),_T("dwf")); 
-         WritePrivateProfileString(_T("Target"),_T("type"),_T("1"),dsd); 
-         WritePrivateProfileString(_T("Target"),_T("DWF"),full_file_path_name,dsd); 
-         WritePrivateProfileString(_T("Target"),_T("OUT"),full_file_path_name.Mid(0,ph.ReverseFind(_T('\\'))),dsd); 
-   
-         struct resbuf vl_new; 
-         vl_new.restype = RTSHORT; 
-         int chk = 0; 
-         vl_new.resval.rint = 0; 
-         chk = acedSetVar(_T("backgroundplot"),&vl_new); 
-         AcPlDSDData dsdDataObj;                          
-         dsdDataObj.readDSD(dsd); 
-         dsdDataObj.setPromptForDwfName(FALSE); 
-         DeleteFile(dsdDataObj.destinationName()); 
-        AcPlPlotConfig* pConfig = NULL;          
-        bool bShowPlotProgress = true;  
-   
-        acedArxLoad(_T("AcPublish.arx")); //У меня вынесен в On_kInitAppMsg 
-        acplPublishExecute( dsdDataObj, pConfig, bShowPlotProgress ); 
-   
-