.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CVport or CTAB

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
730 Views, 4 Replies

CVport or CTAB

How do I find the values of these drawing varibles? How do I test if I'm
currently working inside a paperspace viewport or not?

Thanks in advance
4 REPLIES 4
Message 2 of 5
arcticad
in reply to: Anonymous

You can get the Current Layout by using GetSystemVariable:

Autodesk.AutoCAD.ApplicationServices.Application.GetSystemVariable("CTAB")

And the following code will return true if you are in "Model" tab or inside a viewport

{code}

Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.Interop

Public Class isModelSpaceCode

Function IsModelspace() As Boolean
If ThisDrawing.ActiveSpace = Common.AcActiveSpace.acPaperSpace Then
Return ThisDrawing.MSpace()
Else
Return True
End If
End Function

Function GetSpace() As Object
If IsModelspace() Then
GetSpace = ThisDrawing.ModelSpace
Else
GetSpace = ThisDrawing.PaperSpace
End If
End Function

Function ThisDrawing() As AcadDocument
'The COM active drawing
Dim objThisDrawing As AcadDocument
'Get the COM AutoCAD application object
Dim objAcadApp As AcadApplication = CType(Application.AcadApplication, AcadApplication)
Try
'Get the COM active drawing
objThisDrawing = objAcadApp.ActiveDocument
Return objThisDrawing
Catch ex As System.Exception
End Try
Return Nothing
End Function

End Class
{code}
---------------------------



(defun botsbuildbots() (botsbuildbots))
Message 3 of 5
Anonymous
in reply to: Anonymous

That is great. ThanksIn doing my homework last night I came accross this.
What is the
difference.Autodesk.AutoCAD.EditorInput.Editor.CurrentViewportObjectId()
Autodesk.AutoCAD.EditorInput.Editor.ActiveViewportId() wrote in
message news:6339353@discussion.autodesk.com...
You can get the Current Layout by using GetSystemVariable:

Autodesk.AutoCAD.ApplicationServices.Application.GetSystemVariable("CTAB")

And the following code will return true if you are in "Model" tab or inside
a viewport

{code}

Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.Interop

Public Class isModelSpaceCode

Function IsModelspace() As Boolean
If ThisDrawing.ActiveSpace = Common.AcActiveSpace.acPaperSpace Then
Return ThisDrawing.MSpace()
Else
Return True
End If
End Function

Function GetSpace() As Object
If IsModelspace() Then
GetSpace = ThisDrawing.ModelSpace
Else
GetSpace = ThisDrawing.PaperSpace
End If
End Function

Function ThisDrawing() As AcadDocument
'The COM active drawing
Dim objThisDrawing As AcadDocument
'Get the COM AutoCAD application object
Dim objAcadApp As AcadApplication =
CType(Application.AcadApplication, AcadApplication)
Try
'Get the COM active drawing
objThisDrawing = objAcadApp.ActiveDocument
Return objThisDrawing
Catch ex As System.Exception
End Try
Return Nothing
End Function

End Class
{code}
Message 4 of 5
arcticad
in reply to: Anonymous

GetSpace should be as follows

{code}
Function GetSpace() As Object
If IsModelspace() Then
return ThisDrawing.ModelSpace
Else
return ThisDrawing.PaperSpace
End If
End Function

{code}

>difference.Autodesk.AutoCAD.EditorInput.Editor.CurrentViewportObjectId()
>Autodesk.AutoCAD.EditorInput.Editor.ActiveViewportId() wrote in

what web site was this.
As far as I see Editor doesn't have CurrentViewportObjectId() or ActiveViewportId()
---------------------------



(defun botsbuildbots() (botsbuildbots))
Message 5 of 5
Anonymous
in reply to: Anonymous

They were in the object browser.


wrote in message news:6341165@discussion.autodesk.com...
GetSpace should be as follows

{code}
Function GetSpace() As Object
If IsModelspace() Then
return ThisDrawing.ModelSpace
Else
return ThisDrawing.PaperSpace
End If
End Function

{code}

>difference.Autodesk.AutoCAD.EditorInput.Editor.CurrentViewportObjectId()
>Autodesk.AutoCAD.EditorInput.Editor.ActiveViewportId() wrote in

what web site was this.
As far as I see Editor doesn't have CurrentViewportObjectId() or
ActiveViewportId()

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost