.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to use the command "-etransmit"

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
AubelecBE
1094 Views, 6 Replies

How to use the command "-etransmit"

HI.

i want to save my drawing with the xref so i want to launch "-etransmit" here my code:

 

  Application.SetSystemVariable("FILEDIA", 0)
                                doc.SendStringToExecute("-etransmit" & vbCr & _
                                                        "CH" & vbCr & _
                                                        "archivage" & vbCr & _
                                                        "C" & vbCr & _
                                                         "" & Txt & "" & vbCr, True, False, True)

So the TXT contain my path+filename (.zip)

"archivage" is the config for etransmit.

 

i need to set to 0 the FILEDIA for force my path+name.

 

it work fine but how i can set to 1 the var ? FILEDIA.

 

the SendStringToExecute is execute after the end of my prog so i cant add the code after this.

 

Need to use event ?

 

I tryed to use this :

 

'***********************************************************************
    '**  Fonction Lancement d'une commande Synchrone sur la ligne         **
    '**   de commande d'Autocad                                           **
    '***********************************************************************
    '** ENTREE (exemple)                                                  **
    '**   Tracé une ligne :
    '**     CommandeSync("_.line", New Point3d(10.0, 20.0, 0.0), New Point3d(80.0, 50.0, 0.0), "")
    '**   Freeze du calque 0                                              
    '**     CommandeSync("_.vplayer", "_freeze", "0", "_select", "\", "", "")
    '**
    '** Note:
    '**   - an empty string ("") means a validation (Enter)
    '**   - an anti-slash ("\" with VB or "\\" with C#) means a pause for user input.
    '**
    '**   - Texte : Le texte à afficher                                   **
    '***********************************************************************
    '** with A2013, replace "acad.exe" with "accore.dll" in the DllImport attribute arguments.
    '*******************************************************************************************
    <System.Security.SuppressUnmanagedCodeSecurity()> _
        <System.Runtime.InteropServices.DllImport("acad.exe", _
              EntryPoint:="acedCmd", _
              CharSet:=System.Runtime.InteropServices.CharSet.Unicode, _
              CallingConvention:=System.Runtime.InteropServices.CallingConvention.Cdecl)> _
    Private Function acedCmd(ByVal resbuf As IntPtr) As Integer
    End Function

    '''<summary>
    ''' Call an AutoCAD command (runs synchronously).
    ''' </summary>
    ''' <param name="args">The command name followed by command inputs.</param>
    ''' 
    Public Sub LigneCommandeImmediate(ByVal ParamArray args As Object())
        Dim resbuf As New ResultBuffer()
        For Each obj As Object In args
            Select Case obj.GetType().Name
                Case "String"
                    resbuf.Add(New TypedValue(CInt(Autodesk.AutoCAD.Runtime.LispDataType.Text), obj))
                    Exit Select
                Case "Int16"
                    resbuf.Add(New TypedValue(CInt(Autodesk.AutoCAD.Runtime.LispDataType.Int16), obj))
                    Exit Select
                Case "Int32"
                    resbuf.Add(New TypedValue(CInt(Autodesk.AutoCAD.Runtime.LispDataType.Int32), obj))
                    Exit Select
                Case "Double"
                    resbuf.Add(New TypedValue(CInt(Autodesk.AutoCAD.Runtime.LispDataType.[Double]), obj))
                    Exit Select
                Case "Point2d"
                    resbuf.Add(New TypedValue(CInt(Autodesk.AutoCAD.Runtime.LispDataType.Point2d), obj))
                    Exit Select
                Case "Point3d"
                    resbuf.Add(New TypedValue(CInt(Autodesk.AutoCAD.Runtime.LispDataType.Point3d), obj))
                    Exit Select
                Case "ObjectId"
                    resbuf.Add(New TypedValue(CInt(Autodesk.AutoCAD.Runtime.LispDataType.ObjectId), obj))
                    Exit Select
                Case "ObjectId[]"
                    For Each id As ObjectId In DirectCast(obj, ObjectId())
                        resbuf.Add(New TypedValue(CInt(Autodesk.AutoCAD.Runtime.LispDataType.ObjectId), id))
                    Next
                    Exit Select
                Case "ObjectIdCollection"
                    For Each id As ObjectId In DirectCast(obj, ObjectIdCollection)
                        resbuf.Add(New TypedValue(CInt(Autodesk.AutoCAD.Runtime.LispDataType.ObjectId), id))
                    Next
                    Exit Select
                Case "SelectionSetDelayMarshalled", "SelectionSetFullyMarshalled"
                    resbuf.Add(New TypedValue(CInt(Autodesk.AutoCAD.Runtime.LispDataType.SelectionSet), obj))
                    Exit Select
                Case Else
                    Throw New InvalidOperationException("Unsupported type in Command() method")
            End Select
        Next

        acedCmd(resbuf.UnmanagedObject)
    End Sub

 but not wotking. i need to execute de etransmit immediately and after set to 1 the FILEDIA. How i can do ?

 

6 REPLIES 6
Message 2 of 7
SENL1362
in reply to: AubelecBE

It wouldn't be my idea of creating a zipped folder containing all referenced data, but maybe you could add filedia to you're command line
doc.SendStringToExecute("FILEDIA 0 -etransmit" & vbCr & _
"CH" & vbCr & _
"archivage" & vbCr & _
"C" & vbCr & _
"" & Txt & "" & vbCr & "FILEDIA 1" & vbCr, True, False, True)
Message 3 of 7
hgasty1001
in reply to: AubelecBE

Hi,

 

Did you see this: etransmit

 

Gaston Nunez

Message 4 of 7
AubelecBE
in reply to: hgasty1001

gasty, your solution need interop. it is annoying to do this. I have many PC and system. (XP, Seven 64b).

so it is much better to add FILEDIA in the SendString.

 

But you have to check if the dwg is saved and not modified.

 

Works fine now.

 

Thank to you 2.

Message 5 of 7

Hi,

That's what exactly I am looking for. But could you please translate this in C#
Message 6 of 7

The other way to solve the issue of original post (i.e. reset "FILEDIA" back to 1 after SendStringToExecute()) is to simply add handler to Document.CommandEnded right before calling "etransmit", something like:

 

private bool doETrans=true; // declare a class level variable as flag, indicating the "etrans" command is from your code

... ...

... ...

Application.SerSystemVariable("FILEDIA", 0);

 

doc.CommandEnded+=Handle_EtransCommandEnded;

 doc.SendStringToExecute("-etransmit ", ... ...)

 ... ...

 

private void Handle_EtransCommandEnded(object sender, CommandArgs e)

{

  if (e.GlobalCommandName.ToUpper().Contains("ETRANSMIT") && doETrans)

  {

      Application.SerSystemVariable("FILEDIA", 1);

      doc.CommandEnded-=Handle_EtransCommandEnded;

   }

}

 

 

Message 7 of 7

Hi,

Thanks for your response. I want, on the execution of my command "ETRANSMIT" command should be invoked, but should always show the dialog.

using AcAp = Autodesk.AutoCAD.ApplicationServices.Application;
AcAp.SetSystemVariable("FILEDIA", 1);
AcAp.DocumentManager.MdiActiveDocument.SendStringToExecute("-ETRANSMIT", false, false, true);

This is the code I am using.... is something wrong happening here. Because whenever I execute this piece of code, I am getting not getting the dialog (shown in attachment)

 

ETRANSMIT.JPG

Please help me with this.

Warm Regards,
Sameer Rathoud

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost