I have written using NX Open API in C# language for capturing an image of a sheet metal part and identifying any missing CAD? It works correctly for most cases, but there are some instances where it produces incorrect results. The sheet metal part consists of separate parts.
public static void CaptureScreen(string tempScreenshot, string cameraViewName, NXOpen.Part workPart, NXOpen.Display.Camera camera1) {
camera1 = ((NXOpen.Display.Camera)workPart.Cameras.FindObject(cameraViewName));
camera1.ApplyToView(workPart.ModelingViews.WorkView);
ExportScreenshot(tempScreenshot);
//Copy image to clipboard
}
public static void ExportScreenshot(string filename) {
NXOpen.Session theSession = NXOpen.Session.GetSession();
UFSession theUfSession = UFSession.GetUFSession();
Boolean wcsVisible = theSession.Parts.Display.WCS.Visibility;
int triadVisible = theSession.Preferences.ScreenVisualization.TriadVisibility;
Boolean displayModelViewNames = theSession.Parts.BaseDisplay.Preferences.NamesBorderVisualization.ShowModelViewNames;
Boolean displayModelViewBorders = theSession.Parts.BaseDisplay.Preferences.NamesBorderVisualization.ShowModelViewBorders;
// turn off the WCS, triad, view name, and view border
theSession.Parts.BaseDisplay.WCS.Visibility = false;
theSession.Preferences.ScreenVisualization.TriadVisibility = 0;
theSession.Parts.BaseDisplay.Preferences.NamesBorderVisualization.ShowModelViewBorders = false;
theSession.Parts.BaseDisplay.Preferences.NamesBorderVisualization.ShowModelViewNames = false;
theUfSession.Disp.CreateImage(filename, UFDisp.ImageFormat.Png, UFDisp.BackgroundColor.White);
}
I am trying to find the problem of hiding CAD for some cases.