pack and go with drawings vb.net

pack and go with drawings vb.net

Anonymous
Not applicable
919 Views
5 Replies
Message 1 of 6

pack and go with drawings vb.net

Anonymous
Not applicable

Best

 

I cannot find a solution how I can take the dwg drawings with me. These are in the workspace but in a different folder.

I have to change this rule. But I don't find the information. I tried

     

  the full code

 oPacknGo.AddFilesToPackage(path,sRefFiles)

 

path stands for the location of the folder. But this gives an error 😞

Do you know of a possible solution or where I can find more information about how it works?

 

 

        Dim oPacknGoComp As New PackAndGoLib.PackAndGoComponent
        Dim pAth1 As String
        Dim pAth2 As String
        Dim pAth3 As String


        Dim fileReader As String
        fileReader = My.Computer.FileSystem.ReadAllText("C:\Users\epls\Desktop\PATH.txt")
        Dim paths As String() = fileReader.Split(New String() {System.Environment.NewLine},
         StringSplitOptions.None)

        'Dim paths As String() = fileReader.Split(vbLf)

        pAth1 = paths(0)
        pAth2 = paths(1)
        pAth3 = paths(2)




        Dim oPacknGo As PackAndGoLib.PackAndGo

        If (Not System.IO.Directory.Exists(pAth2)) Then
            System.IO.Directory.CreateDirectory(pAth2)
        End If



        oPacknGo = oPacknGoComp.CreatePackAndGo(pAth1, pAth2)


        ' set the correct project file.  otherwise, the method will crash

        oPacknGo.ProjectFile = pAth3



        Dim sRefFiles = New String() {}

        Dim sMissFiles = New Object



        '  Set the options

        oPacknGo.SkipLibraries = True

        oPacknGo.SkipStyles = True

        oPacknGo.SkipTemplates = True

        oPacknGo.CollectWorkgroups = False

        oPacknGo.KeepFolderHierarchy = True

        oPacknGo.IncludeLinkedFiles = True



        '  Get the referenced files

        oPacknGo.SearchForReferencedFiles(sRefFiles, sMissFiles)


        '  Add the referenced files for package

        oPacknGo.AddFilesToPackage(sRefFiles)



        ' Start the pack and go to create the package

        oPacknGo.CreatePackage()

thank you in advance

0 Likes
Accepted solutions (1)
920 Views
5 Replies
Replies (5)
Message 2 of 6

bradeneuropeArthur
Mentor
Mentor
Accepted solution
 Public Sub PackAndGoSample(a As String)
        'SET THE APPLICATION TO 64 BIT
        Dim fio As System.IO.FileInfo
        Dim dirio As System.IO.DirectoryInfo

        fio = New System.IO.FileInfo(a)
        dirio = New System.IO.DirectoryInfo(fio.Directory.FullName)

        Dim oPacknGoComp As New PackAndGoLib.PackAndGoComponent

        Dim oPacknGo As PackAndGoLib.PackAndGo
        Try
            MkDir("C:\Temp\PackAndGo")
        Catch ex As Exception

        End Try

        oPacknGo = oPacknGoComp.CreatePackAndGo(a, "C:\Temp\PackAndGo")

        ' Set the design project. This defaults to the current active project.
        oPacknGo.ProjectFile = "C:\Vault\XYZ.ipj"

        Dim sRefFiles = New String() {}
        Dim sMissFiles = New Object

        Dim sRefcingFiles = New String() {}

        ' Set the options
        oPacknGo.SkipLibraries = True
        oPacknGo.SkipStyles = True
        oPacknGo.SkipTemplates = True
        oPacknGo.CollectWorkgroups = False
        oPacknGo.KeepFolderHierarchy = True
        oPacknGo.IncludeLinkedFiles = True

        ' Get the referenced files
        oPacknGo.SearchForReferencedFiles(sRefFiles, sMissFiles)

        oPacknGo.SearchForReferencingFiles(sRefFiles, sRefcingFiles, False, dirio.Parent.FullName & "\_Dwg")

        ' Add the referenced files for package
        'oPacknGo.AddFilesToPackage(sRefFiles)
        'oPacknGo.AddFilesToPackage(sRefcingFiles)

        Dim xa = New String(sRefFiles.Length + sRefcingFiles.Length - 1) {}
        sRefFiles.CopyTo(xa, 0)
        sRefcingFiles.CopyTo(xa, sRefFiles.Length)

        'oPacknGo.AddFilesToPackage(sMissFiles)
        ' Start the pack and go to create the 
        oPacknGo.AddFilesToPackage(xa)
        'MsgBox(xa.Length)
        

        oPacknGo.CreatePackage(True)
    End Sub

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

Message 3 of 6

Anonymous
Not applicable

thank you very much I could use the code in my code. Thanks again

Another question is there is a place where you can find more explanation how to approach certain functions of inventor in vb.net.

0 Likes
Message 4 of 6

bradeneuropeArthur
Mentor
Mentor

Hi,

 

what do you exactly mean?

 

Help>>>Programming/API help>>>>

 

 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 5 of 6

jakew4ZK5X
Explorer
Explorer
hey mate, did you end up solving writing a code that works in VB.net?
0 Likes
Message 6 of 6

ILU
Enthusiast
Enthusiast

hi Ewoud ( @Anonymous ), 

can you help us with packAndGo to make it run from iLogic API?\

or,

can you Share with us you Vb.Net code that you have managed to make it work ?

Thanks,

Ionut 😉

0 Likes