几何尺寸与公差论坛

 找回密码
 注册
查看: 214|回复: 0

VisionPro通过代码设定模板训练的中心坐标

[复制链接]
发表于 2023-1-24 13:06:52 | 显示全部楼层 |阅读模式
https://blog.csdn.net/weixin_45499836/article/details/118962823
private void PatternCenterPoint()
        {
            try
            {
                if (this.pmalign_.Pattern != null && this.pmalign_.Pattern.TrainImage != null && this.pmalign_.Pattern.TrainRegion != null)
                {
                    ICogTransform2D transform = this.pmalign_.Pattern.TrainImage.GetTransform(".", this.pmalign_.Pattern.TrainRegion.SelectedSpaceName);
                    CogRectangle rectangle = this.pmalign_.Pattern.TrainRegion.Map(transform, CogCopyShapeConstants.GeometryOnly).EnclosingRectangle(CogCopyShapeConstants.GeometryOnly);
                    this.pmalign_.Pattern.Origin.TranslationX = rectangle.CenterX;
                    this.pmalign_.Pattern.Origin.TranslationY = rectangle.CenterY;
                    this.Display_.AutoFit = true;
                }
            }
            catch (Exception e)
            {
                Common.MsgBox.show(e.Message);
            }
        }
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-3-29 07:20 , Processed in 0.037164 second(s), 21 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表