Smart design of lighting fixtures with lisp modification

Smart design of lighting fixtures with lisp modification

Anonymous
Not applicable
2,182 Views
8 Replies
Message 1 of 9

Smart design of lighting fixtures with lisp modification

Anonymous
Not applicable

Dear Helpes,

 

I got a lisp code from this forum that generate no.of lighting fixtures for all selected rooms (Rectangles) with user input lighting fixtures count. I am requesting to you update this code to be more smart with electrical aspects.

 

NO. OF LIGHTING FIXTURES =                         (1.REQUIRED LUX) X (2.AREA)

                                                               (3.LUMENS) X (4.No. Of LAMPS) X (5.CU) X (6.LLF)

 

LISP Function shall ask the user as below:

1.Required Lux (User input)

2.AREA from selected polygons (From selected Rectangles in drawing)

3.Lumens (User input)

4.No.of Lamps (User Input)

5.CU (User Input)

6.LLF (User input)

 

The lisp code I got is as below:

(vl-load-com)
(defun C:CRM ; = Array Block in Rectangle(s)
  (/ *error* ABRia doc svnames svvals P1 rectss n P3)
  (defun *error* (errmsg)
    (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break"))
      (princ (strcat "\nError: " errmsg))
    ); if
    (if ucschanged (command-s "_.ucs" "_previous"))
      ; [change to (command ...  if Acad version predates (command-s) function]
    (mapcar 'setvar svnames svvals); reset System Variables
    (vla-endundomark doc)
    (princ)
  ); defun - *error*
  (defun ABRia (/ delta LL NX NY colsp rowsp); = ABR Insert & Array
    (setq
      delta (mapcar 'abs (mapcar '- P3 P1)); differences in XYZ list
      LL (mapcar 'min P1 P3)
        ; Lower Left regardless of pick order or Pline start or direction
      colsp (/ (car delta) cols)
      rowsp (/ (cadr delta) rows)
    ); setq
    (command
      "_.insert" blk "_none" (mapcar '+ LL (list (/ colsp 2) (/ rowsp 2)))
      SF
      "" ; Y scale factor = X scale factor
      RO
      "_.array" "_last" "" "_r" rows cols rowsp colsp
    ); command
  ); defun -- ABRia
  (vla-startundomark (setq doc (vla-get-activedocument (vlax-get-acad-object))))
  (setq ; System Variable saving/resetting without separate variables for each:
    svnames '(cmdecho ucsfollow osmode blipmode)
    svvals (mapcar 'getvar svnames)
    blk (cdr (assoc 2 (entget (car (entsel "\n Select Block")))))
    rows (getint "\nNumber of rows (---): ")
    cols (getint "\nNumber of columns (|||): ")
    SF (getreal "\nScale factor: ")
    RO (getreal "\nRotation: ")
  ); setq
  (mapcar 'setvar svnames '(0 0)); turn off command echoing, UCS follow
  (initget "Select"); allows S as input to (getpoint) function, instead of point pick
  (setq P1 (getpoint "\nFirst Corner of ortho-rectangular area for Blocks, or [Select]: "))
    ; [if in non-World UCS, returns in current UCS coordinates, not in WCS]
  (if (= P1 "Select"); chose that option
    (progn ; then
      (prompt "\nTo Array Blocks in Rectangular Polyline(s),")
      (if (setq rectss (ssget '((0 . "LWPOLYLINE") (90 . 4) (-4 . "&") (70 . 1))))
        ; multiple selection -- only 4-vertex closed [does not check for rectangularity]
        (progn ; then
          (mapcar 'setvar svnames '(0 0 0 0)); also turn off Osnap, blips
          (repeat (setq n (sslength rectss)); step through selection
            (setq rect (ssname rectss (setq n (1- n))))
            (command "_.ucs" "_object" rect)
            (setq
              ucschanged T ; marker for resetting in *error*
              P1 (trans (vlax-curve-getPointAtParam rect 0) 0 1); starting vertex
              P3 (trans (vlax-curve-getPointAtParam rect 2) 0 1); third vertex [opposite corner]
            ); setq
            (ABRia); run the subroutine to MINSERT
            (command "_.ucs" "_previous")
            (setq ucschanged nil); [turn off marker]
          ); repeat
        ); progn
        (prompt "\nNo closed 4-vertex Polyline(s) selected."); else
      ); if
    ); progn
    (progn ; else [picked a point]
      (setq P3 (getcorner P1 "\nOpposite Corner: "))
      (mapcar 'setvar svnames '(0 0 0 0)); also turn off Osnap, blips
      (ABRia); run the subroutine to MINSERT
    ); progn
  ); if
  (mapcar 'setvar svnames svvals); reset System Variables
  (vla-endundomark doc)
  (princ)
); defun -- C:CRM
0 Likes
Accepted solutions (3)
2,183 Views
8 Replies
Replies (8)
Message 2 of 9

ВeekeeCZ
Consultant
Consultant
Accepted solution

You got a lisp... Noticed this many times before because you're doing this all the time!  It's obvious that you're not the author. I understand that you found it on the forums, downloaded it for free and you don't really care about the author at all. Why would you, hmm, its for free! But it has its author, he spend some of his free time to wrote that routine and he posted it in public for free. For benefit to all of us... to use if or even to learn from that.

 

You should bother at least mention his name if it's known to you. There are countries in there world where we still respect the authors!

Message 3 of 9

Sea-Haven
Mentor
Mentor

Happy to customise for you but I do charge sometimes. This is just the input side as I have a library routine to make dcl's.

 

ScreenShot142.jpg

Message 4 of 9

Anonymous
Not applicable

Yes Sir, you are absolutely correct, that's why I am writing "I GOT FROM THIS FORUM" instead of "I HAVE" or "I WROTE". Actually here I am not able to find the author names. Suppose your name mentioned as "BeekeeCZ". But I don't the real name of you. That's why I am writing as "I GOT" But next time clearly I will mention with user name, for surely.

 

I don't want to insult Authors, Sir. I always respect Authors, Because of you only, we are surviving in this field by showing short technics to my project managers and all others by saving lot of time to them in projects. I respect you all the time and along the life. And I never take the benefit of others for sure.

0 Likes
Message 5 of 9

roland.r71
Collaborator
Collaborator

A search on the forum brings up @Kent1Cooper as author & @dbhunia as previous modifier.

 

By the looks of it, Kent spend quite some time on modifying this on request already.

 

 

Message 6 of 9

Anonymous
Not applicable

Sir,

 

May I know How much. (Please consider me as a draftsperson(India), not an engineer. So you can give me at best effort, that I can bare)

0 Likes
Message 7 of 9

ВeekeeCZ
Consultant
Consultant
Accepted solution

@Anonymous wrote:

Yes Sir, you are absolutely correct, that's why I am writing "I GOT FROM THIS FORUM" instead of "I HAVE" or "I WROTE". Actually here I am not able to find the author names. ....


 

Yes. Every post has its author which usually is the author of the posted code. If not, it's usually noted. Or you can add the direct link at top of the code.

See @roland.r71, he was able to find the author's name, why shouldn't you?

 

 


@Anonymous wrote:

...Suppose your name mentioned as "BeekeeCZ". But I don't the real name of you. ....


 

Not sure why you need to know my real name. If you ever need to mention me as the author, use my nickname.

Message 8 of 9

ВeekeeCZ
Consultant
Consultant
Accepted solution

@Anonymous wrote:

... Please consider me as a draftsperson(India), not an engineer. ...


 

This is really lame. Either learn yourself to program (as we all did, most of us aren't programmers) or get a programmer from your country with affordable payroll or ask your manager or whoever pays you for more.

0 Likes
Message 9 of 9

Anonymous
Not applicable

Sure Sir,

 

I will mention surely next time, Link or author name or any other info available.

 

Thank you very much Sir to improve my behavior in forums and how to give respect to authors.