2017-02-10 2 views
0

Ich versuche, ein Bündel von MEL-Code in Python in Maya 2015 so zu konvertieren:mel2pyStr schlägt fehl, wenn eine Gruppe von Objekten der Auswahl

mel2py.mel2pyStr(melCmd,pymelNamespace='pm', verbosity=4, forceCompatibility=True) 

wo melCmd ist ein mehrzeiliges Code.

Aber es schlägt fehl, wenn die folgende Zeile Umwandlung:

select -add pPipe1.e[2500:2549] ; 

Der Fehler besagt, dass : unerwartet ist:

p_expression - line 12 
original token: 
['None', '2500'] 
result: 
2500 
# Result : <Token @ 0x18faa7a2678> ('2500') 
# 
# State : 271 
# Stack : translation_unit ID command_statement_input_list ID LBRACKET expression . LexToken(COLON,u':',12,407) 
# ERROR: Error : translation_unit ID command_statement_input_list ID LBRACKET expression . LexToken(COLON,u':',12,407) 
# 
# State : 0 
# Stack : . $end 
# ERROR: Error : . $end 
# Error: MelParseError: file C:\Program Files\Autodesk\Maya2015\Python\lib\site-packages\pymel\tools\mel2py\melparse.py line 2940: Errors: 
line 12 (COLON): : # 

Ich versuche zu wählen (und ändern dann) mehrere Kanten auf einmal. Wie soll ich das in Python machen? Warum versagt mel2py?
Alle Vorschläge sind willkommen.

Hier wird der vollständige MEL-Code ist:

CreatePolygonPipe; 
setToolTo CreatePolyPipeCtx; 
setAttr "polyPipe1.thickness" 0.6; 
polyPipe -ch on -o on -r 4.343087 -h 4.057391 -t 0.6 ; 
// Result: pPipe1 polyPipe1 // 
select -addFirst polyPipe1 ; 
setAttr "polyPipe1.subdivisionsAxis" 50; 
setAttr "polyPipe1.subdivisionsHeight" 37.4; 
setAttr "polyPipe1.subdivisionsHeight" 50; 
select -r pPipe1.e[2546] ; 
select -r pPipe1.e[2546] ; 
select -add pPipe1.e[2500:2549] ; 
select -tgl pPipe1.e[10] ; 
select -add pPipe1.e[0:49] ; 
ScaleToolWithSnapMarkingMenu; 
dR_ScaleToolMarkingMenuPopDown; 
scale -r -p -4.723702cm 1.014348cm -1.380022cm 1.054283 1.054283 1.054283 ; 
select -r pPipe1.e[2498] ; 
select -add pPipe1.e[2450:2499] ; 
select -tgl pPipe1.e[61] ; 
select -add pPipe1.e[50:99] ; 
scale -r -p -4.723702cm 1.014348cm -1.380022cm 1.025089 1.025089 1.025089 ; 
select -r pPipe1.e[2556] ; 
select -add pPipe1.e[2550:2599] ; 
select -tgl pPipe1.e[5096] ; 
select -add pPipe1.e[5050:5099] ; 
scale -r -p -4.723702cm 1.014348cm -1.380022cm 0.960232 0.960232 0.960232 ; 
select -r pPipe1.e[2644] ; 
select -add pPipe1.e[2600:2649] ; 
select -tgl pPipe1.e[5044] ; 
select -add pPipe1.e[5000:5049] ; 
scale -r -p -4.723702cm 1.014348cm -1.380022cm 0.981905 0.981905 0.981905 ; 
select -r pPipe1.e[2546] ; 
select -add pPipe1.e[2500:2549] ; 
TranslateToolWithSnapMarkingMenu; 
dR_TranslateToolMarkingMenuPopDown; 
move -r 0 -0.07989 0 ; 
select -r pPipe1.e[46] ; 
select -add pPipe1.e[0:49] ; 
move -r 0 0.07989 0 ; 
select -d pPipe1.e[0:49] ; 
select -r pPipe1 ; 
select -cl ; 

Antwort

0

Grundsätzlich auf Zeichenfolge seine Krachen und ich bin nicht, ob dies ein erwartetes Verhalten ist, das ist, wie Sie es

melCmd = 'select -add "pPipe1.e[2500:2549]";' 
beheben
Verwandte Themen