Kape01 Posted August 2, 2020 Share Posted August 2, 2020 Hi All, Firstly thanks to all contribute on this forum. I'm a complete newbie to lisp. Dipped my toe into the world of lisp for the first time a few days ago and wow! Definitely something I am now trying to learn. If someone could help with below would be greatly appreciated. I have drawings which have to manually enter the properties of each individual segment into excel file. I use the attached boundary lisp to create a boundary around the segments (all drawings are always drawn with lines) and the rectcsv to export the data. A colleague of mine came across the rectcsv lisp on this forum (by Jonathan Handojo), which is very close to what I need. Is it possible to get the X axis length to always appear in the width column and the Y axis length in the height column? Is it also possible to extract more data to csv such as: the layer of the label the number the second height (H2)? As this gets its own boundary not sure if its possible, if not I can add another label number and filter/ sort the data in excel. I have attached sample drawing & csv file of what I am trying to achieve. Thank you in advance. sample.dwg sample.csv rectcsv.lsp BoundaryMultSel.lsp Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 3, 2020 Share Posted August 3, 2020 For me start again just use ssget Label?????? text, find each text do a bpoly and get bounding box, this gives X & Y lengths, delete bpoly do next. Way less code. Code would be use text insert point, then bpoly. make a list of the results and do a sort on say layer then label number, export list to csv. Need some time doing paying work at moment. Quote Link to comment Share on other sites More sharing options...
Kape01 Posted August 4, 2020 Author Share Posted August 4, 2020 Sorry if this is dumb question, just want to check to make sure I understand correct. I assume this method allows to select multiple segments at once using crossing window or would an internal point of each segment need to picked individually? Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 5, 2020 Share Posted August 5, 2020 The idea is pick say the text on a layer then make a selection set of all the text, loop through this getting insert pt of text use bpoly command to make a polygon you can get co-ords and the height & width. Ok only problem one of your text is off the rectang so no answer. The second issue is the H2 you would need to remove the middle line and run code again, could do an append to the csv file make it a second function but it uses same text. Here is a start as an example ; https://www.cadtutor.net/forum/topic/70959-text-polyline-data-to-csv/ ; test for get area inside a closed shape via text inside ; By Alan Aug 2020 (defun c:test ( / ent ent2 lay ss ins txt obj) (setq ent (entsel "\nPick Text for layer")) (setq lay (cdr (assoc 8 (entget (car ent))))) (setq ss (ssget (list (cons 8 lay)(cons 0 "Text")))) (repeat (setq x (sslength ss)) (setq ent2 (entget (ssname ss (setq x (- x 1))))) (setq ins (cdr (assoc 10 ent2))) (setq txt (cdr (assoc 1 ent2))) (command "bpoly" ins "") (setq obj (vlax-ename->vla-object (entlast))) (princ (strcat "\nArea is " (rtos (vla-get-area obj) 2 3) " Label is " txt)) (command "erase" (entlast) "") ) ) (c:test) Quote Link to comment Share on other sites More sharing options...
Kape01 Posted August 10, 2020 Author Share Posted August 10, 2020 Thanks BIGAL. Ignore the text outside the segment, I can relocate all text to the inside. I thought the H2 would be an issue, unfortunately I cant remove the line. Will just another label and can do the rest in excel. Will try and put something using the method you have suggested. Thanks. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 10, 2020 Share Posted August 10, 2020 That should work. Just add the h1 & h2 as part of data. Quote Link to comment Share on other sites More sharing options...
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.