Help me please!

Hello! uchusU write in VB.NET and first way I have a problem.
Learning language examples for AutoCAD.
One example works:

Imports Autodesk.AutoCAD.ApplicationServices  
Imports Autodesk.AutoCAD.Runtime  
  
 _    
Public Sub SaveActiveDrawing()    
  Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument   
  Dim strDWGName As String = acDoc.Name   
  
  Dim obj As Object = Application.GetSystemVariable("DWGTITLED")  
  
  '' Check to see if the drawing has been named   
  If System.Convert.ToInt16(obj) = 0 Then 
      '' If the drawing is using a default name (Drawing1, Drawing2, etc) 
      '' then provide a new name  
      strDWGName = "c:\MyDrawing.dwg" 
  End If  
  
  '' Save the active drawing  
  acDoc.Database.SaveAs(strDWGName, True, DwgVersion.Current, _   
                        acDoc.Database.SecurityParameters)    
End Sub


the second example does not work:


Imports System.IOImports Autodesk.AutoCAD.ApplicationServices     
Imports Autodesk.AutoCAD.DatabaseServices     
Imports Autodesk.AutoCAD.Runtime      
      
 _        
Public Sub OpenDrawing()      
  Dim strFileName As String = "C:\campus.dwg"     
  Dim acDocMgr As DocumentCollection = Application.DocumentManager        
      
  If (File.Exists(strFileName)) Then      
      acDocMgr.Open(strFileName, False)       
  Else        
      acDocMgr.MdiActiveDocument.Editor.WriteMessage("File " & strFileName & _        
                                                     " does not exist.")      
  End If      
End Sub
I changed the import libraries on BricsCad.  
Why does not the second example. What is wrong? How to do this right?
  

Comments

This discussion has been closed.

Welcome!

It looks like you're new here. Sign in or register to get started.