TheSwamp
Code Red => .NET => Topic started by: poncelet on February 23, 2012, 10:01:01 AM
-
Hello all,
I have a jig that rotates a blockreference.
The angle is calculated by 2 points (basePoint and directionPoint).
pt2.GetVectorTo(pt1).Angle
What if the user wants to type the angle rather that pick a second point (directionPoint)?
I'm a little stuck.
Thanks in advance.
-
This is old but it works:
protected override bool Update()
{
switch (myPromptCounter)
{
case 0:
try
{
Entity.TransformBy(Matrix3d.Displacement(myActualPoint - myCenterPt));
// reset point for next mouse move
myCenterPt = myActualPoint;
}
catch
{
return false;
}
break;
case 1:
try
{
Entity.TransformBy(Matrix3d.Rotation(
myActualAngle - myAngleRad, myNormal, myCenterPt));
// reset the angle
myAngleRad = myActualAngle;
}
catch
{
return false;
}
break;
}
return true;
}
/// <summary>
/// The Callback method
/// </summary>
/// <param name="prompts"></param>
/// <returns></returns>
protected override SamplerStatus Sampler(JigPrompts prompts)
{
switch (myPromptCounter)
{
case 0: // prompt for insertion point
try
{
JigPromptPointOptions pointOpts = new JigPromptPointOptions();
pointOpts.UserInputControls = (UserInputControls.Accept3dCoordinates
| UserInputControls.NoZeroResponseAccepted
| UserInputControls.NoNegativeResponseAccepted);
pointOpts.Message = "\nEnter insert point: ";
PromptPointResult pointRes = prompts.AcquirePoint(pointOpts);
if (myActualPoint == pointRes.Value)
{
return SamplerStatus.NoChange;
}
// The point has moved
myActualPoint = pointRes.Value;
}
catch
{
return SamplerStatus.NoChange;
}
break;
case 1: // prompt for angle of rotation
try
{
JigPromptAngleOptions angleOptions = new JigPromptAngleOptions();
angleOptions.UserInputControls = (UserInputControls.AnyBlankTerminatesInput
| UserInputControls.NullResponseAccepted);
angleOptions.Message = "\nRotation Angle: ";
angleOptions.BasePoint = myCenterPt;
angleOptions.UseBasePoint = true;
angleOptions.Cursor = CursorType.RubberBand;
PromptDoubleResult result = prompts.AcquireAngle(angleOptions);
if (myActualAngle == result.Value)
{
return SamplerStatus.NoChange;
}
// The angle has changed
myActualAngle = result.Value;
}
catch
{
return SamplerStatus.NoChange;
}
break;
case 2: // Prompt for scale - TO DO possibly in the future
break;
}
return SamplerStatus.OK;
}
Not the entire class but you get the idea
-
Thanks Draftek but i want to enter a number when the jig prompts for a second point. Similar to autocad's rotate command! :pissed:
-
You can have a look to this one:
http://www.theswamp.org/index.php?topic=39891.msg451921#msg451921
-
(http://m.UploadEdit.com/bag/1330027422916.gif)
Imagine the user not picking a second point but typing the angle.
-
i want to enter a number when the jig prompts for a second point. Similar to autocad's rotate command!
The sample I purposed, as Draftek's one, allows that, due to the AcquireAngle() method using.
-
I'm using autocad 2006. The jig class is different? Cause the acquireAngle has different result. omg I have to leave the past behind!
Anyway merci beaucoup guys.