×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Angular dimension callout in Visual Basic

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:

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?

 

RE: Angular dimension callout in Visual Basic

(OP)
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?  

RE: Angular dimension callout in Visual Basic

(OP)
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,

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources