4o4osan Posted October 25, 2014 Share Posted October 25, 2014 Hi, I want to select surfaces by name, add them it into selection set and change there layers to something else. The idea behind is that I want to make a certain draw order in my drawing, but the case is that almost all of the civil objects are created in layer 0, so they are not selectable by layer. By now I managed to select them by type, but I still need to filter out serfaces including "DES" in there names and change there layer to known existing layer. Any ideas will be helpful:) Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted October 25, 2014 Share Posted October 25, 2014 QSELECT command doesn't help? Quote Link to comment Share on other sites More sharing options...
4o4osan Posted October 25, 2014 Author Share Posted October 25, 2014 QSELECT does work of course, but I want to apply certain draw order on multiple drawings. I have the order list and by selection of each object I am arranging the order, but I have surfaces like PRE and DES which needs to be in a different level of the order. Selection of all surfaces doesn't work, I need a specific one. This is what I have so far: (defun YesNo (BoxTitle Question / Dcl_Id% Result acadfn fn fid) (if (and (or (setq fn (findfile "YesNo.dcl")) (setq acadfn (findfile "ACAD.PAT") fn (strcat (substr acadfn 1 (- (strlen acadfn) 8 )) "YesNo.dcl"))) (setq fid (open fn "w")) ) (progn (foreach x (list "YesNo : dialog { key = \"Title\";" " spacer;" (strcat " : text { key = \"Question\" ; width = " (itoa (+ (strlen Question) 4)) " ; alignment = centered; }") " spacer;" " : row { fixed_width = true; alignment = centered;" " : button { key = \"Yes\"; label = \"&Yes\"; is_default = true;}" " : button { key = \"No\"; label = \"&No\"; is_cancel = true;}" " }" "}" ) (princ x fid) (write-line "" fid) ) (close fid) ) ) (cond ((setq Dcl_Id% (load_dialog fn)) (new_dialog "YesNo" Dcl_Id%) (set_tile "Title" BoxTitle) (set_tile "Question" Question) (action_tile "Yes" "(done_dialog 1)") (action_tile "No" "(done_dialog 0)") (setq Result (start_dialog)) (unload_dialog Dcl_Id%) ; Unload Dialog (if (and Result (= Result 1)) (setq check 1)(setq check 2)) ) (t nil) ) ) (defun DRO (/ aa bb cc dd ee) (if (SETQ aa (ssget "x" (list (CONS 0 "AECC_TIN_SURFACE")))) (command "_.draworder" aa "" "_front")) (if (SETQ bb (ssget "x" (list (CONS 0 "AECC_SURFACE_CONTOUR_LABEL_GROUP")))) (command "_.draworder" bb "" "_front")) (if (SETQ SS (ssget "x" (list (CONS 8 "56-DES")))) (command "_.draworder" SS "" "_front")) (if (SETQ cc (ssget "x" (list (CONS 0 "AECC_ALIGNMENT_STATION_LABEL_GROUP")))) (command "_.draworder" cc "" "_front")) (if (SETQ dd (ssget "x" (list (CONS 0 "AECC_SAMPLE_LINE")))) (command "_.draworder" dd "" "_front")) (if (SETQ ee (ssget "x" (list (CONS 0 "AECC_ALIGNMENT")))) (command "_.draworder" ee "" "_front")) (setq check nil) ) (YesNo "CHECK, CHECK DOUBLE CHECK!!!" "DID YOU PUT THE DESIGN IN LAYER 56-DES?") (if (= check 1) (DRO) (setq check nil) ) but it is not the most elegant way with that warning window:) Quote Link to comment Share on other sites More sharing options...
SLW210 Posted October 27, 2014 Share Posted October 27, 2014 Please read the Code Posting Guidelines and edit your post to include the Code in Code Tags. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted October 27, 2014 Share Posted October 27, 2014 Here is a surface selection by name routine. ; change contours via a lisp used with toolbar ; By A Houston 2012 ; (defun c:Surface (/ appstr lst surface ss) ;; Assign new style to selected Civil 3D surfaces ;; Required Subroutines: AT:ListSelect ;; by Alan J. Thompson, 06.22.10 (if ((lambda (vrsn) (cond ((vl-string-search "R17.2" vrsn) (setq appstr "6.0")) ;09 ((vl-string-search "R18.1" vrsn) (setq appstr "8.0")) ;11 ((alert "This version of C3D not supported!")) ) ) (vlax-product-key) ) (progn (cond (*AeccDoc*) ((setq *AeccDoc* (vlax-get (cond (*AeccApp*) ((setq *AeccApp* (vla-getinterfaceobject (cond (*Acad*) ((setq *Acad* (vlax-get-acad-object))) ) (strcat "AeccXUiLand.AeccApplication." appstr) ) ) ) ) 'ActiveDocument ) ) ) ) (vlax-for i (vlax-get *AeccDoc* 'SurfaceStyles) (setq lst (cons (cons (vla-get-name i) i) lst)) ) (if (and lst (setq surface (car (AT:ListSelect "Set new surface style" "Select style" 10 10 "false" (vl-sort (mapcar (function car) lst) '<) ) ) ) (setq ss (ssget "_:L" '((0 . "AECC_TIN_SURFACE")))) ) (progn (vlax-for x (setq ss (vla-get-activeselectionset *AeccDoc*)) (vlax-put x 'Style (cdr (assoc surface lst))) ) (vla-delete ss) ) ) ) ) (princ) ) 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.