Ok. I was excited when I found this post a few days ago since I had spent a day looking and not finding much. Since then I have found a few posts on how to create a block rotation jig in C#, but nothing in VB, so I've learned how to translate (kind of).
I came up with the following...
This works well except that I can't constrain the rotation with ORTHO. I've got the "jigOpt.UserInputControls = UserInputControls.GovernedByOrthoMode" line in there, but it's not working.
Sub New(ByVal ent As Entity)
'mybase.new must be called because the base class entity jig does not have an accesible sub new that can be accesses with no arguments
Private lastMousePosition As Point3d = New Point3d()
Property jiggedBlockReference() As BlockReference
Set(ByVal value As BlockReference)
Property currentPosition() As Point3d
Set(ByVal value As Point3d)
Protected Overrides Function Sampler(ByVal prompts As Autodesk.AutoCAD.EditorInput.JigPrompts) As Autodesk.AutoCAD.EditorInput.SamplerStatus
Dim jigOpt As JigPromptPointOptions = New JigPromptPointOptions("Select Rotation :")
jigOpt.UserInputControls = UserInputControls.Accept3dCoordinates
jigOpt.UserInputControls = UserInputControls.GovernedByOrthoMode
Dim res As PromptPointResult = prompts.AcquirePoint(jigOpt)
If res.Status <> PromptStatus.OK Then
If (res.Value.IsEqualTo(currentPosition, New Tolerance(0.1, 0.1))) Then
lastMousePosition = res.Value
Protected Overrides Function Update() As Boolean
Dim oldPosition As Point2d = New Point2d(currentPosition.X, currentPosition.Y)
Dim newPosition As Point2d = New Point2d(lastMousePosition.x, lastMousePosition.Y)
jiggedBlockReference.Rotation = oldPosition.GetVectorTo(newPosition).Angle - Math.PI / 2
'code for use with dynamic blocks
For Each prop As DynamicBlockReferenceProperty In jiggedBlockReference.DynamicBlockReferencePropertyCollection
If prop.PropertyName.ToUpper = "LENGTH" Then
prop.Value = oldPosition.GetDistanceTo(newPosition)
To be frank I'm a newbie at .NET and programming in general. I've spent the last year learning and working with VBA and now we're moving to 64bit, so the .NET conversion was inevitable. I understand the basics of what's going on with the jig, but I just don't understand where the ORTHO comes into play.
For us newbies any explanation would be greatly appreciated.