Jump to content

LISP routine for the distribution of sprinklers and fire detectors in fire protection installations


Recommended Posts

Posted

Hello. I'm happy to share this routine I created with the help of Copilot, which I believe works acceptably for distributing elements (sprinklers, detectors, etc.) based on user input. I would be very grateful if any member of this forum could improve the code or offer any advice. I'm a big fan of @Lee Mac's programs, whom I consider a master.

 

The routine will ask the user to define the measurements that define minimum and maximum values and then, by selecting a block, from which it acquires the layer and scale properties, by selecting an area, with or without "islands", it will generate a mesh pattern, which for a preliminary design is acceptable or approximate in many cases.

I am Spanish and the routine is coded in Castilian Spanish (Spain).

image.thumb.png.1f5664ac0357cbb8873adb2bf3e5c465.pngimage.thumb.png.42d35790718d67cc7aa693c0c3aaec4f.png

PCI_PRO (PFP).lsp

  • Like 2
  • Agree 1
  • Thanks 2
Posted (edited)

Welome aboard.

 

A couple of suggestions.

    Google translate is your friend, you can convert Spanish to English so make a English version.

   Code picks a control point that the grid/blocks is based off, rather than just lower left.

  Can do answers based on a rotated axis. may have a side on angle as control line. Hint Array & UCS

   The get pline points you can use this, much shorter than your code.

; thanks to Lee-mac for this get points
(setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget ent))))

  Not sure if extra block outside shape should be there shown in image Yes did something similar in the 1980's. Looks at what is outside of shape and erase.

 

image.thumb.png.0b0d82e1b954d3b59d4572079298ada0.png

 

  The dcl input is a good idea.

 

Happy to discuss maybe a easier way to make sure erase all objects outside shape.

Edited by BIGAL
Posted

Nice work! For a preliminary sprinkler/detector layout, this looks very practical, especially considering it handles irregular boundaries and islands. The idea of inheriting the selected block's layer and scale is a smart touch—it saves a lot of manual cleanup.

One suggestion would be to add an option to rotate the grid based on a user-defined angle or a reference line, since many buildings aren't aligned with the UCS. It might also be useful to preview the calculated grid before inserting the blocks, giving the user a chance to adjust spacing.

Great project overall, and thanks for sharing it with the community. I'm sure many fire protection designers will find it useful.

Posted

Of course, I appreciate any observations like the ones you mentioned in your post, @BIGAL, but I'm sorry to say I can't have a conversation about programming since I have no programming knowledge whatsoever. I would only ask that if you deem it appropriate to modify the code by adding considerations such as ensuring the routine can work in any SCP, or drastically shortening overly long code, or any other relevant element I may have overlooked, I would be very grateful.

Posted (edited)

@indiancad @Javier Longa there may be a way of using Array if a new UCS OB is used to orient the grid. In the changed rotation need to rotate the block as well.

 

image.thumb.png.a20d3ca67d0f2f9e97b818c44900ff87.png

 

A question @Javier Longa " since I have no programming knowledge whatsoever" then how did you come by the code ? It is considered good manners to acknowledge who wrote the code, if known, or mention Author unknown.

Edited by BIGAL
  • Like 1
Posted

I apologize @BIGAL, because I don't think I explained myself well. The code was generated entirely by COPILOT, Microsoft's AI, following the instructions I gave it.

If there had been a previous author in this case, I would have mentioned it, just as I've confessed that I'm a huge fan of @Lee Mac's work.
And I don't think I made it clear that if any member of this group, expert or not, feels like improving this code, I'll be very grateful, as it's code that could be very useful in my profession.

I'll try to add the necessary code to account for the UCS rotation (Array if a new UCS OB).
Replying to @SLW210, I think the simplicity of the code lies in the fact that it can use NFPA values as well as FM Global or UNE EN 12845 values, since it only requires adding distances.

  • Like 1
Posted

Just trying to help you improve your LISP programming, so don't take this as not appreciating what you have done.

 

These suggestions just make it better for everyone and should be doable upgrades, IMO.

 

 

I would have to know those values in advance.

 

I am sure some people do this everyday and may memorize them, but that is a bad habit to get into.

 

1. The specifications can change.

2. Some may need to use different standards each project.

3. Some people might mis-remember the values, etc. leading to errors.

 

Programs that deal with a Standard should always employ the standard if possible, even if you make it just for the one you use.

 

For example:

 

Al's Steel Mill and Wisey's, they each employ a different standard for steel shapes and do so with easily updateable files.

 

Here is a thread here on Al's with an updated standards file.

 

Updated AISC Shapes for STL.LSP - AutoLISP, Visual LISP & DCL - AutoCAD Forums

 

There is on CADTutor and maybe some other fora, etc. some programs dealing with piping, they each work towards the respective standards in those industries.

 

ANSI B16.5 Flanges Lisp - AutoLISP, Visual LISP & DCL - AutoCAD Forums

 

There are a few more, but speaking of those flanges, etc. I or someone needs to see if any of those standards have changed since it's been a while.

 

Also, another question, since I rarely have to do sprinklers, etc. that often, does this work with AutoCAD MEP's sprinklers? I'll have to check, but I do not believe they are actual blocks, so that could be another upgrade suggestion. 

Posted

I appreciate those suggestions, of course, but due to my age and the demands of my job, I find it very difficult to learn any kind of programming. I'll continue using Copilot.

Regarding what you mentioned @SLW210 about the regulatory values, I don't see any reason to change them. When I created the routine, it was to help my colleagues who are familiar with the values they need to apply, not in a fixed way, but by verifying their validity against the applicable standard. I didn't create the routine for someone unfamiliar with the different fire safety regulations.
I've uploaded this application, and I'm repeating myself a lot, sorry, because I don't think I could find anything similar already created by others that was free, and even the existing ones, including those in calculation software, aren't reliable.
I also wanted to ask a programming expert to take up the challenge and collaborate on improving it.

Following up on this last comment, I'm going to upload a new version that corrects the design when there's a rotation in the UCS, modifies the polyline selection code using Lee Mac's code (thanks to @BIGAL and @Lee Mac), and also includes other considerations. Please excuse me if it's still in Spanish, but as I said, it's primarily for my team's use.

PCI_PRO (PFP)_V3_8.lsp

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...