Costinbos77 Posted February 16, 2013 Posted February 16, 2013 (edited) Hi there, how to find out which modes took effect? (setq pp ([color=blue]osnap[/color] p [color=magenta]"_end,_mid,_cen,_nod[/color][color=magenta]"[/color]) ) Which of the 4 modes have an effect for pp ? Thanks in advance. Edited February 16, 2013 by Costinbos77 Quote
Costinbos77 Posted February 16, 2013 Author Posted February 16, 2013 GP_ , Value of OSMODE Variable is an integer, but which they have reacted? Quote
dbroada Posted February 16, 2013 Posted February 16, 2013 OSMODE is the sum of all active snaps given by GP_ Quote
Lee Mac Posted February 16, 2013 Posted February 16, 2013 how to find out which modes took effect? (setq pp ([color=blue]osnap[/color] p [color=magenta]"_end,_mid,_cen,_nod[/color][color=magenta]"[/color])) Which of the 4 modes have an effect for pp ? The Object Snap mode to which the point is snapped cannot be determined from a single osnap expression in which multiple modes are combined, since the osnap function only returns the snapped point coordinate or nil, and no supplementary information is returned. You would need to test each mode separately, e.g.: (vl-some '(lambda ( m ) (if (setq pp (osnap p m)) m) '("_end" "_mid" "_cen" "_nod"))) Quote
Costinbos77 Posted February 16, 2013 Author Posted February 16, 2013 (edited) Thanks Lee, your idea is more concise. I was thinking about something like: (setq [color=red]litos[/color] ([color=blue]list [/color][color=magenta]"_end,_mid,_cen,_nod[/color][color=magenta]"[/color])) ; [color=red]has a variable content[/color] (setq llitos (length litos) i -1 op nil) ;_ end of setq (while (< (setq i (1+ i)) llitos) (setq el (nth i litos)) ;_ end of setq (if (setq op (osnap p el)) (setq i llitos)) ;_ end of if ) ;_ end of wh < but when litos list has the form presented, I can not get ENDP, or if I have in list litos, quadrant and center circle, I can not get OSMODE for center of circle, etc. This topic is a continuation of: http://www.cadtutor.net/forum/showthread.php?77110-Problems-with-vla-move-and-OSMODE. because I have to reinvent the OSMODE mark. How can I display a string as a comment near the mouse cursor (eg OSMODE value)? Edited February 16, 2013 by Costinbos77 Quote
marko_ribar Posted February 16, 2013 Posted February 16, 2013 Typo mistake : (vl-some '(lambda ( m ) (if (setq pp (osnap p m)) m)[color=red])[/color] '("_end" "_mid" "_cen" "_nod")) On my ACAD, when picked point p as quadrant of circle, Lee's example returns "_cen" witch is true (circle doesn't have end,mid,nod snaps) Quote
Costinbos77 Posted February 16, 2013 Author Posted February 16, 2013 or if I have in list litos, quadrant and center circle, I can not get OSMODE for center of circle, etc. Litos list should be duly filled : (setq [color=red]litos[/color] ([color=blue]list [/color][color=magenta]"_end,_mid,_cen,_qua,_nod[/color][color=magenta]"[/color])) Quote
marko_ribar Posted February 16, 2013 Posted February 16, 2013 (vl-remove-if-not '(lambda ( m ) (if (setq pp (osnap p m)) m)) '("_end" "_mid" "_cen" "_nod" "_qua")) =>("_cen" "_qua") Quote
Costinbos77 Posted February 16, 2013 Author Posted February 16, 2013 1 .OK, but I want to know exactly which ones resulted OSMODE point? 2. If I want to get a OSMODE on "cen", I can not because of "qua" and last OSMODE was on it. Quote
marko_ribar Posted February 16, 2013 Posted February 16, 2013 I don't understand, (osnap) function behaves just like real OSNAP : If your test point is nearest to "_qua" snap, (osnap) will return quadrant point of circle; if firstly nearest snap to test point is closer to center point, (osnap) will return center point of circle... Test depends of test point - its position in relation to SNAPS of nearest entity... Quote
Costinbos77 Posted February 16, 2013 Author Posted February 16, 2013 Everything we discussed going in a loop while the decision, where the function (grread T 15 0) the topic: http://www.cadtutor.net/forum/showthread.php?77110-Problems-with-vla-move-and-OSMODE. Quote
marko_ribar Posted February 16, 2013 Posted February 16, 2013 I think that in case of circle as test entity, you should consider changing APERTURE sys variable to higher value, as this small code gives different results for SNAPS... (while (setq gr (grread t)) (print (osnap (cadr gr) "_cen,_qua")) ) When aperture is small, this will return only quadrant points of circle, but when you set aperture to higher value (I did maximum 50), above code will return among quadrant points also and coordinate of circles center... Note that predominant SNAP will be nil point as space around entity - circle is much wider and larger than space where APERTURE of OSNAP operates... Quote
Costinbos77 Posted February 16, 2013 Author Posted February 16, 2013 Aperture = 10, are not expected results, I will try with 5. Thanks for the idea. Quote
Costinbos77 Posted February 25, 2013 Author Posted February 25, 2013 I found a solution: calculate the distance between each point mouse and OSMODE desired list. Depending on this distance, is make the differentiation: (setq liosnap nil) ;_ end of setq (foreach el litos (if (setq op (osnap p el)) (progn (setq d (distance p op) d (cond ((= el "_cen") (/ d 4.)) ((= el "_nea") (* d 10.)) (T d)) ) (setq liosnap (cons (list d op el) liosnap)) )) ) ;_ end of f (if liosnap (setq liobs (car (vl-sort liosnap '(lambda (s1 s2) (< (car s1) (car s2)) ) ) ) op (nth 1 liobs) mod (nth 2 liobs) ) ;_ end of setq (setq op nil) ;_ end of setq ) ;_ end of if liosnap Some ways of OSNAP are more 'sensitive' (qua, snow) and therefore must be suppressed. 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.