SLW210 Posted Monday at 10:11 AM Author Posted Monday at 10:11 AM I'll see what this week brings for extra playtime. Quote
dexus Posted Tuesday at 01:53 PM Posted Tuesday at 01:53 PM (edited) I managed to get rid of the flickering but keeping snap enabled. Here is the new version: offset.lsp Instead of hiding the polyline before doing the osnap, I now keep the polyline hidden and render it with grvecs instead. Therefore no snapping to itself and no more flickering! Edited Tuesday at 02:05 PM by dexus 4 Quote
pkenewell Posted Tuesday at 02:33 PM Posted Tuesday at 02:33 PM (edited) @dexus Well done! This works very well! Just a suggestion if you wish to add more to it. My code below is for incorporating Function keys during a grread loop would be a good addition. It doesn't support everything, like Snap, polar tracking, osnap tracking, but it does all the toggle modes. It can replace the return condition in your grread loop. ;|============================================================================== Function Name: (pjk-Grread-Fkeys <Character Code)) Arguments: kcode = integer; The Character code from the second element in the return from GRREAD. Returns: T if ENTER or SPACEBAR is pressed, otherwise NIL Description: This function emulates the functions performed when a function key is selected within a GRREAD loop. Created by Phil Kenewell 2018 ================================================================================|; (defun pjk-Grread-Fkeys (kcode / acv ret) (setq acv (atof (substr (getvar "acadver") 1 4))) (cond ((= kcode 6) ;; F3 ;; Faster more efficient way to toggle osmode. Thanks to Lee Mac for the idea. (princ (strcat "\n<Osnap " (if (>= (setvar "osmode" (boole 6 (getvar "osmode") 16384)) 16384) "off>" "on>") ) ) ) ((= kcode 25) ;; F4 (if (>= acv 18.1) ;; If AutoCAD 2011 or Higher (princ (strcat "\n<3DOsnap " (if (= (logand (setvar "3dosmode" (boole 6 (getvar "3dosmode") 1)) 1) 1) "off>" "on>") ) ) (princ (strcat "\n<Tablet " (if (= (setvar "tabmode" (- 1 (getvar "tabmode"))) 1) "on>" "off>") ) ) ) ) ((= kcode 5) ;; F5 (cond ((= (getvar "SNAPISOPAIR") 0)(setvar "SNAPISOPAIR" 1)(princ "\n<Isoplane Top>")) ((= (getvar "SNAPISOPAIR") 1)(setvar "SNAPISOPAIR" 2)(princ "\n<Isoplane Right>")) ((= (getvar "SNAPISOPAIR") 2)(setvar "SNAPISOPAIR" 0)(princ "\n<Isoplane Left>")) ) ) ((= kcode 4) ;; F6 (if (>= acv 17.0) ;; If AutoCAD 2007 or Higher (princ (strcat "\n<Dynamic UCS " (if (= (setvar "ucsdetect" (- 1 (getvar "ucsdetect"))) 1) "on>" "off>") ) ) (princ (strcat "\n<Coords " (if (= (setvar "coords" (if (= (getvar "coords") 2) 0 2)) 2) "on>" "off>") ) ) ) ) ((= kcode 7) ;; F7 (princ (strcat "\n<Grid " (if (= (setvar "gridmode" (- 1 (getvar "gridmode"))) 1) "on>" "off>") ) ) ) ((= kcode 15) ;; F8 (princ (strcat "\n<Ortho " (if (= (setvar "orthomode" (- 1 (getvar "orthomode"))) 1) "on>" "off>") ) ) ) ((= kcode 2) ;; F9 (princ (strcat "\n<Snap " (if (= (setvar "snapmode" (- 1 (getvar "snapmode"))) 1) "on>" "off>") ) ) ) ((= kcode 21) ;; F10 (princ (strcat "\n<Polar " (if (= (logand (setvar "autosnap" (boole 6 (getvar "autosnap") 8)) 8) 8) "on>" "off>") ) ) (Princ "\nNOTE: Polar Tracking is not supported in this command.") ) ((= kcode 151) ;; F11 (princ (strcat "\n<Object Snap Tracking " (if (= (logand (setvar "autosnap" (boole 6 (getvar "autosnap") 16)) 16) 16) "on>" "off>") ) ) (Princ "\nNOTE: Object Snap Tracking is not supported in this command.") ) ((= kcode 31) ;; F12 (if (>= acv 16.2) ;; If AutoCAD 2006 or Higher (princ (strcat "\n<Dynamic Input " (if (minusp (setvar "dynmode" (- (getvar "dynmode")))) "off>" "on>") ) ) ) ) ((vl-position kcode '(13 32)) ;; Enter or Spacebar (setq ret T) ) ) ret ) ;; End Function (pjk-Grread-Fkeys) Edited Tuesday at 02:34 PM by pkenewell 2 Quote
GLAVCVS Posted Tuesday at 07:53 PM Posted Tuesday at 07:53 PM 5 hours ago, dexus said: I managed to get rid of the flickering but keeping snap enabled. Here is the new version: offset.lsp 10.87 kB · 1 download Instead of hiding the polyline before doing the osnap, I now keep the polyline hidden and render it with grvecs instead. Therefore no snapping to itself and no more flickering! This is much better. After seeing your code, I think there's something I may have misunderstood or didn't consider important: the use of the chord as a control parameter. All along, I've been thinking that the main goal was to ensure the cursor was tangent to the curve at all times. But I see that using the chord is important. Clearly, these types of tasks were never part of my CAD menu. In any case, this forces me to change my approach somewhat: I'll try to make 'offsetea' versatile in this case. 1 Quote
GLAVCVS Posted yesterday at 06:55 AM Posted yesterday at 06:55 AM Another necessary question: Does the original code work as expected when selecting an arc segment flanked by other arc segments? Is it possible this isn't intended in the code? 1 Quote
GLAVCVS Posted 16 hours ago Posted 16 hours ago (edited) Excuse me I need to insist on the question. @dexus: You said you're used to doing this kind of task. Therefore, I assume you can answer this question: does running the code on the polyline shown in the clip work as it should? arcsAndMoreArcs.mp4 Edited 13 hours ago by GLAVCVS 1 Quote
SLW210 Posted 2 hours ago Author Posted 2 hours ago For an accurate snap the drag point needs to be on the polyline, so not an accurate snap. At a certain point it stops following the surrounding shapes, works well on the straight with taper in my drawing. On the Taper at the top keyboard input seems okay, the arc sections not so accurate. It is an interesting LISP though. Quote
dexus Posted 2 hours ago Posted 2 hours ago 14 hours ago, GLAVCVS said: Excuse me I need to insist on the question. @dexus: You said you're used to doing this kind of task. Therefore, I assume you can answer this question: does running the code on the polyline shown in the clip work as it should? arcsAndMoreArcs.mp4 1.21 MB · 0 downloads For me it works as expected, I mostly use it on arcs that are symmetrical though. Those results seem more logical: But the vertexes stay in line and the lines stay tangent to each other. I guess increasing the arc size of the arc instead might be another option. What would be the expected result for you? I'm not sure if you can keep the constraints without changing the position of that gray line in its direction. 1 Quote
SLW210 Posted 2 hours ago Author Posted 2 hours ago Here was my post with my examples... I was working towards modifying Lee Macs OffsetSection LISP (mostly trying some of those functions), but getting a proper response from the adjacent sections is tedious. Here is a single offset modifications of it... For my needs as stated earlier, I might need to work on just a redraw from the inputs for the radii, etc. Your LISP looks pretty good for moving roads, certainly useful. AFAIK, I don't have any upcoming road projects, though I might need to fine tune a few, they never put them exactly where I draw them. 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.