AutoCAD Plant 3D Forum
Welcome to Autodesk’s AutoCAD Plant 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Plant 3D topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

TESTACPSCRIPT error

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
kudryavcevrm
1618 Views, 5 Replies

TESTACPSCRIPT error

Hello All!

Plant 3D 2013 (ver G.55.00), Win7 64-bit.

We permanently meet an error after Plant command

(TESTACPSCRIPT "TESTSCRIPT")
Traceback (most recent call last):
  File ".\variants\varmain\__init__.py", line 94, in create
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)
nil

Here's a steps to reproduce:

1) create simple script TESTSCRIPT (see attachement). Save it as "C:\AutoCAD Plant 3D 2013 Content\CPak Common\CustomScripts\TestScript.py". You can save it in ANSI or UTF-8 encoding, it does not matter

2) Open plant 3d. In command line write such strings


PLANTREGISTERCUSTOMSCRIPTS

(arxload "PnP3dACPAdapter.arx")
(TESTACPSCRIPT "TESTSCRIPT")

 

What's wrong,please help me! Also there's a strange behavior with (TESTACPSCRIPT1 "TESTSCRIPT") which does not produce an errors, but also  it is not produce errors when using any other script name, like (TESTACPSCRIPT1 "anY_text_Here")

 

How to test scripts????

5 REPLIES 5
Message 2 of 6
kudryavcevrm
in reply to: kudryavcevrm

solved. Don't forget to quit autocad after PLANTREGISTERCUSTOMSCRIPTS.

But :

script errors are very uninformative(spurious),i.e. many of error messages are similar :(, like

 

UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-6: ordinal not in range(128)

 

 

How to debug scripts?????????????? Can I use native Phyton  IDLE debugger??????

Message 3 of 6
Anonymous
in reply to: kudryavcevrm

you need a parameter name in your script...

 

instead of:

 

def TESTSCRIPT(s, D=80.0, L=150.0, OF=-1, K=1, **kw):
    CYLINDER(s, R=D/2, H=L, O=0.0).rotateY(90)

 

you need it to read:

 

def TESTSCRIPT(s, D=80.0, L=150.0, OF=-1, K=1, **kw):
    o1 = CYLINDER(s, R=D/2, H=L, O=0.0).rotateY(90)

 

That's the first thing I noticed.  The o1 can be anything.  I just tend to use o for OBJECT and 1 for the sequence, or first solid object. The next object would be o2, o3, o4, etc.  I know you are just testing this out but you have translate options as well to move the solid around in X, Y or Z directions.

 

Give that a try.

Message 4 of 6
kudryavcevrm
in reply to: Anonymous

Scott Hallmark
, thank you for useful advice

Message 5 of 6
david.flores
in reply to: Anonymous

Thanks Scott;

Each comment helps me with writing my Python scripts.

Message 6 of 6
mlandmann
in reply to: kudryavcevrm

I tried this. I cannot get any metafiles to procude in the customscripts directory. Does anyone know what the problem is? 

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

Post to forums  

Autodesk Design & Make Report

”Boost