Is there any workaround to insert in python script to know in which line my script gone wrong ?

Is there any workaround to insert in python script to know in which line my script gone wrong ?

bagusvirdo
Contributor Contributor
655 Views
4 Replies
Message 1 of 5

Is there any workaround to insert in python script to know in which line my script gone wrong ?

bagusvirdo
Contributor
Contributor

Hi All, as the title said, is there any workaround to insert in python script to know in which line my script gone wrong?

may it shown in AP3D command lines when testing with (testacpscript "XXX")?

it keeps giving me "Geometry can not be generated with the given parameters.nil" error

 

thanks in advance

0 Likes
Accepted solutions (1)
656 Views
4 Replies
Replies (4)
Message 2 of 5

h_eger
Mentor
Mentor

@bagusvirdo ,

 

I don't know of any function that could provide this in Python for AutoCAD Plant 3D.
In your case, the default parameters do not match the construction functions.

-

If my reply was helpful, please give a "Kudo" or click the "Accept as Solution" button below (or both).

Hartmut Eger
Senior Engineer
Anlagenplanung + Elektotechnik
XING | LinkedIn

EESignature



Message 3 of 5

jabowabo
Mentor
Mentor
Accepted solution

You can strategically place 'print' commands throughout your code. These will display in the AutoCAD command line. From there, you can determine the last successful 'print' line of code.

 

print ("if this line shows in the command line, then code is successful to this point")
Message 4 of 5

matt.worland
Collaborator
Collaborator

The Python module is broken in the current version of 2025.

 

In previous versions of Plant 3D, you could print statements in your code. And if the PlantRegisterCustomScritps command found errors, it would tell you the file and line the registration errored out on.

 

In the current release of 2025 you will need to use writeLine statements. Create a new text file and write out instead of printing to the console.

 

Autodesk Development Team is aware of this and said it should be fixed in 2025.1

If my reply was helpful, please give a "Thumbs Up" or "Accept as Solution"
Message 5 of 5

bagusvirdo
Contributor
Contributor

Thanks for the reply Eger, Jason, Matt,, 

 

"You can strategically place 'print' commands throughout your code. These will display in the AutoCAD command line. From there, you can determine the last successful 'print' line of code."

 

exactly what I'm looking for,

 

this is what I insert in my script to track any mistakesthis is what I insert in my script to track any mistakesand this is what appear on my AP3D command windowand this is what appear on my AP3D command window

0 Likes