Hi Tony, Thanks for the reply. The follwing code creates a Wipout, but either crashes AutoCAD 2008, or when I move the object get Fatal Error, or the Wipeout doesn't hide objects. I have searched everywhere for some sample code, but as it is a new api feature in 2008, Autodesk have no examples that I can find. I have seen many requests for such. I hope my code helps someone else.
Public Function CreateWipeout() As ObjectId
Dim loidWipeoutID As ObjectId
Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database
Dim tm As DBTransMan = db.TransactionManager
Dim lentWipeout As New Wipeout
Dim lvecNormal As New Vector3d(0.0, 0.0, 1.0)
Dim lpntPoint2D As Point2d = Nothing
Dim lcolWipeoutPoints As New Point2dCollection() 'this is 2DPoint to suit Wipeout, add Z to suit Line
Dim i As Integer = 0
lentWipeout.Layer = "0"
'start a transaction
Dim ta As Transaction = tm.StartTransaction()
Try
'fill 2D Point collection with 4 points
lpntPoint2D = New Point2d(0, 0)
lcolWipeoutPoints.Add(lpntPoint2D)
lpntPoint2D = New Point2d(500, 0)
lcolWipeoutPoints.Add(lpntPoint2D)
lpntPoint2D = New Point2d(500, 500)
lcolWipeoutPoints.Add(lpntPoint2D)
lpntPoint2D = New Point2d(0, 500)
lcolWipeoutPoints.Add(lpntPoint2D)
'to test>>>>
Dim s As String = ""
For i = 0 To lcolWipeoutPoints.Count - 1
s = s & vbCrLf & "A. ID i = " & i & " X: " & lcolWipeoutPoints(i).X & " Y: " & lcolWipeoutPoints(i).Y
Next i
MsgBox(s)
'to test>>>>
Dim bt As BlockTable = tm.GetObject(db.BlockTableId, OpenMode.ForRead, False)
Dim btr As BlockTableRecord = tm.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite, False)
Call lentWipeout.SetFrom(lcolWipeoutPoints, lvecNormal)
loidWipeoutID = btr.AppendEntity(lentWipeout)
tm.AddNewlyCreatedDBObject(lentWipeout, True)
ta.Commit()
Finally
ta.Dispose()
CreateWipeout = loidWipeoutID
End Try
End Function
"
______________
Yes, I'm Satoshi.