寄件者:James Welsh (jwelsh@btinternet.com.nospam)
主旨:Re: Determine if objects in Model Space or Layout
新闻群组:autodesk.autocad.customization.vba
View this article only
日期:2001-07-18 12:13:11 PST
Hi Mark,
Try this function...

- [FONT=courier new]
- Private Function GetEntitiesLayout(objEntity As AcadEntity) As AcadLayout
- Dim objTemp As AcadLayout
- For Each objTemp In ThisDrawing.Layouts
- If objEntity.OwnerID = objTemp.Block.ObjectID Then
- Set GetEntitiesLayout = objTemp
- Exit Function
- End If
- Next
- End Function
- [/FONT]
... and here's an example of using it.

- [FONT=courier new]
- Sub JustTesting()
- Dim sp(2) As Double
- Dim ep(2) As Double
- sp(0) = 0: sp(1) = 0: sp(2) = 0
- ep(0) = 10: ep(1) = 0: ep(2) = 0
- Dim objTemp As AcadEntity
- Set objTemp = ThisDrawing.ModelSpace.AddLine(sp, ep)
- Debug.Print GetEntitiesLayout(objTemp).Name
- End Sub
- [/FONT]
Hope this helps,
James
"Mark Sanchez" <specserv@gte.net> wrote in message
news:3B54D9E3.6359A1CC@gte.net... |