VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to get the object of ActiveSpace

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

how to get the object of ActiveSpace

hi,
Would you tell me anything about the following questions please
what is wrong with it.

Set ActiveSpc = ThisDrawing.ActiveSpace
Set polyObj = ActiveSpc.Add3DPoly(points)

how to get the object of ActiveSpace
thank you
regards
4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: Anonymous

you could do something like this:
If ThisDrawing.ActiveSpace = acModelSpace Then
Set polyObj = ActiveSpc.Add3DPoly(points)
Else
Set polyObj = ActiveSpc.Add3DPoly(points)
End If

Kevin

"youngman" wrote in message
news:DC86B70D8E3DD2276D77FB9BCD0DEBEB@in.WebX.maYIadrTaRb...
> hi,
> Would you tell me anything about the following questions please
> what is wrong with it.
>
> Set ActiveSpc = ThisDrawing.ActiveSpace
> Set polyObj = ActiveSpc.Add3DPoly(points)
>
> how to get the object of ActiveSpace
> thank you
> regards
>
Message 3 of 5
Anonymous
in reply to: Anonymous

ThisDrawing.ActiveLayout.Block.Add3dpoly(points)

"youngman" wrote in message
news:DC86B70D8E3DD2276D77FB9BCD0DEBEB@in.WebX.maYIadrTaRb...
> hi,
> Would you tell me anything about the following questions please
> what is wrong with it.
>
> Set ActiveSpc = ThisDrawing.ActiveSpace
> Set polyObj = ActiveSpc.Add3DPoly(points)
>
> how to get the object of ActiveSpace
> thank you
> regards
>
Message 4 of 5
morning0508
in reply to: Anonymous

This is not a good solution because while you enter a viewport in PaperSpace, actually you're modifying in ModelSpace. Use the following code,

If ActiveDocument.ActiveSpace = acModelSpace Then
Set currSpace = ActiveDocument.ModelSpace
Else
If ActiveDocument.MSpace = True Then
Set currSpace = ActiveDocument.ModelSpace
Else
Set currSpace = ActiveDocument.PaperSpace
End If
End If

Set (AnyThing) = currSpace.(AddAnyThing)
Message 5 of 5
arcticad
in reply to: Anonymous

This is a small function that will take into account if you are in a view port or not.

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

Public Function IsModelspace() As Boolean
Dim document As AcadDocument
For Each document In Documents
If document.Active = True Then
If document.ActiveSpace = acPaperSpace Then
IsModelspace = document.MSpace
Exit For
Else
IsModelspace = True
Exit For
End If
End If
Next
End Function
---------------------------



(defun botsbuildbots() (botsbuildbots))

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

Post to forums  

Autodesk Design & Make Report

”Boost