Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Angular dimension callout in Visual Basic

Status
Not open for further replies.

Twullf

Mechanical
Jan 24, 2012
196
I am trying to use the following callout to place an angular dimension:

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 )

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?

 
Replies continue below

Recommended for you

I think the problem is in the call out for the datum axis, I don't think it is selecting the y axis of each sketch and as a result the placement of the DimOrigin3 call out places the dimension in the wrong position which twists the whole thing 180*.

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?
 
I am still looking for a solution on this. I am uploading an image to better show the problem and what I think is going wrong.

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,
 
 http://files.engineering.com/getfile.aspx?folder=d1dbec8b-861b-4c8f-b3f5-0519fcf60de5&file=Twist_Problem_Description.png
Status
Not open for further replies.

Part and Inventory Search

Sponsor