Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Convert VBA "Select Case " to Python

1 REPLY 1
Reply
Message 1 of 2
isocam
261 Views, 1 Reply

Convert VBA "Select Case " to Python

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

1 REPLY 1
Message 2 of 2
jiri.manak
in reply to: isocam

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report