×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Get angle

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.

RE: Get angle

Hi,

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

(OP)
hi ferdo, thank you so much for taking the time reading my issue,

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

(OP)
never mind i just did it, the thing is that is no giving me anything with surface, i dont know is that the way it should be, but it is giving me an angle with an edge, so i guess i will have to evaluate the edges, here is the code i have:

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

Of course

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 Sub 

Regards
Fernando

https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources