ShadyV Posted January 17, 2020 Posted January 17, 2020 I am a self tought noob. Sorry in advance if my questions are super easy to fix or impossible to do. I am completely winging it. (defun c:vTEST () (COMMAND "FILLET" "R" "0" " ") (command "-osnap" "END") (setq ST1 (getpoint "\npick START point")) (command "-osnap" "nearest") (setq EN1 (getpoint "\npick END point")) (command "-osnap" "TAN") (COMMAND "LINE" ST1 EN1 "") (setq LN1 (entlast)) (command "-osnap" "nearest") (setq ST2 (getpoint "\npick exit point")) (command "-osnap" "TAN") (setq EN2 (getpoint "\npick NEXT point")) (COMMAND "LINE" ST2 EN2 "") (setq LN2 (entlast)) (command "pedit" ln2 "y" "O"^c^c) (setq LN2 (entlast)) (command "fillet" LN1 LN2) (setq SG1 (entlast)) (SETQ TEST 1) (WHILE (<= test 10) (command "-osnap" "nearest") (setq ST3 (getpoint "\npick exit point")) (command "-osnap" "TAN") (setq EN3 (getpoint "\npick NEXT point")) (COMMAND "LINE" ST3 EN3 "") (setq LN3 (entlast)) (command "fillet" SG1 LN3) (setq SG1 (entlast)) (setq test (1+ test)) ) ) My code so far (I told you I am a complete noob) The purpose of the code is to draw a continous polyline tangent to each circle the user clicks. It is to show a path of paper through a machine around spinning idlers To the questions! 1. Is there a way to add the property value radius of the circle as the user clicks on it? i.e when user sets EN1 value can the lisp save the radius value of the circle that was chosen? I want that to use for the fillet radius instead of having a radius of 0 for every fillet. Or is there another way for me to know that radius based off of the 2 endpoints of the lines drawn? Somehow autocad figures it out all the time if I use the ARC - continue option but I can't seem to use that within a lisp. 2. Can I set the loop (while) to continue until user right click their mouse? When user right clicks I want to add a prompt box with "end draw" and "undo" or cancel (resume loop). when this prompt box appears can user then work outside the lisp in the drawing and then resume lisp after choosing the option? I really am trying to learn and have spent weeks upon weeks searching the internet and reading the CAD help. I am thinking a class at the technical college is in my near future. I enjow making this work but at the same time get very frustrated when I can't find the answers. This is my first time reaching out in this forum, please take it easy on me! Thank you for your time Quote
BIGAL Posted January 17, 2020 Posted January 17, 2020 (edited) When you pick point can use that to get an entity need to use ssget as it supports a point to look for object and can filter for a circle. Don't use ^c^c use "" "" (command "-osnap" "END") Its actually better to use (setvar 'osmode 1) Is this the final result ? I think your sequence could be better pick 1st point then just keep using tan. Thinking a bit more maybe a list ((entity1 rad1)(entity2 rad2)(entity3 rad3)) note radx may be the same everytime. Edited January 18, 2020 by BIGAL Quote
BIGAL Posted January 18, 2020 Posted January 18, 2020 (edited) Just totally redid it called it conveyor. conveyor belt.lsp Edited January 18, 2020 by BIGAL Quote
ShadyV Posted January 19, 2020 Author Posted January 19, 2020 Crazy I should have reached out for help sooner. You rock, Thank you for your help (and by help I mean complete re-write lol)! For the time being this works just as I needed. As I learn more I will modify this to have an undo option while in the loop in case user clicks the wrong circle or wants a different entry. This works for the majority of my possible paths for the polyline. I have found that when the line wraps a circle more then half it will not fillet passed that circle. There is a rare occasion where this will happen so I will also work on trying to fix that as I learn more about what I am doing. Any possible links or advice about 1.Adding a prompt inside a while loop to have an undo last click or end loop option 2.changing the fillet function to happen in real time instead of all at the end so user can see if any mistakes are made during the drawing of the line 3.eliminating the need for an exit point click where the lisp would auto click the circle it is already attached to (not a major thing just trying to save those precious mouse clicks!) 4.It may be to big an issue to be fixable but the rare times where the "conveyer" wraps a pulley more then half of the circle it fails the remainder of the fillets Once again you have helped me more than you know and I now have a great starting point. Quote
BIGAL Posted January 20, 2020 Posted January 20, 2020 (edited) The angle greater than 180 your correct need to have a big think about that problem. I think can be solved looking at forward angle of the two lines. Can do fillet at each line added need to think about how code works now, its feasible. A version 2. The end loop is press Enter when asked for the starting point of the next line. Look at (while (setq pt1 Edited January 20, 2020 by BIGAL 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.