Visual Basic Customization

Visual Basic Customization

Reply
*youngman
Message 1 of 5 (75 Views)

how to get the object of ActiveSpace

75 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
Message 2 of 5 (75 Views)

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
Message 3 of 5 (75 Views)

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
morning0508
Posts: 13
Registered: ‎08-30-2006
Message 4 of 5 (75 Views)

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*
arcticad
Posts: 1,286
Registered: ‎06-21-2004
Message 5 of 5 (75 Views)

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
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.