One of the diffcult things in Journalling and then scrapping the data out of the Journal is trying to figure out the correlation between the UG dialog, Mouse Clicks, Selection of geometry and so forth. Like in the example below, the journal yielded "curveDumbRule1" and "curveDumbRule2" are these really necessary??? I've been developing in UG since V18 when knowledge fusion first came onto the scene before the journaling API and the only engineering software tool was Knowledge Fusion. I consider myself a mechanical engineer first and a programmer hacker second. I know engineering and manage developing software applications to suit my mechanical engineering design and analysis needs.
Anywho.....I did use the CreateRuleBuilder. If anyone is interested here is the final working code. I think it is good when people post working code snippets. Because we all learn from each other. Any Comments???
Private Function ThroatArea(ByVal line1 As Line, ByVal line2 As Line) As Face
Dim nullFeatures_Feature As Features.Feature = Nothing
Dim ruledBuilder1 As Features.RuledBuilder
ruledBuilder1 = workPart.Features.CreateRuledBuilder(Nothing)
ruledBuilder1.PositionTolerance = 0.0004
ruledBuilder1.IsShapePreserved = False
ruledBuilder1.FirstSection.DistanceTolerance = 0.0004
ruledBuilder1.FirstSection.ChainingTolerance = 0.00038
ruledBuilder1.SecondSection.DistanceTolerance = 0.0004
ruledBuilder1.SecondSection.ChainingTolerance = 0.00038
ruledBuilder1.AlignmentMethod.AlignCurve.DistanceTolerance = 0.0004
ruledBuilder1.AlignmentMethod.AlignCurve.ChainingTolerance = 0.00038
ruledBuilder1.FirstSection.SetAllowedEntityTypes(Section.AllowTypes.CurvesAndPoints)
Dim curves1(0) As IBaseCurve
curves1(0) = line1
Dim curveDumbRule1 As CurveDumbRule
curveDumbRule1 = workPart.ScRuleFactory.CreateRuleBaseCurveDumb(curves1)
ruledBuilder1.FirstSection.AllowSelfIntersection(True)
Dim rules1(0) As SelectionIntentRule
rules1(0) = curveDumbRule1
Dim helpPoint1 As Point3d = New Point3d(line1.StartPoint.X, line1.StartPoint.Y, line1.StartPoint.Z)
ruledBuilder1.FirstSection.AddToSection(rules1, line1, Nothing, Nothing, helpPoint1, Section.Mode.Create, False)
ruledBuilder1.SecondSection.SetAllowedEntityTypes(Section.AllowTypes.OnlyCurves)
' Second Line
Dim curves2(0) As IBaseCurve
curves2(0) = line2
Dim curveDumbRule2 As CurveDumbRule
curveDumbRule2 = workPart.ScRuleFactory.CreateRuleBaseCurveDumb(curves2)
ruledBuilder1.SecondSection.AllowSelfIntersection(True)
Dim rules2(0) As SelectionIntentRule
rules2(0) = curveDumbRule2
Dim helpPoint2 As Point3d = New Point3d(line2.StartPoint.X, line2.StartPoint.Y, line2.StartPoint.Z)
ruledBuilder1.SecondSection.AddToSection(rules2, line2, Nothing, Nothing, helpPoint2, Section.Mode.Create, False)
Dim sections1(1) As Section
sections1(0) = ruledBuilder1.FirstSection
sections1(1) = ruledBuilder1.SecondSection
ruledBuilder1.AlignmentMethod.SetSections(sections1)
Dim nXObject1 As NXObject
nXObject1 = ruledBuilder1.Commit()
Dim objects1(0) As DisplayableObject
Dim ruled1 As Features.Ruled = CType(nXObject1, Features.Ruled)
ruledBuilder1.Destroy()
Dim hoop() As Face = ruled1.GetFaces()
Return hoop(0)
End Function