• <menu id="w2i4a"></menu>
  • logo VectorDraw教程

    文檔首頁(yè)>>VectorDraw教程>>新手入門必看:VectorDraw 常見(jiàn)問(wèn)題整理大全(十七)

    新手入門必看:VectorDraw 常見(jiàn)問(wèn)題整理大全(十七)


    VectorDraw Developer Framework(VDF)是一個(gè)用于應(yīng)用程序可視化的圖形引擎庫(kù)。有了VDF提供的功能,您可以輕松地創(chuàng)建、編輯、管理、輸出、輸入和打印2D和3D圖形文件。該庫(kù)還支持許多矢量和柵格輸入和輸出格式,包括本地PDF和SVG導(dǎo)出。

    VectorDraw Developer Framework最新版下載

    VectorDraw web library (javascript)是一個(gè)矢量圖形庫(kù)。VectorDraw web library (javascript)不僅能打開(kāi)CAD圖紙,而且能顯示任何支持HTML5標(biāo)準(zhǔn)平臺(tái)上的通用矢量對(duì)象,如Windows,安卓,iOS和Linux。無(wú)需任何安裝,VectorDraw web library (javascript)就可以運(yùn)行在任何支持canvas標(biāo)簽和Javascript的主流瀏覽器(Chrome, Firefox, Safari, Opera, Dolphin, Boat等等)中。

    VectorDraw web library (javascript)最新版下載

    一. 使cmdScale具有引用和復(fù)制選項(xiàng)

    問(wèn):是否可以制作“Scale命令”以獲得參考和復(fù)制選項(xiàng)?

    答:可以創(chuàng)建自己的自定義cmdScale命令。在C#中查看此示例代碼:

                    vdDocument doc = vdFramedControl.BaseControl.ActiveDocument;
                    doc.Prompt("Select objects:");
                    doc.CommandAction.CmdSelect("user");
                    doc.Prompt(null);
                    if (!success) return;
                    vdSelection documentSelection = doc.Selections.Add("VDRAW_PREVIOUS_SELSET");
                    if (documentSelection.Count == 0) return;
    
                   
    
                    doc.Prompt("Specify base point:");
                    gPoint origin = doc.ActionUtility.getUserPoint() as gPoint;
                    doc.Prompt(null);
                    if (origin == null) return;
    
                    bool copymode = false;
                    vdSelection set = null;
                    double scalevalue = 1.0d;
                    do
                    {
                        doc.Prompt("Specify scale factor or [Copy/Reference]:");
    
                        VectorDraw.Professional.CommandActions.ActionGetTranfromSelection AScale = new VectorDraw.Professional.CommandActions.ActionGetTranfromSelection(origin, doc.ActiveLayOut, documentSelection, VectorDraw.Professional.CommandActions.ActionTransformParameter.ScaleXY);
                        AScale.SetAcceptedStringValues(new string[] { "Copy;c;C", "Reference;r;R" }, null);
                        doc.ActionAdd(AScale);
                        StatusCode scode = AScale.WaitToFinish();
                        doc.Prompt(null);
                        if (scode != StatusCode.Success) return;
                        if (AScale.Value is double)
                        {
                            set = documentSelection;
                            scalevalue = (double)AScale.Value;
                            break;
                        }
                        else if (AScale.Value.Equals("Copy"))
                        {
                            copymode = true;
                        }
                        else if (AScale.Value.Equals("Reference"))
                        {
                            doc.Prompt("Specify reference length:");
                            object aret = doc.ActionUtility.getUserDist(null);
                            doc.Prompt(null);
                            if (aret is double)
                            {
                                double referencelength = (double)aret;
                                doc.Prompt("Specify new length:");
                                aret = doc.ActionUtility.getUserDist(null);
                                doc.Prompt(null);
                                if (aret is double)
                                {
                                    double newlength = (double)aret;
                                    set = documentSelection;
                                    scalevalue = newlength / referencelength;
                                    break;
                                }
                            }
                        }
                        else
                        {
                            return;
                        }
                    } while (true);
                    if (set != null)
                    {
                        if (copymode)
                        {
                            set = new vdSelection();
                            set.SetUnRegisterDocument(doc);
                            foreach (vdFigure fig in documentSelection)
                            {
                                vdFigure clonefig = fig.Clone(doc) as vdFigure;
                                doc.ActiveLayOut.LayoutOrViewPortEntities().AddItem(clonefig);
                                set.AddItem(clonefig, false, vdSelection.AddItemCheck.Nochecking);
                            }
                        }
                        doc.CommandAction.CmdScale(set, origin, scalevalue);
                    }

    二. ActionEntity用于文本圓弧橢圓和尺寸對(duì)象的用法

    問(wèn):ActionEntity用于文本圓弧橢圓和尺寸對(duì)象的用法?

    答:請(qǐng)參見(jiàn)以下代碼:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    
    using VectorDraw.Professional.vdObjects;
    using VectorDraw.Professional.vdFigures;
    using VectorDraw.Professional.vdPrimaries;
    using VectorDraw.Generics;
    using VectorDraw.Geometry;
    using VectorDraw.Professional.vdCollections;
    using VectorDraw.Actions;
    using VectorDraw.Render;
    using VectorDraw.Professional.Actions;
    using VectorDraw.Serialize;
    
    namespace vdtest
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
            private vdDocument doc { get { return vdFramedControl1.BaseControl.ActiveDocument; } }
    
            private void CmdText_Click(object sender, EventArgs e)
            {
                #region example of prompt the user to type a text on VectorDraw screen
                doc.Prompt("Text Insertion Point:");
                gPoint pt = doc.ActionUtility.getUserPoint() as gPoint;
                doc.Prompt(null);
                if (pt == null) return;
    
                VectorDraw.Professional.CommandActions.ActionText aFig = new VectorDraw.Professional.CommandActions.ActionText(pt, 0.0d, doc.ActionLayout);
                doc.Prompt("Text string:");
                doc.ActionAdd(aFig);
                StatusCode scode = aFig.WaitToFinish();
                doc.Prompt(null);
                if (scode != StatusCode.Success) return;
                string text = aFig.Value as string;
                if (text == null) return;
    
                vdText vdtext = new vdText();
                vdtext.SetUnRegisterDocument(doc);
                vdtext.setDocumentDefaults();
                vdtext.InsertionPoint = pt;
                vdtext.Rotation = 0.0d;
                vdtext.TextString = text;
                vdtext.Transformby(doc.User2WorldMatrix);
                doc.ActionLayout.Entities.AddItem(vdtext);
                doc.ActionDrawFigure(vdtext);
    
                #endregion
    
            }
    
            private void CmdArc_Click(object sender, EventArgs e)
            {
                #region example of prompt the user to select arc properties  on VectorDraw screen
                doc.Prompt("Arc center Point:");
                gPoint arccen = doc.ActionUtility.getUserPoint() as gPoint;
                doc.Prompt(null);
                if (arccen == null) return;
    
                doc.Prompt("Arc radius:");
                object arcrad = doc.ActionUtility.getUserDist(arccen);
                doc.Prompt(null);
                if (arcrad == null) return;
    
                doc.Prompt("Arc StartAngle:");
                object arcSangle = doc.ActionUtility.getUserAngle(arccen);
                doc.Prompt(null);
                if (arcSangle == null) return;
    
                doc.Prompt("Arc EndAngle:");
                object arcEAngle = doc.ActionUtility.getUserActionEntity(new VectorDraw.Professional.CommandActions.ActionArc(arccen, (double)arcrad, (double)arcSangle, doc.ActionLayout));
                doc.Prompt(null);
                if (arcEAngle == null) return;
    
                vdArc vdarc = new vdArc();
                vdarc.SetUnRegisterDocument(doc);
                vdarc.setDocumentDefaults();
                vdarc.Center = arccen;
                vdarc.Radius = (double)arcrad;
                vdarc.StartAngle = (double)arcSangle;
                vdarc.EndAngle = (double)arcEAngle;
                vdarc.Transformby(doc.User2WorldMatrix);
                doc.ActionLayout.Entities.AddItem(vdarc);
                doc.ActionDrawFigure(vdarc);
    
                #endregion
    
            }
    
            private void CmdEllipse_Click(object sender, EventArgs e)
            {
                #region example of prompt the user to select ellipse properties  on VectorDraw screen
                doc.Prompt("Ellipse Center Point:");
                gPoint ellCen = doc.ActionUtility.getUserPoint() as gPoint;
                doc.Prompt(null);
                if (ellCen == null) return;
    
    
                doc.Prompt("Ellipse First Axis End Point:");
                gPoint ellAxis1End = doc.ActionUtility.getUserRefPoint(ellCen as gPoint) as gPoint;
                doc.Prompt(null);
                if (ellAxis1End == null) return;
    
                doc.Prompt("Ellipse Second Axis Distance:");
                object ellMajorLen = doc.ActionUtility.getUserActionEntity(new VectorDraw.Professional.CommandActions.ActionEllipse(ellCen, ellAxis1End, doc.ActionLayout));
                doc.Prompt(null);
                if (ellMajorLen == null) return;
                vdEllipse ell = new vdEllipse();
                ell.SetUnRegisterDocument(doc);
                ell.setDocumentDefaults();
                ell.Center = ellCen;
                ell.MajorAngle = VectorDraw.Geometry.Globals.GetAngle(ellCen, ellAxis1End);
                ell.MajorLength = VectorDraw.Geometry.gPoint.Distance3D(ellCen, ellAxis1End);
                ell.MinorLength = (double)ellMajorLen;
                ell.Transformby(doc.User2WorldMatrix);
                doc.ActionLayout.Entities.AddItem(ell);
                doc.ActionDrawFigure(ell);
                #endregion
    
            }
    
            private void CmdDim_Click(object sender, EventArgs e)
            {
                #region example of prompt the user to select aligned dimension  on VectorDraw screen
                doc.Prompt("Dimension First Point:");
                gPoint dimPt1 = doc.ActionUtility.getUserPoint() as gPoint;
                doc.Prompt(null);
                if (dimPt1 == null) return;
    
                doc.Prompt("Dimension Second Point:");
                gPoint dimPt2 = doc.ActionUtility.getUserRefPoint(dimPt1) as gPoint;
                doc.Prompt(null);
                if (dimPt2 == null) return;
    
                doc.Prompt("Dimension Location:");
                gPoint dimPt3 = doc.ActionUtility.getUserActionEntity(new VectorDraw.Professional.CommandActions.ActionDimension(VectorDraw.Professional.Constants.VdConstDimType.dim_Aligned, dimPt1, dimPt2, dimPt2, 0.0d, doc.ActionLayout)) as gPoint;
                doc.Prompt(null);
                if (dimPt3 == null) return;
    
                vdDimension dim = new vdDimension();
                dim.SetUnRegisterDocument(doc);
                dim.setDocumentDefaults();
                dim.dimType = VectorDraw.Professional.Constants.VdConstDimType.dim_Aligned;
                dim.DefPoint1 = dimPt1;
                dim.DefPoint2 = dimPt2;
                dim.LinePosition = dimPt3;
                dim.Transformby(doc.User2WorldMatrix);
                doc.ActionLayout.Entities.AddItem(dim);
                doc.ActionDrawFigure(dim);
                #endregion
    
            }
        }
    }

    三. 在命令行中禁用右鍵單擊上下文(彈出)菜單

    問(wèn):如何禁用vdCommandLine中的彈出菜單(上下文菜單)?

    答:此菜單是默認(rèn)顯示的默認(rèn)Microsoft System.Windows.Forms.TextBox菜單。你可以使用以下代碼來(lái)禁用它:

                commandLine.History.ContextMenu = new ContextMenu();
                commandLine.UserText.ContextMenu = new ContextMenu();

    或者

                vdFramedControl1.CommandLine.History.ContextMenu = new ContextMenu();
                vdFramedControl1.CommandLine.UserText.ContextMenu = new ContextMenu();

    如果你愿意,還可以創(chuàng)建自己的上下文菜單并通過(guò)右鍵單擊顯示它。

    未完待續(xù)~

    好消息!慧都為了感謝大家的支持和關(guān)注,現(xiàn)免費(fèi)送30套正版ABViewer軟件~走過(guò)路過(guò)的同學(xué)千萬(wàn)不要錯(cuò)過(guò)

    ABViewer免費(fèi)送

    掃碼咨詢


    添加微信 立即咨詢

    電話咨詢

    客服熱線
    023-68661681

    TOP
    三级成人熟女影院,欧美午夜成人精品视频,亚洲国产成人乱色在线观看,色中色成人论坛 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();