Skip to main content
Question

Read/Write Access to DWG Summary Info (DWG Properties)?


I managed to add SummaryInfo Comments (also known as DWG properties) to DWG files (created by FME Desktop) using ObjectDBX in a Windows Powershell  post process and wonder if it is possible to do it directly in FME Desktop:

$srcDir = "C:\DWG\infiles\"
$tgtDir = "C:\DWG\outfiles\"
$errorFile = 'C:\DWG\error.log'
$comments = 'C:\DWG\comments.csv'
 
$AutoCad = New-Object -ComObject Autocad.Application
$AcadVer = $AutoCad.ActiveDocument.GetVariable("ACADVER")
$AcadVer = $AcadVer.Split(".")[0]
$DbxId = "ObjectDBX.AXDbDocument."+$AcadVer
$Dbx = $AutoCAD.GetInterfaceObject($DbxId)
 
foreach($line in Get-Content $comments -Encoding UTF8)
{
  $data = $line.Split(";")
  Write-Host $data[0]
  try{
    $Dbx.Open($srcDir+$data[0]+".dwg")
    $Dbx.SummaryInfo.Comments = $data[1]
    $Dbx.SaveAs($tgtDir+$data[0]+".dwg")
  }
  catch{
    $error_msg = $srcDir+$data[0]+".dwg"
    Out-File -FilePath $errorFile -Append -InputObject $error_msg
	Write-Host "Error: ",$data[0]
  }
}

comments.csv:

4233-15_1;Last Change - VA40:21.10.2020
4234-31_3;Last Change - VA40:21.10.2020
4234-31_4;Last Change - VA40:21.10.2020
4234-32_1;Last Change - VA40:21.10.2020

As a workaround/hack in FME Workspace, I added a temporary DXF header with the included comments to my DWG Writer , but unfortunately this only works with "AutoCAD DWG Writer" and not with "RealDWG Writer" anymore (FME Desktop 2020.2 Windows 10/64bit).

 

2 years ago I had no problems adding DXF headers to DWG files using RealDWG, but the current FME version can't add these headers with the REAL driver. I really need the RealDWG Writer to prevent these annoying TrustedDWG messages 😉 

 

0 replies

Be the first to reply!

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings