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: 

Lisp routine to elevate closed boundary to number shown on text

18 REPLIES 18
SOLVED
Reply
Message 1 of 19
max_bellato
1681 Views, 18 Replies

Lisp routine to elevate closed boundary to number shown on text

Does anyone know of a lisp routine that will create closed boundaries from a drawing, ie 2D site plan showing streets and pads, offset those boundaries slightly so that each one does not touch and then convert that boundary line to an elevated 3D polyline based off of a piece of plain text showing an elevation, ie. 1250.3
This is probably a very easy lisp routine for someone to write but I have no clue.
Please help.

18 REPLIES 18
Message 2 of 19
tcorey
in reply to: max_bellato

Hi Max,

 

Can you post a sketch of what you're trying to accomplish?

 

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 3 of 19
Neilw_05
in reply to: max_bellato

Without going into details I can think of a solution using Map.

1: Create a polygon topology using the existing line work.
2: Perform a buffer analysis to create the offset polygons
3: Use a Map query using the Alter properties option to elevate the polygons using the text as the elevation source.
Neil Wilson (a.k.a. neilw)
AEC Collection/C3D 2024, LDT 2004, Power Civil v8i SS1
WIN 10 64 PRO

http://www.sec-landmgt.com
Message 4 of 19
max_bellato
in reply to: Neilw_05

Neil,

 

I will try your suggestion.

Ultimately I would like to have any linework that crosses in my 2 D file be created into a closed polyline and then converted to a 3D polyline and then elevated to an elevation shown on a piece of text string, oh, and be done globally. 

(see attachment for example of before and after)

 

Thanks

 

Message 5 of 19
max_bellato
in reply to: Neilw_05

I may be doing this incorrectly but it seems the line work needs to be flawless just to create a polygon topology. Secondly, I know I don't know how to do this but how do you elevate polygon based on text? Thanks for your help.
Message 6 of 19
Pointdump
in reply to: max_bellato

Max,

 

Not as slick as Neil's method, but here's another possible workflow:

 

To Trim and Join and Tidy Up Polylines:
Planning & Analysis >> Tools >> Map Edit >> MAPCLEAN


Mapclean.png

 

To Offset:
Home Tab >> Create Design >> Feature Line >> Create Feature Line From Stepped Offset


SteppedOffset.png

 

Dave

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2024
Message 7 of 19
max_bellato
in reply to: Pointdump

Dave, thanks for the response.

 

That is the exact way we are doing it now. Each lot elevated one at a time, just trying to find a global solution.

Message 8 of 19
tcorey
in reply to: max_bellato

Max, is this what you're looking for? I did not include an offset of the new polylines, but if you really need that, let me know how far to offset and I can add the code in short order.

 

Tim

 

 

;|copyright 2014 Timothy Corey,Delta Engineering Systems
Redding, CA
Permission is granted to use this code as you see fit, but
this code may not be sold or used in any for-sale software.
It is the responsibility of the user to verify the accuracy
of the program and suitability for your own use.

The new polylines are placed on the current layer.|;



(defun c:go(/ ls len ctr tobj p1 pl plx)

  (vl-load-com)

(prompt "\nSelect Text Objects: ")
  (setq ls (ssget) ;ask user to pick selection set of text items
	len (sslength ls)  ;get number of items in set
	ctr 0)             ;set counter to 0

  (while (< ctr len)    ;while the counter is less than the selection set length

    (setq tobj (ssname ls ctr))  ;get individual object from set
    (if (or (= (cdr (assoc 0 (entget tobj))) "MTEXT") (= (cdr (assoc 0 (entget tobj))) "TEXT")) ;if it is a text or mtext object
      (progn
	(setq p1 (cdr (assoc 10 (entget tobj)))    ;get insertion point of text
	      )
	(vl-cmdf "boundary" "A" "B" "E" "I" "N" "" "O" "P" "" p1 "") ;use boundary command to create polyline
	(setq pl (entlast)
	      plx (entget pl)
	      )
	(setq plx (subst (cons 38 (atof (cdr (assoc 1 (entget tobj)))))   ;change elevation of polyline to equal text value of text
			 (assoc 38 plx)
			 plx)
	      )
	(entmod plx)
	(entupd pl)
	);end progn
      );end if
    (setq ctr (1+ ctr))
    );end while
  (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 9 of 19
max_bellato
in reply to: tcorey

Tim, this is perfect, you are amazing!
Can you add the option for the user to select the offset distance?
Thanks so much
Message 10 of 19
Neilw_05
in reply to: tcorey

Well done Tim. The Map solution is too complex to explain in the forum so I'm glad you stepped up with an automated solution.

Kudos to you.
Neil Wilson (a.k.a. neilw)
AEC Collection/C3D 2024, LDT 2004, Power Civil v8i SS1
WIN 10 64 PRO

http://www.sec-landmgt.com
Message 11 of 19
tcorey
in reply to: max_bellato

This version asks the user for offset distance.

 

Tim

 

;|copyright 2014 Timothy Corey,Delta Engineering Systems
Redding, CA
Permission is granted to use this code as you see fit, but
this code may not be sold or used in any for-sale software.
It is the responsibility of the user to verify the accuracy
of the program and suitability for your own use.

The new polylines are placed on the current layer.|;



(defun c:go(/ ls len ctr tobj p1 pl plx)

  (vl-load-com)

(prompt "\nSelect Text Objects: ")
  (setq ls (ssget) ;ask user to pick selection set of text items
	len (sslength ls)  ;get number of items in set
	ctr 0)             ;set counter to 0
  (setq OffDis (getreal "\nEnter offset distance: "))

  (while (< ctr len)    ;while the counter is less than the selection set length

    (setq tobj (ssname ls ctr))  ;get individual object from set
    (if (or (= (cdr (assoc 0 (entget tobj))) "MTEXT") (= (cdr (assoc 0 (entget tobj))) "TEXT")) ;if it is a text or mtext object
      (progn
	(setq p1 (cdr (assoc 10 (entget tobj)))    ;get insertion point of text
	      )
	(vl-cmdf "boundary" "A" "B" "E" "I" "N" "" "O" "P" "" p1 "") ;use boundary command to create polyline
	(setq pl (entlast)
	      plx (entget pl)
	      )
	(setq plx (subst (cons 38 (atof (cdr (assoc 1 (entget tobj)))))   ;change elevation of polyline to equal text value of text
			 (assoc 38 plx)
			 plx)
	      )
	(entmod plx)
	(entupd pl)
	(vl-cmdf "Offset" offdis pl p1 "E")
	(vl-cmdf "Erase" pl "")
	);end progn
      );end if
    (setq ctr (1+ ctr))
    );end while
  (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 12 of 19
max_bellato
in reply to: tcorey

Tim,

 

Thanks so much for your help with this, I appreciate the time you spent on this.

 

And thanks to eveyone else that gave suggestions.

Message 13 of 19
neilyj666
in reply to: tcorey

Great lisp but how does it determine the side to offset? I tried with some test polylines and the offset went to the inside rather than the outside of the closed polylines.

neilyj (No connection with Autodesk other than using the products in the real world)
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.

EESignature


AEC Collection 2024 UKIE (mainly Civil 3D UKIE and IW)
Win 11 Pro x64, 1Tb Primary SSD, 1Tb Secondary SSD
64Gb RAM Intel(R) Xeon(R) W-11855M CPU @ 3.2GHz
NVIDIA RTX A5000 16Gb, Dual 27" Monitor, Dell Inspiron 7760
Message 14 of 19
tcorey
in reply to: neilyj666

It offsets towards the insertion point of the text on the inside. It could be modified if you need it to offset to the outside.


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

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
Message 15 of 19
neilyj666
in reply to: tcorey

Thanks for the reply Tim

 

I get data that typically will show a house plot outline and a finished floor level within the plot and I need to create a typical 2.5m offset (for scaffolding etc) outside the plot boundary and also adjust the levels to earthworks level so it would be great if you could modify the lisp to offset outside and I can use other techniques to adjust the levels.

 

Thanks

neilyj (No connection with Autodesk other than using the products in the real world)
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.

EESignature


AEC Collection 2024 UKIE (mainly Civil 3D UKIE and IW)
Win 11 Pro x64, 1Tb Primary SSD, 1Tb Secondary SSD
64Gb RAM Intel(R) Xeon(R) W-11855M CPU @ 3.2GHz
NVIDIA RTX A5000 16Gb, Dual 27" Monitor, Dell Inspiron 7760
Message 16 of 19
tcorey
in reply to: neilyj666

Neil, would you like to post a drawing or send me one: tcorey at shasta dot com?



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

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
Message 17 of 19
neilyj666
in reply to: tcorey

Will do tomorrow

neilyj (No connection with Autodesk other than using the products in the real world)
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.

EESignature


AEC Collection 2024 UKIE (mainly Civil 3D UKIE and IW)
Win 11 Pro x64, 1Tb Primary SSD, 1Tb Secondary SSD
64Gb RAM Intel(R) Xeon(R) W-11855M CPU @ 3.2GHz
NVIDIA RTX A5000 16Gb, Dual 27" Monitor, Dell Inspiron 7760
Message 18 of 19
tcorey
in reply to: neilyj666

Neil, here is a version that asks for offset distance and FFL Offset, offsets to the outside and drops the offset pline by the FFL amount. If you type 3 for the FFL adjustment, the new pline will drop 3 units. No need to put in a minus.

 

Tim

;|copyright 2014 Timothy Corey,Delta Engineering Systems
Redding, CA
Permission is granted to use this code as you see fit, but
this code may not be sold or used in any for-sale software.
It is the responsibility of the user to verify the accuracy
of the program and suitability for your own use.

The new polylines are placed on the current layer.|;



(defun c:go(/ ls len ctr tobj p1 pl plx)

  (vl-load-com)

(prompt "\nSelect Text Objects: ")
  (setq ls (ssget) ;ask user to pick selection set of text items
	len (sslength ls)  ;get number of items in set
	ctr 0)             ;set counter to 0
  (setq OffDis (getreal "\nEnter offset distance: "))
  (setq ffladj (getreal "\nEnter FFL Adjustment: "))

(while (< ctr len)    ;while the counter is less than the selection set length

    (setq tobj (ssname ls ctr))  ;get individual object from set
    (if (or (= (cdr (assoc 0 (entget tobj))) "MTEXT") (= (cdr (assoc 0 (entget tobj))) "TEXT")) ;if it is a text or mtext object
      (progn
	(setq p1 (cdr (assoc 10 (entget tobj)))    ;get insertion point of text
	      )
	(vl-cmdf "boundary" "A" "B" "E" "I" "N" "" "O" "P" "" p1 "") ;use boundary command to create polyline
	(setq pl (entlast)
	      plx (entget pl)
	      )
	(setq plx (subst (cons 38 (atof (cdr (assoc 1 (entget tobj)))))   ;change elevation of polyline to equal text value of text
			 (assoc 38 plx)
			 plx)
	      )
	(entmod plx)
	(entupd pl)
	(setq p2 (polar p1 0 30))
	(vl-cmdf "Offset" offdis pl p2 "E")
	(setq pl2 (entlast)
	      pl2x (entget pl2))
(setq pl2x (subst (cons 38 (- (atof (cdr (assoc 1 (entget tobj)))) ffladj))   ;change elevation of polyline to equal text value of text - FFL Adjustment
			 (assoc 38 pl2x)
			 pl2x)
	      )
	(entmod pl2x)
	(entupd pl2)
	       
	(vl-cmdf "Erase" pl "")
	);end progn
      );end if
    (setq ctr (1+ ctr))
    );end while
  (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 19 of 19
neilyj666
in reply to: tcorey

Tim

This is great - thanks a lot; it'll save a lot of time...:)

Now I need to get into Lisp so I can do the same thing myself...;)

neilyj (No connection with Autodesk other than using the products in the real world)
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.

EESignature


AEC Collection 2024 UKIE (mainly Civil 3D UKIE and IW)
Win 11 Pro x64, 1Tb Primary SSD, 1Tb Secondary SSD
64Gb RAM Intel(R) Xeon(R) W-11855M CPU @ 3.2GHz
NVIDIA RTX A5000 16Gb, Dual 27" Monitor, Dell Inspiron 7760

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

Post to forums  

Rail Community


 

Autodesk Design & Make Report