Jump to content

Recommended Posts

Posted (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 by Costinbos77
Posted

GP_ ,

 

Value of OSMODE Variable is an integer, but which they have reacted?

Posted
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")))

Posted (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 by Costinbos77
Posted

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)

Posted

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]))

Posted
(vl-remove-if-not '(lambda ( m ) (if (setq pp (osnap p m)) m)) '("_end" "_mid" "_cen" "_nod" "_qua"))
=>("_cen" "_qua")

Posted

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.

Posted

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...

Posted

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...

Posted

Aperture = 10, are not expected results, I will try with 5.

 

Thanks for the idea.

  • 2 weeks later...
Posted

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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...