My Problem
Using CATIA V5 I need to change sketch's support without moving geometry (as it can be done with CATIA UI) with automation and I can't find how to do it.
Constraint : No startcommand
and sendkeys
My attempts
Using sketch's method SetAbsoluteAxisData()
Dim coords(8)
coords(0) = 0.0#
coords(1) = 0.0#
coords(2) = 100.0#
coords(3) = 1.0#
coords(4) = 0.0#
coords(5) = 0.0#
coords(6) = 0.0#
coords(7) = 0.0#
coords(8) = 1.0#
MySketch.SetAbsoluteAxisData(coords)
Problem : The sketch's axis system change corrctly but the geometry is moved too.
Recording macro
Got this result :
Dim partDocument1 As PartDocument
partDocument1 = CATIA.ActiveDocument
Dim part1 As Part
part1 = partDocument1.Part
Dim bodies1 As Bodies
bodies1 = part1.Bodies
Dim body1 As Body
body1 = bodies1.Item("Corps principal")
Dim sketches1 As Sketches
sketches1 = body1.Sketches
Dim sketch1 As Sketch
sketch1 = sketches1.Item("Esquisse.1")
Dim factory2D1 As Factory2D
factory2D1 = sketch1.OpenEdition()
Dim geometricElements1 As GeometricElements
geometricElements1 = sketch1.GeometricElements
Dim point2D1 As Point2D
point2D1 = geometricElements1.Item("Point.1")
point2D1.SetData(-19.758759, 60.20845)
Dim point2D2 As Point2D
point2D2 = geometricElements1.Item("Point.2")
point2D2.SetData(-53.244766, 60.20845)
Dim line2D1 As Line2D
line2D1 = geometricElements1.Item("Droite.1")
line2D1.SetData(-19.758759, 60.20845, -1.0#, 0.0#)
So basicly it modifies every geometrical feature manualy.
Problem : I can't predict the sketch content
Searching Stackoverflow
Found this question : How to change sketch support in CATIA using vba?
Problem : it doesn't include the "without moving geometry" constraint.