[UFUN函数] UG二次开发,设置渲染样式,例如带边着色、静态线框等

说明:通过SetRenderingStyle,设置以下渲染样式:

[UFUN函数] UG二次开发,设置渲染样式,例如带边着色、静态线框等_第1张图片

每个渲染样式对应的名字为:

View::RenderingStyleTypeShadedWithEdges 带边着色 
View::RenderingStyleTypeShaded  着色
View::RenderingStyleTypeWireframeWithDimEdges 带有淡化边的线框
View::RenderingStyleTypeWireframeWithHiddenEdges 带有隐藏边的线框
View::RenderingStyleTypeWireframeWithDashedEdges 带有虚线边的线框
View::RenderingStyleTypeStudio 艺术外观
View::RenderingStyleTypeFaceAnalysis 面分析
View::RenderingStyleTypeStaticWireframe 静态线框
View::RenderingStyleTypePartiallyShaded 局部着色

测试代码:

//设置渲染样式
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
using namespace NXOpen;

extern "C" DllExport int ufusr_ask_unload()
{
	return (int)Session::LibraryUnloadOptionImmediately;
}

extern "C" DllExport void ufusr(char *param, int *retCode, int paramLen)
{
	Session *theSession = Session::GetSession();
	Part *workPart(theSession->Parts()->Work());

	//WorkView 工作视图   //SetRenderingStyle 设置视图样式
	workPart->ModelingViews()->WorkView()->SetRenderingStyle(View::RenderingStyleTypeShadedWithEdges);  //带边着色 
	uc1601("带边着色",1);

	
	workPart->ModelingViews()->WorkView()->SetRenderingStyle(View::RenderingStyleTypeShaded);           //着色
	uc1601("着色",1);

	
	workPart->ModelingViews()->WorkView()->SetRenderingStyle(View::RenderingStyleTypeWireframeWithDimEdges);  //带有淡化边的线框
	uc1601("带有淡化边的线框",1);

	
	workPart->ModelingViews()->WorkView()->SetRenderingStyle(View::RenderingStyleTypeWireframeWithHiddenEdges);  //带有隐藏边的线框
	uc1601("带有隐藏边的线框",1);

	
	workPart->ModelingViews()->WorkView()->SetRenderingStyle(View::RenderingStyleTypeWireframeWithDashedEdges);  //带有虚线边的线框
	uc1601("带有虚线边的线框",1);

	
	workPart->ModelingViews()->WorkView()->SetRenderingStyle(View::RenderingStyleTypeStudio);                    //艺术外观
	uc1601("艺术外观",1);

	
	workPart->ModelingViews()->WorkView()->SetRenderingStyle(View::RenderingStyleTypeFaceAnalysis);    //面分析
	uc1601("面分析",1);

	
	workPart->ModelingViews()->WorkView()->SetRenderingStyle(View::RenderingStyleTypeStaticWireframe); //静态线框
	uc1601("静态线框",1);

	
	workPart->ModelingViews()->WorkView()->SetRenderingStyle(View::RenderingStyleTypePartiallyShaded); //局部着色
	uc1601("局部着色",1);
}

效果演示:

 

你可能感兴趣的:(UG二次开发)