bbryson_2000 Posted May 26, 2016 Posted May 26, 2016 Hopefully a lisp routine.... I work in the electrical department of an engineering Co. and I need what is called a home run arrowhead that will place itself at the end of an arc or curved line. The arrowhead needs to be parallel to the curve or along the curve. 1. The ideal routine would be to place the arrowhead first and then have the arc come out of the back-end of the arrowhead so as to give two more points to place the arc. I'm just asking for the world and see what I get. 2. Much shorter version would be to place the arc on my own and then invoke a lisp routine to place the arrowhead on the end of the arc. The .lisp would call for a block (the arrowhead) to be placed. 3. Place block by-layer, color by-layer, line type by-layer. 4. Name of block (EARR). 5. Layer name (E-LITE-CIRC) 6. File attached. Thank you very much in advance for your help. Drawing1.dwg Quote
iconeo Posted May 26, 2016 Posted May 26, 2016 This could be modified to work. I use it to add special symbols to the ends of lines and plines. I'm not sure where this code came from as I inherited it with the job and I just modded it... Note that it requires that the layer already be present. Easily fixable. (defun DXF (code lst) (cdr (assoc code lst)) ) (defun rtd (x) (* x (/ 180.0 pi))) (defun dtr (x) (* pi (/ x 180.0))) (defun addblocktoend (strBlockPath strBlockName setScale setLayer / objEnt pt1 pt2 ent2 layName ang lts objType) (while (setq objEnt (entsel "\n Select a point on a line/pline/arc... ")) (progn (setq objType (cdr (assoc 0 (entget (car objEnt))))) (princ objType) (setq pt1 (osnap (cadr objEnt) "_nea")) (setq pt2 (osnap (cadr objEnt) "_endp")) (setq ent2 (entget (setq entList (car objEnt)))) ; (if (= strUseDIMscale "Y") ; (setq lts (getvar "dimscale")) ; (setq lts 1.0) ; ) ; (setq layName (DXF 8 ent2)) (setq restoreclayer (getvar "clayer")) (if (= setLayer "OBJECTLAYER") (setvar "clayer" (DXF 8 ent2)) (setvar "clayer" setLayer) ) ; (setvar "clayer" setLayer) (setq ang (angle pt1 pt2)) (command "-insert" (strcat strBlockPath strBlockName) pt2 setScale "" (rtd ang)) (setvar "clayer" restoreclayer) ) ) (princ) ) (defun c:addblocktoend_linebreak () (setq slocation "V:\\AutoCAD\\Blocks\\Standard\\misc\\") (setq sblock "BREAK_PIPE_END") (setq sscale (/ (getvar "dimscale") 12)) (setq slayer "S-ANNO-BKLN") (addblocktoend slocation sblock sscale slayer) ) (defun c:addblocktoend_moment () (setq slocation "V:\\AutoCAD\\Blocks\\Standard\\leaders\\") (setq sblock "ldr_moment") (setq sscale (/ (getvar "dimscale") 12)) (setq slayer "OBJECTLAYER") (addblocktoend slocation sblock sscale slayer) ) (defun c:addblocktoend_singlearrow () (setq slocation "V:\\AutoCAD\\Blocks\\Standard\\leaders\\") (setq sblock "ldr_single_arrow") (setq sscale (/ (getvar "dimscale") 12)) (setq slayer "S-ANNO-DIMS") (addblocktoend slocation sblock sscale slayer) ) Quote
pkenewell Posted June 1, 2016 Posted June 1, 2016 What about this program from Lee Mac? http://www.lee-mac.com/arrowarc.html Quote
tombu Posted June 1, 2016 Posted June 1, 2016 (edited) This one matches the one in your drawing exactly and uses Current Anno Scale for the arrowhead size and sets the linetype to continuous. Change the scale and the next one drawn will match that scale. ;| Arc Leader for labeling BY: Tom Beauford BeaufordT@LeonCountyFL.gov Leon County Public Works Engineering Section Macro: ^P(or C:ld (load "Leader.lsp"));ld Command line: (load "Leader.lsp") ld ================================================|; (defun C:ld (/ *ERROR* st_txt osm othm cur_lt pt1 pt2) (defun *ERROR* (s) ; If an error (such as CTRL-C) occurs (if (/= s "Function cancelled") ; while this command is active... (princ (strcat "\nError: " s)) ) (redraw) (setq s nil) (setvar "osmode" osm) (setvar "orthomode" othm) (setvar "celtype" cur_lt) (setvar "plinewid" 0.0) (setvar "cmdecho" 0) (grtext -1 "") ;CLEAR STATUS LINE (command "_REGEN") (setq *error* olderr) ; Restore old *error* handler (princ) ) (setq st_txt (strcat "Arrow size = Text Size = " (rtos(/ 0.1 (getvar "cannoscalevalue"))2 2))) ; (setq st_txt (strcat "Arrow size = Text Size = " (rtos(getvar "textsize")2 2))) (grtext -1 st_txt) (setq osm (getvar "osmode")) (setq othm (getvar "orthomode")) (setq cur_lt (getvar "celtype")) (setvar "osmode" 0) (setvar "orthomode" 0) (setvar "celtype" "CONTINUOUS") (setq pt1 (getpoint "Start at object to be labeled: ") pt2 (getpoint pt1 "Tangent Direction Point: ")) (setq pt1 (list(car pt1)(cadr pt1)) pt2 (list(car pt2)(cadr pt2)) pt2 (list (- (car pt1)(* (/ (/ 0.1 (getvar "cannoscalevalue")) (distance pt1 pt2)) (-(car pt1)(car pt2))) ) (- (cadr pt1)(* (/ (/ 0.1 (getvar "cannoscalevalue")) (distance pt1 pt2)) (-(cadr pt1)(cadr pt2))) ) ) ) (setvar "cmdecho" 0) (command "_pline" pt1 "w" 0 (/ (/ 0.1 (getvar "cannoscalevalue")) 3) ; (command "_pline" pt1 "w" 0 (/ (getvar "textsize") 3) ; pt2 "a" "w" (/ (getvar "textsize")30)(/ (getvar "textsize")30)) pt2 "a" "w" 0 0) (setvar "cmdecho" 1) (while (= 1 (logand 1 (getvar "cmdactive"))) (command PAUSE) ) (setvar "plinewid" 0.0) (setvar "osmode" osm) (setvar "orthomode" othm) (setvar "celtype" cur_lt) (setvar "cmdecho" 0) (grtext -1 "") ;CLEAR STATUS LINE (command "_REGEN") (princ) ) Edited June 1, 2016 by tombu add comment Quote
bbryson_2000 Posted June 17, 2016 Author Posted June 17, 2016 Thanks for the code but I don't see how to start this routine. Usually there is a defun name at the beginning of the .lsp. Quote
ReMark Posted June 17, 2016 Posted June 17, 2016 You are referring to the first lisp routine posted by iconeo? Quote
tombu Posted June 17, 2016 Posted June 17, 2016 (edited) Thanks for the code but I don't see how to start this routine.Usually there is a defun name at the beginning of the .lsp. I put both the macro you would add to the CUI and what to enter at the Command Line: in the comments at the beginning of my routine which matched the one in your drawing exactly. Enter ld to start the routine after it's loaded by entering (load "Leader.lsp") first. iconeo's code defuns a few functions look for one's that start with defun c: addblocktoend_singlearrow appears to add an arrowhead to the end of an existing segment. Edited June 17, 2016 by tombu more detail to explnation Quote
ReMark Posted June 17, 2016 Posted June 17, 2016 bb: From what I can tell iconeo has included three different defuns in his routine for, as he says, adding special symbols. It pays to read through the entire code before commenting. Quote
bbryson_2000 Posted June 17, 2016 Author Posted June 17, 2016 I don't need two arrows, just one and I don't know how to edit code. Thanks anyway Quote
ReMark Posted June 17, 2016 Posted June 17, 2016 iconeo's code has a single arrow. And all you have to edit is the name of the block you're using for the single arrowhead. No one is asking you to become a lisp guru but you should learn some basic skills as they might come in handy down the road. Stop being so hard headed. Quote
tombu Posted June 17, 2016 Posted June 17, 2016 I don't need two arrows, just one and I don't know how to edit code.Thanks anyway I opened your drawing and the code I posted drew exactly the same arrow as in the drawing the way you wanted the "ideal routine" to do. Did you try it? Quote
bbryson_2000 Posted June 17, 2016 Author Posted June 17, 2016 Because I read through the entire code before commenting I knew there was no c: defun and didn't know what the other defuns were for. And still don't. Typing in "RTD" or "DTR" I came up with nothing. YES - After loading the .lsp routine. I'm lost when it comes to code. That's why I rely on the knowledge and patience of others. Quote
ReMark Posted June 17, 2016 Posted June 17, 2016 You are mistaken. There are three defun c: in iconeo's code. I'm legally blind in my right eye and yet I can clearly see them. Quote
tombu Posted June 17, 2016 Posted June 17, 2016 Because I read through the entire code before commenting I knew there was no c: defun and didn't know what the other defuns were for. And still don't. Typing in "RTD" or "DTR" I came up with nothing. YES - After loading the .lsp routine. I'm lost when it comes to code. That's why I rely on the knowledge and patience of others. That's iconeo's code. I opened your drawing and the code I posted drew exactly the same arrow as in the drawing the way you wanted the "ideal routine" to do. I put both the macro you would add to the CUI and what to enter at the Command Line: in the comments at the beginning of my routine which matched the one in your drawing exactly. Enter ld to start the routine after it's loaded by entering (load "Leader.lsp") first. Just try it. Quote
ReMark Posted June 17, 2016 Posted June 17, 2016 The OP seems to be stuck on the first code posted and appears not to have tried your code Tom. Quote
bbryson_2000 Posted June 17, 2016 Author Posted June 17, 2016 Your really critical with people who are asking for help. Hard headed is someone that will not even try. I'm sure you were born with this knowledge. The rest of us have to put in the effort to try or ask for help. Quote
ReMark Posted June 17, 2016 Posted June 17, 2016 Are you going to continue complaining or are you going to make an effort to try Tom's code? Quote
tombu Posted June 17, 2016 Posted June 17, 2016 Your really critical with people who are asking for help.Hard headed is someone that will not even try. I'm sure you were born with this knowledge. The rest of us have to put in the effort to try or ask for help. Sorry, we're just trying to help. Having trouble answering you when you never mention which code you're referring to and we both tried to help you. We told you how to find the functions and I even included the name of the function in iconeo's code that does the "shorter version" you described. Still wonder why you haven't looked at the code I posted as it does as you asked for an "ideal routine". Quote
iconeo Posted June 17, 2016 Posted June 17, 2016 It helps to learn even a little code. This situation reminds of when I see someone stuck on the side of the road because they never learned how to change a tire. Just the basics I'm sayin'. After all it's a tool you use 40 hours a week... Sent from my SM-G920T using Tapatalk Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.