Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
*Expert Elite*
pbejse
Posts: 2,511
Registered: ‎11-24-2009
Message 11 of 30 (843 Views)

Re: Example of a typical room

01-14-2013 04:03 AM in reply to: mwhea

mwhea wrote:

You sir are a genius :smileyhappy: 

Just had a quick test of it and works amazing :smileyvery-happy: 

 

Is there away to ask for the type of fitting it is being inserted (example drawing had type F1 fitting) As the blocks have ID 1 and ID2 for descriptions of the light. If this is not possible its not hard to select all the new drawings and just go to properties and add "F1" or whatever the light is to be called.

 

Thanks again :smileyhappy:


Glad it works for you.

 

Yes its possible ,that is why i put a note in the code "prep for Dynamic Block Manipulation" ....  or by "descriptions" you mean visibiltiy parameter? Yes it can be arranged to worked on any Dblocks

 

 

 

*Expert Elite*
scot-65
Posts: 2,210
Registered: ‎12-11-2003
Message 12 of 30 (829 Views)

Re: Example of a typical room

01-14-2013 03:20 PM in reply to: pbejse

Looks good!

I would have used ARRAY after finding the first insertion point...

:-)

Scot-65
Dyslexia is a permanent physical disability that cannot be seen.
Introverts is proof that there is indeed intelligent life on this planet.
*Expert Elite*
pbejse
Posts: 2,511
Registered: ‎11-24-2009
Message 13 of 30 (823 Views)

Re: Example of a typical room

01-14-2013 05:59 PM in reply to: scot-65

scot-65 wrote:

Looks good!

I would have used ARRAY after finding the first insertion point...

:-)


True, But what i had in mind are the eventual options that will go with this routine in the future:

 

(setq opt (getkword "\nChoose option [Regular/Numbered/Block List] <N>:smileyhappy:)

 

wherein options are 

 

R = use ARRAY as you suggested

N = use Copy

   : LTR/TTB/BTT/ :<------ number order

B = use INSERT

   :smileytongue:roperties/Visiblity/Name list

           :N option shows a listbox and an option to select two or more blocks

 

I opted to use insert for this example as i was counting on labelling the blocks, as it is easier to "capture" or modify the object on the fly after insertion.

 

but like i said. in the future. 

 

Good call scot-65 

 

Cheers

*Expert Elite*
scot-65
Posts: 2,210
Registered: ‎12-11-2003
Message 14 of 30 (796 Views)

Re: Lisp Routine to place lights in a room evenly

01-16-2013 03:27 PM in reply to: mwhea

One of the greatest things about this board is one can

be inspired to create macros that can benefit the work

environment, and therefore become more productive.

 

With that said, I have created a preliminary interface that will be

taken to completion very shortly, as I can use something like this:

 

RLA01.gif

 

The routine will start by asking the user to select 2 corners of the area (getcorner).

When successful, this dialog will appear.

 

If you want the beginnings, I'd be happy to attach the DCL and LSP.

They are in an easy to read format and with some tweaking, can

be tailored to your liking (or used as a template).

 

:-)

Scot-65
Dyslexia is a permanent physical disability that cannot be seen.
Introverts is proof that there is indeed intelligent life on this planet.
Active Contributor
mwhea
Posts: 40
Registered: ‎09-04-2012
Message 15 of 30 (791 Views)

Re: Example of a typical room

01-16-2013 05:44 PM in reply to: pbejse

scot-65,

 

I'll be happy to look at the beggings of this :smileyhappy: anything that simplifies work is for the better.

 

pbejse lisp routine works really well for what we are after atm, though there are somethings i have thought about wanting to add into it later on llike ceiling tiles for instances where we cant just space our lights evenly but based on an actual grid tile setout point. 

*Expert Elite*
pbejse
Posts: 2,511
Registered: ‎11-24-2009
Message 16 of 30 (786 Views)

Re: Lisp Routine to place lights in a room evenly

01-16-2013 07:58 PM in reply to: scot-65

scot-65 wrote:

........

 

If you want the beginnings, I'd be happy to attach the DCL and LSP.

They are in an easy to read format and with some tweaking, can

be tailored to your liking (or used as a template).

 

:-)


Please by all means do so scot :smileyhappy:

 

 

*Expert Elite*
pbejse
Posts: 2,511
Registered: ‎11-24-2009
Message 17 of 30 (774 Views)

Re: Example of a typical room

01-16-2013 11:16 PM in reply to: mwhea

mwhea wrote:

scot-65,

 

I'll be happy to look at the beggings of this :smileyhappy: anything that simplifies work is for the better.

 

pbejse lisp routine works really well for what we are after atm, though there are somethings i have thought about wanting to add into it later on llike ceiling tiles for instances where we cant just space our lights evenly but based on an actual grid tile setout point. 


post an example. mwhea

 

*Expert Elite*
Kent1Cooper
Posts: 5,871
Registered: ‎09-13-2004
Message 18 of 30 (763 Views)

Re: Example of a typical room

01-17-2013 05:56 AM in reply to: mwhea

mwhea wrote:

.... I have attached a drawing showing steps of how we go about breaking a room up to insert our lights. .... 


Are you aware of the MINSERT command?  It inserts a Block in rectangular-array rows and columns all in one drawing entity.  It's a significant memory saver compared to all those Blocks separately inserted, and has other advantages.  If you need to do anything to the Blocks, such as change the Layer, Move, Erase, etc., they are collectively one thing, so one pick gets them all, one grab of grip to Move them takes them all together, etc.  [In some ways that's similar to having them in a Group, but with Minsert they're actually a single entity.]  If you want to round off the spacing to ceiling tile increments, you just set one row and one column spacing, and they are all regularly spaced.  And if you decide to change the spacing, changing that in one place alters all the positions at once.  They can't accidentally get moved out of alignment with each other.  And so on....

 

In your example drawing, it would simply be a matter of calculating one insertion point [in that case, an eighth of the way across the room from one side or the other, and a sixth of the way up or down], and making one Minsert with the desired numbers of rows and columns, and appropriate spacings -- no need to calculate all those insertion points separately.

 

However, there may be reasons not to use it.  If the Block has Attributes, they would need to be the same in every one in the Minsert array, which may be fine if it's just a fixture type designation, but may not be if they need to be differentiated in some way.  And I'm not sure what effects there may be on Dynamic Blocks.  Or if there's reason to have any not on the regular-interval spacing, or perhaps not at the same rotation, they would need to be independent of any Minsert that contains most of them.

Kent Cooper
*Expert Elite*
pbejse
Posts: 2,511
Registered: ‎11-24-2009
Message 19 of 30 (756 Views)

Re: Example of a typical room

01-17-2013 06:43 AM in reply to: Kent1Cooper

Kent1Cooper wrote:


mwhea wrote:

.... I have attached a drawing showing steps of how we go about breaking a room up to insert our lights. .... 


Are you aware of the MINSERT command?...

 

 If you want to round off the spacing to ceiling tile increments, you just set one row and one column spacing, and they are all regularly spaced.  And if you decide to change the spacing, changing that in one place alters all the positions at once.  They can't accidentally get moved out of alignment with each other.  And so on....


 

 MINSERT,now  thats interesting. Had not use that command in ages. Come to think of it, i think i never did. :smileyhappy:

 

......-- no need to calculate all those insertion points separately.

 

Yes, that too.

 

I thought about scot's  suggestion regarding ARRAY. I realize making a selection set isnt really that hard.

 

My mind was set in using insert for every condition i had in my "option" list. But after reading thru the other posts  made me think twice.

 

The insert  command is still play a vital role of course, mix with copy, array and even minsert will make it loads easier to code.

 

Thank for your input [Scot-65 / Kent Cooper]

 

Cheers

*Expert Elite*
Kent1Cooper
Posts: 5,871
Registered: ‎09-13-2004
Message 20 of 30 (744 Views)

Re: Example of a typical room

01-17-2013 11:22 AM 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

Kent Cooper
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.