This error gives he on the line: "bron.Database.SaveAs("C:\test.dwg", DwgVersion.Current)"
Could some help me.
Tanks
Maarten
Private Sub cmdTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdTest.Click
Me.OpenFileDialog1.Filter = "DWG files (*.dwg)|*.dwg"
Me.OpenFileDialog1.ShowDialog()
Dim TekeningNaam = Me.OpenFileDialog1.FileName
BlokNaam = Me.OpenFileDialog1.SafeFileName
BlokNaam = BlokNaam.Remove(BlokNaam.Length - 4, 4)
bron = Application.DocumentManager.Add("")
bron.Database.SaveAs("C:\test.dwg", DwgVersion.Current)
bron.LockDocument()
bron.SendStringToExecute("-Insert" & vbCr & TekeningNaam & vbCr & "s 1 r 0 0,0 z all ", True, False, False)
End Sub
Solved! Go to Solution.
Can you give a bit of a description of what it is you are trying to acheive? I assume that bron is meant to be a Document?
It's open a Wblock in a clean drawning and saved it.
This clean drawning is used for redifined blocks in other drawnings after a revision.
If you want the rest of it, i sent you a personal message.
.Maarten.
I didn't have any problem with the code. I have made some changed to the code (If OpenFileDialog1.ShowDialog() = DialogResult.OK Then).
OpenFileDialog1.Filter = "DWG files (*.dwg)|*.dwg" If OpenFileDialog1.ShowDialog() = DialogResult.OK Then Dim TekeningNaam = OpenFileDialog1.FileName Dim BlokNaam As String = System.IO.Path.GetFileNameWithoutExtension(OpenFileDialog1.FileName) Dim bron As Document = ApplicationServices.Application.DocumentManager.Add("") bron.Database.SaveAs("C:\test.dwg", DwgVersion.Current) bron.LockDocument() bron.SendStringToExecute("-Insert" & vbCr & TekeningNaam & vbCr & "s 1 r 0 0,0 z all ", True, False, False) End If
Which line of code was the error occuring?
Can I also recommend that instead of using SendStringToExecute, use one of Tony Tanzillos CommandLine
http://www.caddzone.com/CommandLine.vb
Try saving to folder on the C drive
Create a folder Test on the C drive and change code to
C:\Test\test.dwg
Depending on security settings I have seen mainly Windows 7 reject saving directly to the C drive