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

Creating Pline along centreline of existing road

16 REPLIES 16
SOLVED
Reply
Message 1 of 17
neilyj666
786 Views, 16 Replies

Creating Pline along centreline of existing road

I have an exsiting road survey and I need to create the centreline. I am creating a PLINE by slecting two approx adjacent points and using the M2P transparent command to fin the mid point. This method means having to type M2P every time so is there a way I can create a new command to create a PLINE but which defaults to M2P??

 

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
16 REPLIES 16
Message 2 of 17
Jeff_M
in reply to: neilyj666

Do you need to account for arcs in the pline?

Jeff_M, also a frequent Swamper
EESignature
Message 3 of 17
neilyj666
in reply to: Jeff_M

Not specifically - I basically have both sides of a forest track surveyed (with shots at varying distances apart but shots on each side are generally opposite each other) and want to create the approx centreline for realignment purposes using the M2P command.

 

I will be concentrating on the straight(ish) sections and then using the alignment tool to do the fancy stuff with curves and offsets etc

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 4 of 17
Jeff_M
in reply to: neilyj666

Looks like you already have a different solution, but since I whipped this up perhaps someone may find a use for it. It's quick & dirty, not pretty, no frills, no arcs, but it works.. command name is plinemid. Stupid forum software STILL places smileys in code panes. that smiley should be "c : plinemid" without the spaces or quotes.

 

(defun c:plinemid (/ DOC MSPACE P1 P2 PLINE VERTICES)
  (vl-load-com)
  (setq	doc    (vla-get-activedocument (vlax-get-acad-object))
	mspace (vla-get-modelspace doc)
  )
  (defun getmidpoint (start_next_msg / p1 p2)
    (if	(and (setq p1
		    (getpoint (strcat "\n" start_next_msg " point side 1: "))
	     )
	     (setq p2
		    (getpoint p1
			      (strcat "\n" start_next_msg " point side 2: ")
		    )
	     )
	)
      (mapcar '(lambda (x y) (/ (+ x y) 2)) p1 p2)
      nil
    )
  )
  (if (and (setq p1 (getmidpoint "Start"))
	   (setq p2 (getmidpoint "Next"))
	   (setq vertices (list (car p1) (cadr p1) (car p2) (cadr p2)))
      )
    (progn
      (setq pline (vlax-invoke mspace 'addlightweightpolyline vertices))
      (while (setq p1 (getmidpoint "Next"))
	(setq vertices (append vertices (list (car p1) (cadr p1))))
	(vlax-put pline 'coordinates vertices)
	(vla-update pline)
      )
    )
  )
  (princ)
)

 

Jeff_M, also a frequent Swamper
EESignature
Message 5 of 17
neilyj666
in reply to: Jeff_M

This is a great solution - thanks for taking the time and trouble to do the lisp - I wouldn't have known where to start.

 

Is it possible to put Lisp routines on a tool palette??

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 6 of 17
Jeff_M
in reply to: neilyj666


@neilyj666 wrote:

 

Is it possible to put Lisp routines on a tool palette??


Should be able to. Place the code in a new text file and save it in your support path or somewhere you will know where to find it named "plinemid.lsp". Then the macro would be (no space after the colon again):

 

^C^C(if (not c:plinemid) (load "plinemid")) plinemid;

Jeff_M, also a frequent Swamper
EESignature
Message 7 of 17
AllenJessup
in reply to: neilyj666

Theoretically you could make the lisp one long line and put in on the Tool Palette. But Jeff's way is much better.

 

Macros have no length limit. But I think it's best to keep them small.

 

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.

EESignature

Message 8 of 17
neilyj666
in reply to: Jeff_M

Many thanks again - that work's well

 

Another query - can a DLL (usually loaded via NETLOAD) be placed on a tool palette in a similar way??

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 9 of 17
Jeff_M
in reply to: neilyj666


@neilyj666 wrote:

Many thanks again - that work's well

 

Another query - can a DLL (usually loaded via NETLOAD) be placed on a tool palette in a similar way??



Glad I could help.

Yes, although rather than checking if the command is available, just netload it. If it's already loaded it won't load again. 

^C^C(netload "path to dll) commandname;

Jeff_M, also a frequent Swamper
EESignature
Message 10 of 17
neilyj666
in reply to: Jeff_M

Can you confirm that this syntax is correct - not sure about the quote and brackets??

 

^C^C(netload "C:\AutoLisp\AutoCAD_Project_SurveyFix.dll) Surveyfix;

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 11 of 17
AllenJessup
in reply to: neilyj666

Looks like you're short a "

 

^C^C(netload "C:\AutoLisp\AutoCAD_Project_SurveyFix.dll") Surveyfix;

 

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.

EESignature

Message 12 of 17
Jeff_M
in reply to: AllenJessup

And lisp needs 2 "\"'s when used literally...

^C^C(netload "C:\\AutoLisp\\AutoCAD_Project_SurveyFix.dll") Surveyfix;



Jeff_M, also a frequent Swamper
EESignature
Message 13 of 17
neilyj666
in reply to: Jeff_M

Thanks for these comments - it's working great now

 

Can commands (e.g. DLL as discussed, Lisp routines, simple macros) be added to the Toolbox rather than a Tool Palette??

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 17
neilyj666
in reply to: neilyj666

I've added a DLL to the toolbox and it works fine - but can't work out if it is possible to add Lisp and macros to the toolbox.......

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 15 of 17
greg_battin
in reply to: neilyj666

Here's another LISP routine.

you select the 2 PLines and then you specify the # of segments for the new PL. It may take some time to get used to...

Message 16 of 17
neilyj666
in reply to: greg_battin

Nice routine Smiley Happy

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 17 of 17

For lisp in toolbox check this post

 

http://forums.autodesk.com/t5/AutoCAD-Civil-3D-Customization/Add-LISP-routine-to-Toolbox/m-p/3134272



If a post provides a fix for your issue, click on "Accept as Solution" to help other users find solutions to problems they might have that are similar to yours.

Andrew Puller
Maitland, NSW, Australia
Windows 10 Enterprise 64bit
Intel core i7 11800 @ 2.30 GHz with 32GB Ram
Civil 3d 2021

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

Post to forums  

Rail Community


 

Autodesk Design & Make Report