Get angle
Get angle
(OP)
hi everybody, i am new in this, and i am learning,
i need to get the angles of a surface, i have the following code
Sub catmain()
Set objsel = CATIA.ActiveDocument.Selection
objsel.Clear
objsel.Search "Type=Topology.Face,all"
Set partDocument1 = CATIA.ActiveDocument
Set part1 = partDocument1.Part
Set Selection = partDocument1.Selection
Set ref1 = Selection.Item(1).Reference
Set spabench = partDocument1.GetWorkbench("SPAWorkbench")
Set mymeas = spabench.GetMeasurable(ref1)
On Error Resume Next
Angle = mymeas.Angle
MsgBox Angulo
End Sub
the msgbox is empty, and i dont know what am i doing wrong,
i hope anyone can help me out with this,
Thank you for taking the time reading this.
i need to get the angles of a surface, i have the following code
Sub catmain()
Set objsel = CATIA.ActiveDocument.Selection
objsel.Clear
objsel.Search "Type=Topology.Face,all"
Set partDocument1 = CATIA.ActiveDocument
Set part1 = partDocument1.Part
Set Selection = partDocument1.Selection
Set ref1 = Selection.Item(1).Reference
Set spabench = partDocument1.GetWorkbench("SPAWorkbench")
Set mymeas = spabench.GetMeasurable(ref1)
On Error Resume Next
Angle = mymeas.Angle
MsgBox Angulo
End Sub
the msgbox is empty, and i dont know what am i doing wrong,
i hope anyone can help me out with this,
Thank you for taking the time reading this.





RE: Get angle
You are checking in MsgBox for Angulo and this is not evaluated in the code....probably should be Angle? And why are you searching for all faces when you need first one in selection (Selection.Item(1)) ? Is easier to tell the user to pick the face and use user selection...search the forum for some examples and also check the v5automation.chm file.
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...
RE: Get angle
i already change the msgbox and still giving me nothing,
and i search for all the faces because i thought that the faces needed to be count previously,
RE: Get angle
Sub catmain()
Set objsel = CATIA.ActiveDocument.Selection
Set partDocument1 = CATIA.ActiveDocument
Set ref1 = objsel.Item(1).Reference
Set spabench = partDocument1.GetWorkbench("SPAWorkbench")
Set mymeas = spabench.GetMeasurable(ref1)
On Error Resume Next
Angle = mymeas.Angle
MsgBox Angle
End Sub
RE: Get angle
CODE --> CATScript
Sub CATMain() Dim productDocument1 As Document Set productDocument1 = CATIA.ActiveDocument Dim selection1 As Selection Set selection1 = productDocument1.Selection selection1.Clear Dim InputObjectType(0), Status1 InputObjectType(0)="Edge" Status1=selection1.SelectElement2(InputObjectType,"Select 1st Edge",false) If Status1 = "Cancel" Then selection1.Clear: Exit Sub Dim reference1 As Reference Set reference1 = selection1.Item(1).Reference Dim TheSPAWorkbench As Workbench Set TheSPAWorkbench = productDocument1.GetWorkbench("SPAWorkbench") Dim TheMeasureable Set TheMeasureable = TheSPAWorkbench.GetMeasurable(reference1) selection1.Clear Status1=selection1.SelectElement2(InputObjectType,"Select 2nd Edge",false) If Status1 = "Cancel" Then selection1.Clear: Exit Sub Dim reference2 As Reference Set reference2 = selection1.Item(1).Reference msgbox TheMeasureable.GetAngleBetween(reference2) End SubRegards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...