VectorDraw Developer Framework(VDF)是一个用于应用程序可视化的图形引擎库。有了VDF提供的功能,您可以轻松地创建、编辑、管理、输出、输入和打印2D和3D图形文件。
VectorDraw web library (javascript)不仅能打开CAD图纸,而且能显示任何支持HTML5标准平台上的通用矢量对象,如Windows,安卓,iOS和Linux。无需任何安装,VectorDraw web library (javascript)就可以运行在任何支持canvas标签和Javascript的主流浏览器(Chrome, Firefox, Safari, Opera, Dolphin, Boat等等)中。这意味着可以用DXF,DWG,DGN,SKP(Google的Sketchup),VDML等多种格式在任何台式、平板电脑,智能手机和便携式笔记本上展现出你的业务。
问:
如何才能在绘制数字时混合渲染模式?能否有代码示例实现如下目标:
使用Wire3D渲染绘制vdPolyface。
使用Shade / Hide / ShadeOn / Render模式渲染绘制所有其他图形。
答:
想要实现目标可以采用以下代码:
private void Form1_Load(object sender, EventArgs e)
{
vdFramedControl1.BaseControl.ActiveDocument.New();
if (vdFramedControl1.BaseControl.ActiveDocument.CommandAction.CmdSphere(new gPoint(0, 0, 0), 3.0d, 6, 6))
{
vdFramedControl1.BaseControl.ActiveDocument.Model.Entities[vdFramedControl1.BaseControl.ActiveDocument.Model.Entities.Count - 1].Label = "WIRE3D"; // the sphere will be drawn as Wire3D
}
vdFramedControl1.BaseControl.ActiveDocument.CommandAction.CmdBox3d(new gPoint(5, 0, 0), 3.0d, 4.0d, 2.0d, 0.0d);
vdFramedControl1.BaseControl.ActiveDocument.ZoomExtents();
vdFramedControl1.BaseControl.ActiveDocument.FreezeEntityDrawEvents.Push(false);
vdFramedControl1.BaseControl.ActiveDocument.GlobalRenderProperties.CustomRenderTypeName = "VectorDraw.Render.opengllist#VectorDraw.Professional.dll";
vdFramedControl1.BaseControl.ActiveDocument.OnDrawFigure += new vdDocument.FigureDrawEventHandler(ActiveDocument_OnDrawFigure);
}
void ActiveDocument_OnDrawFigure(object sender, VectorDraw.Render.vdRender render, ref bool cancel)
{
vdPolyface pface = sender as vdPolyface;
if (pface != null)
{
if (pface.Label == "WIRE3D")// You can check here by Label/XProperty/Handle/Type/Layer etc
{
vdFramedControl1.BaseControl.ActiveDocument.FreezeEntityDrawEvents.Push(true);
VectorDraw.Render.vdRender.Mode RMode = render.RenderMode;
render.RenderMode = VectorDraw.Render.vdRender.Mode.Wire3d;
pface.Draw(render);
render.RenderMode = RMode;
cancel = true;
vdFramedControl1.BaseControl.ActiveDocument.FreezeEntityDrawEvents.Pop();
}
}
}