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.
Solved! Go to Solution.
Solved by Jeff_M. Go to Solution.
Solved by Jeff_M. Go to Solution.
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.
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) )
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.
@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;
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.
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.
@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;
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.
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.
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.
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.
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...
Nice routine
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.
For lisp in toolbox check this post
http://forums.autodesk.com/t5/AutoCAD-Civil-3D-Customization/Add-LISP-routine-to-Toolbox/m-p/3134272