How to select labels of one particular surface? Select similar filter can't be narrowed down to civil object detail, neither does not work Quick select by Surface name or style etc. Or am I missing something here?
Solved! Go to Solution.
Solved by tcorey. Go to Solution.
I don't know of a way to filter by surface. But since labels are only shown for surfaces that are displayed, you could temporarily set the OTHER surfaces to a non-display surface style and the related labels will also turn off. You will be left with the one remaing surface and its labels.
Don Ireland
Engineering Design Technician
This LISP code makes a selection set for you. When you run another command and it asks to select objects, just give it P (previous).
(defun c:go ( / lbl srf srfnm All_lbls lbls clbl clblv clblsrf clblsrfnm len ctr) (vl-load-com) (setq lbl (vlax-ename->vla-object (car (entsel "\nSelect reference label: ")))) ;(vlax-dump-object lbl t) (setq srf(vlax-get-property lbl 'Surface)) ;(vlax-dump-object srf t) (setq srfnm (vlax-get-property srf 'Name)) (setq All_lbls (ssget "x" (list (cons 0 "AECC_SURFACE_ELEVATION_LABEL"))) len (sslength All_lbls) ctr 0) (setq lbls (ssadd)) (while (< ctr len) (setq clbl (ssname All_lbls ctr)) (setq clblv (vlax-ename->vla-object clbl) clblsrf (vlax-get-property clblv 'Surface) clblsrfnm (vlax-get-property clblsrf 'Name) ) (if (= clblsrfnm srfnm) (ssadd clbl lbls) ) (setq ctr (1+ ctr)) );end while (vl-cmdf "Select" lbls "") (princ) );end defun
Nice!
Don Ireland
Engineering Design Technician
Hi, thank you!
Surface contour labels are groups and won't get selected with the lisp. Would it be possible that it worked also with surface label groups?
Robert
Kudos Tim. Very nice of you to share the code I am sure everyone stuck using the NCS template or a variation of it will find the code useful.
On a side note I don't need the code. I can use the layer isolate command to do what the OP wants. 🙂
I am continually amazed at all the hoops the NCS template forces users to go through. Wasting time with new code to write, new commands to learn & new things to manage because the template is set up as it is with all styles hard coded to layers. This forces you to have layers and styles that you don't need to have, see, manage or waste time configuring layer filters and states for.
If a template is set up with Object layers configured in the drawing settings and all styles (object and label) are forced to layer zero then the layer isolate command on the surface labels will work as the OP requested and you will not get labels from other surfaces. No code needed. On top of this all layer commands work on all c3d objects (layoff, layfrx, layiso, laycur,etc). With this setup you have no need for layer filters or state since you can purge layers, no No need for the Object Isolate commands since the layer commands work...
John Mayo
Try this:
(defun c:go ( / lbl srf srfnm All_lbls lbls clbl clblv clblsrf clblsrfnm len ctr lbltyp) (vl-load-com) (setq lbl (car (entsel "\nSelect reference label: "))) (setq lbltyp (cdr (assoc 0 (entget lbl)))) (setq lbl (vlax-ename->vla-object lbl)) ;(vlax-dump-object lbl t) (setq srf(vlax-get-property lbl 'Surface)) ;(vlax-dump-object srf t) (setq srfnm (vlax-get-property srf 'Name)) (setq All_lbls (ssget "x" (list (cons 0 lbltyp))) len (sslength All_lbls) ctr 0) (setq lbls (ssadd)) (while (< ctr len) (setq clbl (ssname All_lbls ctr)) (setq clblv (vlax-ename->vla-object clbl) clblsrf (vlax-get-property clblv 'Surface) clblsrfnm (vlax-get-property clblsrf 'Name) ) (if (= clblsrfnm srfnm) (ssadd clbl lbls) ) (setq ctr (1+ ctr)) );end while (vl-cmdf "Select" lbls "") (princ) );end defun
Thank you, Tim!
I just added (sssetfirst nil lbls) to get them selected straight away.
Don's first proposal is a workaround, thanks for checking out the issue. Still, I would not like to hassle with setting & reverting the styles of surfaces, I wonder why the native quick select option does not work with the labels, i believe it is intended to be possible as it is enabled in the quick select window.
John, thank you. I see now, you could set style layers to 0 and work with layers not styles. But, if it is necessary to change anything else in the style but properties handled by layer (color, lweight, linetype) - text height etc, you'll have to operate both, the layer and the style.
Also, I wish layer commands would work on civil styles' nested level if needed but that's another subject.
John, what do you do in the case where he has spot elevation labels and contour labels for the same surface but he only wants to choose the spots?
Great code!
On 2017 often it does not work. Just ends with:
Select reference label: ; error: Automation Error. Unspecified error
What could be the problem?
Thanks a lot!
Thanks an error we get when the code is written for older versions and we haven’t updated to the latest. I can take a look this afternoon or tomorrow.
Can't find what you're looking for? Ask the community or share your knowledge.