Hello
I am using kernelcad with VB.NET in visual studio 2010
I would like to make SOR Hubs for gear models from scratch, i.e. I suppose I need to provide a series of line segments - or a line strip - to use DIObjGenerator or ISORSectionGenerator.
For me there is a great advantage in using this as hubs sometimes have a bit of a complicated form and using a line strip describing its contour - already available in my software - and creating a SOR from this is by far the easiest way for me. Also, all the tools I use are by definition circular in form, hence using a SOR makes it a breeze to create a tool.
I've searched in the examples, including ObjArray, but though I could find how you instantiate the object, I could find neither how the line strip providing the contour was created nor where it comes from.
So, in short, what I would need to see is:
•how is the contour of the SOR created ?
•how is this contour actually used to create the desired SOR object ?
Thanks, Jeff
Creating SOR on the run
Re: Creating SOR on the run
Hi Jeff
Have a look at the MiniCAD sample (the second configuration) shows how to modify KC SOR object. But as I suspect you might need Step solids for that as created by OCCT KernelCAD component. More on that shortly
Nick
Have a look at the MiniCAD sample (the second configuration) shows how to modify KC SOR object. But as I suspect you might need Step solids for that as created by OCCT KernelCAD component. More on that shortly
Nick
-
- Posts: 4
- Joined: Tue Aug 29, 2017 6:42 am
Re: Creating SOR on the run
Good day Nick,
I have been working on the different functions to create a linestrip that defines the contour of an SOR.
I now need to know how to use this in order to create a volume about an axis.
Here is the function creating the LineStrip.
And here is the InitPointSet function, based on your own. Vectors V1 V2 V3 contain the coordinates.
Things appear to work Ok.
Therefore, how do I convert this ISection containing a LineStrip into an SOR ? I have looked into the ObjArray samples, but could not relate with what to do next.
Thanks, Jeff
I have been working on the different functions to create a linestrip that defines the contour of an SOR.
I now need to know how to use this in order to create a volume about an axis.
Here is the function creating the LineStrip.
Code: Select all
Function CreateLineStrip(ByRef NPts As Int32, _
ByRef IsClosed As Boolean, _
ByRef V1() As Double, _
ByRef V2() As Double, _
ByRef V3() As Double) As ISection
Dim iSection As ISection
iSection = CreateSection(EObjectType.eObjTypeLineStrip)
iSection.SetName("Line Strip")
InitPointSet(iSection, NPts, IsClosed, V1, V2, V3)
Return iSection
End Function
Code: Select all
Sub InitPointSet(ByRef iSection As ISection, _
ByRef NPts As Int32, _
ByRef IsClosed As Boolean, _
ByRef V1() As Double, _
ByRef V2() As Double, _
ByRef V3() As Double)
Dim Ii, Ii1 As Int32
' Create new ISectionPointSet
'
Dim iPointSet As ISectionPointSet = iSection
' Create new IArray
'
Dim iArray2 As IArray2 = iPointSet
' Inform IArray of the #Segments = NPts
'
If IsClosed Then
iArray2.SetCount(NPts + 1)
Else
iArray2.SetCount(NPts)
End If
iArray2.SetCount(NPts)
' Create new matrix of Points
'
Dim iMatrixPoints As IMatrixData = iPointSet.GetPoints()
' Add the point coordinates to the Matrix
'
For Ii = 0 To Npts - 1
Ii1 = Ii + 1
iMatrixPoints.Set(Ii, 0, V1(Ii1)) ' X value
iMatrixPoints.Set(Ii, 1, V2(Ii1)) ' Y value
iMatrixPoints.Set(Ii, 2, V3(Ii1)) ' Z value
Next Ii
' If IsClosed, Last Point = 1st Point
'
If IsClosed Then
Ii = NPts + 1
iMatrixPoints.Set(Ii, 0, V1(1)) ' X value
iMatrixPoints.Set(Ii, 1, V2(1)) ' Y value
iMatrixPoints.Set(Ii, 2, V3(1)) ' Z value
End If
' Size of Points
'
iPointSet.PointSize = 6
' Colors of Points
'
Dim iMatrixColor As IMatrixData
iMatrixColor = iPointSet.GetColors()
' Color is not per vertex so matrix of
' colors has a single row
iMatrixColor.Set(0, 0, 1.0) ' Red component has full intensity
iMatrixColor.Set(0, 1, 0.0) ' Green
iMatrixColor.Set(0, 2, 0.0) ' Blue
' Give it a name
'
iSection.SetName("Line Strip")
End Sub
Therefore, how do I convert this ISection containing a LineStrip into an SOR ? I have looked into the ObjArray samples, but could not relate with what to do next.
Thanks, Jeff
Re: Creating SOR on the run
An SOR object is created in ObjArray > NewGenericObjectForm.CreateSOR(). The SetDefaults() call there defines how many segments should be in the strip and whether it should be closed, etc.
To, say, modify the first point of the strip you need:
ISection>IStrip>IStrip.GetElement(0, True)>IElement>IElement.SetParam(0,x) and IElement.SetParam(1,y)
You need to call kc.UpdateSurface() after modifications to show up in 3D
Nick
To, say, modify the first point of the strip you need:
ISection>IStrip>IStrip.GetElement(0, True)>IElement>IElement.SetParam(0,x) and IElement.SetParam(1,y)
You need to call kc.UpdateSurface() after modifications to show up in 3D
Nick