Angular dimension callout in Visual Basic
Angular dimension callout in Visual Basic
(OP)
I am trying to use the following callout to place an angular dimension:
Sometimes in the data the slope of the line, goes from positive to negative. As UG doesn't like negative dimensions we add 360 to all of the angles. Manually this works fine, by the program moves from using the positive direction of the Y axis to the negative and completely changes the slope direction. Is there a way to force the program to always use the positive direction on the Y axis and the endpoint of the created line, regardless of whether it is the minor or major angle?
CODE
Dim strTwist = "360+S" & counter & "_Twist"
Dim dimObject1_3 As Sketch.DimensionGeometry
dimObject1_3.Geometry = lineChord
dimObject1_3.AssocType = Sketch.AssocType.EndPoint
dimObject1_3.AssocValue = 0
dimObject1_3.HelpPoint.X = 0.0
dimObject1_3.HelpPoint.Y = 0.0
dimObject1_3.HelpPoint.Z = 0.0
dimObject1_3.View = workPart.ModelingViews.WorkView
Dim dimObject2_3 As Sketch.DimensionGeometry
Dim datumAxis1 As DatumAxis = CType( workPart.Datums.FindObject( "SKETCH(5:1B) Y axis" ), DatumAxis )
dimObject2_3.Geometry = datumAxis1
dimObject2_3.AssocType = Sketch.AssocType.EndPoint
dimObject2_3.AssocValue = 0
Dim HelpPoint As Point3d = Transform.Apply( New Point3d( -90, 74, 0 ) )
dimObject2_3.HelpPoint.X = HelpPoint.x
dimObject2_3.HelpPoint.Y = HelpPoint.y
dimObject2_3.HelpPoint.Z = HelpPoint.z
Dim nullNXObject As NXObject = Nothing
dimObject2_3.View = nullNXObject
Dim dimOrigin3 As Point3d = Transform.Apply( New Point3d( 1500, 3, 0 ) )
Dim sketchDimensionalConstraint3 As SketchDimensionalConstraint
sketchDimensionalConstraint3 = theSession.ActiveSketch.CreateDimension( Sketch.ConstraintType.MinorAngularDim, _
dimObject1_3, dimObject2_3, dimOrigin1, nullExpression, Sketch.DimensionOption.CreateAsDriving )
Dim dimObject1_3 As Sketch.DimensionGeometry
dimObject1_3.Geometry = lineChord
dimObject1_3.AssocType = Sketch.AssocType.EndPoint
dimObject1_3.AssocValue = 0
dimObject1_3.HelpPoint.X = 0.0
dimObject1_3.HelpPoint.Y = 0.0
dimObject1_3.HelpPoint.Z = 0.0
dimObject1_3.View = workPart.ModelingViews.WorkView
Dim dimObject2_3 As Sketch.DimensionGeometry
Dim datumAxis1 As DatumAxis = CType( workPart.Datums.FindObject( "SKETCH(5:1B) Y axis" ), DatumAxis )
dimObject2_3.Geometry = datumAxis1
dimObject2_3.AssocType = Sketch.AssocType.EndPoint
dimObject2_3.AssocValue = 0
Dim HelpPoint As Point3d = Transform.Apply( New Point3d( -90, 74, 0 ) )
dimObject2_3.HelpPoint.X = HelpPoint.x
dimObject2_3.HelpPoint.Y = HelpPoint.y
dimObject2_3.HelpPoint.Z = HelpPoint.z
Dim nullNXObject As NXObject = Nothing
dimObject2_3.View = nullNXObject
Dim dimOrigin3 As Point3d = Transform.Apply( New Point3d( 1500, 3, 0 ) )
Dim sketchDimensionalConstraint3 As SketchDimensionalConstraint
sketchDimensionalConstraint3 = theSession.ActiveSketch.CreateDimension( Sketch.ConstraintType.MinorAngularDim, _
dimObject1_3, dimObject2_3, dimOrigin1, nullExpression, Sketch.DimensionOption.CreateAsDriving )
Sometimes in the data the slope of the line, goes from positive to negative. As UG doesn't like negative dimensions we add 360 to all of the angles. Manually this works fine, by the program moves from using the positive direction of the Y axis to the negative and completely changes the slope direction. Is there a way to force the program to always use the positive direction on the Y axis and the endpoint of the created line, regardless of whether it is the minor or major angle?





RE: Angular dimension callout in Visual Basic
So is there a more standard, less specific way of calling to collect the y axis of the datum, so the program selects its own datum for every sketch?
RE: Angular dimension callout in Visual Basic
Basically the angular dimension is being placed wrong. Now the models will go through and create this sketch 20 times, most work properly. But some at the beginning and the end are twisting wrong. The image is from the beginning. Towards the end it appears the angular dimension is not going to the sketch Y axis but one of the earlier Sketch's X-axis.
So I have tried to modify the Origin so the X value is .05, and that has not fixed the problem.
So is there a way to call out the local Y axis without calling a specific name, as it is obviously different per sketch.
Also is the placement of the actual dimension in the origin? Or is there a better way to ensure the correct angle is being measured.
Thanks,