文檔首頁(yè)>>VectorDraw Developer Framework使用教程>>VDF常見問(wèn)題整理(七):如何正確繪制具有PenWidth的圓?
VDF常見問(wèn)題整理(七):如何正確繪制具有PenWidth的圓?
VectorDraw Developer Framework(VDF)是一個(gè)用于應(yīng)用程序可視化的圖形引擎庫(kù)。有了VDF提供的功能,您可以輕松地創(chuàng)建、編輯、管理、輸出、輸入和打印2D和3D圖形文件。
VectorDraw Developer Framework試用版下載
問(wèn):
在Shade / Render / Wire3D模式下,如何才能正確繪制具有PenWidth的圓?
答:
面對(duì)這個(gè)問(wèn)題,我們需要先檢查是否可以用OpenGL(這個(gè)圓圈的4個(gè)邊緣)來(lái)解決這個(gè)圓的筆寬問(wèn)題,如果發(fā)現(xiàn)由于OpenGL限制無(wú)法解決這個(gè)問(wèn)題。那么,就建議避免使用帶有penwidth的圓/橢圓/弧等對(duì)象,而是使用Hatch對(duì)象,例如:
vdCircle cir = new vdCircle(); // assume that this is the circle with penwidth inside your block. cir.SetUnRegisterDocument(vdFramedControl1.BaseControl.ActiveDocument); cir.setDocumentDefaults(); cir.Center = new gPoint(3,3); cir.Radius=2; cir.PenWidth = .5; cir.PenColor.SystemColor = Color.Green; vdFramedControl1.BaseControl.ActiveDocument.Model.Entities.AddItem(cir); vdCircle cir1 = new vdCircle(); cir1=cir.Clone(vdFramedControl1.BaseControl.ActiveDocument) as vdCircle; cir1.Radius = cir.Radius - cir.PenWidth / 2.0; vdCircle cir2 = new vdCircle(); cir2 = cir.Clone(vdFramedControl1.BaseControl.ActiveDocument) as vdCircle; cir2.Radius = cir.Radius + cir.PenWidth / 2.0; vdPolyhatch hatch = new vdPolyhatch(); // replace the circle with this object hatch.SetUnRegisterDocument(vdFramedControl1.BaseControl.ActiveDocument); hatch.setDocumentDefaults(); VectorDraw.Professional.vdCollections.vdCurves curs = new VectorDraw.Professional.vdCollections.vdCurves(); curs.AddItem(cir1); curs.AddItem(cir2); hatch.HatchProperties = new vdHatchProperties(VdConstFill.VdFillModeSolid); hatch.HatchProperties.DrawBoundary = false; hatch.HatchProperties.FillColor = cir.PenColor; hatch.PolyCurves.AddItem(curs); vdFramedControl1.BaseControl.ActiveDocument.Model.Entities.AddItem(hatch);