Results 1 to 7 of 7

Thread: .Net TRANSMITTALLib Sample Code

  1. #1
    Login to Give a bone
    0

    Default .Net TRANSMITTALLib Sample Code

    Hi,

    I'm writing an eTransmit batch program in vb.net, and am having trouble getting it to get anywhere near making a zip. I've looked through the Objectarx 2013 doc, but it's a little over my head. I found a bit of code from Through the Interface which I used as a starter and hacked it into VB:

    Code:
    Imports TRANSMITTALLib
    
            Dim TransZip As TransmittalFile
            Dim TransOp As New TransmittalOperation()
    
    
            MsgBox(sDWGtoZip & vbNewLine & sZipFile)
    
    
            If [TransOp].addDrawingFile(sDWGtoZip, TransZip) = TRANSMITTALLib.AddFileReturnVal.eFileAdded Then
    
    
            End If
    It crashes at addDrawingFile, which doesn't suprise me, TransZip hasn't been set up in anyway.
    Code:
    System.ArgumentException: Value does not fall within the expected range.
       at TRANSMITTALLib.ITransmittalOperation.addDrawingFile(String fullpathname, TransmittalFile& ppIAddedFile)
    I found sound Bricscad (!) code which seemed it might get me a bit further along

    Code:
            Dim trmOp As New TransmittalOperation
            trmOp.createTransmittalPackage()
            trmOp = ThisDrawing.getTransmittalOperationInterface
    
    
            Dim trmInfo As TransmittalInfo
            trmInfo = trmOp.getTransmittalInfoInterface
            trmInfo.destinationRoot = sZipFile
            Dim trmFile As TransmittalFile
            Dim retVal As AddFileReturnVal
            retVal = trmOp.addDrawingFile(sDWGtoZip, trmFile)
            Dim trmGraph As TransmittalFilesGraph
            trmGraph = trmOp.getTransmittalGraphInterface
            trmOp.createTransmittalPackage() 'copy the files to the folder set by destPath
    but its VBA, and in .NET we have no Thisdrawing and I can find no object that provides a getTransmittalOperationInterface method.

    Has anyone had any success before with AcETransmit18.tlb?

    Thanks,
    Bernie

  2. #2
    Login to Give a bone
    0

    Default Re: .Net TRANSMITTALLib Sample Code

    Sorry, my mistake.

    I was put off by the error message System.ArgumentException: Value does not fall within the expected range. This turned out that I was targeting a zip file instead of a directory. Another issue was I was running this inside a loop where I was opening the drawing with ReadDwgFile (giving the same multi-use error message). It all works fine, except I think I have to supply my own Zip function. The following code works (and it seems you might be able to run a standalone app referencing AcETransmit18.tlb and doing your eTramsmit business outside of AutoCAD, as you are only passing it paths to drawings a strings.


    Code:
    Private Function eTransmitaDWG(sDWGtoZip As String, sZipPath As String) As String
            Dim sErr As String = ""
    
            '/////////////// Call ITransmittalOperation::getTransmittalInfoInterface() to get the ITransmittalInfo interface.
            Dim trmOp As New TransmittalOperation
            trmOp.createTransmittalPackage()
    
            '/////////////// Use the ITransmittalInfo interface methods to set up the destination folder and other settings.
            Dim trmInfo As TransmittalInfo
            trmInfo = trmOp.getTransmittalInfoInterface
            trmInfo.destinationRoot = sZipPath
            '    'tweak following settings to either include or exclude files in the package
            trmInfo.includeImageFile = True
            trmInfo.includeXrefDwg = True
            trmInfo.includePlotFile = True
            'note: limitation - currently saveVersion cannot be set so following will have no effect (it will default to 0=eNoConversion)
            trmInfo.saveVersion = SaveDwgFormat.eNoConversion
    
    
            '/////////////// Add files to the transmittal set by calling the appropriate ITransmittalOperation add methods.
            Dim trmFile As New TransmittalFile
            Dim retVal As AddFileReturnVal
            If My.Computer.FileSystem.FileExists(sDWGtoZip) Then
    
                Try
                    retVal = trmOp.addDrawingFile(sDWGtoZip, trmFile)
                    If retVal = TRANSMITTALLib.AddFileReturnVal.eFileAdded Then
    
                    Else
                        sErr = retVal.ToString
                    End If
                Catch ex As Exception
                    sErr = ex.Message & vbNewLine & ex.ToString
                End Try
            Else
                Return "File Not found"
            End If
    
            '/////////////// Investigate the file dependencies by checking the transmittal graph using the ITransmittalFilesGraph interface methods.
            Dim trmGraph As TransmittalFilesGraph
            trmGraph = trmOp.getTransmittalGraphInterface
     
            trmOp.createTransmittalPackage() 'copy the files to the folder set by destPath
    
            sErr = sTESTSTRING
            Return sErr
        End Function
    Not much error handling there as I want to sent the message from the JIT.

    Cheers,
    Bernie

  3. #3
    Login to Give a bone
    0

    Default Re: .Net TRANSMITTALLib Sample Code

    Well just to continue this delightful conversation with myself, I built my solution in VS2010 targeting AutoCAD 2013. Following Serge Camire's most excellent post http://www.augifr.fr/images/migratio...256-colors.png I made a solution with numerous projects targeting various AutoCAD versions linking code from a master project in the solution, using preprocessing #if #then's to run code that needs to be different between versions, changing the ,net version to suit the AutoCAD version (really, Serge's article is brilliant), I got it all to compile.

    I edited acad.exe.config in accordance with http://adndevblog.typepad.com/autoca...-location.html.

    However, my reference to aceTransmit18.tlb ruins everything. Sometimes I couldn't attached the reference at all to a pre-2013 project, it would say file not found (I assume the wrapper could not be found, as I just selected the file in the add ref dialog). Other times, I could not compile. Sometimes I detach the reference, restart VS2010, reference, and can compile. Sometimes I could compile, but when I NETLOAD into Acad 2011 I get an error message. Now I apologise, and I know how lame this is, but its a long 24 hours since I saw the error message, but it was words to the effect that aceTransmit18.tlb was built for a more recent version of the framework. No worries I thought, I downloaded the 2011 ObjectArx SDK and referenced aceTransmit.tlb (date stamped 2010) recompiled, netloaded, same "more recent" error message.

    Googled it, here it is: This assembly is built by a runtime newer than the currently
    loaded runtime and cannot be loaded.

    If I detach the reference to aceTransmit.tlb, comment out the relevant code and recompile, the app runs, but my app is basically just a dialog box without aceTransmit18.

    Any Ideas? Again I apologise for being away from my workstation and not providing all the info.

    I'd be happy to just support back to 2010/2011. Is it really that hard? I miss VBA. Wish I knew LISP, there's 20 year old LISP in my office written for AutocAD 10 that works just fine in 2013. Sigh.

    Bernie.
    I

  4. #4
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,713
    Login to Give a bone
    0

    Default Re: .Net TRANSMITTALLib Sample Code

    Perhaps this DevBlog post will be of use: Resolving references when using tlbimp
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  5. #5
    Login to Give a bone
    0

    Default Re: .Net TRANSMITTALLib Sample Code

    How did I miss that article? Thanks RenderMan.

  6. #6
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,713
    Login to Give a bone
    0

    Default Re: .Net TRANSMITTALLib Sample Code

    Quote Originally Posted by bernie.snodgrass892799 View Post
    Thanks RenderMan.
    You're welcome; Happy to help
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  7. #7
    Woo! Hoo! my 1st post
    Join Date
    2014-01
    Posts
    1
    Login to Give a bone
    0

    Default Re: .Net TRANSMITTALLib Sample Code

    Quote Originally Posted by bernie.snodgrass892799 View Post
    How did I miss that article? Thanks RenderMan.
    Hello Mister,

    I'm trying today to do the same operation as you. Did you success to make eTransmit in a zip format ?

    AS we can't find help on internet maybe you could help me a bit.

    You code is working for me at this time and I would like to be able to :

    1) choose between the 3 types of transfert folder - exe - zip
    2) Insert Xrefs in the dwg

    Thanks beforehand, any help would be appreciated !

Similar Threads

  1. Error in a sample code ?
    By Dubweisertm in forum Dot Net API
    Replies: 3
    Last Post: 2011-09-08, 08:17 PM
  2. Sample code Error
    By r.vetrano in forum Revit - API
    Replies: 2
    Last Post: 2007-07-09, 11:42 AM
  3. Replies: 0
    Last Post: 2006-04-10, 05:38 PM
  4. Replies: 13
    Last Post: 2004-07-29, 11:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •