VisionPro中ToolBlock工具下怎么实现偏移显示(代码如下):
public override bool GroupRun(ref string message, ref CogToolResultConstants result)
{
// To let the execution stop in this script when a debugger is attached, uncomment the following lines.
// #if DEBUG
if (System.Diagnostics.Debugger.IsAttached) System.Diagnostics.Debugger.Break();
// #endif
double Offset = (double)mToolBlock.Inputs["offset"].Value;(这里的Offset是ToolBlock输入端写的偏移量)
// Run each tool using the RunTool function
foreach(ICogTool tool in mToolBlock.Tools)
mToolBlock.RunTool(tool, ref message, ref result);
CogCreateLineBisectPointsTool lineAVG = mToolBlock.Tools["CogCreateLineBisectPointsTool1"] as CogCreateLineBisectPointsTool;
CogFindCircleTool c1 = mToolBlock.Tools["CogFindCircleTool1"] as CogFindCircleTool;
CogFindCircleTool c2 = mToolBlock.Tools["CogFindCircleTool2"] as CogFindCircleTool;
lineAVG.GetOutputLine().X=( (c1.Results.GetCircle().CenterX + c2.Results.GetCircle().CenterX) / 2)+Offset;
lineAVG.GetOutputLine().Y= (c1.Results.GetCircle().CenterY + c2.Results.GetCircle().CenterY) / 2;
lineAVG.GetOutputLine().Visible = true;
lineAVG.OutputColor = CogColorConstants.Red;
lineAVG.OutputLineStyle = CogGraphicLineStyleConstants.DashDotDot;
return false;
} |