multicaduser
Industrial
- Jan 29, 2013
- 261
I would like to use a journal create multiple lines of text on a face from attributes. My issue is the code below was lifted from another program and I would like to loop through it passing the text and position without having to brute force repeat it for every line. It seems like it should be simple but so far it has not worked. Just looking for a nudge in the right direction.
tia
NX 1899 Windows 10
tia
Code:
Dim nullNXOpen_Features_Text As NXOpen.Features.Text = Nothing
Dim textBuilder1 As NXOpen.Features.TextBuilder = Nothing
textBuilder1 = workPart.Features.CreateTextBuilder(nullNXOpen_Features_Text)
textBuilder1.TextString = Attline01
textBuilder1.FrameOnPath.AnchorPosition.Expression.RightHandSide = "50"
textBuilder1.Type = NXOpen.Features.TextBuilder.Types.OnFace
textBuilder1.PlanarFrame.Shear.RightHandSide = "5"
textBuilder1.FrameOnPath.AnchorLocation = NXOpen.GeometricUtilities.FrameOnPathBuilder.AnchorLocationType.Left
textBuilder1.FrameOnPath.AnchorPosition.Expression.RightHandSide = "3"
textBuilder1.FrameOnPath.Height.RightHandSide = "0.4"
textBuilder1.PrintMarkThickness.RightHandSide = "1"
textBuilder1.FrameOnPath.WScale = 150.0
textBuilder1.FrameOnPath.Offset.RightHandSide = "0"
textBuilder1.SelectFont("Modern", NXOpen.Features.TextBuilder.ScriptOptions.Oem)
Dim boundaryFaces1(-1) As NXOpen.Face
Dim faceTangentRule1 As NXOpen.FaceTangentRule = Nothing
faceTangentRule1 = workPart.ScRuleFactory.CreateRuleFaceTangent(pickFace, boundaryFaces1, 0.5)
Dim rules3(0) As NXOpen.SelectionIntentRule
rules3(0) = faceTangentRule1
textBuilder1.PlacementFaces.ReplaceRules(rules3, False)
textBuilder1.OnFacePlacementProfile.SetAllowedEntityTypes(NXOpen.Section.AllowTypes.OnlyCurves)
Dim features1(0) As NXOpen.Features.Feature
Dim aOCS1 As NXOpen.Features.AOCS = CType(feature1, NXOpen.Features.AOCS)
features1(0) = aOCS1
Dim line1 As NXOpen.Line = CType(aOCS1.FindObject("CURVE 1"), NXOpen.Line)
Dim nullNXOpen_Curve As NXOpen.Curve = Nothing
Dim curveFeatureTangentRule1 As NXOpen.CurveFeatureTangentRule = Nothing
curveFeatureTangentRule1 = workPart.ScRuleFactory.CreateRuleCurveFeatureTangent(features1, line1, nullNXOpen_Curve, False, 0.01, 0.5)
textBuilder1.OnFacePlacementProfile.AllowSelfIntersection(True)
Dim rules4(0) As NXOpen.SelectionIntentRule
rules4(0) = curveFeatureTangentRule1
Dim helpPoint2 As NXOpen.Point3d = New NXOpen.Point3d(-56.880335976917863, -6.0840221749458578e-14, 10.000000000000043)
textBuilder1.OnFacePlacementProfile.AddToSection(rules4, line1, nullNXOpen_NXObject, nullNXOpen_NXObject, helpPoint2, NXOpen.Section.Mode.Create, False)
Dim nXObject1 As NXOpen.NXObject = Nothing
nXObject1 = textBuilder1.Commit()
textBuilder1.Destroy()
NX 1899 Windows 10