Beijer Electronics (formerly QSI Corporation)
http://www.qsiforums.com/

linewidth in Plot Trace V2
http://www.qsiforums.com/viewtopic.php?f=6&t=4236
Page 1 of 1

Author:  Dano.oh [ Thu Mar 24, 2011 1:25 pm ]
Post subject:  linewidth in Plot Trace V2

I am developing a new program and using Plot Trace V2 to draw curves. I would like to make some of the line widths wider on some of the plots but I cannot seem to find a way to do this. I do have an older program that was developed within Qlarity and it does have a linewidth property within Plot Trace V2 but I do not have that property in Qlarity version 2.63. Did this property get removed? How can I do this?

Author:  Ron L. [ Thu Mar 24, 2011 2:15 pm ]
Post subject:  Re: linewidth in Plot Trace V2

Does that other workspace have a Template copy of the PlotTraceV2? You may just need to create a template copy and copy the code into your new workspace. I remember giving some code out to add that type of functionality, but it was not tested, so it wouldn't have been put in the library.

Author:  Dano.oh [ Thu Jun 09, 2011 3:29 pm ]
Post subject:  Re: linewidth in Plot Trace V2

Thanks. I figured it out.

In Qlarity with your project open go to

Edit

Edit Libraries

Add Existing Library

Add Other Library

Go to directory in which QSI was installed

Select “all files”

Find core.qlib.qhide and add it.

Close this screen



Edit

Add/edit templates

New template

Copy code of an existing template in a library

Select corePathtrace

Close



Switch to Code view

Find templates in “Object Tree”

Copy code from modified to this template

Author:  Roberto [ Thu Jun 16, 2011 11:39 pm ]
Post subject:  Re: linewidth in Plot Trace V2

I've just done what you said... but after that What is the property or field that you changed ?
I am searching for borderline but it doesn't appear.
What field or fields did you changed ?

Author:  Ron L. [ Mon Jun 20, 2011 8:41 am ]
Post subject:  Re: linewidth in Plot Trace V2

The PlotTraceV2 object doesn't have a LineWidth property. You can make a template copy of the "CorePathTrace" object and possibly add that functionality. First add the library "core.qlib.qhide" to your workspace. Make a template copy of "CorePathTrace".

Add this code to the template:

Code:
dim lineWidth as integer
init lineWidth := 1


Change the draw function code in the template:

Code:
func Draw()
     handles MSG_DRAW

     dim i, i2, max as integer
     dim j, k as integer
     dim old_ypts[], old_xpts[] as integer
     dim ypts2[], xpts2[] as integer

     setbgcolor (_colorMap[bgcolor])
     settransparent(_colorMap[bgcolor])
     usetransparent (transparent)

     drawBorder (xpos, ypos, xpos+width-1, ypos+height-1, _styleMap[borderstyle], BDR_FILL)

     if showLines then
         if fastDraw then
             Setfgcolor(_colorMap[Tracecolor1])
             DrawPolygon (left(xpts, insertIdx), left(ypts, insertIdx), POLY_NOCONNECT)
             old_ypts := ypts
             old_xpts := xpts
             for j = 2 to lineWidth
                if j mod 2 == 0 then
                    for k = 0 to len(ypts)-1
                        ypts[k] := ypts[k] + 1
                    next
                else
                    for k = 0 to len(xpts)-1
                        xpts[k] := xpts[k] + 1
                    next
                endif
                DrawPolygon (left(xpts, insertIdx), left(ypts, insertIdx), POLY_NOCONNECT)
             next
             ypts := old_ypts
             xpts := old_xpts
         else
             old_ypts := ypts
             old_xpts := xpts
             xpts2 := xpts
             ypts2 := ypts
             for j = 1 to lineWidth
                 max = insertIdx-1
                 for i = 1 to max
                     i2 := i-1
                     SetFgColor (clrs[max-i2])
                     DrawLine (xpts[i], ypts[i], xpts[i2], ypts[i2])
                     if linewidth > 1 then
                        DrawLine (xpts2[i], ypts2[i], xpts2[i2], ypts2[i2])
                        DrawLine (xpts2[i], ypts[i], xpts2[i2], ypts[i2])
                        DrawLine (xpts[i], ypts2[i], xpts[i2], ypts2[i2])
                    endif
                 next
                if j mod 2 == 0 then
                    for k = 0 to len(ypts)-1
                        ypts[k] := ypts[k] + 1
                        ypts2[k] := ypts2[k] - 1
                    next
                else
                    for k = 0 to len(xpts)-1
                       xpts[k] := xpts[k] + 1
                        xpts2[k] := xpts2[k] - 1
                    next
                endif
             next
             ypts := old_ypts
             xpts := old_xpts
         endif
    else
        max := insertIdx-1
    endif

     if showPointMarker then
         SetFgColor (_colorMap[curPosColor])
         for i = 0 to max
             DrawBox (xPts[i]-1, yPts[i]-1, xPts[i]+1, yPts[i]+1)
         next
     endif

     if showCurPos then
         SetFgColor (_colorMap[curPosColor])
         if insertIdx > 0 then
             i := insertIdx-1
             DrawBox (xPts[i]-1, yPts[i]-1, xPts[i]+1, yPts[i]+1)
         endif
     endif
endfunc

Author:  Roberto [ Mon Jun 20, 2011 9:19 am ]
Post subject:  Re: linewidth in Plot Trace V2

Thanks a lot, your solution is so good and the final result is perfect. I am thankful

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/