工作平面改变后,物体属性可以通过方法Select()来刷新。测试代码如下:
TSM.Model model = new Model();
if (model.GetConnectionStatus())
{
TSM.UI.Picker picker = new Picker();
try
{
model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane());
TSM.Beam beam = picker.PickObject(Picker.PickObjectEnum.PICK_ONE_PART) as TSM.Beam;
TSG.Point p1 = beam.StartPoint;
MessageBox.Show(p1.ToString());
TSG.CoordinateSystem cs = beam.GetCoordinateSystem();
TransformationPlane transformationPlane = new TransformationPlane(cs);
model.GetWorkPlaneHandler().SetCurrentTransformationPlane(transformationPlane);
beam.Select(); //没有这个,下面p2仍然获取的是世界坐标系坐标值,不是局部坐标系坐标值。
TSG.Point p2 = beam.StartPoint;
MessageBox.Show(p2.ToString());
MessageBox.Show(p1.ToString());
model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane());
}
catch
{
MessageBox.Show("Selection error!!!");
}
model.CommitChanges();
}
幻灯片下载地址:https://www.aliyundrive.com/s/GRkHvFJbNnD
本文详细介绍了如何在改变工作平面后,通过`Select()`方法更新TSM.Beam对象的属性,确保坐标系转换正确。通过代码实例和错误处理,展示了工作流程及关键点。附有幻灯片链接以供深入学习。
1218

被折叠的 条评论
为什么被折叠?



