Aviatorbarath
New member
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("BorderFVertexBEdgeBrpSketch.1;1);NoneLimits1);Limits2);+1);Cf11));WithPermanentBody;WithoutBuildError;WithSelectingFeatureSupport;MFBRepVersion_CXR15)", sketch1)
Dim reference2
Set reference2 = part1.CreateReferenceFromBRepName("BorderFVertexBEdgeBrpSketch.1;2);NoneLimits1);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
[highlight #8AE234]hybridShapeLinePtPt1.PutDirection Change1[/highlight]
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
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("BorderFVertexBEdgeBrpSketch.1;1);NoneLimits1);Limits2);+1);Cf11));WithPermanentBody;WithoutBuildError;WithSelectingFeatureSupport;MFBRepVersion_CXR15)", sketch1)
Dim reference2
Set reference2 = part1.CreateReferenceFromBRepName("BorderFVertexBEdgeBrpSketch.1;2);NoneLimits1);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
[highlight #8AE234]hybridShapeLinePtPt1.PutDirection Change1[/highlight]
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