OMEGA-ThundeR Posted July 27, 2016 Share Posted July 27, 2016 Hello, i got an GPS Survey readout and i use some program to translate it to an autocad drawing. Problem in this is that the conversion places everything (insertion point and some mtext labels) in the layer 0. With the 'Qselect' command i can filter certain textcontents and select all the labels with a certain content and place it in a layer, in the end i can filter objects by layer this way. This however is time consuming, so i would like to make some sort of LISP that does this in an automated way. FILTER and QSELECT don't have command line commands, so they are out of the question for lisp, but the internet said something about SSGET (ssget "_X" '((0 . "TEXT,MTEXT")(1 . "A*,B*"))) source: http://www.cadforum.cz/cadforum_en/qaID.asp?tip=6403 The content of text in the labels is something like: Huisaansluiting - DWA,Inlaat Huisaansluiting - HWA,Inlaat Kolken,Trottoirkolk Kolken,Inlaat Lets take the last one for example "Kolken,Inlaat" and then i use the following code: ;;; GPS converter (Defun C:gpsfilter () (setq kolkinlaat(ssget "_X" '((0 . "TEXT,MTEXT")(1 . "Kolken,Inlaat")))) (command "-layer" "make" "N-Layer-Kolkinlaat" "") (command ".laycur" kolkinlaat "") ) It selects all the texts but also returns a 'nil' output in command bar. It works (in a crude way, i want to add some IF and AND's and what not), but i wonder that the 'nil' returns come from and why it does that. i believe the comma between 'Kolken' and 'Inlaat' causes some trouble? Perhaps i need to do a 'find and replace' action first? Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted July 27, 2016 Share Posted July 27, 2016 (command ...) always returns nil. And since this is the last statement of your defun the function also returns nil. Quote Link to comment Share on other sites More sharing options...
OMEGA-ThundeR Posted July 27, 2016 Author Share Posted July 27, 2016 Ah, i guess i missed the '(princ)' part at the end of the command. Built it bigger with multiple text contents to find and it seems to work perfectly, so i guess no worries there. For future reference (or perhaps some people want to improve this basic code) my code so far: ;;; GPS converter (Defun C:gpsfilter () (setq kolkinlaat(ssget "_X" '((0 . "TEXT,MTEXT")(1 . "Kolken,Inlaat")))) (setq kolktstuk(ssget "_X" '((0 . "TEXT,MTEXT")(1 . "Kolken,T-stuk")))) (setq huisdwainlaat(ssget "_X" '((0 . "TEXT,MTEXT")(1 . "Huisaansluiting - DWA,Inlaat")))) (setq overig(ssget "_X" '((0 . "TEXT,MTEXT")(1 . "Overig*")))) (setq huisdwabocht(ssget "_X" '((0 . "TEXT,MTEXT")(1 . "Huisaansluiting - DWA,Bocht")))) ;; Top part searches for text content and places textobjectsin a SETQ ;; Bottom part creates layers, when creating layer it goes to current and ;; then i place 'SETQ' content to the current layer. (command "-layer" "make" "R-XX-KOLK_INLAAT-T" "") (command ".laycur" kolkinlaat "") (command "-layer" "make" "R-XX-KOLKLEIDING_T_STUK-T" "") (command ".laycur" kolktstuk "") (command "-layer" "make" "R-XX-HUISAANSLUITING_DWA_INLAAT-T" "") (command ".laycur" huisdwainlaat "") (command "-layer" "make" "R-XX-RIOOL_OVERIGE-T" "") (command ".laycur" overig "") (command "-layer" "make" "R-XX-HUISAANSLUITING_DWA_BOCHT-T" "") (command ".laycur" huisdwabocht "") (princ) ) (and for the people who don't understand the words, its dutch ) Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 28, 2016 Share Posted July 28, 2016 As an alternative method if the comma may be doing some funny things in the ssget filter why not just check the text within 1 big selection set using a series of cond statements and put on correct layer. 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.