File name for Save as PDF

Hello everyone,

 

I very often save drawing as PDF and DXF for laser cutting.

I would like to create alone macro for PDF and DXF.

I am programer biginer. I use MS VB 10 Express

 

My code now is:

 

Imports System.Runtime.InteropServices

 

 

Module Module1

 

Public seApp

Dim dftDoc As SolidEdgeDraft.DraftDocument = Nothing

 

 

Sub Main()

seApp = GetObject(, "SolidEdge.Application")

dftDoc = CType(seApp.ActiveDocument, SolidEdgeDraft.DraftDocument)

dftDoc.SaveAs("test.pdf")

End Sub

 

End Module

 

It works but name of PDF file is always "Test.pdf".

How get active drawing file name to name of PDF (instead "Test")?

 

Thank you.

 

Mike

 

Posted by: Michal
Post date: 4/5/2012 8:25:12 AM

1 REPLY

Re: File name for Save as PDF

Mike,

 

below your code with the required changes:

 

Module Module1
 
Public seApp
 Dim dftDoc As SolidEdgeDraft.DraftDocument = Nothing
 

Sub Main()
 seApp = GetObject(, "SolidEdge.Application")
 dftDoc = CType(seApp.ActiveDocument, SolidEdgeDraft.DraftDocument)
 dftDoc.SaveAs(IO.Path.GetFileNameWithoutExtension(dftDoc.FullName) & ".pdf")
 End Sub
 
End Module

 

Posted by: Wolfgang Kunert
Post date: 4/8/2012 2:34:50 AM