I have a problem. in my task, I have Pad and Line which intersect each other. I have 2 intersection points and I want to get coordinates, or something identification because I want to create a line between these points. After the first action, my line changed position and I have a new intersection and split. part updated and all these actions as well updated. I want to previous action stay in my product and go next. Can anyone help me?
Sub ArchiliIntCoords()
' Define the document and part
Dim documents1 As Documents
Set documents1 = CATIA.Documents
Dim partDocument1 As PartDocument
Set partDocument1 = documents1.Item("X0 Line.CATPart")
Dim part1 As Part
Set part1 = partDocument1.Part
' Define the bodies and sketches
Dim bodies1 As Bodies
Set bodies1 = part1.Bodies
Dim body1 As Body
Set body1 = bodies1.Item("X0-Line")
Dim sketches1 As Sketches
Set sketches1 = body1.Sketches
Dim sketch1 As Sketch
Set sketch1 = sketches1.Item("Sketch.1")
' Create a new geometrical set for the intersection
Dim hybridBodies1 As HybridBodies
Set hybridBodies1 = part1.HybridBodies
Dim hybridBody1 As HybridBody
Set hybridBody1 = hybridBodies1.Add()
' Create a new intersection object
Dim hshf As HybridShapeFactory
Set hshf = part1.HybridShapeFactory
Dim pad1 As Sketch
Set pad1 = body1.Sketches.Item(1)
Dim ref11 As Reference
Set ref11 = part1.CreateReferenceFromObject(pad1)
Dim myObj2 As AnyObject
Set myObj2 = part1.FindObjectByName("Epox")
Set ref2 = part1.CreateReferenceFromObject(myObj2)
Dim myIntersect As HybridShapeIntersection
Set myIntersect = hshf.AddNewIntersection(ref11, ref2)
' Add the intersection object to the geometrical set
hybridBody1.AppendHybridShape myIntersect
part1.Update
Dim myHybridBody As HybridBody
Set myHybridBody = part1.HybridBodies.Item(1) 'geometrical setshi iwereba wertili
Dim hybridShapeFactory1 As HybridShapeFactory
Set hybridShapeFactory1 = part1.HybridShapeFactory
Dim bodies11
Set bodies11 = part1.Bodies
Dim body11 As Body
Set body11 = bodies1.Item(1) 'ak migebulia partpody
Dim line11
Set line11 = body1.Sketches.Item(1) 'curved igebs sketch 1-is lines romelzec unda daematos wertili
Dim mysplit As HybridShapeSplit
Set mysplit = hybridShapeFactory1.AddNewHybridSplit(ref11, ref2, -1)
myHybridBody.AppendHybridShape mysplit
part1.Update
Dim oSelection As Selection
Set oSelection = partDocument1.Selection
oSelection.Clear
oSelection.Add mysplit
oSelection.VisProperties.SetRealColor 0, 255, 0, 0 'mwvane pers nishnavs
End Sub