hi every body,
i dont really know how to solve this, my code count the faces of the part and calculate the area of the surface but some how is not getting the reference
hope you can help me.
Sub CATMain()
CATIA.ActiveDocument.Selection.Clear
Set objsel = CATIA.ActiveDocument.Selection
objsel.Search "Type=Topology.Face,all"
icnt = objsel.Selection.Count
ReDim MySurface(icnt + 1)
For o = 1 To icnt
Set MySurface(o) = objsel.Item(o).Value
Next
For o = 1 To icnt
Set partDocument1 = CATIA.ActiveDocument
Set part1 = partDocument1.Part
Set Selection = partDocument1.Selection
Set ref1 = objsel.Item(MySurface(o)).Reference
Set spabench = partDocument1.GetWorkbench("SPAWorkbench")
Set mymeas = spabench.GetMeasurable(ref1)
myans = mymeas.Area
data_file.WriteLine (myans)
Next
End Sub
i dont really know how to solve this, my code count the faces of the part and calculate the area of the surface but some how is not getting the reference
hope you can help me.
Sub CATMain()
CATIA.ActiveDocument.Selection.Clear
Set objsel = CATIA.ActiveDocument.Selection
objsel.Search "Type=Topology.Face,all"
icnt = objsel.Selection.Count
ReDim MySurface(icnt + 1)
For o = 1 To icnt
Set MySurface(o) = objsel.Item(o).Value
Next
For o = 1 To icnt
Set partDocument1 = CATIA.ActiveDocument
Set part1 = partDocument1.Part
Set Selection = partDocument1.Selection
Set ref1 = objsel.Item(MySurface(o)).Reference
Set spabench = partDocument1.GetWorkbench("SPAWorkbench")
Set mymeas = spabench.GetMeasurable(ref1)
myans = mymeas.Area
data_file.WriteLine (myans)
Next
End Sub