Well I hadn't done much on this but finally got around to translating it to VB. I can get the example to run, but the ellipse does not update dynamically. It will create the ellipse at the end but I must be doing some thing wrong. Any body have a clue??
Here is the code
Thanks a bunch CougerAC. Yes, you definitely shed some light on what I was doing wrong. I got my example to run fine.
This is what made the difference:
With DirectCast(Entity, Ellipse)
New Vector3d(0, 0, 1), _
In the update function and this property:
Friend Shadows ReadOnly Property Entity() As Entity
I did have a question. I am using the typical "Imports ...." at the beginning of my class, but I don't see that in your project. How does that work? We are using the same references and everything.
Now I have to try to adapt this sample to be able to insert blocks so that it mimics the native AutoCAD "insert" command. Is that possible?
If you look in the "Project Properties" -> "References" tab, you'll see an "Imported Namespaces" section. This is for Global Imports, available to the entire project. But I don't want all those namespaces clogging up my intellisense, so I use global imports like "Imports AcadDS = Autodesk.Autocad.DatabaseServices" and "Imports AcadApp = Autodesk.Autocad.ApplicationServices.Application". This way I can create code like this:
Dim ellipseObj as AcadDS.Ellipse = New AcadDS.Ellipse
Dim Doc as AcadAS.Document = AcadApp.Documentmanager.MDIActiveDocument
There were a couple of areas in your example code translated from C# that would have created problems.
jigOpts.UserInputControls = (UserInputControls.Accept3dCoordinates Xor UserInputControls.NoZeroResponseAccepted Xor UserInputControls.NoNegativeResponseAccepted)
I changed it to this:
jigOpts.UserInputControls = UserInputControls.Accept3dCoordinates Or UserInputControls.NoZeroResponseAccepted Or UserInputControls.NoNegativeResponseAccepted
Notice the OR instead of XOR. This could have also caused problems.
Notice also in the CommandMethod my use of the Using Construct. I am really glad that MS decided to add this to the language. I basically calls the "Dispose" method for you when the "End Using" code is encountered. BUT you must take care to trap errors INSIDE the using construct so it behaves correctly, especially if you are using it for a transaction.
Finally, I am not sure about inserting blocks with this method. I have never really tried. Maybe someone else has a suggestion for this.