Hi All,
In order to write a python script of the geometry of my conical Tank which should be customizable by users according to its volume, I should compute and find relation betwwen all geometry parameters according to the inputs which are figured in blanc in the image below.
My issue is that I can not find the hight of the exterior wall face figured in red which is based on the exterior angle that can not be find either due to the non parallel faces of the wall because Thk1 and Thk2 are not equals
Then any idea or orientation to use a special node in dynamo well welcomed
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import math
#--- INPUT DATA ---
pt_A,pt_B=IN[0],IN[1]
thick_1,thick_2=IN[2],IN[3]
offset_up,offset_down=IN[4],IN[5]
#--- Right equation: z =mx+p ---
m=(pt_B.Z-pt_A.Z)/(pt_B.X-pt_A.X)
p=pt_A.Z-m*pt_A.X
alpha=math.atan(m)
#--- Right equation of the shifted curve ---
pt_C=Point.ByCoordinates(pt_A.X+thick_1*math.sin(alpha),pt_A.Y,pt_A.Z-thick_1*math.cos(alpha))
pt_D=Point.ByCoordinates(pt_B.X+thick_2*math.sin(alpha),pt_B.Y,pt_B.Z-thick_2*math.cos(alpha))
m_offset=(pt_D.Z-pt_C.Z)/(pt_D.X-pt_C.X)
p_offset=pt_C.Z-m_offset*pt_C.X
#---- Intersection points based on offset along X up and down---
Pt_up=Point.ByCoordinates(pt_B.X+offset_up,pt_B.Y,m_offset*(pt_B.X+offset_up)+p_offset)
Pt_down=Point.ByCoordinates(pt_A.X+offset_down,pt_A.Y,m_offset*(pt_A.X+offset_down)+p_offset)
#--- Results ---
angle=math.degrees(math.atan(m_offset))
H=Pt_up.Z-Pt_down.Z
OUT = my_dic={"angle-->":angle ,"H-->":H}
I tryed your script, it works well for an angle of 45 degrees…but by sweeping the angle alpha I discovered an error that needs to be corrected…so there are two choices: