+ Reply to Thread
Results 1 to 3 of 3

VBA to generate and draw vertical and horizontal lines following some rules

  1. #1
    Registered User
    Join Date
    06-02-2009
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    74

    Red face VBA to generate and draw vertical and horizontal lines following some rules

    I have ground & ceiling geometrical data given in X, Y coordinates, which I plotted in thick brown in the chart below.
    I want to add and plot vertical and horizontal lines (constituting building blocks) in between ground and ceiling; following some rules as follows:

    # Vertical Lines
    Shall be established every 4 feet apart. The lines' length is an even number with 2 feet increment (i.e. length is 2,4,6, or 8, etc.) as height permits at that location.
    The vertical lines should NOT intersect with the ceiling. Each has to stop at least 2 feet before it hits the ceiling.

    # Horizontal lines
    Shall also be established every 4 feet apart. The lines' length has to be an even number with 4 feet increment (i.e. 4, 8, or 12, etc. …to whatever it takes)
    The lines should not intersect with the ceiling's side slopes, at least 5 feet needs to be before hitting sideways

    The lines should end up creating a proper outline of building blocks (rectangles/squares) in an organized format.

    I manually tried to create some lines (with formulas) for illustration purpose (attached) but I appreciate if I can accomplish this perfectly with VBA.

    It would be also fantastic at the end to provide the final number of utilized blocks and the surface area, but this is optional, plotting is more important!

    I appreciate any help!

    I also posted this in another forums, but I had no luck as I write for over 36 hours:
    https://www.ozgrid.com/forum/index.p...ng-some-rules/
    https://www.mrexcel.com/board/thread...rules.1167752/
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    09-16-2015
    Location
    United States
    MS-Off Ver
    2010
    Posts
    94

    Re: VBA to generate and draw vertical and horizontal lines following some rules

    It sounds like you are looking for a CAD style program.

    This is easy enough to do for a one time shot, just by plotting X Y lines on a line scatter chart (please see the edit below). However, this would be a major undertaking if you are wanting to make it 'reusable' for several applications.

    Might I suggest instead of reinventing the wheel you try a free CAD program? If you prefer to use Excel, you can try Excel Draw. It a CAD style add-in that lets you do basic CAD drawings inside of Excel. Its not as robust as CAD, but it gets the basics done with 2D and 3D wire frames.


    -EDIT-

    As an example, this creates a rectangle using X and Y values. The rectangle starts at 0,0 and ends at 5,5.

    Please Login or Register  to view this content.
    Last edited by frabulator; 04-11-2021 at 07:32 AM.

  3. #3
    Registered User
    Join Date
    06-02-2009
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    74

    Re: VBA to generate and draw vertical and horizontal lines following some rules

    Thanks frabulator for the feedback... Yes, I agree regarding the CAD thing, this is basically my ultimate goal. I appreciate your help ...

    It would be fantastic if I could generate all the coordinates programmatically considering the maximum height and maximum width each line of blocks could get ...

    Thanks again!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Sumifs formula to handle vertical and horizontal lines
    By jwhite03458 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-28-2020, 09:31 AM
  2. [SOLVED] How to change horizontal text lines into vertical ?
    By christianbber in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 08-07-2012, 08:37 AM
  3. How to draw static vertical lines in Excel graph
    By vivekengg in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 05-03-2011, 10:04 AM
  4. Replies: 7
    Last Post: 10-29-2009, 10:12 AM
  5. Replies: 1
    Last Post: 04-06-2009, 05:46 AM
  6. [SOLVED] problem with VBA to draw vertical lines
    By Wazooli in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-16-2005, 01:10 AM
  7. mixed plot: scatter, vertical, and horizontal lines
    By confused_newbie in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 06-20-2005, 02:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1