How to add a custom script to variants--varmain

How to add a custom script to variants--varmain

traiduong014969
Collaborator Collaborator
2,703 Views
5 Replies
Message 1 of 6

How to add a custom script to variants--varmain

traiduong014969
Collaborator
Collaborator

Dear all,

In my customscripts folder, It has many scripsub. So I want to add them to  variants.zip---varmain like  I can import a script from variants.zip 

For example:

from varmain.supportsub.csgcsub.csgc001 import  CSGC001.

I tried many ways to add them. In my custom scrip, I make a copy a custom scrip, eg: elbow45.pyc then I insert them to variants.zip\varmain\arcsub\cpbdsub. However, It not working. Someone that success with it please tell for me.

Many thank to your help!

traiduong014969_0-1637545651716.png

 

0 Likes
2,704 Views
5 Replies
Replies (5)
Message 2 of 6

rajendra.prajapat
Advisor
Advisor

@traiduong014969 is there any specifc resaon to aad the custom script in to the varmain folder?You can import you sub script from other location also.

If my reply was helpful, please give a "Kudo" or click the "Accept as Solution" button below (or both).
0 Likes
Message 3 of 6

matt.worland
Advisor
Advisor

I recommend not mixing custom files with installed files. It's easier to keep track of your files if they are separated into their own directories.

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

ZZikic
Advocate
Advocate

I agree.  It is best not to mix custom scripts with the out-of-the-box variants scripts.

Keep in mind that you can always call any custom script such as your elbow45 within the current script like so:

At the top of your script after you import packages...

 

# Import Python Packages
from aqa.math import *
import math
from varmain.primitiv import *
from varmain.var_basic import *
from varmain.custom import *

 

#Add Custom Python Packages
import os
import sys
sys.path.append(os.path.normpath(sys.PnP3dNativeContentCustomScriptsPath))
from elbow45 import *

Message 5 of 6

Fahad_Ghoerobi
Enthusiast
Enthusiast

Hi,
I'm developing my custom script for pipe support customization.
For now, I use primitive like box, arc3d, cylinder, etc to create the support including the steel profile.
Is there any variant/varmain I can call in my script so there's no need to use primitive? Maybe function like modeling steel profile of Equal Angle, C Shape, H Shape profile, etc.

0 Likes
Message 6 of 6

matt.worland
Advisor
Advisor

I haven't found any additional Primitives and use the ones provided to us.

 

You need to create your own Profile Shape python files, where you can pass in the parameters to build an Equal Angle or other profile. Then in your support script, just call which ever profile you need for that support.

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