Article | 70000934 |
Type | Wish |
Product | Engine |
Version | 7009 |
Date Added | 11/15/2016 12:00:00 AM |
Fixed | 7.7010.0.2 (11/17/2016 12:00:00 AM) |
Submitted by | David Saunders |
Summary
I would like a crosshair or similar to show the cutting head position but still have full mouse control and to be rendered fast on screen.
Solution
A new method is exported in the document that render objects inside a vdSelection (which might or not be in the Entities collection of the document/layouts). These objects will dissapear after a Redraw() or Refresh() call. In C#, try a code like:
vdInsert ins = null; // public in the form double step = 0.0d; private void button9_Click(object sender, EventArgs e) { vdDocument doc = vdFramedControl1.BaseControl.ActiveDocument; doc.Open(@"c:\test\myfile.vdcl"); // open a drawing Box bx = doc.ActiveLayOut.Entities.GetBoundingBox(true, false); double width = bx.Width; step = bx.Width / 200.0; //create the block vdBlock blk = new vdBlock(doc, "MyPOSTemp"); blk.Entities.AddItem(new vdCircle(doc, new gPoint(), 0.25)); blk.Entities.AddItem(new vdLine(doc, new gPoint(-0.5, 0), new gPoint(0.5, 0))); blk.Entities.AddItem(new vdLine(doc, new gPoint(0, -0.5), new gPoint(0, 0.5))); blk.Entities.AddItem(new vdCircle(doc, new gPoint(), 0.25)); //create the vdInsert ins = new vdInsert(doc, blk, new gPoint(), 0, 1, 1, 1); ins.AlignToView = true; ins.AlignToViewSize = 10; ins.Draw3DFlag = Draw3DFlagEnum.ExcludeFromList; ins.InsertionPoint = bx.UpperLeft; //set the timer Timer timer = new Timer(); timer.Interval = 200; timer.Tick += new EventHandler(timer_Tick); timer.Start(); //create the vdSelection that will hold these items vdSelection sel = new vdSelection("DrawScreenTemp"); doc.Selections.AddItem(sel); sel.RemoveAll(); sel.AddItem(ins, false, vdSelection.AddItemCheck.Nochecking); } void timer_Tick(object sender, EventArgs e) { vdDocument doc = vdFramedControl1.BaseControl.ActiveDocument; ins.InsertionPoint = new gPoint(ins.InsertionPoint.x + step, ins.InsertionPoint.y - step); ins.Update(); doc.DrawScreenTemporary(doc.Selections.FindName("DrawScreenTemp")); // draw the objects in the vdSelection }In VB6 (wrapper) you can use it like :
Dim ins As VDrawI5.vdInsert // public in the form Private Sub Command10_Click() Dim cir As VDrawI5.vdCircle Dim sel As VDrawI5.vdSelection Dim blk As VDrawI5.vdBlock VDraw1.ActiveDocument.Open "c:\test\aaa.vdml" Set sel = VDraw1.ActiveDocument.Selections.Add("DrawScreenTemp") Set blk = VDraw1.ActiveDocument.Blocks.Add("MyPOSTemp", Array(0, 0)) Set cir = blk.AddCircle(Array(0, 0), 0.25) Set ins = VDraw1.CreateInstance(VDrawI5.VdConstObjectType_tag.OBJ_INSERT) ins.BlockName = "MyPOSTemp" ins.InsertionPoint = Array(0, 0) sel.ClearAll sel.AddItem ins Timer1.Interval = 200 End Sub Private Sub Timer1_Timer() Dim selset7 As VectorDraw_Professional.vdSelection Dim selset As VDrawI5.vdSelection Dim doc7 As VectorDraw_Professional.vdDocument Dim insp As Variant Set selset = VDraw1.ActiveDocument.Selections.FindName("DrawScreenTemp") Set selset7 = selset.WrapperObject insp = ins.InsertionPoint insp(0) = insp(0) + 0.1 insp(1) = insp(1) + 0.1 ins.InsertionPoint = insp ins.Update Set doc7 = VDraw1.ActiveDocument.WrapperObject Call doc7.DrawScreenTemporary(selset7) End Sub