• <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)最新版下載

    一. 通過(guò)鍵盤鍵和要傳遞給活動(dòng)命令的點(diǎn)通過(guò)命令透明地調(diào)用放大鏡

    問(wèn):如何通過(guò)鍵盤鍵和要傳遞給活動(dòng)命令的點(diǎn)通過(guò)命令透明地調(diào)用放大鏡?

    答:你可以使用以下代碼:

    private void Form1_Load(object sender,EventArgs e)
    
    {
    
    vdFramedControl.BaseControl.KeyDown + = new KeyEventHandler(BaseControl_KeyDown);
    
    }
    
     
    
    void BaseControl_KeyDown(object sender,KeyEventArgs e)
    
    {
    
    if(e.KeyCode == Keys .ControlKey )doc.ActionUtility.StartUserMagnifier(doc,3,210,-100);
    
    }

    請(qǐng)注意,這適用于版本6016及更高版本。

    二. 計(jì)算vdPolyHatch對(duì)象的面積和長(zhǎng)度

    問(wèn):如何計(jì)算vdPolyHatch對(duì)象的面積和長(zhǎng)度?

    答:你可以使用以下代碼計(jì)算復(fù)雜vdPolyhatch的面積和長(zhǎng)度:

    private void button1_Click(object sender, EventArgs e)
    {
       vdFramedControl1.BaseControl.ActiveDocument.Open(@"c:\321\Hatch\test.vdml"); // I have used a test drawing that containd a hatch
       VectorDraw.Professional.vdFigures.vdPolyhatch pHatch = vdFramedControl1.BaseControl.ActiveDocument.ActiveLayOut.Entities[4] as VectorDraw.Professional.vdFigures.vdPolyhatch;// this is the vdPolyHatch object that I need to calculate the length and area
       if (pHatch == null) return;
       double area = pHatch.ToMesh(0).Area();
       double length1 =0.0d;
    
       foreach (VectorDraw.Professional.vdCollections.vdCurves curves in pHatch.PolyCurves)
       {
          foreach (VectorDraw.Professional.vdFigures.vdCurve curve in curves)
          {
             length1 += curve.Length();
          }
       }
       this.Text = "Area: " + area.ToString(); +" Length: " + length1.ToString();
    }

    三. 加速多圖紙印刷

    問(wèn):如何加快多圖紙印刷?

    答:為了使你的打印速度更快,你需要為所有圖紙選擇一個(gè)通用的vdPrint對(duì)象。

    //A common printer for all drawings.
    
    VectorDraw.Professional.vdObjects.vdPrint mPrinter = new VectorDraw.Professional.vdObjects.vdPrint();
    
     
    
    void SelectPrinter()
    
    {
    
    mPrinter.SetUnRegisterDocument(vdDrawingManager.BaseControl.ActiveDocument);
    
    mPrinter.PrinterName = "";//The default system printer
    
    mPrinter.SelectPaper("PRINTER-DEFAULT");//The default paper of selected system printer
    
    mPrinter.OutInBlackWhite = true;
    
    mPrinter.LandScape = true;
    
    //here you can change some additional properties for selected printer like Margings Resolution copies
    
    mPrinter.UpdatePrinterFromProperties();//this will update the internally selected System.Drawing.Printing.PrintDocument
    
    }
    
     
    
    void Print(vdDocument document)
    
    {
    
    mPrinter.DocumentName = "Printing Example(" + document.FileName +")";
    
    mPrinter.SetLayout(document.ActiveLayOut);
    
    mPrinter.PrintExtents();
    
    mPrinter.PrintScaleToFit();
    
    mPrinter.PrintOut();
    
    mPrinter.SetLayout(null);
    
    }

    四. 將一些表格作為新圖紙或現(xiàn)有圖紙的模板

    問(wèn):我需要在我的應(yīng)用程序加載或創(chuàng)建模板的所有圖形中標(biāo)注一些文本樣式和暗淡標(biāo)準(zhǔn)。我該怎么做?

    答:可以通過(guò)在圖形中包含這些表(或更多取決于你的應(yīng)用程序需要)來(lái)完成,并在臨時(shí)圖形中打開(kāi)它們并使用MergeTables將它們合并。例如 :

    namespace CreateAndMerge
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
    
            private void AddTextstylesItems(VectorDraw.Professional.vdObjects.vdDocument doc)
            {
                //We add a textstyle with font name Verdana.
                VectorDraw.Professional.vdPrimaries.vdTextstyle style1 = new VectorDraw.Professional.vdPrimaries.vdTextstyle();
                style1.SetUnRegisterDocument(doc);
                style1.setDocumentDefaults();
                style1.Name = "TextStyle1";
                style1.FontFile = "Verdana";
                doc.TextStyles.AddItem(style1);
    
                VectorDraw.Professional.vdPrimaries.vdTextstyle style2 = new VectorDraw.Professional.vdPrimaries.vdTextstyle();
                style2.SetUnRegisterDocument(doc);
                style2.setDocumentDefaults();
                style2.Name = "TextStyle2";
                style2.Extra.IsUnderLine = true;
                style2.Extra.IsStrikeOut = true;
                style2.FontFile = "Lucida Console";
                doc.TextStyles.AddItem(style2);
            }
    
            private void AddDimstylesItems(VectorDraw.Professional.vdObjects.vdDocument doc)
            {
                //We create a vdDimstyle object.
                VectorDraw.Professional.vdPrimaries.vdDimstyle style1 = new VectorDraw.Professional.vdPrimaries.vdDimstyle();
                style1.SetUnRegisterDocument(doc);
                style1.setDocumentDefaults();
                //And change some properties.
                style1.Name = "DimStyle1";
                style1.TextColor.ColorIndex = 1;
                style1.TextHeight = 0.5;
                //And add this object to the Dimstyles collection of the document.
                doc.DimStyles.AddItem(style1);
    
                //We can also add dimstyles using the Add function of the dimstyles collection which is much easier.
                VectorDraw.Professional.vdPrimaries.vdDimstyle style2 = doc.DimStyles.Add("DimStyle2");
                style2.ExtLineVisible = false;
                style2.TextHeight = 0.5;
    
                VectorDraw.Professional.vdPrimaries.vdDimstyle style3 = doc.DimStyles.Add("DimStyle3");
                style3.ExtLineColor.ColorIndex = 1;
                style3.DimTol = true;
                style3.DimTp = 0.3;
                style3.DimTm = 0.3;
                style3.TextHeight = 0.5;
    
                VectorDraw.Professional.vdPrimaries.vdDimstyle style4 = doc.DimStyles.Add("DimStyle4");
                style4.DimAdec = 0;
                style4.DecimalPrecision = 0;
                style4.TextHeight = 0.5;
    
                VectorDraw.Professional.vdPrimaries.vdDimstyle style5 = doc.DimStyles.Add("DimStyle5");
                style5.ArrowBlock = doc.Blocks.VDDIM_NONE;
                style5.TextHeight = 0.5;
    
                VectorDraw.Professional.vdPrimaries.vdDimstyle style6 = doc.DimStyles.Add("DimStyle6");
                style6.ArrowSize *= 5.0;
                style6.TextHeight = 0.5;
            }
    
            private void btOpen_Click(object sender, EventArgs e)
            {
                //First we call the dialog to select the file to open and then open the file.
                object ret = vdFrameControl.BaseControl.ActiveDocument.GetOpenFileNameDlg(0, "", 0);
                if (ret == null) return;
                string fname = (string)ret;
                bool success = vdFrameControl.BaseControl.ActiveDocument.Open(fname);
                if (success) vdFrameControl.BaseControl.ActiveDocument.Redraw(true);
            }
    
            private void btMergeTables_Click(object sender, EventArgs e)
            {
                // This code will open the template drawing file which contains the tables (vdTextStyles, vdDimStyles,
                //      vdLayers, vdBlocks etc) that we mostly use, in a vdDocument component and merge this with a new 
                //      drawing or with a drawing that already exists.
                VectorDraw.Professional.Components.vdDocumentComponent vdDocComponent;
                vdDocComponent = new VectorDraw.Professional.Components.vdDocumentComponent();
                vdDocComponent.Document.Open(@"e:\tests\tables.vdcl");
                DialogResult res= MessageBox.Show("Do you want to replace existing (if they exist already) tables in the document", "Overwrite Existing", MessageBoxButtons.YesNo);
                vdFrameControl.BaseControl.ActiveDocument.MergeTables(vdDocComponent.Document, false, (bool)(res == DialogResult.Yes));
                vdFrameControl.BaseControl.ActiveDocument.CommandAction.RegenAll(); // this is needed to update the tables and entities
                vdDocComponent.Document.New();
                vdDocComponent.Document.Dispose();
                vdDocComponent.Dispose();
            }
    
            private void btCreateTemplate_Click(object sender, EventArgs e)
            {    
                //creating the drawing which contains the tables with the TextStyles and DimStyles that we need to use in other drawings
                // then the drawing is saved as vdcl file
                VectorDraw.Professional.Components.vdDocumentComponent vdDocComponent;
                vdDocComponent = new VectorDraw.Professional.Components.vdDocumentComponent();
    
                AddTextstylesItems(vdDocComponent.Document);
                AddDimstylesItems(vdDocComponent.Document);
                vdDocComponent.Document.SaveAs(@"e:\tests\tables.vdcl", null);
                vdDocComponent.Document.New();
                MessageBox.Show("The TextStyles and DimStyles are created. Now you can open the drawing you want and merge them to this drawing.");
                vdDocComponent.Document.Dispose();
                vdDocComponent.Dispose();
            }
    
        }
    }

    五. 在vdInsert活躍后顯示屬性字符串

    問(wèn):在vdInsert活躍后,是否可以顯示值而不是vdAttribute的標(biāo)記?

    答:對(duì)于內(nèi)部具有屬性(vdAttribDef和vdAttribs)的插入,所有CAD軟件都會(huì)發(fā)生這種情況。這不算是錯(cuò)誤或者問(wèn)題,如果你希望保持文本顯示相同,則必須使用“special”活躍,這將更改這些attrib-definitions的TagString屬性。請(qǐng)參閱以下代碼:

    private void button2_Click(object sender, EventArgs e)
    {
        VectorDraw.Professional.vdFigures.vdInsert ins = vdFramedControl1.BaseControl.ActiveDocument.ActiveLayOut.Entities[0] as VectorDraw.Professional.vdFigures.vdInsert;
        // assume that the drawing contains only a vdInsert with attributes so this is Entity 0.
     
        if (ins == null) return;
        VectorDraw.Professional.vdCollections.vdEntities exploded_entities = ins.Explode();
        vdFramedControl1.BaseControl.ActiveDocument.UndoHistory.StoreUndoGroup(true, "EXPLODE");
        ins.Deleted = true;
        foreach (VectorDraw.Professional.vdPrimaries.vdFigure var in exploded_entities)
        {
           vdFramedControl1.BaseControl.ActiveDocument.ActiveLayOut.Entities.AddItem(var);
           VectorDraw.Professional.vdFigures.vdAttribDef def = var as VectorDraw.Professional.vdFigures.vdAttribDef;
           if (def != null)
           {
              def.TagString = def.ValueString.ToString(); // this is the code that you want that the default explode function do not have
           }
           var.Invalidate();
        }
        vdFramedControl1.BaseControl.ActiveDocument.UndoHistory.StoreUndoGroup(false, "EXPLODE");
    }

    未完待續(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); })();