<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to jig rotate a block with different fixed point? in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-jig-rotate-a-block-with-different-fixed-point/m-p/3458396#M55576</link>
    <description>&lt;P&gt;That is because you are transforming the block by the angle from the basept to the cursor, but after the first time through the sampler, the angle you need to transform by is&amp;nbsp;(angle from the basept to the cursor) minus&amp;nbsp;(angle that you applied the last time through the sampler).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See if you can figure that out... otherwise I have an example, but it's a bit different than yours, because I used AcquireAngle instead of AcquirePoint, and I'm setting the Position and Rotation properties of the block in the&amp;nbsp;Update function,&amp;nbsp;instead of using TransformBy.&lt;/P&gt;</description>
    <pubDate>Tue, 15 May 2012 17:59:33 GMT</pubDate>
    <dc:creator>chiefbraincloud</dc:creator>
    <dc:date>2012-05-15T17:59:33Z</dc:date>
    <item>
      <title>How to jig rotate a block with different fixed point?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-jig-rotate-a-block-with-different-fixed-point/m-p/3458190#M55574</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is my jig rotate code&lt;/P&gt;&lt;PRE&gt;    Protected Overrides Function Sampler(ByVal prompts As JigPrompts) As SamplerStatus
        Dim myPPR As PromptPointResult


        myPPR = prompts.AcquirePoint(myOpts)
        Dim curPos As Point3d
        curPos = myPPR.Value
        If curPos.IsEqualTo(BasePt) Then
            Return SamplerStatus.NoChange
        Else
            myMatrix = Geometry.Matrix3d.Displacement( _
                BasePt.GetVectorTo(myPPR.Value))
                Dim pt1 As New Point2d(BasePt.X, BasePt.Y)
                Dim pt2 As New Point2d(myPPR.Value.X, myPPR.Value.Y)
                BaseRo = pt1.GetVectorTo(pt2).Angle
            End If
            Return SamplerStatus.OK
        End If
    End Function

    Protected Overrides Function Update() As Boolean
            myBRef.Rotation = BaseRo
        Return False
    End Function&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I always rotate the block with bottom left point as fixed point. What can I do to make the block rotate around another point? such as centre point of the block?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks very much&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2012 16:21:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-jig-rotate-a-block-with-different-fixed-point/m-p/3458190#M55574</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-05-15T16:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to jig rotate a block with different fixed point?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-jig-rotate-a-block-with-different-fixed-point/m-p/3458236#M55575</link>
      <description>&lt;P&gt;I have updated code&lt;/P&gt;&lt;PRE&gt;    Protected Overrides Function Update() As Boolean
            myMatrix = Geometry.Matrix3d.Rotation(BaseRo, Vector3d.ZAxis, BasePt)
            myBRef.TransformBy(myMatrix)
            ' myBRef.Rotation = BaseRo
    End Function&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;This seems to make myBRef rotate with the point I set it to. However the block is just keeping rotate even my mouse stopped. Plus the block is like a crazy wheel.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2012 16:48:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-jig-rotate-a-block-with-different-fixed-point/m-p/3458236#M55575</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-05-15T16:48:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to jig rotate a block with different fixed point?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-jig-rotate-a-block-with-different-fixed-point/m-p/3458396#M55576</link>
      <description>&lt;P&gt;That is because you are transforming the block by the angle from the basept to the cursor, but after the first time through the sampler, the angle you need to transform by is&amp;nbsp;(angle from the basept to the cursor) minus&amp;nbsp;(angle that you applied the last time through the sampler).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See if you can figure that out... otherwise I have an example, but it's a bit different than yours, because I used AcquireAngle instead of AcquirePoint, and I'm setting the Position and Rotation properties of the block in the&amp;nbsp;Update function,&amp;nbsp;instead of using TransformBy.&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2012 17:59:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-jig-rotate-a-block-with-different-fixed-point/m-p/3458396#M55576</guid>
      <dc:creator>chiefbraincloud</dc:creator>
      <dc:date>2012-05-15T17:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to jig rotate a block with different fixed point?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-jig-rotate-a-block-with-different-fixed-point/m-p/3458484#M55577</link>
      <description>&lt;P&gt;So I fiddled with your jig a little, and it works if you add a class level variable for the last angle, and make your update routine like this:&lt;/P&gt;&lt;PRE&gt;Protected Overrides Function Update() As Boolean
	Entity.TransformBy(Matrix3d.Rotation(BaseRo - lastang, Vector3d.ZAxis, BasePt))
	lastang = BaseRo
End Function&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;BTW, "Entity" in my code above is a Friend ReadOnly Property of the class that comes along with inheriting EntityJig, no need to declare your own MyBref.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I assume you either already did figure that out, or eventually would have, but I am posting because when I ran it that way, the block was not displaying properly for some reason.&amp;nbsp; I mean the jig worked as expected, but only a portion of the block was visible on screen.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run the same block, with the same code, through my off center rotate jig, It looks normal, so I wondered if you were seeing the same thing?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my jig:&lt;/P&gt;&lt;PRE&gt;Public Class BlkRotJigOffCen
	Inherits EntityJig
	Dim NewAng, Radius, OrigRot As Double
	Dim CenPt As Autodesk.AutoCAD.Geometry.Point3d
	Dim jigopts As New JigPromptAngleOptions()
	Protected Overrides Function Sampler(ByVal prompts As Autodesk.AutoCAD.EditorInput.JigPrompts) As Autodesk.AutoCAD.EditorInput.SamplerStatus
		Dim PrAngRes As PromptDoubleResult = prompts.AcquireAngle(jigopts)
		If NewAng = PrAngRes.Value Then
			Return SamplerStatus.NoChange
		Else
			NewAng = PrAngRes.Value
			Return SamplerStatus.OK
		End If
	End Function
	Protected Overrides Function Update() As Boolean
		Try
			CType(Entity, BlockReference).Rotation = NewAng + OrigRot
			CType(Entity, BlockReference).Position = CenPt.Add(New Vector3d(Radius * Cos(NewAng), Radius * Sin(NewAng), 0))
			Return True
		Catch ex As Exception
			Return False
		End Try
	End Function
	Public Sub New(ByVal bref As BlockReference, ByVal Cpt As Point3d, ByVal prompt As String)
		MyBase.New(bref)
		OrigRot = bref.Rotation
		CenPt = Cpt
		Radius = Cpt.GetVectorTo(bref.Position).Length
		jigopts.UserInputControls = UserInputControls.GovernedByOrthoMode
		jigopts.Cursor = CursorType.RubberBand
		jigopts.BasePoint = Cpt
		jigopts.UseBasePoint = True
		jigopts.Message = vbLf &amp;amp; prompt
	End Sub
	Public Function GetEntity() As Entity
		Return Entity
	End Function
End Class&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2012 18:53:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-jig-rotate-a-block-with-different-fixed-point/m-p/3458484#M55577</guid>
      <dc:creator>chiefbraincloud</dc:creator>
      <dc:date>2012-05-15T18:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to jig rotate a block with different fixed point?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-jig-rotate-a-block-with-different-fixed-point/m-p/3459162#M55578</link>
      <description>&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My problem solved. However your whole module doesn't work correctly. The "LastAngle" method works perfect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tested both of your solution. the effects are the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again&lt;/P&gt;</description>
      <pubDate>Wed, 16 May 2012 08:23:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-jig-rotate-a-block-with-different-fixed-point/m-p/3459162#M55578</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-05-16T08:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to jig rotate a block with different fixed point?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-jig-rotate-a-block-with-different-fixed-point/m-p/3459246#M55579</link>
      <description>&lt;P&gt;Sorry, I saw the same effect for using your 1st method.&lt;/P&gt;&lt;P&gt;I am twisting your 2nd code and try to make it works my way&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 16 May 2012 10:05:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-jig-rotate-a-block-with-different-fixed-point/m-p/3459246#M55579</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-05-16T10:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to jig rotate a block with different fixed point?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-jig-rotate-a-block-with-different-fixed-point/m-p/3459942#M55580</link>
      <description>&lt;P&gt;It works great for me, but my purpose is a little different than yours.&amp;nbsp; For me it is supposed to rotate the block around a point that is outside the block by some distance.&amp;nbsp; (In one case it's only about 8 inches away, in&amp;nbsp;another case it's between 60 and 90 inches away).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For what it's worth, I also tested my jig using the TransformBy method in the update function, to see if that was what was causing the glitch, but it seemed to work the same (graphics-wise), but it would cause me to have to change some of my input arguments.&amp;nbsp; Maybe that would make it easier for you though?&lt;/P&gt;</description>
      <pubDate>Wed, 16 May 2012 15:51:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-jig-rotate-a-block-with-different-fixed-point/m-p/3459942#M55580</guid>
      <dc:creator>chiefbraincloud</dc:creator>
      <dc:date>2012-05-16T15:51:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to jig rotate a block with different fixed point?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-jig-rotate-a-block-with-different-fixed-point/m-p/3459992#M55581</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your reply&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tested both method carefully on my end. They both looks the same(graphic-wise) ,neither of them show block fully.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The 2nd way still not working, as the position has some problem. I do think the math is correct but just doesn't looks ok.&lt;/P&gt;&lt;P&gt;My block postion is the bottom left corner, I would like it to rotate around bottom&amp;nbsp; its right corder. (I am sure I pass the correct point in)&lt;/P&gt;</description>
      <pubDate>Wed, 16 May 2012 16:05:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-jig-rotate-a-block-with-different-fixed-point/m-p/3459992#M55581</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-05-16T16:05:03Z</dc:date>
    </item>
  </channel>
</rss>

