Organic Posted October 5, 2019 Share Posted October 5, 2019 (edited) I have been provided with a few DWG survey files from a surveyor who I believe has used Carlson survey software addon for AutoCad to complete the survey. The survey points all come in on a layer called 'PTS' and each point is comprised of an attributed block that houses attributes for the description, height and point number for the point. I need to put the points on their own layer and retain the heights. E.g. NS points on a layer called NS and each point has its height. If I edit the block to add a point at the basepoint then when I explode the block the point will take on the height of the block although all points are then on a layer called PTS. Does anyone have any lisp tools or know of other ways of doing this in AutoCad where the would would be put on a layer representing their code (e.g. layers NS, TB etc)? Sample survey points.dwg Edited October 5, 2019 by Organic Edit: sample file of blocks attached Quote Link to comment Share on other sites More sharing options...
dlanorh Posted October 5, 2019 Share Posted October 5, 2019 Could you re-post the drawing in AutoCAD 2010 format. I have several routines that do something similar to what you want, but none specific to Carlsson Survey format. This used to be a major problem, as everyone seemed to have their own internal "point" format. Quote Link to comment Share on other sites More sharing options...
Organic Posted October 5, 2019 Author Share Posted October 5, 2019 Hi dlanorh, apologies, AutoCAd 2000 drawing attached. Thanks Sample survey points Acad 2000.dwg Quote Link to comment Share on other sites More sharing options...
BIGAL Posted October 5, 2019 Share Posted October 5, 2019 Very straight forward just need some time. Organic you should be able to do it. Just ssegt the "SRVPNO1" blocks Just get the insertion point of the block this give Z value Get layer name from the attribute do a (tblsearch "layers" desc) make if not exist Then make a point Quote Link to comment Share on other sites More sharing options...
dlanorh Posted October 5, 2019 Share Posted October 5, 2019 Ok, I have two blocks "SRVPNO1" and "SPT10". The first is the block of three attribute, the second a block of a cross (two lines), I assume to be the representation of a point. Which attributes do you want to retain, and in which layer(s), and what do you want to do with the "point" block? How do you want to represent the point, a point entity? Quote Link to comment Share on other sites More sharing options...
BIGAL Posted October 6, 2019 Share Posted October 6, 2019 (edited) dlanorh dont worry about 2 blocks as insert point is at correct xyz point. ; Create point at xyz from survey code block ; By Alan H info@alanh.com.au (defun lay-miss (misslay / ) (if (= (tblsearch "layer" misslay) "T") (princ (strcat "\n" misslay)) (command "-layer" "m" misslay "") ) (setvar 'clayer misslay) ) (defun survpoint ( / ss x att obj ins newlay) (setq ss (ssget "X" (list (cons 0 "Insert")(cons 2 "SRVPNO1")))) (repeat (setq x (sslength ss)) (setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1))))) (setq ins (vlax-get Obj 'insertionPoint)) (foreach att (vlax-invoke obj 'getattributes) (if (= (vla-get-tagstring att) "DESC2" ) (progn (setq newlay (vla-get-textstring att)) (princ (strcat "\n" newlay)) (lay-miss newlay) ) ) (command "point" ins) ) ) ) (survpoint) Edited October 6, 2019 by BIGAL Quote Link to comment Share on other sites More sharing options...
dlanorh Posted October 6, 2019 Share Posted October 6, 2019 1 hour ago, BIGAL said: dlanorh dont worry about 2 blocks as insert point is at correct xyz point. ; Create point at xyz from survey code block ; By Alan H info@alanh.com.au (defun lay-miss (misslay / ) (if (= (tblsearch "layer" misslay) "T") (princ (strcat "\n" misslay)) (command "-layer" "m" misslay "") ) (setvar 'clayer misslay) ) (defun survpoint ( / ss x att obj ins newlay) (setq ss (ssget "X" (list (cons 0 "Insert")(cons 2 "SRVPNO1")))) (repeat (setq x (sslength ss)) (setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1))))) (setq ins (vlax-get Obj 'insertionPoint)) (foreach att (vlax-invoke obj 'getattributes) (if (= (vla-get-tagstring att) "DESC2" ) (progn (setq newlay (vla-get-textstring att)) (princ (strcat "\n" newlay)) (lay-miss newlay) ) ) (command "point" ins) ) ) ) (survpoint) I know, but do we need to delete them etc..? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted October 6, 2019 Share Posted October 6, 2019 6 hours ago, BIGAL said: (= (tblsearch "layer" misslay) "T") @BIGAL The above statement will never return true. Quote Link to comment Share on other sites More sharing options...
Organic Posted October 6, 2019 Author Share Posted October 6, 2019 (edited) Thanks Bigal that achieves what I need. I have still not managed to get my head around more than the basics of lisp Dlanorh, I don't quite understand what Bigal's code does although it does seem to insert multiple points (at the same location); I'm, not sure if that is to do with the block though or if it is inserting one point per attribute? Overkill solves the duplicated points though and leaves just a single point. Edited October 6, 2019 by Organic Quote Link to comment Share on other sites More sharing options...
dlanorh Posted October 6, 2019 Share Posted October 6, 2019 2 hours ago, Organic said: Thanks Bigal that achieves what I need. I have still not managed to get my head around more than the basics of lisp Dlanorh, I don't quite understand what Bigal's code does although it does seem to insert multiple points (at the same location); I'm, not sure if that is to do with the block though or if it is inserting one point per attribute? Overkill solves the duplicated points though and leaves just a single point. See attached commented version of BIGAL's routine My inquiry was about what you want to do with the "SRVPNO1" and "SPT10" blocks. Did you want them deleting; and more specifically, did you want any of the other attibutes values, i.e. you could convert them into text entities in the same layer they are in the block. The level attribute might not be required, the description is used to put the point on the required layer but you may need the point number? This could all be combined into a short single lisp routine BIGAL1.lsp Quote Link to comment Share on other sites More sharing options...
BIGAL Posted October 6, 2019 Share Posted October 6, 2019 Thanks Tharwat and dlanorh I corrected the If for the layer and moved the make point a couple of lines up so now will only be once a oversight by me, just looked at the visual result when testing. Code updated above. Note in the dwg there is a "Point" on layer PNTS that already exists so should that be deleted or at least frozen ? BIGAL 1.lsp 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.