'Make Excel write Acad Script Files which draw things. 'Very elegant where math outweighs graphics. 'Trick dicovered by me in year 2000, unless before that ... 'The Tower application is due to inspiration from Bindas of this forum.
Dim dx, dy, dz, w, h, z, TopX, TopY, ThisX, ThisY, i, j, k, P1, P2, Width, slope1 'Dim hBars(), dBars() As Double
Sub Acad3Dtower() 'Open a new excel Workbook, Alt+F11 for VBA Editor, Insert new module, paste this code there 'save the file - this path defines where the script file will go. 'Run command from Tools/Extras ->Macros->runMacro 'Coordinates of 12 horizontal bars at each level will be written into script file Tower1.scr 'From AcadMenu->Tools->RunScript pick this file and watch the tower draw 'use acad commands _3dcorbit etc to see the 3Dtower (only horizontal bars - for demo) 'with command _id pick a point to see the coordinates on command line. 'Next weekend I may add the contour and diagonal bars of the tower too - no time now, sorry folks!
'Data in meters dx = Array(1.75, 1.75, 8.23) dy = Array(1.75, 1.75, 8.23) dz = Array(0#, -6#, -60#) 'horizontalBars hBars = _ Array(0#, -2#, -4#, -6#, -9#, -12#, -16#, -20#, -25#, -30#, -35#, -40#, -45#, -50#, -55#, -60#) 'diagonalBars dBars = _ Array(0#, -1#, -3#, -5#, -7.5, -10.5, -14#, -18#, -22.5, -27.5, -32.5, -37.5, -42.5, -47.5, -52.5, -57.5) 'Top Frame Coordinates - assuming top center of tower be (0,0,0) '4 Corners and 4 midpoints, from upperRight, Clockwise w = dx(0): h = dy(0): z = dz(0) TopX = Array(w / 2, w / 2, w / 2, 0, -w / 2, -w / 2, -w / 2, 0) TopY = Array(h / 2, 0, -h / 2, -h / 2, -h / 2, 0, h / 2, h / 2) For i = 0 To 7: Debug.Print "Level "; z; "Point "; i; TopX(i); ","; TopY(i); ","; z: Next i 'Open a scriptFile MyScriptFile = ActiveWorkbook.Path & "\" & "Tower1.scr" Open MyScriptFile For Output As #1 Close #1 Open MyScriptFile For Append As #1
'HorizontalBars For i = 1 To UBound(hBars) z = hBars(i) slope1 = slope(z) w = w + slope1 * 2 * (z - (hBars(i - 1))) h = h + slope1 * 2 * (z - (hBars(i - 1))) '4 Corners and 4 midpoints at this level
ThisX = Array(w / 2, w / 2, w / 2, 0, -w / 2, -w / 2, -w / 2, 0) ThisY = Array(h / 2, 0, -h / 2, -h / 2, -h / 2, 0, h / 2, h / 2) Debug.Print hBars(i); " m. slope at level "; i; slope(hBars(i)); "width "; w
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a part’s function at the center of their design considerations. Download Now
Metal 3D printing has rapidly emerged as a key technology in modern design and manufacturing, so it’s critical educational institutions include it in their curricula to avoid leaving students at a disadvantage as they enter the workforce. Download Now
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now