Visual Basic Customization

Visual Basic Customization

Reply
*youngman
Post 1 of 5

how to get the object of ActiveSpace

79 Views, 4 Replies
09-23-2003 08:13 PM
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
*Terry, Kevin
Post 2 of 5

Re: how to get the object of ActiveSpace

09-23-2003 09:38 PM in reply to: *youngman
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:smileyvery-happy:C86B70D8E3DD2276D77FB9BCD0DEBEB@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
>
*Gabriel, Chuck
Post 3 of 5

Re: how to get the object of ActiveSpace

09-23-2003 10:25 PM in reply to: *youngman
ThisDrawing.ActiveLayout.Block.Add3dpoly(points)

"youngman" wrote in message
news:smileyvery-happy:C86B70D8E3DD2276D77FB9BCD0DEBEB@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
>
Contributor
13 Posts
1 Kudo
Registered: ‎08-30-2006
Post 4 of 5

Re: how to get the object of ActiveSpace

09-05-2006 08:15 AM in reply to: *youngman
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)
*Expert Elite*
1,286 Posts
37 Kudos
Registered: ‎06-21-2004
Post 5 of 5

Re: how to get the object of ActiveSpace

09-06-2006 04:39 PM in reply to: *youngman
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))
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post