2024 Technology Preview Program:
Master powerful new features and shape the latest BIM-enabled innovations
2021-02-10 12:14 PM - last edited on 2021-09-14 01:24 PM by Noemi Balogh
x1 = 0.500*0.01: y1 = 0.500*0.01 !*0.01 - just to make it smaller x2 = 0.750*0.01: y2 =-0.250*0.01 ! for closer look in 3D y3 =-0.375*0.01 ! on line between tube and revolve y4 =-0.500*0.01 R=0.125*0.01 path_x1 =-1*0.01 : path_y1 = 0 : path_z1 = 0 path_x2 = 0 : path_y2 = 0 : path_z2 = 0 path_x3 = 1*0.01 : path_y3 = 0 : path_z3 = 0 path_x4 = 2*0.01 : path_y4 = 0 : path_z4 = 0.5*0.01 path_x5 = 3*0.01 : path_y5 = 0 : path_z5 = 0.5*0.01 path_x6 = 4*0.01 : path_y6 = 0 : path_z6 = 0.5*0.01 res=24 resol res stepi=360/res matWhite = 60 penRed = 20 showText = 1 pen penRed material matWhite gosub "tube shape" add path_x5, path_y5, path_z5 rotz 180 roty -90 gosub "revolve shape" del 3 addx path_x5*2 gosub "half tube double path" del 1 if showText then gosub "defStyle" add 0, -x2*2, y4 text 0,0, "tube + revolve" addx path_x5*2 text 0,0, "half tube, double path" del 2 endif end !___________________________________________END_________________________________________ "tube shape": !status for cross-section of tube command si=1 !0 is good WHEN angle=0, else IF lines on the rounded edges are present... !1 remove lines on the edges, but some other lines are missing !2 too much lines !cross-section put x1, y1, si put x1, y2, si put x2, y2, si for i=90 to -90 step -stepi ! to make it the same as for revolve, where si isn't available put x2 + R*cos(i), y3 + R*sin(i), si ! that's why i didn't use centerpoint (900) plus arc (4000) next i put x2, y4, si put -x2, y4, si for i=270 to 90 step -stepi ! to make it the same as for revolve, where si isn't available put -x2 + R*cos(i), y3 + R*sin(i), si next i put -x2, y2, si put -x1, y2, si put -x1, y1, si put x1, y1, -1 !path of cross-section put path_x1, path_y1, path_z1, 0 put path_x2, path_y2, path_z2, 0 !changed 45 degrees to 0 - to look the same as "half tube double path" put path_x3, path_y3, path_z3, 0 !same put path_x4, path_y4, path_z4, 0 put path_x5, path_y5, path_z5, 0 put path_x6, path_y6, path_z6, 0 mask = 1 + 2*1 + 16*0 + 32*0 + 64*0 + 128*0 !first m=6 ! number of the path nodes n=(nsp-m*4)/3 tube n, m, mask, get (n*3), get(nsp) !prism_ n, 0.01, get(n*3) return "revolve shape": si=1 put y1, 0, si put y1, x1, si put y2, x1, si put y2, x2, si for i=90 to -90 step -stepi put y3 + R*sin(i), x2 + R*cos(i), si next i put y4, x2, si put y4, 0, si j1=0: j2=0: j3=1: j4=1: j5=0 j6=0: j7=0: j8=0: j9=0 revolve nsp/3, 180, j1 + j2*2 + j3*4 + j4*8 + j5*16 + j6*32 + j7*64 + j8*128 + j9*256, get(nsp) ! prism_ nsp/3, 0.0001, get(nsp) return "half tube double path": group "smoothness" !status for cross-section of tube command si=1 !cross-section n=0 put 0, y1, si: n=n+1 put 0, y2, si: n=n+1 put x2-x1, y2, si: n=n+1 for i=90 to -90 step -stepi put x2-x1 + R*cos(i), y3 + R*sin(i), si: n=n+1 next i put x2-x1, y4, si : n=n+1 put -x1, y4, si : n=n+1 put -x1, y1, si : n=n+1 put 0, y1, -1 : n=n+1 !path of cross-section put path_x1, path_y1, path_z1, 0 put path_x2, path_y2, path_z2, 0 !removed angle=45 or its becoming too complicated put path_x3, path_y3, path_z3, 0 !to find same coordinates backwards (at least for me) put path_x4, path_y4, path_z4, 0 put path_x5, path_y5, path_z5, 0 for i=90 to -90.1 step -1 put path_x5 + x1*cos(i), path_y5-x1 + x1*sin(i), path_z5, 0 !x1 - radius next i put path_x5, path_y5 - x1*2, path_z5, 0 put path_x4, path_y4 - x1*2, path_z4, 0 put path_x3, path_y3 - x1*2, path_z3, 0 put path_x2, path_y2 - x1*2, path_z2, 0 put path_x1, path_y1 - x1*2, path_z1, 0 mask = 1 + 2*1 + 16*0 + 32*0 + 64*0 + 128*0 !first m=(nsp-n*3)/4 ! number of the path nodes tube n, m, mask, get (n*3), get(nsp) !prism_ n, 0.01, get(n*3) endgroup !abc=addgroup ("smoothness","smoothness") !placegroup abc !very strange starting surface... and still 3D looks not clean placegroup "smoothness" return "defStyle": define style "style1" "arial", 1, 8, 0 set style "style1" return
Solved! Go to Solution.
2021-02-15 06:30 PM
si = 1 put x1, y1, 0 put x1, y2, 0 put x2, y2, si put x2, y3, 900 put 0, -180, 4000 + si put -x2, y4, si put -x2, y3, 900 put 0, -180, 4000 + si put -x1, y2, 0 put -x1, y1, 0 put x1, y1, -1 put -1*0.01, 0, 0, 30, 0, 0, 0, 30, 1*0.01, 0, 0, 30, 2*0.01, 0, 0.5*0.01, 0, 3*0.01, 0, 0.5*0.01, 0, 4*0.01, 0, 0.5*0.01, 0 tube 11, 6, 1+2+16+32+64, get(11 * 3), get(6 * 4)About cross-section edges (image 2, image 4): the missing line will be visible with mask bit 64, as on image3. When bit 64 isn't set it doesn't mean they will be all invisible. When the angle between neighboring triangles is greater than a treshold, a line will appear. It can't be controlled from GDL. A trick to hide all of them is modelling a short TUBE for each path segment:
tube 11, 4, 1+2, use(11 * 3), -1*0.01, 0, 0, 30, 0, 0, 0, 30, 1*0.01, 0, 0, 30, 2*0.01, 0, 0.5*0.01, 0 tube 11, 4, 1+2, use(11 * 3), 0, 0, 0, 30, 1*0.01, 0, 0, 30, 2*0.01, 0, 0.5*0.01, 0, 3*0.01, 0, 0.5*0.01, 0 tube 11, 4, 1+2, use(11 * 3), 1*0.01, 0, 0, 30, 2*0.01, 0, 0.5*0.01, 0, 3*0.01, 0, 0.5*0.01, 0, 4*0.01, 0, 0.5*0.01, 0
2021-02-15 06:30 PM
si = 1 put x1, y1, 0 put x1, y2, 0 put x2, y2, si put x2, y3, 900 put 0, -180, 4000 + si put -x2, y4, si put -x2, y3, 900 put 0, -180, 4000 + si put -x1, y2, 0 put -x1, y1, 0 put x1, y1, -1 put -1*0.01, 0, 0, 30, 0, 0, 0, 30, 1*0.01, 0, 0, 30, 2*0.01, 0, 0.5*0.01, 0, 3*0.01, 0, 0.5*0.01, 0, 4*0.01, 0, 0.5*0.01, 0 tube 11, 6, 1+2+16+32+64, get(11 * 3), get(6 * 4)About cross-section edges (image 2, image 4): the missing line will be visible with mask bit 64, as on image3. When bit 64 isn't set it doesn't mean they will be all invisible. When the angle between neighboring triangles is greater than a treshold, a line will appear. It can't be controlled from GDL. A trick to hide all of them is modelling a short TUBE for each path segment:
tube 11, 4, 1+2, use(11 * 3), -1*0.01, 0, 0, 30, 0, 0, 0, 30, 1*0.01, 0, 0, 30, 2*0.01, 0, 0.5*0.01, 0 tube 11, 4, 1+2, use(11 * 3), 0, 0, 0, 30, 1*0.01, 0, 0, 30, 2*0.01, 0, 0.5*0.01, 0, 3*0.01, 0, 0.5*0.01, 0 tube 11, 4, 1+2, use(11 * 3), 1*0.01, 0, 0, 30, 2*0.01, 0, 0.5*0.01, 0, 3*0.01, 0, 0.5*0.01, 0, 4*0.01, 0, 0.5*0.01, 0
2021-02-15 07:06 PM
put y1, x1, 0 put y2, x1, 0 put y2, x2, si put y3, x2, 900 put 0, 180, 4000 + si roty -90 revolve 5, 180, 1 + 2 + 4 + 8, get(5*3) del 1
2021-02-16 06:19 PM