how to draw gusset plate or right angle triangle by using python script

how to draw gusset plate or right angle triangle by using python script

jawalev
Contributor Contributor
773 Views
3 Replies
Message 1 of 4

how to draw gusset plate or right angle triangle by using python script

jawalev
Contributor
Contributor

i have created python script for flange holder for grve flange and stuck in tringle or gusset plate,

please find below script for the same and attached image snap.

 

jawalev_0-1723575729926.png

jawalev_1-1723575762099.png

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

@activate(
    Group="support",
    Ports="1",
    TooltipShort="Flange Holder",
    TooltipLong="Flange holder with dimensional graphics",
    LengthUnit="mm",
)
@group("MainDimensions")
@param(D=LENGTH, TooltipShort="Diameter of pipe", TooltipLong="Diameter of pipe",)
@param(L=LENGTH, TooltipShort="Length of the base plate", TooltipLong="Length of the base plate")
@param(W=LENGTH, TooltipShort="Width of the Base plate", TooltipLong="Width of the Base plate")
@param(T=LENGTH, TooltipShort="Thickness of base plate", TooltipLong="Thickenss Of base plate")
@param(L1=LENGTH, TooltipShort="Length of Gusset plate", ToolyipLong="Length of Gusset plate")
@param(W1=LENGTH, TooltipShort="Width Of Gusset plate", TooltipLong="Width of Gusset plate")
@param(T1=LENGTH, TooltipShort="Thickness of Gusset plate", TooltipLong="Thickness of Gusset plate")
@param(L2=LENGTH, TooltipShort="Length of Rib plate", TooltipLong="Length of Rib plate")
@param(W2=LENGTH, TooltipShort="Width of Rib Plate", TooltipLong="Width of Rib plate")
@param(T2=LENGTH, TooltipShort="Thickness of Rib plate", TooltipLong="Thickness of Rib plate")
@param(L3=LENGTH, TooltipShort="Thickness of Flange", TooltipLong="Thickness of Flange Face to Flange End")
@param(H=LENGTH, TooltipLong="Height of Flange Center To Base plate bottom")
@group(Name="meaningless enum")
@enum(1, "align X")
@enum(2, "align Y")
@enum(3, "align Z")

def FlangeHolder(s, D=213.15, L=400, W=150, T=16, L1=10, W1=119.91, T1=119.91, L2=400, W2=16, T2=184, L3=79.25, H=325, ID="FlangeHolder", **kw😞

    # Calculation
    R1 = D / 2.0
    A = (T2/2.0 + T/2.0)
    B = (T1/2.0 + T/2.0)
    C = (T1/2.0+T/2.0) - math.sqrt(W1*W1 + T1*T1)
    E = W1 / 2.0  
   

    # Create Base Plate
    o1 = BOX(s, L=L, W=W, H=T).translate((0, 0, 0))
    o2 = BOX(s, L=L2, W=W2, H=T2).translate((-A, 0, -(W/2 - W2/2.0)))
    o3 = BOX(s, L=L1, W=W1, H=T1).translate((-B, 0, 0))

    # Create right-angled triangle
    o5 = BOX(s, L=L1, W=W1, H=T1).translate((-B, 0, 0))
   
    # Unite all the parts
    o1.uniteWith(o2)
    o2.erase()
    o1.uniteWith(o3)
    o3.erase()
   
   
   
    # Rotate
    o1.rotateY(90)
   
    # Connection Points
    # Main pipe ports
    s.setPoint((-L3, 0, 0), (0, 0, 0))  # Port at Center of the main pipe
   
    # Optional: Linear dimensions
    s.setLinearDimension("H", (0, 0, 0), (0, 0, H))
0 Likes
Accepted solutions (1)
774 Views
3 Replies
Replies (3)
Message 2 of 4

matt.worland
Advisor
Advisor

Hello, Since we dont have that shape, you would have to create two boxes. Move and rotate 45deg the second box so that you can then subtract it from the first and be left with the shape of a triangle.

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

jawalev
Contributor
Contributor

thanks for your reply i have already created 2 boxes but subtract is not done properly.

 

 

0 Likes
Message 4 of 4

quan_hm
Collaborator
Collaborator
Accepted solution

Hi,

Try this

 

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

@activate(
    Group="support",
    Ports="1",
    TooltipShort="Flange Holder",
    TooltipLong="Flange holder with dimensional graphics",
    LengthUnit="mm",
)
@group("MainDimensions")
@param(D=LENGTH, TooltipShort="Diameter of pipe", TooltipLong="Diameter of pipe",)
@param(L=LENGTH, TooltipShort="Length of the base plate", TooltipLong="Length of the base plate")
@param(W=LENGTH, TooltipShort="Width of the Base plate", TooltipLong="Width of the Base plate")
@param(T=LENGTH, TooltipShort="Thickness of base plate", TooltipLong="Thickenss Of base plate")
@param(L1=LENGTH, TooltipShort="Length of Gusset plate", ToolyipLong="Length of Gusset plate")
@param(W1=LENGTH, TooltipShort="Width Of Gusset plate", TooltipLong="Width of Gusset plate")
@param(T1=LENGTH, TooltipShort="Thickness of Gusset plate", TooltipLong="Thickness of Gusset plate")
@param(L2=LENGTH, TooltipShort="Length of Rib plate", TooltipLong="Length of Rib plate")
@param(W2=LENGTH, TooltipShort="Width of Rib Plate", TooltipLong="Width of Rib plate")
@param(T2=LENGTH, TooltipShort="Thickness of Rib plate", TooltipLong="Thickness of Rib plate")
@param(L3=LENGTH, TooltipShort="Thickness of Flange", TooltipLong="Thickness of Flange Face to Flange End")
@param(H=LENGTH, TooltipLong="Height of Flange Center To Base plate bottom")
def FlangeHolder(s, D=213.15, L=400, W=150, T=16, L1=10, W1=119.91, T1=119.91, L2=400, W2=16, T2=184, L3=79.25, H=325, ID="FlangeHolder", **kw):
    # Calculation
    R1 = D / 2.0
    A = (T2/2.0 + T/2.0)
    B = (T1/2.0 + T/2.0)
    C = (T1/2.0+T/2.0) - math.sqrt(W1*W1 + T1*T1)
    E = W1 / 2.0  
   

    # Create Base Plate
    o1 = BOX(s, L=L, W=W, H=T).translate((0, 0, 0))
    o2 = BOX(s, L=L2, W=W2, H=T2).translate((-A, 0, -(W/2 - W2/2.0)))
    o3 = BOX(s, L=L1, W=W1, H=T1).rotateY(45)
    cutO3 = BOX(s, L=L1, W=W1*2, H=T1).translate((W1/2,0,0))
    o3.subtractFrom(cutO3)
    cutO3.erase()
    o3.rotateY(-135)
    o3.translate((-B, 0, 0))
    # Create right-angled triangle
    # o5 = BOX(s, L=L1, W=W1, H=T1).translate((-B, 0, 0))
   
    # Unite all the parts
    o1.uniteWith(o2)
    o2.erase()
    o1.uniteWith(o3)
    o3.erase()
   
   
   
    # Rotate
    o1.rotateY(90)
   
    # Connection Points
    # Main pipe ports
    s.setPoint((-L3, 0, 0), (0, 0, 0))  # Port at Center of the main pipe
   
    # Optional: Linear dimensions
    s.setLinearDimension("H", (0, 0, 0), (0, 0, H))

 

quan_hm_0-1723679959948.png

You will get the idea, the rest is on you :)).

 

Hoang Minh Quan - Lead Developer

Autodesk Store for IntegaDesign Content

Smart Solutions by IntegaDesign

Plant 3D • CAD Optimization • Automation