Ask: How to draw an arc with a rightangled trapezoid in cross section through code?
Currently through addpoly; draw the arc structure. Below is the code and graphics
Now the requirements are: the same is arc but I want to change the cross section from rectangular to rightangled trapezoid. How to modify the code? The cross section is shown in the figure below
The slope of the hypotenuse of the trapezoid is a variable that is adjusted by the angle。
thank you!!!
Best Answer

greg_baethge Posts: 120Ansys Employee
I definitely agree it's not simple. The limitation of addpoly is it can only create a shape that is extruded in the z direction, so it can't have any angle in the vertical walls. I had a bit of time, so I wrote this script:
## Definition of the vertices coordinates z_bot = matrix(res); z_top = z_bot + thickness; x1_top = rad1 * cos(t1); y1_top = rad1 * sin(t1); z1_top = z_top; x2_top = rad2 * cos(t1); y2_top = rad2 * sin(t1); z2_top = z_top; x2_bot = rad2 * cos(t1); y2_bot = rad2 * sin(t1); z2_bot = z_bot; x1_bot = (rad1  thickness*tan(thetarad)) * cos(t1); y1_bot = (rad1  thickness*tan(thetarad)) * sin(t1); z1_bot = z_bot; ################################################## x = matrix(4*res); y = matrix(4*res); z = matrix(4*res); x(1:res) = x1_top; # top R1 y(1:res) = y1_top; z(1:res) = z1_top; x(res+1:2*res) = x2_top; # top R2 y(res+1:2*res) = y2_top; z(res+1:2*res) = z2_top; x(2*res+1:3*res) = x2_bot; # bot R2 y(2*res+1:3*res) = y2_bot; z(2*res+1:3*res) = z2_bot; x(3*res+1:4*res) = x1_bot; # bot R1angle y(3*res+1:4*res) = y1_bot; z(3*res+1:4*res) = z1_bot; vtx = [x,y,z]; ## Definition of the facets fct = cell((res1)*4+2); for(i=1:length(fct)){ fct{i} = cell(1); } fct{1}{1} = [1, res+1, 2*res+1, 3*res+1]; fct{2}{1} = [res, 4*res, 3*res, 2*res]; for(i=1:res1){ j = i+2; fct{j}{1} = [3*res+i, 3*res+i+1, i+1, i]; fct{j+res1}{1} = [i, i+1, res+1+i, res+i]; fct{j+2*(res1)}{1} = [2*res+i, res+i, res+i+1, 2*res+i+1]; fct{j+3*(res1)}{1} = [3*res+i, 2*res+i, 2*res+i+1, 3*res+i+1]; } addplanarsolid(vtx, fct);
Where thetarad is the angle of wall in radian, rad1 and rad2 the 2 radii (taken from the top surface). This should create a object like this:
Let me know if you have any question
Answers
Hi @phill,
Thank you for posting your question. I think you should be able to create such structure using a planar solid object. It's a bit tricky, as you have to:
the latter is usually the painful part! We have this example that could be helpful:
Let me know if you run into any issue.
thank you for your reply. The solution you gave seems to be a bit difficult. If you can solve this problem through “addpoly”, thank you.
Thank you for taking the time to help, the problem has been resolved. I may need your help if I face difficulties.