need help writing auto LISP

need help writing auto LISP

davidteller
Explorer Explorer
924 Views
8 Replies
Message 1 of 9

need help writing auto LISP

davidteller
Explorer
Explorer

I'm new to writing LISP and I'm stuck. Can anyone help me write a LISP routine for evenly drawing and spacing grid lines from user input into a window frame (window the opening size, user input number of columns and rows, user input width of grid)? I tried using "array," and I still think that's the way to go, but I cannot find LISP language and I'm not able to make the formulas work.

0 Likes
925 Views
8 Replies
Replies (8)
Message 2 of 9

john.uhden
Mentor
Mentor

In my aged mind, I tend to think of using AutoCAD commands as being limited to mundane conditions.  Whereas AutoLisp can do most any kind of mathematics you want.  You apparently want to "divide" the vertical and horizontal lengths into a variable grid based on some kind of preset limitations.  Perhaps minimum/maximum grid spacing (horizontal different from vertical), or number of panes (like a widow), or ratio of vertical to horizontal.

Use symbol variables and conditions to do your forensic math and then draw the results.  No, it's not as simple as I put it, but keeping the concepts simple help you to develop the successful code.

Many of us here like to help, but not necessarily provide drive-through solutions (but some do).  Please post anything you are trying and we will help to guide you to success.

John F. Uhden

0 Likes
Message 3 of 9

Kent1Cooper
Consultant
Consultant

@davidteller wrote:

…. a LISP routine for evenly drawing and spacing grid lines from user input into a window frame (window the opening size, user input number of columns and rows, user input width of grid)....


PanelDivRect.lsp, available >here<, may be just what you're after.

Kent Cooper, AIA
Message 4 of 9

davidteller
Explorer
Explorer
It works well. I may need to tweak and fine tune, but this is what I was wanted.
Very cool. Thanks a million times over. I was getting frustrated with this.
0 Likes
Message 5 of 9

CodeDing
Advisor
Advisor

@davidteller,

 

Why not just create a table? (Assuming frame is rectangular) (command TABLE).

 

Best,

~DD

0 Likes
Message 6 of 9

davidteller
Explorer
Explorer
Because I'm not trying to draw a table for text. I need to show the opening between dividers in a window frame.
0 Likes
Message 7 of 9

CodeDing
Advisor
Advisor

Ok thanks for clarifying. I was reading, grid, and evenly spaced.. Perhaps got some tunnel vision.

 

Best,

~DD

0 Likes
Message 8 of 9

davidteller
Explorer
Explorer
No worries, thanks for responding.
0 Likes
Message 9 of 9

roland.r71
Collaborator
Collaborator

You don't have to.

After creating a table, you can use explode to turn it into lines.

Creating a evenly spaced 'grid' with columns & rows. Works nice if precision isn't all that important. (as the table uses character size + margins to determine row width & height, instead of fixed numbers)

0 Likes