Javier Longa Posted 22 hours ago Posted 22 hours ago 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). PCI_PRO (PFP).lsp 2 1 1 Quote
CamDuy Posted 19 hours ago Posted 19 hours ago Very well, the community needs people like you. 1 Quote
BIGAL Posted 11 hours ago Posted 11 hours ago (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. The dcl input is a good idea. Happy to discuss maybe a easier way to make sure erase all objects outside shape. Edited 11 hours ago by BIGAL Quote
indiancad Posted 5 hours ago Posted 5 hours ago 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. Quote
Javier Longa Posted 3 hours ago Author Posted 3 hours ago 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. Quote
Recommended Posts
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.