VDF常见问题整理(七十):单击是否可以创建旋转的连续尺寸?

本系列教程整理了VectorDraw Developer Framework(VDF)最常见问题,教程整理的很齐全,非常适合新手学习。本文将会介绍单击如何创建旋转尺寸。

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

VectorDraw Developer Framework


问:单击是否可以创建旋转的连续尺寸/span>

您可以尝试如下代码:

gPoint prevPT = null; // the point that th euser clicked previouslygPoint DimPos = null; // position of the dimensionsbool IsOnDimCont = false;private void button1_Click(object sender, EventArgs e){    //where doc is a vdDocument, like vdFramedControl1.BaseControl.ActiveDocument    IsOnDimCont = false;    if (doc.CommandAction.CmdDim(VectorDraw.Professional.Constants.VdConstDimType.dim_Rotated, null, null, 0.0d))    {        vdDimension dim = doc.ActiveLayOut.Entities.Last as vdDimension;        prevPT = doc.World2UserMatrix.Transform(new gPoint(dim.DefPoint2)); // get the last point the user clicked and keep it for the next dimension        gPoint DimPos = doc.World2UserMatrix.Transform(new gPoint(dim.LinePosition)); // or you can calculate this by using the midpoint of DefPoint1 & DefPoint2 plus a DX/DY        doc.OnPrompt += new vdDocument.PromptEventHandler(doc_OnPrompt);// enable the event        for (int i = 0; i < 5; i++) // here you can change it to a do..while loop        {            IsOnDimCont = true;            if (doc.CommandAction.CmdDim(VectorDraw.Professional.Constants.VdConstDimType.dim_Rotated, null, DimPos, 0.0d))            {                vdDimension dimNext = doc.ActiveLayOut.Entities.Last as vdDimension;                prevPT = doc.World2UserMatrix.Transform(new gPoint(dimNext.DefPoint2)); // get the last point the user clicked and keep it for the next dimension            }            IsOnDimCont = false;        }        doc.OnPrompt -= new vdDocument.PromptEventHandler(doc_OnContDimPrompt); // disable it    }} void doc_OnContDimPrompt(object sender, ref string promptstr){    if (IsOnDimCont && sender!=null && promptstr == "First Point:" ) // this means that it is inside your cont. dimension code    {        doc.PostCommandActionString(vdFramedControl1.BaseControl, prevPT.ToString()); // here we pass the first point of the new dimension using the prevPT stored earlier    }}

=======================================================

如果您对想要购买正版授权VectorDraw Developer Framework(VDF),可以联系在线客服>>咨询相关问题。

标签:

来源:慧都

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

上一篇 2021年3月5日
下一篇 2021年3月5日

相关推荐

发表回复

登录后才能评论