geometry cannot be generated with the given parameters.nil

geometry cannot be generated with the given parameters.nil

paseka_viki
Explorer Explorer
1,565 Views
10 Replies
Message 1 of 11

geometry cannot be generated with the given parameters.nil

paseka_viki
Explorer
Explorer

I've wanted to learn to make custom parts for plant3d using python.

To test I've copied code from the internet (that I included below)

steps taken in Autocad:

 

appload (loaded PnP3dACPAdapter.arx)

plantregistercustomscripts

restarted autocad

appload (loaded PnP3dACPAdapter.arx)

(testacpscript "TESTSCRIPT")

which returned error geometry cannot be generated with the given parameters.nil

 

 

code is saved in a shared folder

compiled python code is saved in "__pycache__" under CustomScripts (which is different from what i've seen elsewhere)

0 Likes
Accepted solutions (1)
1,566 Views
10 Replies
Replies (10)
Message 2 of 11

matt.worland
Advisor
Advisor

Hello @paseka_viki,

There are a few things wrong with your file.

Your file name must match the name of the function you are creating. In this case, the file name must be TESTSCRIPT.py

You're also missing some parameters for the Cylinder function, you need to have the O parameter.

On the second cylinder, you have a negative parameter. These must be positive. If you want to have the cylinder go down, you can either rotate it or move it. I've shown how to move it.

mattworland_0-1692109556703.png

 

The __pycache__ is correct for 2022 and above. Autodesk has changed where they store the pyc files, but most online information is for older versions of Plant 3D.

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

paseka_viki
Explorer
Explorer

I somehow sent the wrong file, in this one i've just wanted to try stuff.

But this is the code that i've copied and tried (FROM: https://adndevblog.typepad.com/autocad/2015/06/custom-python-scripts-for-autocad-plant-3d-part-2.htm...)

renaming didnt help.

0 Likes
Message 4 of 11

h_eger
Mentor
Mentor

Dear @paseka_viki ,

 

The result corresponds to what is contained in your script.

 

Befehl: (testacpscript "TESTSCRIPT")
<Objektname: 18cdda6bcd0>

 

15-08-_2023_17-38-24.png

-

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



0 Likes
Message 5 of 11

paseka_viki
Explorer
Explorer

I've just tested it on my desktop pc, it functions as expected. On my laptop, I tried changing path to a local directory which didnt solve it, tried in different projects that didnt solve it either. But functions correctly on desktop.

0 Likes
Message 6 of 11

MONTECINOS
Advocate
Advocate

Hi paseka_viki,

 

I´m learning to create custom components using python.

I followed the same exercise that you tried to carry out and i have the same problem, in fact all the code was copied directly from the example of the link of autodesk that you attached before. The steps i followed:

-APPLOAD

-PLANTREGISTERCUSTOMSCRIPT

-(testacpscript "TESTSCRIPT") (in this step the folders and files )

The result in Autocad was the message NIL

 

I tried several times without modifying anything and the result was the same, then i turned off my computer. The funny thing was at the next day, i followed the same steps once again and....surprise, this time the example worked out and the tube that h_eger is showing appeared in my computer, so i deleted all of the files, and followed all the steps once again to check if i could repeat successfully the same good result but the messagge NIL appeared again, sometimes some errors has to do with the version of Plant 3D that is utilized, for example i tried a different example of Plnat 3D testscript that i found in internet, in the version of 2025 didn´t work out, however the same example worked properly right in a version of 2023.

I found in several forums people claiming about the same error that you have paseka_viki, even using examples that are published in internet like you did and so on.

The problem of the versions of AutoCAD Plant 3D is hard to detect until you do have installed in a computer differnt versions of Plant 3D of different years, so this way yo can test a process in both version and check different result, a similar problem sometimes happen at the moment of generating isometrics

0 Likes
Message 7 of 11

h_eger
Mentor
Mentor
Accepted solution

@MONTECINOS ,

 

APPLOAD "PnP3dACPAdapter.arx"

PLANTREGISTERCUSTOMSCRIPT

 

close AutoCAD Plant 3D and restart AutoCAD Plant 3D

Now nothing should stand in the way of your testing of the script.

 

(testacpscript "TESTSCRIPT") (in this step the folders and files )

 

-

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 8 of 11

paseka_viki
Explorer
Explorer

I kind of forgot about this thread and i havent encountered this problem since, but i have noticed that in this script i had the unit type set to inches even though every project that i work on is in mm. So i tested this in autocad plant 3D 2026: on first try this script returned nil, changed LengthUnit="in" to  LengthUnit="mm" (+deleting pychache) and it worked but returning to  LengthUnit="in" did not break it again. tested on 2 separate computers with different versions of plant3d, but the content folder was shared on network. next i tried deleting the script itself, then ive copied the same script back and its broken again, so there may be some sort of caching outside of pycache involved. Upon further testing: sometimes autocad decides to work with "in" but most of the times it doesnt and it is solved by changing "in" to "mm", deleting pycache as well as the .xml just for a good measure. also every i have restarted plant between every change and used the same drawing and never saved said drawing.

0 Likes
Message 9 of 11

h_eger
Mentor
Mentor

@paseka_viki ,

 

thank you very much for your answer and explanation

-

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



0 Likes
Message 10 of 11

CGBenner
Community Manager
Community Manager

@MONTECINOS 

Did the information provided answer your question? If so, please use Accept Solution so that others may find this in the future. Thank you very much!

Did you find a post helpful? Then feel free to give likes to these posts!
Did your question get successfully answered? Then just click on the 'Accept solution' button.  Thanks and Enjoy!



Chris Benner

Community Manager - NAMER / D&M


0 Likes
Message 11 of 11

MONTECINOS
Advocate
Advocate

Good morning @h_eger

Thanks for your answer, previously i made a mistake, not closing AutoCAD after registered the script and then restart AutoCAD again to test it, so i followed your advice and now is working fine.

Now i have a different problem, i am trying to create a reduction tray fitting, to do so i´m creating several shapes, then subtracting each other to to create the final result, the thing is when i write the distances to move theses pieces in X and Y i cannot achieve to place them in th exact place where i want to because of the decimals, i measured everything before start doing this, but there is something wrong, here i have the code:

 

 

MONTECINOS_0-1755157213825.png

 

 

This is what i want:

MONTECINOS_1-1755157303057.png

 

 

This is how i am doing the process:

MONTECINOS_2-1755157342134.png

 

 

And this is the result (i have overlapped the shape green which is what i want to compare the result):

MONTECINOS_3-1755157432232.png

 

When i look closely i can see the pieces don´t fit accuratedly:

MONTECINOS_4-1755157552973.png

I have to add several decimals after the comma to get more accuracy but i cannot achieve it

 

 

 

 

 

 

###################------------------------------------------------------------------------------------------------------------------------------------##############################

 

 

 

I had to change the order of the code to get accuracy:

MONTECINOS_0-1755160655670.png

I modified the way i moved b1, this way i could change some of the displacement values using less decimals, for example the b1.translate((37.1390, 0, 0)) was the original value, then i had to modify that value and the rest of the values when i set the code like in b2, but appearently changing the order of the code affects the final result.

 

 

For example this is how originaly was b1 but i had to change the values because b1 didn´t move to the coordinates written in this codes

MONTECINOS_3-1755161492436.png

 

 

 

 

 

Here is the final result:

MONTECINOS_1-1755161248431.png

 

 

And you can notice that now fits exactly where it should be:

MONTECINOS_2-1755161308596.png

 

 

 

 

 

 

 

 

 

 

 

0 Likes