Twullf
Mechanical
- Jan 24, 2012
- 196
The sub I am posting works, it is creating an intersection line, except for the fact that the intersection line is not associative. I set associative to true and have gone over the code over and over to the point where I think I may be missing the obvious.
any help would be greatly appreciated.
I have tried setting Associative to false, just to see if it did any good but it made no difference.
Thanks for the help
any help would be greatly appreciated.
Code:
Sub PlaceIntersection( ByRef checkFace() As Face, ByRef dPStation As DatumPlane, _
ByRef InterLine As Features.IntersectionCurve )
Dim intersectionCurveBuilder1 As Features.IntersectionCurveBuilder
Dim plane2 As Plane
Dim objects2(-1) As TaggedObject
Dim added2 As Boolean
Dim faceDumbRule1 As FaceDumbRule
Dim rules1(0) As SelectionIntentRule
Dim geom2(0) As NXObject
Dim datumPlane1 As DatumPlane
Dim origin2 As Point3d
Dim normal2 As Vector3d
Dim faces1(-1) As Face
Dim intersectionCurve1 As Features.IntersectionCurve
Dim feature1 As Features.Feature
'------------------------------------------------------------------------------------------
' Place an intersection line on surface associated with the datum plane
' Modified journal to accept passed variables
'------------------------------------------------------------------------------------------
Dim nullFeatures_Feature As Features.Feature = Nothing
intersectionCurveBuilder1 = workPart.Features.CreateIntersectionCurveBuilder( nullFeatures_Feature )
origin2 = New Point3d( 0.0, 0.0, 0.0 )
normal2 = New Vector3d( 0.0, 0.0, 1.0 )
plane2 = workPart.Planes.CreatePlane( origin2, normal2, SmartObject.UpdateOption.WithinModeling )
intersectionCurveBuilder1.Tolerance = 0.0001
intersectionCurveBuilder1.Associative = True
faces1 = checkFace
faceDumbRule1 = workPart.ScRuleFactory.CreateRuleFaceDumb(faces1)
rules1(0) = faceDumbRule1
intersectionCurveBuilder1.FirstFace.ReplaceRules( rules1, False )
objects2 = faces1
added2 = intersectionCurveBuilder1.FirstSet.Add( objects2 )
datumPlane1 = dPStation
plane2.SetMethod( PlaneTypes.MethodType.Distance )
geom2(0) = datumPlane1
plane2.SetGeometry( geom2 )
plane2.SetFlip( False )
plane2.SetReverseSide( False )
plane2.SetAlternate( PlaneTypes.AlternateType.One )
plane2.Evaluate()
intersectionCurveBuilder1.SecondPlane = plane2
Try
feature1 = intersectionCurveBuilder1.commitFeature()
Catch
MessageBox.Show( "Intersection Line could not be completed make sure root surface was selected", _
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error )
'boolIntersection = false
End Try
intersectionCurveBuilder1.Destroy()
End Sub
I have tried setting Associative to false, just to see if it did any good but it made no difference.
Thanks for the help