Convert VBA "Select Case " to Python

Convert VBA "Select Case " to Python

isocam
Collaborator Collaborator
436 Views
1 Reply
Message 1 of 2

Convert VBA "Select Case " to Python

isocam
Collaborator
Collaborator

Can anybody help?

 

I have the following VBA code....

 

Select Case PartType
Case "Flame Cut Profile"
          PartGroup = "FC-"
Case "Flash Ground Profile"
          PartGroup = "FG-"
Case "HD Plasma Cut Profile"
         PartGroup = "HD-"
Case "Laser Cut Profile"
        PartGroup = "LC-"
Case "Water Jet Profile"
        PartGroup = "WJ-"
End Select

 

Can anybody tell me what the Python version code will be?

 

Many thanks in advance!

 

IsoCAM

0 Likes
437 Views
1 Reply
Reply (1)
Message 2 of 2

jiri.manak
Contributor
Contributor

use if-elif-else

 

if PartType == "Flame Cut Profile":

     PartGroup = "FC-"

elif PartType == "Flash Ground Profile":

     PartGroup = "FG-"

elif PartType ==  "HD Plasma Cut Profile"

     ....

else:

    # optional    

    do_something_as_default

 

Jiri

0 Likes