romaleee
Mechanical
- May 13, 2016
- 39
Hi guys. I need help please. I got this code chunk that worked fine and did his job and at some point just broke. I don't know what I did to break it and that's why I need your assistance. I got two lines in a sketch and I'm trying to get two connex curves out of it. Something is wrong with my logic and I dont know what. Error that I'm getting is::

Model tree:

Code:
It probably has something to do with this but I don't know what exactly is meant with this note::

@LWolf sorry to tag you but I saw in other thread that you have experience with this function so maybe you know the answer.
Thnx in advance.
Roman

Model tree:

Code:
Code:
Sub CatMain()
'input
Dim partDocument1 As PartDocument
Set partDocument1 = CATIA.ActiveDocument
Dim part1 As Part
Set part1 = partDocument1.Part
Dim hybridBodies1 As HybridBodies
Set hybridBodies1 = part1.HybridBodies
Dim hybridBody1, hybridBody2 As HybridBody
Set hybridBody1 = hybridBodies1.Item("GS_Geo")
Set hybridBody2 = hybridBodies1.Item("GS_Uzad")
Dim sketches1 As Sketches
Set sketches1 = hybridBody1.HybridSketches
Dim sketch1 As Sketch
Set sketch1 = sketches1.Item("Sketch_Two_lines")
Dim oRef As Reference
Set oRef = part1.CreateReferenceFromObject(sketch1)
Dim hsF As HybridShapeFactory
Set hsF = part1.HybridShapeFactory
Dim i As Integer
Dim arr
'problem
arr = hsF.AddNewDatums(oRef)
Dim num
num = UBound(arr)
For i = 0 To num
Set oRef = part1.CreateReferenceFromObject(arr(i))
Set hSSC = hsF.AddNewSweepCircle(oRef)
With hSSC
.Mode = 6
.SmoothActivity = False
.GuideDeviationActivity = False
.SetRadius 1, 2
.C0VerticesMode = False
.name = "Sweep_" & i
End With
hybridBody2.AppendHybridShape hSSC
Next
part1.Update
End Sub
It probably has something to do with this but I don't know what exactly is meant with this note::

@LWolf sorry to tag you but I saw in other thread that you have experience with this function so maybe you know the answer.
Thnx in advance.
Roman