dexus Posted July 15 Posted July 15 (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 July 15 by dexus 4 Quote
pkenewell Posted July 15 Posted July 15 (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 July 15 by pkenewell 2 Quote
GLAVCVS Posted July 15 Posted July 15 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 July 16 Posted July 16 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 Wednesday at 08:16 PM Posted Wednesday at 08:16 PM (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 Wednesday at 11:23 PM by GLAVCVS 1 Quote
SLW210 Posted Thursday at 10:20 AM Author Posted Thursday at 10:20 AM 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 Thursday at 10:31 AM Posted Thursday at 10:31 AM 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 Thursday at 10:49 AM Author Posted Thursday at 10:49 AM 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
GLAVCVS Posted Saturday at 11:20 AM Posted Saturday at 11:20 AM (edited) Hi, Here’s a preview of what the new Offsetea will look like. Sorry for the delay — I’ve had other things to take care of. Still, I believe the wait will be worth it. Each improvement leads to another... but I think I'm going to stop here I still need to fine-tune a few things, but the final result will be very close to what you see in the clip: -Projection of straight line segments -3 projection modes for arc segments (one of them is the same as the one Evgeny proposed in his code) + 1 custom mode that I still have to write. Switching between modes is as simple as pressing keys 1, 2, 3, or 4 -Snapping to adjust position with the cursor -Real-time "texting" using grread in all cases -Voice assistance to provide useful info I'll try to finish it this week, but I can’t promise anything — I’ve got quite a bit of work. Still, I hope that with this small preview I’ve earned a bit of your patience Offsetea Reloaded.mp4 Edited Saturday at 11:23 AM by GLAVCVS 2 Quote
SLW210 Posted 6 hours ago Author Posted 6 hours ago As time allows, I am still working at this. I have a conveyor screw to completely design and detail this week. I made a few tries messing with @Lee Mac's Offset Section LISP using some of those functions, but, I might try a new route. 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.