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 blocks by surface

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
charles.neely
622 Views, 10 Replies

Select blocks by surface

I have a cut/fill volume surface with 2 ranges that leave a gap of 4 feet. I would like to select all tree blocks that are within the two ranges. Is this possible? Thanks, 

10 REPLIES 10
Message 2 of 11
tcorey
in reply to: charles.neely

Do the tree blocks have elevations?



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

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
Message 3 of 11
charles.neely
in reply to: tcorey

Yes, they do have elevations.

Message 4 of 11
tcorey
in reply to: charles.neely

Be patient. I might be able to have something for you by this afternoon....assuming the phone doesn't ring off the hook between now and then!



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

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
Message 5 of 11
tcorey
in reply to: charles.neely

That was easier than I thought. Here's some LISP code that does what you're asking for:

 

;Select blocks within existing surface elevation analysis ranges

;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 responsibility of any person using this code
;to evaluate and test to be sure the code works for your needs.

;the program requests you select a representative block. All blocks of that name are added to a selection set.
;A surface selection is then requested.
;The program then creates a selection set of all blocks of the correct name and that fall within the
;elevation ranges of the elevation analysis applied to the surface.
;To use the selection set, select Previous.


(defun c:go ( / reptree blknam trees treesx surf **** zanal xreg cnt ctr itm minz maxz ctr1 len ob obz)
  (vl-load-com)

  (setq reptree (car (entsel "\nSelect representative tree block: ")))
  (setq blknam (cdr (assoc 2 (entget reptree))))
  (setq trees (ssget "x" (list (cons 2 blknam))))
  (setq treesx (ssadd))

  

  (setq surf (vlax-ename->vla-object (car (entsel "\nSelect Surface: ")))
	**** (vlax-get-property surf 'SurfaceAnalysis)
	zanal (vlax-get-property **** 'ElevationAnalysis)
	zreg (vlax-get-property zanal 'ElevationRegions)
	cnt (vlax-get-property zreg 'Count)
	ctr 0)

  (while (< ctr cnt)

    (setq itm (vlax-get-property zreg 'item ctr))
    (setq minz (vlax-get-property itm 'MinimumElevation)
	  maxz (vlax-get-property itm 'MaximumElevation)
	  )

    (setq ctr1 0
	  len (sslength trees)
	  )

    (while (< ctr1 len)
      (setq ob (ssname trees ctr1))
      (setq obz (cadddr (assoc 10 (entget ob))))
      (if (and (<= obz maxz)(>= obz minz))
	(ssadd ob treesx)
	)
      (setq ctr1 (1+ ctr1))
      )
    (setq ctr (1+ ctr))
    )
  (vl-cmdf "Select" treesx "")
  (princ)
  );end defun

    

 

Best regards,

 

Tim



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

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
Message 6 of 11
jmayo-EE
in reply to: charles.neely

Not that a lisp to automate this would not be better but I would bet a map query could do this.

 

I also think it could be as easy as going into a Front (or Back or Right or Left) view, draw a pline at the top and bottom of the elv range and simply select everyting in those ranges with a crossing window using the plines as a guide.

John Mayo

EESignature

Message 7 of 11
tcorey
in reply to: tcorey

In my code, the auto-censor that Autodesk uses changed the variable I used that is short for Analysis. Unfortunately, I used the first four letters of that word and it got zapped for being potentially pornographic. Sorry about that.

 

Anywhere you see ****, just put in whatever you want, but be sure to use the same in all of those locations. If you want to go back to the first four letters of Analysis, that was what I originally used. Innocent mistake, sorry.

 

Good thing this is not a proctologists discussion group. They wouldn't be able to get anything done! 😉

 

Tim

 

 

 



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 11
charles.neely
in reply to: tcorey

It was a great effort, but it didnt work. After trying it I realized my tree block is at the actual point elevation and my cut/fill surface is the difference between FG and EG.

Message 9 of 11
tcorey
in reply to: charles.neely

There is a surface tool that moves blocks to a surface elev. move the trees to the vol surf and run the routine again.


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 11
gunnarl
in reply to: charles.neely

I beleive you can accomplish this using the FILTER command. Add block name, and 2 elevation filters using <= or >= and the elevations of your blocks for each range. See attached image an an example. If your not familiar with the filter command Autocad help has some good info. Not as elegant as a lisp though...

 

 

Gunnar

Message 11 of 11
charles.neely
in reply to: tcorey

That did the trick! Thanks for the lisp and the direction to the blocks to surface command. Hadnt seen that one before.

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

Post to forums  

Rail Community


 

Autodesk Design & Make Report