GraveBane Posted June 2, 2017 Posted June 2, 2017 so I've written a few macros, and I've altered a few lisps that were close to what I wanted to do to make them do what I wanted them to do. but its been years and I've never written my own and the place I work at has no lisps to try and use as a start. what I'm trying to do should be a pretty simple lisp. I work in AV and most of what we draft is simple and schematic. I want a lisp that will semi automate drawing the wires. if I could get 1 lisp to work as I want I can probbly alter it to work on all wire types that we use. so heres what I want the lisp to do. 1. I want to start the lisp and have it change my layer. 2. I want to click a point and insert a block at the standard rotation and scale 3. I want it to start a PLine 5" to the right of that point. 4. I want to click a second point to the right (or input a distance) and have it ignore the y and go straight to the right to 5" past the point I clicked. 5. I want to click a 3rd point and have it draw a line straight up or down to the Y coordinate, then straight right to the 5" left of the x coordinate. 6. then I want it to insert a second block at the standard rotation and scale. 7. I want it to change the layer to another layer. I want to take this lisp and save it as HDMI, VGA, RCAA, RCAV, TRS8, TRS4, ect so I'll need to be able to change the command that starts the lisp, the first layer change (to the cable type) the block names (the left and right connector blocks) and the distance left and right of the first and last click(some connector blocks take up alot more room then others). it should always go back to the the same layer that I should be working on anyways for devices. anyone able to throw something together? or give me some pointers on how to get something like this started? I may decide to try and make it more complicated later, but this basic script would save me atleast a 2 hours a day if not more. I had not even thought of doing it this way until I seen someone programming a dsp and how they could draw the line in that program with just 2 clicks. I've attached a small portion of a drawing showing 3 hdmi cables (the yellow lines and blocks) that I'm trying to make the drawing of faster. something like this would also help me get other people able to work on the drawings in this office who have no skill in autocad for the few weeks a year I get swamped. it would make it drag in the equipment blocks type the wire type you want to draw, click the 3 points and your done. Quote
BIGAL Posted June 3, 2017 Posted June 3, 2017 There has been a number of lisps posted here about doing electrical connections like what your asking for. Try various key word searches "terminal" "wire" etc Quote
BKT Posted June 3, 2017 Posted June 3, 2017 so I've written a few macros, and I've altered a few lisps that were close to what I wanted to do to make them do what I wanted them to do. but its been years and I've never written my own and the place I work at has no lisps to try and use as a start. what I'm trying to do should be a pretty simple lisp. I work in AV and most of what we draft is simple and schematic. I want a lisp that will semi automate drawing the wires. if I could get 1 lisp to work as I want I can probbly alter it to work on all wire types that we use. so heres what I want the lisp to do. 1. I want to start the lisp and have it change my layer. 2. I want to click a point and insert a block at the standard rotation and scale 3. I want it to start a PLine 5" to the right of that point. 4. I want to click a second point to the right (or input a distance) and have it ignore the y and go straight to the right to 5" past the point I clicked. 5. I want to click a 3rd point and have it draw a line straight up or down to the Y coordinate, then straight right to the 5" left of the x coordinate. 6. then I want it to insert a second block at the standard rotation and scale. 7. I want it to change the layer to another layer. I want to take this lisp and save it as HDMI, VGA, RCAA, RCAV, TRS8, TRS4, ect so I'll need to be able to change the command that starts the lisp, the first layer change (to the cable type) the block names (the left and right connector blocks) and the distance left and right of the first and last click(some connector blocks take up alot more room then others). it should always go back to the the same layer that I should be working on anyways for devices. anyone able to throw something together? or give me some pointers on how to get something like this started? I may decide to try and make it more complicated later, but this basic script would save me atleast a 2 hours a day if not more. I had not even thought of doing it this way until I seen someone programming a dsp and how they could draw the line in that program with just 2 clicks. I've attached a small portion of a drawing showing 3 hdmi cables (the yellow lines and blocks) that I'm trying to make the drawing of faster. something like this would also help me get other people able to work on the drawings in this office who have no skill in autocad for the few weeks a year I get swamped. it would make it drag in the equipment blocks type the wire type you want to draw, click the 3 points and your done. I'm not clear on what you mean in #3 above. You say that you want the pline to start 5" to the right of the insertion point of the block. Is the inserted block the yellow connector? What's the insertion point, and why start 5" away from it? Perhaps a closeup identifying the inserted blocks, left and right, would be helpful, too. Quote
rlx Posted June 3, 2017 Posted June 3, 2017 (edited) Awel , just for the fun of it (defun c:RlxEwire ( / p1 p2 p3 p4 x1 y1 x4 y4 loop trackpoint inp ) (defun draw_wire () (redraw)(mapcar '(lambda ( a b ) (grdraw a b 4 -1)) (list p1 p2 p3)(list p2 p3 p4))) (vl-load-com) (redraw) (setvar "orthomode" 0) (if (and (setq p1 (getpoint "Enter start point : "))(setq p4 (getpoint p1 "Enter end point : "))) (progn (setq x1 (car p1) y1 (cadr p1) x4 (car p4) y4 (cadr p4) loop t) (princ "\nEnter point for vertical line (M or enter / space for middle) : ") (while loop (if (vl-catch-all-error-p (setq trackpoint (vl-catch-all-apply 'grread (list t 10 1)))) (progn (princ "\nFunction cancelled")(setq p1 nil loop nil)) (progn (setq inp (grread trackpoint)) ;(princ "\ninp = ")(princ inp)(princ " , trackpoint = ")(princ trackpoint) (cond ; point entered ((= (car inp) 3) (setq p2 (list (caadr inp) y1) p3 (list (car p2) y4))(draw_wire)(setq loop nil)) ; enter , m , M or space ((member inp '((2 13)(2 109)(2 77)(2 32))) (setq p2 (list (/ (+ x1 x4) 2.0) y1) P3 (list (car p2) y4))(draw_wire)(setq loop nil)) ; tracking point ((= (car trackpoint) 5) (setq p2 (list (caadr trackpoint) y1) p3 (list (car p2) y4))(draw_wire)) ) ) ) ) ) ) (terpri) (if (and p1 p2 p3 p4)(list p1 p2 p3 p4) nil) ) Inserting your blocks and setting layers should be easy so I leave that to you. btw , you can dump the princ inp & trackpoint line , is was just for testing gr. Rlx Edited June 6, 2017 by rlx 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.