System Variables

System Variables

sanganaksakha
Advocate Advocate
758 Views
1 Reply
Message 1 of 2

System Variables

sanganaksakha
Advocate
Advocate

I am sudying the sample code in the 'AutoCAD .NET Developer's Guide'.

'CVPORT' is a system variable. It is called as follows:

Application.GetSystemVariable("CVPORT")

'TileMode' is another system variable which is called as follows:

Application.DocumentManager.MdiActiveDocument.Database.TileMode

Can somebody explain me the difference between the two methods of accessing the system variable?

Also, the logic about which method can be used with which system variable because I found that

Application.DocumentManager.MdiActiveDocument.Database.Cvport

does not seem to work.

0 Likes
759 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable

Hi,

 

the diffrent between tilemode and cvport is, that the cvport is an object and tilemode only an integer value.

 

use this:

 

Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;

Database db = doc.Database;

 

CurrentViewportTableRecordId cvId = db.CurrentViewportTableRecordId;

Transaction tr = db.TransactionManager.StartTransaction();

using (tr)

{

  //The following code gets the current viewport as an object.

  ViewportTableRecord cv = (ViewportTableRecord)tr.GetObject(cvId, OpenMode.ForRead);

 

}

 

I think thats works, but it is not tested.

 

Jürgen

 

0 Likes