我是靠谱客的博主 结实母鸡,这篇文章主要介绍NX二次开发 获取部件的预览图,现在分享给大家,希望可以做个参考。


/// <summary>
/// 获取部件的预览图
/// </summary>
/// <param name="part">部件对象</param>
/// <returns></returns>
public static Bitmap GetPreview(Part part)
{
part.GetPreviewImage(out int width, out int height, out int[] pixels);
if (width > 0 && height > 0)
{
Bitmap bm = new Bitmap(width, height);
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
int pixel = pixels[y * width + x];
Color col1 = Color.FromArgb(pixel);
Color col2 = Color.FromArgb(255, col1);
bm.SetPixel(x, y, col2);
}
}
return bm;
}
else
{
MessageBox.Show("Part has no valid preview", "Information");
return null;
}
}

最后

以上就是结实母鸡最近收集整理的关于NX二次开发 获取部件的预览图的全部内容,更多相关NX二次开发内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(123)

评论列表共有 0 条评论

立即
投稿
返回
顶部