×
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

How to change direction of the line vector

How to change direction of the line vector

How to change direction of the line vector

(OP)
How to change the vector of a line.. I tried one script. But it doesnt work and gives error in PutDirection syntax

Here is my code

Sub CATMain()

Dim partDocument1
Set partDocument1 = CATIA.ActiveDocument

Dim part1
Set part1 = partDocument1.Part

Dim hybridShapeFactory1
Set hybridShapeFactory1 = part1.HybridShapeFactory

Dim bodies1
Set bodies1 = part1.Bodies

Dim body1
Set body1 = bodies1.Item("PartBody")

Dim sketches1
Set sketches1 = body1.Sketches

Dim sketch1
Set sketch1 = sketches1.Item("Sketch.1")

Dim reference1
Set reference1 = part1.CreateReferenceFromBRepName("BorderFVertex:(BEdge:(Brp:(Sketch.1;1);None:(Limits1:();Limits2:();+1);Cf11:());WithPermanentBody;WithoutBuildError;WithSelectingFeatureSupport;MFBRepVersion_CXR15)", sketch1)

Dim reference2
Set reference2 = part1.CreateReferenceFromBRepName("BorderFVertex:(BEdge:(Brp:(Sketch.1;2);None:(Limits1:();Limits2:();+1);Cf11:());WithPermanentBody;WithoutBuildError;WithSelectingFeatureSupport;MFBRepVersion_CXR15)", sketch1)

Dim hybridShapeLinePtPt1
Set hybridShapeLinePtPt1 = hybridShapeFactory1.AddNewLinePtPt(reference1, reference2)

body1.InsertHybridShape hybridShapeLinePtPt1

part1.InWorkObject = hybridShapeLinePtPt1

part1.Update

Dim myDir(2)
hybridShapeLinePtPt1.GetDirection myDir
MsgBox "" & myDir(0) & " , " & myDir(1) & " , " & myDir(2)
Dim Change1(2)
Change1(0) = myDir(0) *-1
Change1(1) = myDir(1) *-1
Change1(2) = myDir(2) *-1
hybridShapeLinePtPt1.PutDirection Change1

Dim reference3
Set reference3 = part1.CreateReferenceFromObject(hybridShapeLinePtPt1)

Dim hybridShapePointOnCurve1
Set hybridShapePointOnCurve1 = hybridShapeFactory1.AddNewPointOnCurveFromDistance(reference3, 0#, False)

hybridShapePointOnCurve1.DistanceType = 1

body1.InsertHybridShape hybridShapePointOnCurve1

part1.InWorkObject = hybridShapePointOnCurve1

part1.Update

End Sub

i am getting error at the coloured line

Thanks and Regards
Barath

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