Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
ChingYen  
#1 Posted : Monday, April 25, 2011 8:07:15 AM(UTC)
ChingYen

Rank: Advanced Member

Groups: Member
Joined: 3/3/2008(UTC)
Posts: 185

Thanks: 8 times
Hi,

We tried to do this
Code:

float tmpLine = (float)lpX.Value;
Aurigma.GraphicsMill.WinControls.LineVObject lpLine = new Aurigma.GraphicsMill.WinControls.LineVObject(tmpLine, 0, tmpLine, _workingMultilayerViewer.WorkspaceHeight * 72);
lpLine.Pen.Width = 0.1f;
lpLine.Brush = null;
PointF[] test = GetTransformedCornerPoints(lpLine);
               _workingMultilayerViewer.Layers[0].VObjects.Add(lpLine);

        private System.Drawing.PointF[] GetTransformedCornerPoints(Aurigma.GraphicsMill.WinControls.VObject obj)
        {
            System.Drawing.RectangleF baseRect = obj.GetVObjectBounds();
            System.Drawing.PointF[] cornerPnts = new System.Drawing.PointF[4];

            try
            {
                cornerPnts[0] = baseRect.Location;
                cornerPnts[1] = new System.Drawing.PointF(baseRect.Right, baseRect.Top);
                cornerPnts[2] = new System.Drawing.PointF(baseRect.Right, baseRect.Bottom);
                cornerPnts[3] = new System.Drawing.PointF(baseRect.Left, baseRect.Bottom);
                obj.Transform.TransformPoints(cornerPnts);
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }
            return cornerPnts;
        }



We found that, when tmpLine = 22.6768
Test Point will be
+ [0] {X = 22.6768 Y = 0.0} System.Drawing.PointF
+ [1] {X = 22.726799 Y = 0.0} System.Drawing.PointF
+ [2] {X = 22.726799 Y = 612.0} System.Drawing.PointF
+ [3] {X = 22.6768 Y = 612.0} System.Drawing.PointF

Wondering why the value for X are not all the same?

We did check on some other numbers like tmpLine=28.346, it gave no issue @ all.

Please advise.

Dmitry.Obukhov  
#2 Posted : Tuesday, April 26, 2011 4:08:35 AM(UTC)
Dmitry.Obukhov

Rank: Advanced Member

Groups:
Joined: 5/29/2010(UTC)
Posts: 1,310

Thanks: 8 times
Was thanked: 111 time(s) in 111 post(s)
Ching-Yen,

It is not issue. You use GetVObjectBounds() method to get bounds of the line vector object:
Code:
 System.Drawing.RectangleF baseRect = obj.GetVObjectBounds();

Therefore, you get a bit different values from right side. The difference is 0.05. I checked tmpLine = 28.346. And got
Code:
[1]	{X = 28.396 Y = 0.0}	System.Drawing.PointF
[2]	{X = 28.396 Y = 612.0}	System.Drawing.PointF 
Best regards,
Dmitry Obukhov
Technical Support. Aurigma, Inc.
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.