新手入门必看:VectorDraw 常见问题整理大全(六)

本教程整理了VectorDraw 最常见问题,教程整理的很齐全,非常适合新手学习,希望对大家有一定的帮助!

VectorDraw Developer Framework(VDF)是一个用于应用程序可视化的图形引擎库。有了VDF提供的功能,您可以轻松地创建、编辑、管理、输出、输入和打印2D和3D图形文件。该库还支持许多矢量和栅格输入和输出格式,包括本地PDF和SVG导出。

VectorDraw Developer Framework最新版下载

VectorDraw web library (javascript)是一个矢量图形库。VectorDraw web library (javascript)不仅能打开CAD图纸,而且能显示任何支持HTML5标准平台上的通用矢量对象,如Windows,安卓,iOS和Linux。无需任何安装,VectorDraw web library (javascript)就可以运行在任何支持canvas标签和Javascript的主流浏览器(Chrome, Firefox, Safari, Opera, Dolphin, Boat等等)中。

VectorDraw web library (javascript)最新版下载

一. 更改PropertyGrid的宽度和CommandLine的高度

问:如何在vdFramedControl中更改PropertyGrid的宽度和CommandLine的高度/p>

答:您可以使用代码执行此操作,例如:

vdFramedC.SetLayoutStyle(vdControls.vdFramedControl.LayoutStyle.CommandLine, true); // Show the CommandLinevdFramedC.SetLayoutStyle(vdControls.vdFramedControl.LayoutStyle.PropertyGrid, true); // Show the PropertyGridvdFramedC.HistoryLines = 4; // Change CommandLine's Height, changing the history lines that will be displayedvdFramedC.PropertyGridWidth = vdFramedControl.PropertyGridWidth * 2;// Change PropertyGrid's Width

二. 在不将这些操作添加到撤消/重做的情况下进行缩放/平移

问:如何在不使用.NET组件将这些操作添加到撤消/重做列表的情况下进行缩放/平移/p>

答:您可以使用vdDocument事件的onUndoStoreValue,当ViewSize或ViewCenter发生更改时(这会发生缩放和/或平移),然后将Cancel设置为true。例如:

private void Form1_Load(object sender, EventArgs e){vdFramedControl1.BaseControl.ActiveDocument.OnUndoStoreValue += new VectorDraw.Professional.vdObjects.vdDocument.UndoStoreValueEventHandler(ActiveDocument_OnUndoStoreValue);}void ActiveDocument_OnUndoStoreValue(object sender, bool isRedo, object propObject, string propName, object value, ref bool Cancel){if (propName.ToLower() == "viewcenter" || propName.ToLower() == "viewsize"){ // zoom pan change ViewCenter and ViewSizeCancel = true; // This will not write to the UNDO the pan/zoom actions}}

对于7版本的代码应该是:

        void ActiveDocument_OnUndoStoreValue(object sender, bool isRedo, object propObject, string propName, object value, ref bool Cancel)        {            if (propName.ToLower() == "viewcenter" || propName.ToLower() == "viewsize" || propObject.ToString().ToLower() == "zoom")            { // zoom & pan change ViewCenter and ViewSize                Cancel = true; // This will not write to the UNDO the pan/zoom actions            }        }

三. 在ACAD中显示的直径符号

问:如何在ACAD中显示的直径符号/p>

答:您可以使用vdDocument事件的onUndoStoreValue,当ViewSize或ViewCenter发生更改时(这会发生缩放和/或平移),然后将Cancel设置为true。例如:

***本文适用于6010及以上版本***

vdDimStyle的新属性在6010 DiameterSymbol中添加了直径类型尺寸,RadialSymbol用作径向类型尺寸的前缀默认情况下,“D”用于直径,“R”用于径向

您可以通过实现以下两个事件让您的应用程序使用特定的Diameter和径向字符串值:

public Form1(){    InitializeComponent();    vdFramedControl1.BaseControl.AfterNewDocument += new VectorDraw.Professional.Control.AfterNewDocumentEventHandler(BaseControl_AfterNewDocument);    vdFramedControl1.BaseControl.AfterOpenDocument += new VectorDraw.Professional.Control.AfterOpenDocumentEventHandler(BaseControl_AfterOpenDocument);}void ChangeDimensionsStylePrefix(string PrefixDiameter,string PrefixRadial){     foreach (vdDimstyle style in vdFramedControl1.BaseControl.ActiveDocument.DimStyles)     {          style.DiameterSymbol = PrefixDiameter;          style.RadialSymbol = PrefixRadial;     }}void BaseControl_AfterOpenDocument(object sender){    ChangeDimensionsStylePrefix("%%c","r");}void BaseControl_AfterNewDocument(object sender){    ChangeDimensionsStylePrefix("%%c","r");}

四. 获取图形中使用的所有collors(可见实体)

问:想从屏幕上绘制的实体中获取颜色,所以如何获取图形中使用的所有collors(可见实体)/p>

答:请参阅下面的代码。它是在C#2005中使用vdFramed控件。调用onDrawFigure事件,从此事件的渲染中可以获得PenStyle.Color。

System.Collections.Generic.Dictionary<int, System.Drawing.Color> dictionarycolor;private bool countcolors = false;public Form1(){    InitializeComponent();} private void Form1_Load(object sender, EventArgs e){    vdFC.BaseControl.ActiveDocument.FreezeEntityDrawEvents.Push(false);    vdFC.BaseControl.ActiveDocument.OnDrawFigure += new VectorDraw.Professional.vdObjects.vdDocument.FigureDrawEventHandler(ActiveDocument_OnDrawFigure);   // this event is needed. The render of this event has the PenStyle.Color}private void button3_Click(object sender, EventArgs e){   //create a dictionary to filter dublicate colors   dictionarycolor = new Dictionary<int, Color>();    countcolors = true;    vdFC.BaseControl.ActiveDocument.Open(vdFC.BaseControl.ActiveDocument.GetOpenFileNameDlg(0, "", 0) as string);    vdFC.BaseControl.ActiveDocument.Redraw(true);    countcolors = false;   //put the colors from dictionary in a simple array of System colors.   System.Drawing.Color[] usedcolors = new Color[dictionarycolor.Count];   int i = 0;   foreach (System.Collections.Generic.KeyValuePair<int,System.Drawing.Color> var in dictionarycolor)    {      usedcolors.SetValue(var.Value,i ); i++;    }   MessageBox.Show("different colors used : "+ i.ToString());}void ActiveDocument_OnDrawFigure(object sender, VectorDraw.Render.vdRender render, ref bool cancel){   if (countcolors)    {      int key = render.PenStyle.color.GetHashCode();      if(dictionarycolor.ContainsKey(key)) return;        dictionarycolor.Add(key, render.SystemPenColor); //add the color to the dictionary if doesn't already exist   }}

五. 在vdraw的DblClick事件后显示模式对话框时如何克服焦点问题

问:在Wrapper中,当DblClick发生时,此事件的处理程序中显示的模态形式没有焦点,所以如何在vdraw的DblClick事件后显示模式对话框时如何克服焦点问题/p>

答:***此解决方案适用于6009及以上版本***

您可以使用CommandID事件和PostCommandID方法轻松解决此问题。请参阅以下代码:

void CAdd3dEntitiesDlg::DblClickVdpro1(){    m_vdraw.PostCommandId(555);}void CAdd3dEntitiesDlg::CommandIdVdpro1(long cmdid){    if(cmdid == 555){        MyTest Dlg;        Dlg.DoModal();    }}

未完待续……

标签:CAD工业4.0

来源:慧都

声明:本站部分文章及图片转载于互联网,内容版权归原作者所有,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2018年9月19日
下一篇 2018年9月19日

相关推荐

发表回复

登录后才能评论