Dear Friends,
How to Move An Entity Along Arc Path while Dragging in C++..
Thanks,
nathan307
Which entity is it? A custom entity or AutoCAD native entity?
Dragging within a jig or by moving grip points or by using "transform commands" (like MOVE)?
Dear Friend,
Thanks For Your Reply.
It is Autocad native Entity ..I want to move it in a curve path Corresponding to mouse move in Auto cad...It is Happen at Dragging....
This article posted a few years ago may be of help:
http://drive-cad-with-code.blogspot.ca/2012/03/moving-entity-along-curve.html
While it is wriiten in ObjectARX .NET API, not C++, you get the idea and can see it is fairly easy to do.
Norman Yuan
Dear Friend,
Thank you For Your Suggestion.
I Already saw that post in Derive Autocad With code with .net API.
But In that Article The Entity is moved along the Selected Curve path With Its Original Appearance.It is not rotated while moving on the Curve.
I am trying to say that is I want Rotate the Entity While Moving with Response to Selected Curve.
I want Rotate the Entity While Moving along the Curve path the Rotation Depends on Curve path...
I am Exactly want is as same as Lee Mac's Align Objects to curve....
OK, that would be mote a math/geometry problem than a AutoCAD technics (Jig) problem.
For example, you may want the moving entity rotates while moving, similar like the Moom moves around the Earth: while moving, it also rotates so that it alway with one side facing the Earth.
Assume you have an arc, which is a quarter of cricle. When move the antity from the arc's start to the end, the entity would also need to rotate 90 degree. Therefore, you can use the silimalr technics shown in my article and then get rotate angle (90 degree when moved a quarter of circle). It would be easy to calculate what the roate angle of the entity should be while moving long a circle (or arc). Once you get the rotation angle figured out, you just apply a rotation transform to the moving entity in the Jig's sampling code.
Norman Yuan
Dear Friend,
Thank you For Your Valuable Suggestion.
How to Calculate rotate Angle of the Entity while moving on the Arc...
This(how to calculate Rotate Angle) is only the problem for me from start of this Discussion...
Thank you..
nathan307
The calculating should be fairly easy. Is this video clip shows what the effect you are after?
If yes, then what I did is just a minor update to the code posted in my old article. I can update that article to show to minor code change. Of course, it is .NET API code. But you can get the idea on how to rotate the moving object while dragging it along an arc/circle, and do the similar thing in your C++ jig.
Norman Yuan
Dear Friend...
Yes, I really want this as shown in your video clip..
Can You Update the Code that is minor change in Your old article...
Thank You For Your Valuable Help...
Regards,
nathan307
OK, the article is updated.
As you can see the code to calculation the rotation angle in method GetRotationAngle() is really simple. Since you do C++ Jig, the code would be somewhat different, but the logic is the same.
HTH
Norman Yuan