I do a Bool Op subtract, which works, but I have an issue with the color of the result.
What I get is as follows: you can see that the teeth have different colors for the Pinion and Gear, but both hubs are of the same color, even if I impose the color when doing the Bool Op. And the color of the hubs has nothing to do with that of the teeth.
Here is my code. What is missing in there ?
Thanks, Richard
Code: Select all
' ---------------------------
' Create the Inner Cylinder
' ---------------------------
'
ISection2 = iStdShape2.Cylinder(Gen.RayIntHub, Gen.RayIntHub, RLong * 2)
' Give it color
'
Dim IMatl2 As IMaterial = DirectCast(iSection2, IMaterial)
IMatl2.SetColor(1, CDec(IRed / 255), CDec(IGreen / 255), CDec(IBlue / 255))
' Transform location
'
Dim i3DObj2 As I3DObject = DirectCast(iSection2, I3DObject)
i3DObj2.Translate(0, 0, -RLong / 2#)
i3DObj2.Rotate(-Gen.Angl2 * Gen.Ig / Degr, 0, 0, 0, 0, 1, 0)
If Gen.IChoi = GeoType.Herringbone Then
i3DObj2.Translate(0#, 0#, -Gen.L / 2#)
End If
i3DObj2.Translate(-Gen.Dist1, -Gen.HypoiD2, Gen.Dist3)
' ---------------------------
' Create the Outer Cylinder/Cone
' ---------------------------
'
iSection = iStdShape.Cylinder(RayToe, RayHeel, RLong)
' Give it coulor
'
Dim IMatl As IMaterial = DirectCast(iSection, IMaterial)
IMatl.SetColor(1, CDec(IRed / 255), CDec(IGreen / 255), CDec(IBlue / 255))
' Transform location
'
Dim i3DObj As I3DObject = DirectCast(iSection, I3DObject)
i3DObj.Rotate(-Gen.Angl2 * Gen.Ig / Degr, 0, 0, 0, 0, 1, 0)
If Gen.IChoi = GeoType.Herringbone Then
i3DObj.Translate(0#, 0#, -Gen.L / 2#)
End If
i3DObj.Translate(-Gen.Dist1, -Gen.HypoiD2, Gen.Dist3)
' ---------------------------
' Remove Inner Cylinder
' ---------------------------
'
iBoolSection = iSection
iBoolSection.execute(EBooleanOperation.eBoolOpSubtract, ISection2, True)
' Give it color
'
Dim IMatl3 As IMaterial = DirectCast(iBoolSection, IMaterial)
IMatl3.SetColor(1, CDec(IRed / 255), CDec(IGreen / 255), CDec(IBlue / 255))
' ---------------------------
' Update
' ---------------------------
'
ChildWindow(IActWin).AxKCad.UpdateSurface()
ChildWindow(IActWin).AxKCad.UpdateView()