Message 1 of 48
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
Facing a new problem. Planning to overrule some of subentities in a block. Let's make it simple . All lines and attributes in block should be circles and original block should not be seen. I came up with below code.
The code reacts differently if I remove
MyBase.WorldDraw(drawable, Wd)
and my goal is not to show the real block. Just showing whatever is overruled.
Could somebody help me please
Thanks.
Janet.
Public Class toverrule
Inherits Autodesk.AutoCAD.GraphicsInterface.DrawableOverrule
Public Overrides Function WorldDraw(ByVal drawable As Autodesk.AutoCAD.GraphicsInterface.Drawable, ByVal Wd As Autodesk.AutoCAD.GraphicsInterface.WorldDraw) As Boolean
Dim myBlock As BlockReference = CType(drawable, BlockReference)
If Not myBlock.Database Is Nothing Then
Dim ListEnts As New List(Of Entity)
Dim MyDBObjColl As DBObjectCollection = New DBObjectCollection()
myBlock.Explode(MyDBObjColl)
Dim myline As New Line
For Each mydbobj As DBObject In MyDBObjColl
If TypeOf mydbobj Is Line Then
myline = TryCast(mydbobj, Line)
Dim mycircle As New Circle
mycircle.Radius = myline.Length
mycircle.Center = myline.StartPoint
ListEnts.Add(mycircle)
ElseIf TypeOf mydbobj Is AttributeDefinition Then
Dim mycircle As New Circle
mycircle.Radius = myline.Length / 2
mycircle.Center = myline.StartPoint
ListEnts.Add(mycircle)
End If
Next
For Each Ent As Entity In ListEnts
Ent.WorldDraw(Wd)
Ent.Dispose()
Next
MyBase.WorldDraw(drawable, Wd)
End If
Return True
End Function
End Class
Solved! Go to Solution.