iLogic, save .idw sheet as PDF

iLogic, save .idw sheet as PDF

Anonymous
Not applicable
605 Views
3 Replies
Message 1 of 4

iLogic, save .idw sheet as PDF

Anonymous
Not applicable

Hi

We have this small code running in Inventor which auto saves a PDF copy of all .idw files when we save them.

But something is wrong and it comes with an Error message

“Argument ”Length” has to be equal or lager then 0”

Code looks like this

WorkspacePath = ThisDoc.WorkspacePath()

WorkspacePathLength = Len(WorkspacePath)

PathOnly = ThisDoc.Path

DirectoryPath = Strings.Right(PathOnly, PathOnly.Length-WorkspacePathLength)

PDFPath = "\\sbs 2011\files\Z\Tegninger PDF"

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

ThisDoc.Document.SaveAs(PDFPath & "\" & ThisDoc.FileName(False) & ".pdf" , True)

 

0 Likes
606 Views
3 Replies
Replies (3)
Message 2 of 4

chandra.shekar.g
Autodesk Support
Autodesk Support

@Anonymous,

 

Try this,

 

DirectoryPath = Strings.Right(PathOnly, Len(PathOnly) - WorkspacePathLength)

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 3 of 4

Anonymous
Not applicable

This changes nothing.. Still same Error message

0 Likes
Message 4 of 4

chandra.shekar.g
Autodesk Support
Autodesk Support

@Anonymous,

 

Try this. Can you please provide sample path of WorkspacePath and ThisDoc.Path.

 

WorkspacePath = ThisDoc.WorkspacePath()

WorkspacePathLength = Len(WorkspacePath)

PathOnly = ThisDoc.Path

Pathlength = Len(PathOnly)

If Pathlength > WorkspacePathLength Then
	DirectoryPath = Strings.Right(PathOnly, Pathlength - WorkspacePathLength)
Else
	DirectoryPath = Strings.Right(PathOnly, WorkspacePathLength - Pathlength)
End If  

PDFPath = "\\sbs 2011\files\Z\Tegninger PDF"

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

ThisDoc.Document.SaveAs(PDFPath & "\" & ThisDoc.FileName(False) & ".pdf" , True)

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes