VBA - Create Parallel Curve with S-Type Law

Francois Doyon

VBA - Create Parallel Curve with S-Type Law



I'm trying to create a parallel curve with a S-Type law in VBA. The way I found so far is to create a regular offset curve then to change the lawtype to S-Type. I can change the offset parameter afterward, but it seems that the offset2 parameter is not automatically generated after the lawtype change and the script crashes when I change the offset2 value. If I manually enter the generated offset curve after the crash and exit it without changing anything, the parameter appears under the feature. 

Any Idea what I'm missing?

Here's a sample of my code:

dim HSF1 As HybridShapeFactory
dim IntegralOffsetPS As HybridShapeCurvePar
dim refPSCrv 'as reference curve
dim refSectPlane 'as reference plane
dim InvertOffsetPS as Boolean


Set IntegralOffsetPS = HSF1.AddNewCurvePar(refPSCrv, refSectPlane, 25, InvertOffsetPS, False)
IntegralOffsetPS.LawType = 3     'S-Type
IntegralOffsetPS.Offset.Value = 10
IntegralOffsetPS.Offset2.Value = 30