Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Lisp Routine to place lights in a room evenly

52 REPLIES 52
Reply
Message 1 of 53
mwhea
6697 Views, 52 Replies

Lisp Routine to place lights in a room evenly

Hello,

 

I was wondering if anyone had a lisp routine that divided up a normal square / rectangle room and insert a block at each given point.

 

At present if the room was to have four lights width ways and three lights length ways we would divide the width by eight to give us 1/2 1 1 1/2 so the lights would be placed on every second point after the divde command (dividing the room by twice the amound of lights needed). 

 

Hopefully someone already has a lisp routine that does this dividing for simple rooms as obviously its a bit more tricky when it comes to rooms that are odly shaped. Any help would be appreciated.

 

Kind Regards,

Mark

52 REPLIES 52
Message 41 of 53
Kent1Cooper
in reply to: thajmul2501


@thajmul2501 wrote:

.... i had attached the lisp the  name of (addarray lisp). include also dcl file. that lisp i want to modify . i could not able to do decimal point like (1.50) so i would like to add decimal point. kindly make for me.

 

....

I am not experienced with .dcl operations, and where I am now I have an older version in which I think the prompt sequence for the Hatch command is different, so it doesn't work for me, either -- maybe at a newer version location later....  But at the very least, you would need to change these two lines in the .lsp file:

 

(setq *rowdist* (atoi (get_tile "row")))
(setq *coldist* (atoi (get_tile "col")))

 

to convert the tile input to real numbers, not integers:

(setq *rowdist* (atof (get_tile "row")))
(setq *coldist* (atof (get_tile "col")))]

Kent Cooper, AIA
Message 42 of 53
Kent1Cooper
in reply to: thajmul2501


@thajmul2501 wrote:

@Kent1Cooper wrote:

@thajmul2501 wrote:

.... 

ur lisp quietly help. when i load ur lisp, poops up function error. can u explain me. what does that mean "miinsert.blk" . i change the lisp location also i can't get exacltly. pls explain.

....


Which code -- from Post 20 or 28?

 

There's no "miinsert.blk" in either code -- is that part of an error message, or did you type it differently from what you meant?

 

Does the "function error" message say anything more than just that?

 

.....

i think you misunderstanding as i mentioned. check above post i had attached the lisp the  name of (addarray lisp). include also dcl file. ....


No, I didn't misunderstand.  My questions above are in response to your issues about my routine, not about the ADARRAY files, which you didn't attach until after I asked those questions.  If you will actually answer them, I might be able to get my routine working for you, if you can't get the ADARRAY files to work.

Kent Cooper, AIA
Message 43 of 53
thajmul2501
in reply to: Kent1Cooper

hi kent

thank you so much your kind reply. let i check your lisp.

best regards

hussain
Message 44 of 53
thajmul2501
in reply to: Kent1Cooper

@Kent1Cooper wrote:
....

Are you aware of the MINSERT command?  It inserts a Block in rectangular-array rows and columns all in one drawing entity.  ....


In pretty simple terms, without lots of controlling and/or limiting and/or checking and/or default features that could be added, assuming a non-Attributed Block, and minimally tested:

 

(defun C:LRR (/ c1 c2 wid ht rows cols blk); = Lights in Rectangular [& orthogonal] Room
  (setq
    c1 (getpoint "\nCorner of room: ")
    c2 (getpoint "\nOpposite corner: ")
    wid (abs (- (car c1) (car c2)))
    ht (abs (- (cadr c1) (cadr c2)))
    rows (getint "\nNumber of rows (---): ")
    cols (getint "\nNumber of columns (|||): ")
    blk (getstring "\nBlock name: ")
  ); setq
  (command
    "_.minsert" blk
    (mapcar '+ ; insertion point
      (list (min (car c1) (car c2)) (min (cadr c1) (cadr c2))); lower left of room

      (list (/ wid cols 2) (/ ht rows 2)); fractions of width/height
    ); mapcar
    "" "" "" ; X, Y, rotation defaults -- edit if needed
    rows cols (/ ht rows) (/ wid cols); numbers and spacings
  ); command
  (princ)
); defun

 

 

hi kent 

 

I am not perfect in English so i try my best. sorry for inconvenience. i actually asked about as you mentioned above the code that time i worrying about the distance. as you can see your code only possible to put how many rows & columns but not possible to put distance of rows & columns. i hope you will understand .  

 

 


@Kent1Cooper wrote:

@thajmul2501 wrote:

@Kent1Cooper wrote:

@thajmul2501 wrote:

.... 

ur lisp quietly help. when i load ur lisp, poops up function error. can u explain me. what does that mean "miinsert.blk" . i change the lisp location also i can't get exacltly. pls explain.

....


Which code -- from Post 20 or 28?

 

There's no "miinsert.blk" in either code -- is that part of an error message, or did you type it differently from what you meant?

 

Does the "function error" message say anything more than just that?

 

.....

i think you misunderstanding as i mentioned. check above post i had attached the lisp the  name of (addarray lisp). include also dcl file. ....


No, I didn't misunderstand.  My questions above are in response to your issues about my routine, not about the ADARRAY files, which you didn't attach until after I asked those questions.  If you will actually answer them, I might be able to get my routine working for you, if you can't get the ADARRAY files to work.


 

Message 45 of 53
Kent1Cooper
in reply to: thajmul2501


@thajmul2501 wrote:
... i worrying about the distance. as you can see your code only possible to put how many rows & columns but not possible to put distance of rows & columns. ....

That is because it calculates the distances between rows and columns from the size of the room.  There are other similar routines [one about sprinkler layouts recently] that take a spacing [or a maximum spacing], and a room size, and calculate the number of columns and rows for you.  If you are going to specify both the number of rows and columns and the distances between them, do you need any routine at all?

Kent Cooper, AIA
Message 46 of 53
thajmul2501
in reply to: Kent1Cooper


@Kent1Cooper wrote:

@thajmul2501 wrote:
... i worrying about the distance. as you can see your code only possible to put how many rows & columns but not possible to put distance of rows & columns. ....

That is because it calculates the distances between rows and columns from the size of the room.  There are other similar routines [one about sprinkler layouts recently] that take a spacing [or a maximum spacing], and a room size, and calculate the number of columns and rows for you.  If you are going to specify both the number of rows and columns and the distances between them, do you need any routine at all?


hi kent 

 

i am grateful your reply. yes it is possible your code. i agree.

But we have standard dimension for  luminaries . i could not do only to put no. of rows & column. i would like to put manually and Edit the dimension.    i had already send to you that lisp file the name of "ADDARRAY" as you can see in the file.only can do put distance for rows & column. there is no mention no. of rows & column.

 

if you have time to create lisp what i said.ok carry on. no time ,no problem because why i am telling to you already familiar with auotlisp.

 

thank you so much. i am appreciate you. your response really helping for us. keep going your work.

 

best regards

 

hussain

 

Message 47 of 53
pogilearn
in reply to: mwhea

Here's my suggested dialog box Lighting Routine you requested.

Message 48 of 53
arslan.khalid79
in reply to: scot-65

Hello Bro, I liked your concept of lighting array, just trying to load your lisp and it is not working for me (RLA command is not showing.). using AutoCAD 2017.

Message 49 of 53
sally_munden
in reply to: Kent1Cooper

you sir, are a bloody genius! 🙂 this has made my day!!!
Message 50 of 53
arroyo.18david
in reply to: mwhea

Ok bn

Message 51 of 53
CAD7875
in reply to: Kent1Cooper

i was using this lisp fine and now all of a sudden it just puts all blocks on top of each other; instead of spacing them out - any ideas/fixes?
Message 52 of 53
Kent1Cooper
in reply to: CAD7875


@CAD7875 wrote:
.... this lisp ....

Which one?

 

EDIT:  Never mind.  I suspect you are using a Block defined for uniform scaling.  [That may not even have been an option back then.]  If that's the case, take out one of the "" Enters in the series of three.  Or leave the code alone, and BEDIT the Block definition to not scale uniformly.

 

If one of those doesn't fix it, then which one?

Kent Cooper, AIA
Message 53 of 53
CAD7875
in reply to: Kent1Cooper

edited the block - works a treat now - thanking you muchly 🙂

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost