Community
Civil 3D Forum
Welcome to Autodesk’s Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Select surface labels

12 REPLIES 12
SOLVED
Reply
Message 1 of 13
robert06
2867 Views, 12 Replies

Select surface labels

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?

 

12 REPLIES 12
Message 2 of 13
doni49
in reply to: robert06

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




If a reply solves your issue, please remember to click on "Accept as Solution". This will help other users looking to solve a similar issue. Thank you.


Please do not send a PM asking for assistance. That's what the forums are for. This allows everyone to benefit from the question asked and the answers given.

Message 3 of 13
tcorey
in reply to: robert06

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


Tim Corey
MicroCAD Training and Consulting, Inc.
Redding, CA
Autodesk Gold Reseller

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
Message 4 of 13
doni49
in reply to: tcorey

Nice!



Don Ireland
Engineering Design Technician




If a reply solves your issue, please remember to click on "Accept as Solution". This will help other users looking to solve a similar issue. Thank you.


Please do not send a PM asking for assistance. That's what the forums are for. This allows everyone to benefit from the question asked and the answers given.

Message 5 of 13
robert06
in reply to: tcorey

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

 

Message 6 of 13
jmayo-EE
in reply to: tcorey

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

EESignature

Message 7 of 13
tcorey
in reply to: robert06

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



Tim Corey
MicroCAD Training and Consulting, Inc.
Redding, CA
Autodesk Gold Reseller

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
Message 8 of 13
robert06
in reply to: tcorey

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.

 

Message 9 of 13
tcorey
in reply to: jmayo-EE

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?

 

 

 

 

 

 

 

 

 



Tim Corey
MicroCAD Training and Consulting, Inc.
Redding, CA
Autodesk Gold Reseller

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
Message 10 of 13
jmayo-EE
in reply to: robert06

I would just put them on a different layer.

John Mayo

EESignature

Message 11 of 13
Anonymous
in reply to: tcorey

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!

Message 12 of 13
robert06
in reply to: robert06

I've seen this, too. After reopening the drawing or maybe civil, it usually works again.
Message 13 of 13
tcorey
in reply to: Anonymous

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. 



Tim Corey
MicroCAD Training and Consulting, Inc.
Redding, CA
Autodesk Gold Reseller

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report