I'm using Civil 3D 2013. I'd like to be able to select all of the spot grades that are using a specific style. I have tried using Quick Select to do this, but have had zero luck. Here are the parameters I've been using:
Apply to: Entire Drawing
Object type: Surface Elevation Label
Properties: Surface Spot Elevation Label Style
Operator: = Equals
Value: style_name
In the value box I paste in the name of the surface spot elevation label style. After clicking okay, it always says "0 item(s) selected". I've tried a few different style names (all of which are in use). I've searched the web and haven't really found any information about people using the quick select command for this purpose. Any thoughts?
That's very possible with a short LISP routine:
;select all labels of a particular style. ;copyright 2014, Timothy Corey ;Delta Engineering Systems ;Autodesk Authorized Value-Added Reseller ;Redding, CA ;permission is hereby granted to use this code for free. ;This code may not be sold or included in any for-sale software ;It is the repsonsibility of any person using this code ;to evaluate and test to be sure the code works for your needs. (defun c:go () ;get representative label and its lable style info (setq rep (car (entsel "\nSelect a representative label" ))) (setq repv (vlax-ename->vla-object rep)) (setq replblsty (vlax-get-property repv 'LabelStyle)) (setq repname (vlax-get-property replblsty 'Name)) (setq finalSS (ssadd)) ;create the container for filtered selection set (setq otyp (cdr (assoc 0 (entget rep)))) ;get object type (setq ls (ssget "x" (list (cons 0 otyp))) ;make selection set of all labels of type len (sslength ls) ;selection set length ctr 0) ;inititialize counter (while (< ctr len) (setq lbl (ssname ls ctr)) ;object in selection set at counter position (setq lblv (vlax-ename->vla-object lbl)) ;vlisp version of object (setq lblsty (vlax-get-property lblv 'LabelStyle)) ;labelstyle (setq styNam (vlax-get-property lblsty 'Name)) ;name of labelstyle (if (= styNam repname) ;if item in list label style name equals representative object (ssadd lbl finalss) ;add that object to the final selection set ) (setq ctr (1+ ctr)) ;increment the counter );end while (vl-cmdf "Select" finalss "") ;Use Select command to make a Previous selection set (prompt "\nUse Previous selection set to access labels...") (princ) );end defun
Best regards,
Tim
The OP said you wanted to create a selection set by label style name. This creates a selection set. To do something with it, start a command and when AutoCAD asks to Select Objects: type P for Previous.
If there is something specific you're trying to do with the selected labels, let me know what that is and I will modify the routine.
Glad to hear Tim got you going with the lisp. The question does remain; Why doesn't QSelect work when by all appearances it should?
Allen
Allen Jessup
CAD Manager - Designer
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
I actually posted the question not btmarvel, but it looks like you've posted something that has definitely helped him out. Thank you for posting the lsp. I'm still struggling to get it to work though. When I run the lsp, it asks me to "Select a representative label". As you posted (and as the code hints), I hit "p" enter. Since I selected a surface spot elevation label before I ran the lsp, I figured it would work. Unfortunately it tells me, "Invalid Selection", "Expects a point or Last".
To Allen's point, yes, why doesn't the Quick Select Command just work. It's interesting that when you use the tool to select by layer it provides a drop-down menu with a list of all of the layers. For the label styles it doesn't provide the same drop-down selection menu. Could it be that label styles have a computer recognizable name that differs from the name we see (and the quick select will only work with the computer recognizable name)?
I think the QSelect routine is written to provide a list of properties it can extract from a selected object type. It's more likely it can extract a list from a basic AutoCAD object or a property that is basic to AutoCAD. It seems to have trouble with Civil 3D objects and properties.
Allen
Allen Jessup
CAD Manager - Designer
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
@Anonymous wrote:
Unfortunately it tells me, "Invalid Selection", "Expects a point or Last".
What command are you starting before you hit P? It has to be one that will accept a selection set of labels.
Allen
Allen Jessup
CAD Manager - Designer
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
When the routine asks you to select a representative label, pick one on the screen.
The use of Previous selection set is after the lisp routine has finished and you are trying to select those filtered objects.
Let's say you want to Erase all spot elevation labels of style name TEST. Run the lisp routine, pick a label of that style name as a representative.
The routine is done. Now start the Erase command. When AutoCAD asks you to Select Objects: type P for Previous. This will select all those labels that were filtered into a selection set by the lisp routine.
Tim
Thanks, Jeff. I didn't know about sssetfirst.
I don't see an option for rotation. These are the options for Alignment Station Labels.
Allen Jessup
CAD Manager - Designer
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Quick Select actually works when selecting by rotation angle. Thank you very much for making me try again.
Older post, but this LISP routine has helped out tremendously for my project. Posting Kudos to the creator!
Great routine!
Any idea why it doesn't seem to work with General Line Segment labels?
Thanks for your time.
Select a representative label; error: Automation Error. Unspecified error
Great routine except for line and curve labels.
To all who were wanting to use this for line and curve labels.
change
(setq replblsty (vlax-get-property repv 'LabelStyle))
and
(setq lblsty (vlax-get-property lblv 'LabelStyle)) ;labelstyle
to
(setq replblsty (vlax-get-property repv 'LineLabelStyle))
and
(setq lblsty (vlax-get-property lblv 'LineLabelStyle)) ;labelstyle
this needs to be a different lisp from the original post since the veriables are different. Maybe someone better than me can post a way to combine them. please note that a line also has an arc style listed and vise versa. this will grab all lines and arcs that have both styles the same.