.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Example For Wipeout?

11 REPLIES 11
Reply
Message 1 of 12
Anonymous
646 Views, 11 Replies

Example For Wipeout?

There is no example for the Wipeout class,even C++.
Can someone give an example for this class?
Thanks in advance!
11 REPLIES 11
Message 2 of 12
Anonymous
in reply to: Anonymous

What I have done, is to make a 1x1 transparent bitmap and use it as
replacement for masking - have not done it via code... yet.


//csharpbird ...
//There is no example for the Wipeout class,even C++.
//Can someone give an example for this class?
//Thanks in advance!
Message 3 of 12
Anonymous
in reply to: Anonymous

I found the solution.
You only need the SetFrom method !!
Message 4 of 12
Anonymous
in reply to: Anonymous

No idea what you end up doing, but good that you found a way 🙂


//
//I found the solution.
//You only need the SetFrom method !!
Message 5 of 12
Dale.Bartlett
in reply to: Anonymous

I have used the SetFrom method, passing a Point2DCollection, but am getting a fatal error and memory problem. Can you post some sample code please, I have searched everywhere to no avail. Thanks, Dale



______________
Yes, I'm Satoshi.
Message 6 of 12
Anonymous
in reply to: Anonymous

Perhaps you should post *your* code that isn't
working so someone can look at it and perhaps
tell you what's wrong.

Asking folks here to provide you with sample
code probably isn't going to get you any unless
someone may have already done this, and is
willing to share it, but chances of that are not
terribly good.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com

wrote in message news:5795089@discussion.autodesk.com...
I have used the SetFrom method, passing a Point2DCollection, but am getting a fatal error and memory problem. Can you post some sample code please, I have searched everywhere to no avail. Thanks, Dale
Message 7 of 12
Dale.Bartlett
in reply to: Anonymous

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.
Message 8 of 12
Dale.Bartlett
in reply to: Anonymous

Hi Tony/All, I have determined my error was in providing only 4 points to the Point2DCollection rather than returning to the first point. No other change was needed. I hope the following code helps someone else. Regards, Dale

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

lentWipeout.Layer = "0"

'start a transaction
Dim ta As Transaction = tm.StartTransaction()
Try
Dim bt As BlockTable = tm.GetObject(db.BlockTableId, OpenMode.ForRead, False)
Dim btr As BlockTableRecord = tm.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite, False)

'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)
lpntPoint2D = New Point2d(0, 0)
lcolWipeoutPoints.Add(lpntPoint2D)
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.
Message 9 of 12
Anonymous
in reply to: Anonymous

Dale - Thanks for sharing your solution.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com

wrote in message news:5798925@discussion.autodesk.com...
Hi Tony/All, I have determined my error was in providing only 4 points to the Point2DCollection rather than returning to the first point. No other change was needed. I hope the following code helps someone else. Regards, Dale

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

lentWipeout.Layer = "0"

'start a transaction
Dim ta As Transaction = tm.StartTransaction()
Try
Dim bt As BlockTable = tm.GetObject(db.BlockTableId, OpenMode.ForRead, False)
Dim btr As BlockTableRecord = tm.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite, False)

'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)
lpntPoint2D = New Point2d(0, 0)
lcolWipeoutPoints.Add(lpntPoint2D)
Call lentWipeout.SetFrom(lcolWipeoutPoints, lvecNormal)

loidWipeoutID = btr.AppendEntity(lentWipeout)
tm.AddNewlyCreatedDBObject(lentWipeout, True)
ta.Commit()
Finally
ta.Dispose()
CreateWipeout = loidWipeoutID
End Try
End Function
Message 10 of 12
Dale.Bartlett
in reply to: Anonymous

Well, spoke too soon. I have a continuing problem. The code does create a wipeout, however if used to create several Wipeouts in the one drawing, it will Fatal Error. Randomly the Wipeout will have a single grip instead of 4, and the displayed boundary is not the same as the actual boundary. Easier to demo than explain. The attached code will create several Wipeouts in a ine, if you have a line drawn from 0,0 to the right you will notice that not all will hide the line, square 2 seems to fail regularly but not consistantly. If you run the command again in the same drawing it will always fatal error. I have tried .SetDatabaseDefaults and .SetClipBoundary. They don't appear to make any difference.

Public Function CreateWipeout(ByVal pintStartPntX As Integer, ByVal pintStartPntY As Integer, ByVal pintSquareSide As Integer) 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()
lentWipeout.Layer = "0"
'start a transaction
Dim ta As Transaction = tm.StartTransaction()
Try
Dim bt As BlockTable = tm.GetObject(db.BlockTableId, OpenMode.ForRead, False)
Dim btr As BlockTableRecord = tm.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite, False)
'fill 2D Point collection with 4 points
lpntPoint2D = New Point2d(pintStartPntX, pintStartPntY)
lcolWipeoutPoints.Add(lpntPoint2D)
lpntPoint2D = New Point2d(pintStartPntX + pintSquareSide, pintStartPntY)
lcolWipeoutPoints.Add(lpntPoint2D)
lpntPoint2D = New Point2d(pintStartPntX + pintSquareSide, pintStartPntY + pintSquareSide)
lcolWipeoutPoints.Add(lpntPoint2D)
lpntPoint2D = New Point2d(pintStartPntX, pintStartPntY + pintSquareSide)
lcolWipeoutPoints.Add(lpntPoint2D)
lpntPoint2D = New Point2d(pintStartPntX, pintStartPntY)
lcolWipeoutPoints.Add(lpntPoint2D)
'Call lentWipeout.SetDatabaseDefaults(db) 'this makes number 2 have single grip point
'Call lentWipeout.SetClipBoundary(ClipBoundaryType.Poly, lcolWipeoutPoints)
Call lentWipeout.SetFrom(lcolWipeoutPoints, lvecNormal)
loidWipeoutID = btr.AppendEntity(lentWipeout)
tm.AddNewlyCreatedDBObject(lentWipeout, True)
ta.Commit()
Finally
ta.Dispose()
CreateWipeout = loidWipeoutID
'lentWipeout.Dispose()
End Try
End Function
_
Public Sub samp3()
CreateWipeout(-1000, -1000, 5000)
CreateWipeout(9000, -1000, 5000)
CreateWipeout(19000, -1000, 5000)
CreateWipeout(29000, -1000, 5000)
CreateWipeout(39000, -1000, 5000)
CreateWipeout(49000, -1000, 5000)
CreateWipeout(59000, -1000, 5000)
CreateWipeout(69000, -1000, 5000)
End Sub



______________
Yes, I'm Satoshi.
Message 11 of 12
Anonymous
in reply to: Anonymous

http://through-the-interface.typepad.com/through_the_interface/2007/12/creating-an-aut.html

wrote in message news:5752003@discussion.autodesk.com...
There is no example for the Wipeout class,even C++.
Can someone give an example for this class?
Thanks in advance!
Message 12 of 12
Dale.Bartlett
in reply to: Anonymous

Actually this code works fine, once or twice in a drawing. If several Wipeouts are created in the one drawing, AutoCAD will Fatal Error, randomly the Wipeout will have a single grip instead of 4, and the displayed boundary is not the same as the actual boundary. Does anyone have any suggestion for a workaround as it appears this may not be resolved for some time. Thanks Dale



______________
Yes, I'm Satoshi.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost