AutoCAD Plant 3D Forum
Welcome to Autodesk’s AutoCAD Plant 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Plant 3D topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Custom Script Olet

1 REPLY 1
SOLVED
Reply
Message 1 of 2
alessandro-motta
289 Views, 1 Reply

Custom Script Olet

Hi everyone,

i'm trying to create a special olet for GRP pipes, but I'm facing a problem with the component alignment to the pipe as per picture below. Is there a way to align olet to the run pipe based on its orientation?

alessandro_motta64S62_0-1661933717671.png

Here it is my script:

from aqa.math import *
from varmain.primitiv import *
from varmain.var_basic import *
from varmain.custom import *

@Anonymous(Group="Olet", TooltipShort="Local branch lamination", TooltipLong="Local branch lamination",FirstPortEndtypes="BV", LengthUnit="mm", Ports="2")
@group("MainDimensions")
@Anonymous(D1=LENGTH, TooltipShort="Pipe OD", TooltipLong="Nominal outside diameter 1")
@Anonymous(D2=LENGTH, TooltipShort="Pipe OD", TooltipLong="Nominal outside diameter 2")
@Anonymous(L=LENGTH, TooltipShort="Lamination length", TooltipLong="1st lamination layer length on run pipe")
@Anonymous(A1=LENGTH, TooltipShort="Lamination length 1", TooltipLong="1st lamination layer distance from branch pipe")
@Anonymous(B1=LENGTH, TooltipShort="Lamination length 2", TooltipLong="2nd lamination layer distance from branch pipe")
@Anonymous(H1=LENGTH, TooltipShort="Lamination length 1", TooltipLong="1st lamination layer length on branch pipe")
@Anonymous(T1=LENGTH, TooltipShort="Lamination Thk 1", TooltipLong="1st lamination layer thickness")
@Anonymous(T2=LENGTH, TooltipShort="Lamination Thk 2", TooltipLong="2nd lamination layer thickness")

#Part Definition
#(arxload "PnP3dACPAdapter")
#(testacpscript "LOCALBL")
def LOCALBL(s, D1 = 926.0, D2 = 414.0, L = 913.0, A1 = 250.0, B1 = 90.0, H1 = 250.0, T1 = 16.0, T2 = 18.0, **kw):
#Local branch lamination
LCP1=CYLINDER(s, R=D1/2+T1, H=L, O=D1/2).rotateY(90).translate((-L/2, 0, 0)) #1st layer cylinder on run pipe blu
LCB1=CYLINDER(s, R=D2/2+T1, H=D1/2+H1, O=D2/2) #1st layer cylinder on branch pipe yellow
LCP2=CYLINDER(s, R=D1/2+T1+T2, H=D2+B1*2+T1*2, O=D1/2+T1).rotateY(90).translate((-(D2+B1*2+T1*2)/2, 0, 0)) #2nd layer cylinder on run pipe red
LCB2=CYLINDER(s, R=D2/2+T1+T2, H=D1/2+T1+B1, O=D2/2+T1) #2nd layer cylinder on branch pipe green
SUB1=CYLINDER(s, R=D1*2, H=D1*4, O=L/2).translate((0, 0, -(D1*1.5))) #subtraction from 1st lamination layer on run pipe cyan
BOX1=BOX(s, L=D1+T1*2, W=D1, H=L+500).translate((0, 0, -D1/2)) #subtraction from 1st lamination layer on run pipe magenta
SUB2=CYLINDER(s, R=D1*2, H=D1*4, O=(D2+B1*2+T1*2)/2).translate((0, 0, -(D1*1.5))) #subtraction from 2nd lamination layer on run pipe grey
BOX2=BOX(s, L=D1+T1*2+T2*2, W=D1, H=L+500).translate((0, 0, -D1/4)) #subtraction from 2nd lamination layer on run pipe orange
SUB3=CYLINDER(s, R=D1/2, H=L, O=0).rotateY(90).translate((-L/2, 0, 0)) #subtraction from 1st lamination layer on branch pipe brown
SUB4=CYLINDER(s, R=D1/2+T1, H=L, O=0).rotateY(90).translate((-L/2, 0, 0)) #subtraction from 2nd lamination layer on branch pipe white
SUB5=CYLINDER(s, R=D2/2, H=D1/2+H1, O=0) #pipe hole dark green
SUB1.uniteWith(BOX1)
BOX1.erase()
SUB2.uniteWith(BOX2)
BOX2.erase()
LCP1.subtractFrom(SUB1)
SUB1.erase()
LCP2.subtractFrom(SUB2)
SUB2.erase()
LCB1.subtractFrom(SUB3)
SUB3.erase()
LCB2.subtractFrom(SUB4)
SUB4.erase()
LCP1.uniteWith(LCB1)
LCB1.erase()
LCP2.uniteWith(LCB2)
LCB2.erase()
LCP1.uniteWith(LCP2)
LCP2.erase()
LCP1.subtractFrom(SUB5)
SUB5.erase()
#Set port point
s.setPoint((0, 0, 0), (0, 0, -1))
s.setPoint((0, 0, D1/2), (0, 0, 1))
return

 

Thanks in advance

1 REPLY 1
Message 2 of 2
DVaquand
in reply to: alessandro-motta

Hello

 

Try this

 

@Anonymous(Group="Olet", TooltipShort="Local branch lamination", TooltipLong="Local branch lamination",FirstPortEndtypes="BV", LengthUnit="mm", Ports="2")
@group("MainDimensions")
@Anonymous(D1=LENGTH, TooltipShort="Pipe OD", TooltipLong="Nominal outside diameter 1")
@Anonymous(D2=LENGTH, TooltipShort="Pipe OD", TooltipLong="Nominal outside diameter 2")
@Anonymous(L=LENGTH, TooltipShort="Lamination length", TooltipLong="1st lamination layer length on run pipe")
@Anonymous(A1=LENGTH, TooltipShort="Lamination length 1", TooltipLong="1st lamination layer distance from branch pipe")
@Anonymous(B1=LENGTH, TooltipShort="Lamination length 2", TooltipLong="2nd lamination layer distance from branch pipe")
@Anonymous(H1=LENGTH, TooltipShort="Lamination length 1", TooltipLong="1st lamination layer length on branch pipe")
@Anonymous(T1=LENGTH, TooltipShort="Lamination Thk 1", TooltipLong="1st lamination layer thickness")
@Anonymous(T2=LENGTH, TooltipShort="Lamination Thk 2", TooltipLong="2nd lamination layer thickness")
@group(Name="meaningless enum")
@enum(1, "align X")
@enum(2, "align Y")
@enum(3, "align Z")

 

DVaquand_0-1661964701640.png

 

 

 

Cordialement
Dominique VAQUAND
www.dovaq.fr

Cette publication vous a-t-elle été utile ? N’hésitez pas à attribuer la mention J’aime à cette publication.
Avez-vous obtenu la réponse à votre question ? Cliquez ensuite sur le bouton ACCEPTER LA SOLUTION.

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report