Importing *.pyd library into Python Scripts Components

Importing *.pyd library into Python Scripts Components

theshoaib.mughal
Advocate Advocate
971 Views
9 Replies
Message 1 of 10

Importing *.pyd library into Python Scripts Components

theshoaib.mughal
Advocate
Advocate

Hello guys,

 

I am trying to model a component and for that I have created a *.pyd (python dynamic library) file. So far so good. But when I import that file into my script then PLANTREGISTERCUSTOMSCRIPT run just fine and does not give any error. However, when I test the script with TESTACPSCRIPT it gives me error  Geometry can not be generated with the given parameters.nil but if do not create a *.pyd file and compile it as simple *.pyc then everything works out smooth and geometry is created just fine. 

 

I don't know what I am doing wrong and how to rectify

0 Likes
Accepted solutions (1)
972 Views
9 Replies
Replies (9)
Message 2 of 10

h_eger
Mentor
Mentor

Dear @theshoaib.mughal ,

 

the answer is quite simple *.pyd library are not supported into Python Scripts Components of AutoCAD Plant 3D

-

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 3 of 10

theshoaib.mughal
Advocate
Advocate

It is supported h.eger. Because ElectroWorx plugin by ECEDesign adds *.py, *.png and *.pyd files in custom script folder and their plugin works fine. The py file imports pyd file and generates geometry. Check this link

 https://support.ecedesign.com/support/solutions/articles/xxx-xxxxxxxx-electroworx-for-p3d-integratio...

 

I just need to figure out how I can do the same for my script. 

0 Likes
Message 4 of 10

h_eger
Mentor
Mentor

Dear @theshoaib.mughal ,

 

But we don't have an ElectroWorx PlugIn!
We work directly in Plant 3D Content and PYD files are not supported.
By the way, you can develop your own plug-in via SDK AutoCAD Plant 3D and you can also use PYD files, otherwise not.
By the way, the PlupIn from Lisega also uses PYD files, but only for the internal generation of Plant 3D components in order to use them via Plant 3D insert in the models.

-

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 10

theshoaib.mughal
Advocate
Advocate
Accepted solution

Its okay. I figured it out how to do it. Turned out it was the wrong python/cython version to create pyd file. When used the right version, the generated pyd file works fine. So it is supported. We need only to figure out how. Autocad plant 3d uses python version 3.7 so corresponding cython version is 0.29

0 Likes
Message 6 of 10

abilabib
Advocate
Advocate

We've changed Python version 3.7 and Cython version 0.29, but it still did not work when importing *.pyd. 
Could you share how import *,pyd correctly?

0 Likes
Message 7 of 10

theshoaib.mughal
Advocate
Advocate

Two questions. For which AutoCAD version are you creating the pyd file and how are you creating it. I mean what environment are you using. Different versions of AutoCAD uses different combination of python/cython

0 Likes
Message 8 of 10

abilabib
Advocate
Advocate

AutoCAD Plant 2022 or AutoCAD Plant 2025. 

 

0 Likes
Message 9 of 10

h_eger
Mentor
Mentor

AutoCAD Plant 2022 = Python 3.7

AutoCAD Plant 2025 = Python 3.11

-

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 10

theshoaib.mughal
Advocate
Advocate

Yes h.edger is right but with one distinction. 2022 uses cython 0.26 which ran out of support alongwith C compiler required to make the pyd. So it's not possible anymore unless you have required files stashed somewhere. 

0 Likes