custom python scripts

custom python scripts

Anonymous
Not applicable
8,836 Views
28 Replies
Message 1 of 29

custom python scripts

Anonymous
Not applicable

Hello

 

with the awesome help of the

 

Custom Python Scripts for AutoCAD Plant 3D

By David Wolfe

 

int the AutoCAD DevBlog I started scripting successfull.

 

On the contrary to the blog, I have to create a part, based on my new script, first before I can test it with 'TESTACPSCRIPT'. Is this actual the typical workaround?

 

Where can I find a documentation, which sub routines are in which import files (in /varmain), which parameters expect the sub routines and which order is importent for the import files?

 

 

Thanks

Reply
Reply
0 Likes
8,837 Views
28 Replies
Replies (28)
Message 21 of 29

matt.worland
Collaborator
Collaborator
I haven't played with creating supports much, but I don't recall seeing scripts for structural shapes. You might need to create those on your own. And the same goes for the flange dims, you could look in the flangesub and find the flange you are connecting to and see how it is being built. Then create your own getFlangeHubDiameter. But, if you have the known values, it may be easier to create a lookup table.
If my reply was helpful, please give a "Thumbs Up" or "Accept as Solution"
Reply
Reply
0 Likes
Message 22 of 29

mikael.santospj
Enthusiast
Enthusiast

Thanks. Do you mean that I can create a method inside my script ?

Clearly, I am struggling a bit with some command lines I see, like: linkFuncToDbman, getParamVal, defaultPipeLength....

I mean, is there any documentation for these advanced topics?

Can I create another varmain, .pyc file (shape)

Reply
Reply
0 Likes
Message 23 of 29

matt.worland
Collaborator
Collaborator
Yes, whatever shapes you need, you can create your own scripts. You could create a script to house all of the steel data, then in your support call upon that script. Also do the same thing for the flange data. Create a script that has all of the sizes and dimensions you need, then call that from your support script.

By putting the steel and flange data into a different script you can use it in other places and not have to re-write that code over and over.

Just keep all of you scripts together in the CustomScripts folder and they should all be reachable.
If my reply was helpful, please give a "Thumbs Up" or "Accept as Solution"
Reply
Reply
0 Likes
Message 24 of 29

avinashkumar797901
Observer
Observer

Its all right. Whenever you have multiple .pyc files, it is stored in that cache folder.

You can check it inside the folder, it goes by name  yourscriptname.pyc

Reply
Reply
Message 25 of 29

mikael.santospj
Enthusiast
Enthusiast
try this file: C:\Program Files\Autodesk\AutoCAD 2022\PLNT3D\ContentScripts\variants.zip as already posted here
and the following link: https://tool.lu/pyc/ to see the .pyc filescripts/parameters
Reply
Reply
Message 26 of 29

mikael.santospj
Enthusiast
Enthusiast

Hy guys

Another question came this afternoon: Can I use libraries like NUmpy, sympy...?I nee solve one equation in order to get a variable value to draw my geometry.

Reply
Reply
Message 27 of 29

matt.worland
Collaborator
Collaborator

Yes, as long as they are available on the computers you are running them on.

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

mikael.santospj
Enthusiast
Enthusiast

Sorry, but I am not sure how I would do that. Just a simple 

from sympy import * ?

thanks for answering

Reply
Reply
Message 29 of 29

matt.worland
Collaborator
Collaborator
Sympy will need to be installed on each computer. https://www.sympy.org/en/download.html
Once it's installed on the computers that need it, you can then use
from sympy import *
If my reply was helpful, please give a "Thumbs Up" or "Accept as Solution"
Reply
Reply