×
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

VB automation Angle dimension

VB automation Angle dimension

VB automation Angle dimension

(OP)
I have an automation which is working wonderfully except where it comes into putting the twist dimension into the sketches. The value being set is always in the correct place but the angle being measured is not consistent.

It is supposed to measure from the X-axis in the positive direction and the specified line in the negative y direction and set a specified value for this. However the angle being measured seems to randomly dimension it correctly and to dimension it in the positive x, positive y direction.

Here is the code:

CODE --> VB

'------------------------------------------------------------------------------------------
' Dimension angle from linechord to x-axis as S*counter*_Twist
' Dimension is always going to the interior angle, not to the positive y and towards endpoint of chord
' ??Dimension constantly going to the +x, +y direction, to compensate Twist is
' 90+Tool-S*counter*_Twist 5-1-2012
'------------------------------------------------------------------------------------------

strTwist = "90+Tool-S" & counter & "_Twist"

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

datumAxis1 = CType( workPart.Datums.FindObject( "DATUM_CSYS(0) X axis" ), DatumAxis )

dimObject2_3.Geometry = datumAxis1
dimObject2_3.AssocType = Sketch.AssocType.EndPoint
dimObject2_3.AssocValue = 0
dimObject2_3.HelpPoint.X = 0
dimObject2_3.HelpPoint.Y = 0
dimObject2_3.HelpPoint.Z = 0
dimObject2_3.View = nullNXObject

dimOrigin3 = Transform.Apply( New Point3d( 10000 ,10000 ,0 ))

Try
sketchDimensionalConstraint3 = theSession.ActiveSketch.CreateDimension( Sketch.ConstraintType.MinorAngularDim, _
dimObject1_3, dimObject2_3, dimOrigin3, nullExpression, Sketch.DimensionOption.CreateAsDriving )

dimension3 = sketchDimensionalConstraint3.AssociatedDimension
expression3 = sketchDimensionalConstraint3.AssociatedExpression
expression3.RightHandSide = strTwist
Catch
MessageBox.Show( "Expression S" & counter & "_twist not set, sketch skipped", "Error", _
MessageBoxButtons.OK, MessageBoxIcon.Error )
booleanSketch = false
Exit Sub
End Try

Try
' Expression is still in use.
workPart.Expressions.Delete( expression3 )
Catch ex As NXException
ex.AssertErrorCode( 1050029 )
End Try

Any help on this would be greatly appreciated.

RE: VB automation Angle dimension

(OP)
Correction:

It is supposed to be in the positive x and positive y direction, and randomly is placed in the positive x and negative y direction.

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