I want to use Python script to create components, but I can't find a way to set the transparency and RGB color of 3D solid.
Does any expert know the solution to this problem?
李榕华
13489140049@qq.com
Solved! Go to Solution.
Solved by joakim_lindh. Go to Solution.
Solved by h_eger. Go to Solution.
You cannot do this inside of Python scripts for parts.
I know that there is no corresponding function in that document.
But I found a way to set the color in @h_eger reply.
已解决: Re: Python script assistance - Autodesk Community - AutoCAD Plant 3D
I hope there are other functions that can meet this requirement.
李榕华
13489140049@qq.com
Dear @李榕华|Ronghua.LI ,
there are also limits in Python scripting this is where they are exceeded.
This function cannot be influenced with Python scripting.
@jabowabo has already answered your question.
Hartmut Eger
Senior Engineer
Anlagenplanung + Elektotechnik
XING | LinkedIn
Hello everyone.
I was playing around with this color thing today again after finding out that it might work with changing colors of blocks inside a python script.
After some trail and error i did find out that .setColor() works perfectly on pythonscripts for plant 3D.
It uses the Color index RGB where for example 100=green 255=black and so on!
This is how i have done it on one of my scripts.
The only disadvantage is .uniteWith() is grabing the color of the object you are uniting to. So if you are looking for a colorful Python script you can group objects and then make a color for the group or just assign the color for each block and skip the unite part.
Body2 = CYLINDER(s, R=D2/2.0, H=FL1, O=0.0).rotateY(90).translate((-L2/2.0-FL1, 0.0, 0.0))
Body2.setColor(12)
Body3 = CYLINDER(s, R=D2/2.0, H=FL1, O=0.0).rotateY(90).translate((L2/2.0, 0.0, 0.0))
Body3.setColor(12)
Have you found a way to set the transparency of objects?
李榕华
13489140049@qq.com
Hi, I tried the obj.setColor(12), and there is no error in the "PLANTREGISTERCUSTOMSCRIPTS" command, I restarted the program and ran (TESTACPSCRIPT"SCRIPT") just to find nil, in the command line, with no items drawn. Is there a additional variable that needs to be imported to work?
Sidenote: I have managed to set the color, I concur nou with Joakim that it works
Also, i have tried oobj.setTransparency(40) and have not worked
I tried the following functions without success.
s01.transparency(T)
s01.Transparency(T)
s01.setTransparency(T)
s01.entityTransparency(T)
s01.entitytransparency(T)
s01.EntityTransparency(T)
s01.setEntityTransparency(T)
李榕华
13489140049@qq.com
Maybe have a look at this post:
https://forum.dynamobim.com/t/change-layer-transparency-in-autocad-file/47346/2
I think you have to wangle it a bit, I don't know how plant 3d will react to this script of Paolo_Emilio_Serra1,
but I guess its worth the try if needed so badly
Can't find what you're looking for? Ask the community or share your knowledge.