Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
I have a Jig that asks the user for start point, end point, and then places circles at spacings along the path.
When I use OSnap for the first point, all good (using Editor.GetPoint())
My issue is when I select the end point. If I use OSnaps, I might be slightly off the endpoint, but the marker has snapped to it, but when I click, the end point I need is slighty off (It will take location of the crosshairs, and not the snapped location).
Is there any way around this?
public class ReinforcementSectionJig : DrawJig
{
public ReinforcementSectionJig()
: base()
{
Reinforcement = new Reinforcement();
Reinforcement.Points = new Point3dCollection();
}
public Reinforcement Reinforcement { get; set; }
public Editor Editor { get { return AcApp.DocumentManager.MdiActiveDocument.Editor; } }
protected override bool WorldDraw(WorldDraw draw)
{
return Reinforcement.JigBars(draw);
}
protected override SamplerStatus Sampler(JigPrompts prompts)
{
JigPromptPointOptions prOptions1 = new JigPromptPointOptions("\nSpecify point for last bar: ");
prOptions1.UserInputControls = UserInputControls.GovernedByOrthoMode | UserInputControls.GovernedByUCSDetect | UserInputControls.Accept3dCoordinates | UserInputControls.NoZeroResponseAccepted;
prOptions1.BasePoint = Reinforcement.StartPoint;
PromptPointResult prResult1 = prompts.AcquirePoint(prOptions1);
//if (prResult1.Status == PromptStatus.Cancel && prResult1.Status == PromptStatus.Error)
// {
// return SamplerStatus.Cancel;
// }
if (Reinforcement.EndPoint == prResult1.Value)
return SamplerStatus.NoChange;
//else
// {
Reinforcement.EndPoint = prResult1.Value;
return SamplerStatus.OK;
//}
}
public void Jig()
{
PromptPointResult ppr = Editor.GetPoint("\nSpecify point for first bar: ");
if (ppr.Status == PromptStatus.OK)
{
Reinforcement.StartPoint = ppr.Value.TransformBy(Editor.CurrentUserCoordinateSystem);
if (Editor.Drag(this).Status == PromptStatus.OK)
{
using (DocumentLock dLock = AcApp.DocumentManager.MdiActiveDocument.LockDocument())
{
Database db = AcApp.DocumentManager.MdiActiveDocument.Database;
using (Transaction tr = db.TransactionManager.StartTransaction())
{
BlockTableRecord space = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);
Reinforcement.DrawBars(tr, Reinforcement.Points, Reinforcement.Diameter, Reinforcement.Fill, space);
tr.Commit();
}
}
}
}
}
}
Cheers
Brent
Solved! Go to Solution.

