verb222 Posted July 15, 2016 Share Posted July 15, 2016 Hi, I need advice/idea. I have uploaded example1.dwg It's easiest way to explain what I need advice for. My job is to design cables. Data that I need to put in drawing are cable_number and connection_number and I have way doing those. But... Later, I also need show that data in excel table like attached. I plan to do it via Export Attribute Information. Now, imagine whole town, lots of different street names, house numbers. I need advice how to put easily those data from existing landbase drawing (street name, house number) into block because no other way of making xls table doesn't come to my mind. Maybe it can be done using some GIS program, it is an option if somebody convince me it is possible - I'll learn it. Maybe it can be done via some lisp, routine... (programing of those is chinese language for me ) Manual way of doing the table would be BLOCK without street names and house numbers, just cable data... AND... opening excel and putting data by typing. I would appreciate advice/idea how to do it easiest way. Tnx for giving it a thought. Example1.xlsx Example1.dwg Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 16, 2016 Share Posted July 16, 2016 Pretty easy need some time, enter cable number, pick st name, Repeat -> pick house no, place block. Other alternative is place block lots of them first, line up nicely etc then Repeat -> pick house no, pick block. Suns out I am going fishing. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 16, 2016 Share Posted July 16, 2016 (edited) This is so close it has an error some where some days you just can not see it. Matches Example dwg. code fixed see next post Edited July 21, 2016 by BIGAL Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 16, 2016 Share Posted July 16, 2016 Try this (vl-load-com) (defun c:HOUSE ( / cableno stname blkobj) (setq Connectno (Getint "\nConnection Number")) (setq Cableno (getstring "\nEnter Cable No")) (setq stname (vla-get-textstring (vlax-ename->vla-object (car (entsel "\nPick Street Name"))))) (while (/= nil (setq Hnum (vla-get-textstring (vlax-ename->vla-object (car (entsel "\nSelect House number pick nothing to exit")))))) (setq blkobj (vlax-ename->vla-object (car (entsel "\nPick House block")))) (foreach att (vlax-invoke blkobj 'getattributes) (if (= "STREET_NAME" (vla-get-tagstring att)) (vla-put-textstring att stname) ) ; end if (if (= "ADDRESS_NUMBER" (vla-get-tagstring att)) (vla-put-textstring att Hnum) ) ; end if (if (= "CABLE_NUMBER" (vla-get-tagstring att)) (vla-put-textstring att Cableno) ) ; end if (if (= "CONNECTION_NUMBER" (strcase (vla-get-tagstring att))) (vla-put-textstring att (rtos Connectno 2 0)) ) ; end if ) ; foreach (setq Connectno (+ 1 Connectno)) ) ;while (princ) ; exit neatly ) ; Defun (c:house) ;for testing remove after Quote Link to comment Share on other sites More sharing options...
verb222 Posted July 16, 2016 Author Share Posted July 16, 2016 (edited) BiGAL, thank you! Your's code was inspiration for further idea enhancement. From it, I've made two lisps. One inputs house number from picked text to attribute, and second one puts street name from picked text to attribute. Cable stuff attributes are unnecessary for this purpose. I changed yours code by deleting what I was thought was excess/over. Please, don't laugh. Probably it needs some reduction, but I don't understand it too much, so I've just made it works for me, like this: 1. house number (vl-load-com) (defun c:Han ( / cableno stname blkobj) (while (/= nil (setq Hnum (vla-get-textstring (vlax-ename->vla-object (car (entsel "\nSelect House number pick nothing to exit")))))) (setq blkobj (vlax-ename->vla-object (car (entsel "\nPick House block")))) (foreach att (vlax-invoke blkobj 'getattributes) (if (= "ADDRESS_NUMBER" (vla-get-tagstring att)) (vla-put-textstring att Hnum) ) ; end if ) ; foreach ) ;while (princ) ; exit neatly ) ; Defun (c:house) ;for testing remove after Now 2. street name Code: (vl-load-com) (defun c:hsn ( / cableno stname blkobj) (while (/= nil (setq Hnum (vla-get-textstring (vlax-ename->vla-object (car (entsel "\nSelect House number pick nothing to exit")))))) (setq blkobj (vlax-ename->vla-object (car (entsel "\nPick House block")))) (foreach att (vlax-invoke blkobj 'getattributes) (if (= "STREET_NAME" (vla-get-tagstring att)) (vla-put-textstring att Hnum) ) ; end if ) ; foreach ) ;while (princ) ; exit neatly ) ; Defun (c:house) ;for testing remove after Please, can you do one more thing for me. Make second code (street address) to work like this: First I pick text with street name, and than that command keeps executing in the way I dont need any more to choose source input for street name - just to be able paste it in more then one block attributes. Something similar how MATCH PROPERTIES works. You pick source, and all clicks after that are "pasteing" the same properties to different objects (blocks in this case). Once again, tnx! Edited July 21, 2016 by SLW210 Added Code Tags. Quote Link to comment Share on other sites More sharing options...
verb222 Posted July 20, 2016 Author Share Posted July 20, 2016 Hi, I did it. I put WHILE loop and it works. It was quite long reading about LISPing, but I made something work... even it was changing someone else's code, but... I am happy I must confess, it was very motivating for future learning about LISPing. Hope it'll be time for that. Once again, tnx. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 21, 2016 Share Posted July 21, 2016 No worries, changing a block attribute is relatively simple. There is a second method in that you just use the attribute creation order att1 att2 etc and change the required one so dont need to worry about attribute name. Ps use the code tags next time thats the # option or the administrator will be after you. Quote Link to comment Share on other sites More sharing options...
verb222 Posted July 21, 2016 Author Share Posted July 21, 2016 Sorry, i thought "Code:" works like "#". Sorry! ;just wanna try it I have problem now: I realized possibilities with programming/combining LISPs. Now I am spending hours learning, browsing, reading... Luckily, I am on vacation Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 21, 2016 Share Posted July 21, 2016 [ c o d e ] and [/ c o d e ] without spaces Re vacation started in 1980's with lisp. But others are just so brilliant, leaning all the time. 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.