Toplu NCZ Dosya Düzenleme ve Şablon Uygulama Makrosu (Batch NCZ File Editing and Template Application Macro)

netcad-toplu-ncz-duzenle-temizlik

sabangul67@gmail.com
Mayıs 17, 20255 dk okuma2 görüntülenme

🚀 Toplu NCZ Dosyalarını Hızlıca Düzenleyin: Şablon Uygulama ve Proje Temizleme Makrosu

🚀 Streamline Your NCZ Files: Batch Template Application and Project Cleaning Macro


Bu makro, NetCAD kullanıcıları için geliştirilmiş güçlü bir otomasyon aracıdır. Kaynak klasördeki tüm NCZ dosyalarını toplu olarak açar, belirtilen şablon NCZ dosyasının tabaka yapısı ve projeksiyon ayarlarını uygular, projeyi düzenler ve hedef klasöre kaydeder. Ayrıca, kullanıcı dostu bir arayüzle kaynak ve hedef klasörleri seçme imkanı sunar. Proje temizleme seçeneği ile gereksiz verileri temizleyerek dosyaları optimize eder. Harita mühendisleri ve teknik ofisler için zaman tasarrufu sağlar!

This macro is a powerful automation tool designed for NetCAD users. It batch-processes all NCZ files in a source folder, applies the layer structure and projection settings of a specified template NCZ file, edits the project, and saves the results to a target folder. It offers a user-friendly interface to select source and target folders. With the project cleaning option, it optimizes files by removing unnecessary data, saving time for surveyors and technical offices!


Nasıl Çalışır (How Does It Work)

Klasör Seçimi: Kullanıcı, kaynak (NCZ dosyalarının bulunduğu) ve hedef (düzenlenen dosyaların kaydedileceği) klasörleri seçer.

Şablon Uygulama: Belirtilen şablon NCZ dosyasının tabaka ve projeksiyon ayarları, kaynak NCZ dosyalarına uygulanır.

Kilit Kaldırma: Tüm tabakaların kilitleri otomatik olarak kaldırılır, böylece düzenleme yapılabilir. Proje Temizleme: Opsiyonel olarak, proje temizleme komutu çalıştırılarak gereksiz veriler silinir.

Kaydetme ve Kapatma: Her NCZ dosyası düzenlendikten sonra hedef klasöre kaydedilir ve proje kapatılır.

Sonuç Bildirimi: İşlem tamamlandığında, kaç dosyanın düzenlendiği kullanıcıya bildirilir.

  • Folder Selection: The user selects the source folder (containing NCZ files) and the target folder (where edited files will be saved).
  • Template Application: The layer structure and projection settings of the specified template NCZ file are applied to the source NCZ files.
  • Unlock Layers: All layer locks are automatically removed to allow editing.
  • Project Cleaning: Optionally, the project cleaning command is executed to remove unnecessary data.
  • Saving and Closing: Each NCZ file is saved to the target folder after editing, and the project is closed.
  • Result Notification: Upon completion, the user is informed of how many files were processed.


Etiket ( Labels )

NCZ düzenleme, toplu proje düzenleme, harita mühendisliği, otomasyon, makro, NetCAD makro, proje temizleme, şablon uygulama, NCZ dosya işleme, haritacılık, teknik ofis, proje otomasyonu, tabaka yönetimi, kilit kaldırma, dosya kaydetme

NCZ editing, batch project editing, surveying, automation, macro, NetCAD macro, project cleaning, template application, NCZ file processing, cartography, technical office, project automation, layer management, unlock layers, file saving


📝 Netcad NVB Code

VB

public sablon
'sablon = "d:\\FY\\Referans.NCZ" 'sablon mutlaka oluşturulmalı ve path bilgisi düzenlenmelidir

sub main()
 dim inPath,outPath,BD,proj,datum,zone,cleanProj
with netcad
    inpath = openDirDialog("Esas Alınacak Klasör")
    outpath = openDirDialog("Kaydedilecek Klasör ")
    set BD = .newbdialog("Hoşgeldiniz.")
  '  BD.PutPrompt "      Kaynak klasördeki dosyalar  "  & sablon
  '  BD.PutPrompt "      Referans projesinde olduğu gibi düzenlenecek"
    BD.PutPrompt "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯µ"
    BD.getString "INPATH","Kaynak Klasör : ",inpath,255
    BD.getString "OUTPATH","Hedef Klasör : ",outPath,255
    BD.getcheck  "CLEAN","Proje Düzenle",1
    BD.PutPrompt "________________________________________________________________µ"
    BD.PutPrompt "TOPLU PROJE DÜZENLEME MODÜLÜ - ŞABAN GÜL, HARİTA MÜHENDİSİ "
   if BD.showmodal then
        if BD.valuebyname("INPATH") <> "" then
            inPath = BD.valuebyname("INPATH")
            if BD.valuebyname("OUTPATH") <> "" then
                outPath = BD.valuebyname("OUTPATH")
                if BD.valuebyname("CLEAN") <> 0 then
                    cleanProj = BD.valuebyname("CLEAN")
                    process inPath,Outpath,cleanProj
                end if
            else
                msgbox "Esas Alınacak Klasörü Seçmediniz !!!"
                exit sub
            end if
        else
            msgbox "Kaydedilecek Klasörü Seçmediniz !!!"
            exit sub
        end if
    end if
end with
end sub

Sub process(inPath,Outpath,cleanProj)
dim FSO_folder,FSO,Count,NCZ_File,inFile,ly,b,i
  ' MSGBOX Outpath
'IF INSTR(outPath,"OLCU")>0  OR INSTR(outPath,"sınır")>0 then sablon = "d:\\FY\\Ref_OLCU.NCZ"
'IF INSTR(outPath,"SINIR")>0  OR INSTR(outPath,"sınır")>0 then sablon = "d:\\FY\\Ref_SIN.NCZ"
'IF INSTR(outPath,"pafta")>0  OR INSTR(outPath,"PAFTA")>0 then sablon = "d:\\FY\\Ref_Pafta.NCZ"
with netcad
    set FSO = CreateObject("Scripting.FileSystemObject")
    set FSO_folder = FSO.GetFolder(InPath)
    set Count = FSO_folder.Files
   for each NCZ_File in Count
                     IF RIGHT(InPath & NCZ_File.name,4)=".NCZ" THEN
                .InsertFile InPath & NCZ_File.name,fs_bnetcad,true
dim toptbk,tbksay
toptbk = .numlayers - 1
With nclayermanager
For tbksay = 0 To toptbk
 .layer(tbksay).LockActive=false
Next
 END with
if cleanProj = 1 then .NetcadCommand "PROJECT CLEAN 1,1,1,1,1,1"
        inFile = split(NCZ_File.name,".",-1,1)
        .SaveToFile OutPath & inFile(0) & ".NCZ"
        .findworld
        .NetcadCommand "CLOSE ACTIVEPROJECT"
        i = i + 1
        END IF
    Next
    msgbox i & " Dosya Düzenlendi..."
end with
end Sub

function openDirDialog(title)
dim shell,folder,filePath,fileRoot
  Set shell = CreateObject("Shell.Application")
  Set folder = shell.BrowseForFolder(&H0,title,&H0008,&H0011)
  on error resume next
  openDirDialog = folder.ParentFolder.ParseName(folder.title).Path&"\\"
  if err.number <> 0 then
    fileRoot = mid(folder.items.item(0).path,1,3)
    openDirDialog = fileRoot
  end if
  set shell  = nothing
  set folder = nothing
end function
VB

netcad-toplu-ncz-duzenle-temizlik

Yazar

sabangul67@gmail.com

Bu yazarın yayınladığı diğer içerikleri inceleyebilirsiniz.

Tüm yazıları