Lines and areas on surface

Technical discussions
Post Reply
Claude
Posts: 23
Joined: Thu Jan 05, 2017 3:58 am

Lines and areas on surface

Post by Claude »

Good day again,

This is my next topic: how to collect a series of distinct line segments into 1 single entity ?

For example, in my software, the Bearing Pattern, i.e. the extent of the contact area of two moving objects, is displayed as a series of separate Blue lines. And the Red line represents the Path of Contact, i.e. the locus of the center point of each
instant line of contact (in Blue).

From what I have seen so far in KCad, I would need to create n Sections to represent each line of the above pattern in Blue and Red, n being equal to the sum of all the distinct Blue lines and the 1 Red line.

Problem is I will have to manipulate these individually, and it is tiresome and heavy in programming. What I would like is to make a collection of this, i.e. 1 single Section.

Is this possible ? Must all the components be of the same color, or can they be of different colors ? Do you have a sample showing how to tackle these tasks (can be in C# - I now translate directly as you saw) ?

Thanks, Claude

nickz
Site Admin
Posts: 236
Joined: Fri Jul 26, 2013 3:58 am

Re: Lines and areas on surface

Post by nickz »

Hi Claude
I see you have already figured out how to create line strips.
A line strip section can have unlimited number of strips inside. You need to use index for that.
By default index is 0,1,2,..,pointCount-1. If you define index as, say 3,0,5,-1,5,1,-1,0,2 you will have three strips defined on points with indices in the base point array (3,0,5), (5,1), (0,2)

If you search in samples for GetIndex it will find one in
Samples\NET\VB\ObjArray\NewGenericObjectForm.vb

Code: Select all

                  iSectionLineStrip = iSect
                  Dim countPoints, countIndex As Integer
                  countPoints = iArray2.GetCount()
                  Dim iArray2Index As IArray2
                  iArray2Index = iSectionLineStrip.GetIndex()
                  countIndex = iArray2Index.GetCount()

                  If countIndex = 0 Then

                      For i As Integer = 0 To countPoints - 1
                          iArray2Index.InsertAt(i, i)
                      Next i
                      ' The closing segment
                      iArray2Index.InsertAt(countPoints, 0)
                  Else
                      If (countIndex > countPoints) Then
                          iArray2Index.InsertAt(countIndex - 1, 0)
                      End If
                  End If
You can define colours per point

The red and blue items should be separate segment strip sections, of
course, to keep the logic clear

I hope this helps

Post Reply