With the following code, can not bind xrefs,I don't know why?
[CommandMethod("TESTETRANSMIT2022")]
public static void ETransmitDwg2022()
{
TransmittalOperation tro = new TransmittalOperation();
TransmittalInfo ti = tro.getTransmittalInfoInterface();
ti.BindType = BindType.eBind;
ti.depathXrefs = 1;
ti.destinationRoot = "D:\\TransmittalSet\\";
ti.saveVersion = SaveDwgFormat.eNoConversion;
ti.visualFidelity = 1;
ti.purgeDatabase = 1;
ti.resetPlotter = 1;
ti.includeDataLinkFile = 0;
ti.includeDGNUnderlay = 0;
ti.includeDWFUnderlay = 0;
ti.includeFontFile = 0;
ti.includeImageFile = 0;
ti.includeMaterialTextureFile = 0;
ti.includeNestedOverlayXrefDwg = 0;
ti.includePDFUnderlay = 1;
ti.includePhotometricWebFile = 0;
ti.includePlotFile = 0;
ti.includeUnloadedReferences = 0;
ti.includeUnloadedXrefDwg = 0;
ti.includeXrefDwg = 0;
TransmittalFile tf = null;
string dwgFile = @"D:\新建文件夹\Drawing2.dwg";
AddFileReturnVal val = tro.addDrawingFile(dwgFile, out tf);
tro.createTransmittalPackage();
}
hi
according to IncludeXrefDwg Property (ActiveX/ATO) Autocad Documents maybe you need to change this line:
ti.includeXrefDwg = 0;
to
ti.includeXrefDwg = 1;
sorry maybe i misunderstand what you want to do.
binding a xRef is complitly different from eTransmit, in other word you have to do this tasks seperately, maybe you need first bind xRef and after that try to eTransmit.
for binding you can use this documentation.
you can use TransmittalAddFileNotificationHandler, or another Transmittal event to preprocess stuff.
I try it like this,but also not work; the database can not change;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AcETransmit;
using AutoCAD;
using Autodesk.AutoCAD.Runtime;
namespace ETransmitDwg2022
{
internal class MyTransFileNotifier : TransmittalAddFileNotificationHandler
{
public void addFileNotificationHandler(TransmittalFile pFile, TransmittalOperation pTransmit)
{
if (pFile.database != null)
{
AcadDatabase acDb = pFile.database;
if (acDb != null)
{
foreach (AcadBlock block in acDb.Blocks)
{
if (block.IsXRef)
{
block.Bind(true);
}
}
}
}
}
public void beginFilesGraphCreation(TransmittalOperation pTransmit) { }
public void endFilesGraphCreation(TransmittalOperation pTransmit) { }
}
internal class datahandle : TransmittalDatabaseNotificationHandler
{
public int preDatabaseProcessing(object pDatabase, TransmittalFile pFile, TransmittalOperation pTransmit)
{
if (pDatabase != null)
{
AcadDatabase acDb = (AcadDatabase)pDatabase;
if (acDb != null)
{
foreach (AcadBlock block in acDb.Blocks)
{
if (block.IsXRef)
{
block.Bind(true);
}
}
}
}
return 1;
}
public int postDatabaseProcessing(object pDatabase, TransmittalFile pFile, TransmittalOperation pTransmit)
{
if (pDatabase != null)
{
AcadDatabase acDb = (AcadDatabase)pDatabase;
if (acDb != null)
{
foreach (AcadBlock block in acDb.Blocks)
{
if (block.IsXRef)
{
block.Bind(true);
}
}
}
}
return 1;
}
public int convertDatabase(object pDatabase, TransmittalFile pFile, TransmittalOperation pTransmit)
{
if (pDatabase != null)
{
AcadDatabase acDb = (AcadDatabase)pDatabase;
if (acDb != null)
{
foreach (AcadBlock block in acDb.Blocks)
{
if (block.IsXRef)
{
block.Bind(true);
}
}
}
}
return 1;
}
}
public class Class1
{
private static MyTransFileNotifier myTransFileNotifier = new MyTransFileNotifier();
private static datahandle datah = new datahandle();
[CommandMethod("TESTETRANSMIT2022")]
public static void ETransmitDwg2022()
{
TransmittalOperation tro = new TransmittalOperation();
tro.subscribeToAddFileNotification(myTransFileNotifier);
tro.subscribeDatabaseNotification(datah);
TransmittalInfo ti = tro.getTransmittalInfoInterface();
ti.BindType = BindType.eBind;
ti.depathXrefs = 1;
ti.destinationRoot = "D:\\TransmittalSet\\";
ti.saveVersion = SaveDwgFormat.eNoConversion;
ti.visualFidelity = 1;
ti.purgeDatabase = 1;
ti.resetPlotter = 1;
ti.includeDataLinkFile = 0;
ti.includeDGNUnderlay = 0;
ti.includeDWFUnderlay = 0;
ti.includeFontFile = 0;
ti.includeImageFile = 0;
ti.includeMaterialTextureFile = 0;
ti.includeNestedOverlayXrefDwg = 0;
ti.includePDFUnderlay = 1;
ti.includePhotometricWebFile = 0;
ti.includePlotFile = 0;
ti.includeUnloadedReferences = 0;
ti.includeUnloadedXrefDwg = 0;
ti.includeXrefDwg = 1;
TransmittalFile tf = null;
string dwgFile = @"D:\00\Drawing2.dwg";
AddFileReturnVal val = tro.addDrawingFile(dwgFile, out tf);
tro.createTransmittalPackage();
}
}
}
Thank you for your answer, I just want to replicate that function in the picture;I wonder how autocad is implemented , use eTransmit and Bind Dwg Files
Well, that’s a bummer, wondering if you need to save the drawing so etransmit sees the changes
but the NotificationHandler can only get database, the AcadDatabase can not save, only AcadDocument can save; so use database(AcadDatabase ) can not save the drawing;
So, somehow you need to get the .NET version of the database, which does have a saveas method.
ARX has a global function acdbActiveDatabaseArray, I don’t know if there’s a .NET equivalent.
Or maybe there’s a way to get a .net instance of the database from COM
Can't find what you're looking for? Ask the community or share your knowledge.