Radu Iordache Posted March 4, 2023 Posted March 4, 2023 Hello, I am using the lisp below (written by chatgpt based on my requests) to add a text showing polyline area inside selected polylines. It works well. The polylines are selected one by one or by window. Now, for another application, I want to modify this code so I can select the areas to add the text (area) by clicking inside them instead of selecting them as objects. I suppose it should do a boundary, add the text with it's area and then delete (or not) the resulted polyline. Please note that I am using progecad (intellicad platform) so some functions may not work though the majority of them do. Somehow chatgpt was not able to help with this modification :)) Thanks in advance! PLA.lsp Quote
devitg Posted March 4, 2023 Posted March 4, 2023 1 hour ago, Radu Iordache said: Hello, I am using the lisp below (written by chatgpt based on my requests) to add a text showing polyline area inside selected polylines. It works well. The polylines are selected one by one or by window. Now, for another application, I want to modify this code so I can select the areas to add the text (area) by clicking inside them instead of selecting them as objects. I suppose it should do a boundary, add the text with it's area and then delete (or not) the resulted polyline. Please note that I am using progecad (intellicad platform) so some functions may not work though the majority of them do. Somehow chatgpt was not able to help with this modification :)) Thanks in advance! PLA.lsp 1.33 kB · 1 download @Radu Iordache Please upload your sample.dwg Quote
BIGAL Posted March 5, 2023 Posted March 5, 2023 (edited) Your answer is BPOLY throw that at Chatgp. Would like to see what is returned. Was the code provided edited or is it as created interested to see how good chatgp is. Edited March 5, 2023 by BIGAL Quote
Radu Iordache Posted March 5, 2023 Author Posted March 5, 2023 12 hours ago, BIGAL said: Your answer is BPOLY throw that at Chatgp. Would like to see what is returned. Was the code provided edited or is it as created interested to see how good chatgp is. It is as created. However, I asked for each step. for example: create a lisp that writes areas of selected polylines as text. then I asked to cut the decimals to 0, then to put the text in the center of the polyline, then to ask for the user input for text height, etc. Each step at a time. I tried to tell him about bpoly, he does not manage to change the lisp, no versions are working I am no lisp programmer to be able to check. That's why I turned to you guys, maybe someone could help. Quote
Steven P Posted March 5, 2023 Posted March 5, 2023 (edited) Doesn't bpoly throw up a dialogue box? i'd be tempted to do it hatch and no dialogue box, this should give the boundary. Noting there is no checking that a valid boundary is selected, no warnings either. Note also below will select any entity as the hatch boundary, lines, polyline, circles..... not just polylines If it was me I would use the selected point, pt, as the text entry point, just fewer clicks, or as above using the geometric centre of the area. (defun c:test ( / pt tempent Boundaryent) ;; Draw a boundary (setq pt (getpoint "Select Internal Point")) (command "-hatch" pt "") (setq tempent (entlast)) (command "-hatchedit" (entlast) "b" "p" "") (setq Boundaryent (entlast)) (entdel tempent) Boundaryent ; returns the entity name for the boundary, area can be calculated from this and boundaryu deleted later ) Edited March 5, 2023 by Steven P 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.