Author Topic: Osnap during Entsel ?  (Read 2742 times)

0 Members and 1 Guest are viewing this topic.

snownut2

  • Swamp Rat
  • Posts: 971
  • Bricscad 22 Ultimate
Osnap during Entsel ?
« on: March 11, 2014, 08:49:00 AM »
This is from the Aacd Developer Help guide, in the Entsel function subject.

"The current Osnap setting is ignored by this function unless you specifically request it while you are in the function. "

Yet I do not find it possible to do this, even while toggling the osnap on or off while function is active.

Any tricks for this in lisp, here is the current line in my code;

Code: [Select]
(while (not (setq ent (entsel "Select Entity :"))))

Bruce

ribarm

  • Gator
  • Posts: 3313
  • Marko Ribar, architect
Re: Osnap during Entsel ?
« Reply #1 on: March 11, 2014, 09:09:20 AM »
Maybe this :

Code: [Select]
(while
  (setq pt (getpoint "Select Entity :"))
  (setq ent (nentselp pt))
  (princ ent)
)
« Last Edit: March 11, 2014, 09:12:35 AM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ronjonp

  • Needs a day job
  • Posts: 7533
Re: Osnap during Entsel ?
« Reply #2 on: March 11, 2014, 09:12:48 AM »
Or maybe:


Code: [Select]
(while (and (not (setq ent (entsel "Select Entity :")))))
(if (osnap (cadr ent) "END")
  (alert "snap!")
  (alert "boo!")
)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Osnap during Entsel ?
« Reply #3 on: March 11, 2014, 11:23:04 AM »
I was not aware that osnaps worked with entsel. Does not work on ACAD 2006 or before.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

snownut2

  • Swamp Rat
  • Posts: 971
  • Bricscad 22 Ultimate
Re: Osnap during Entsel ?
« Reply #4 on: March 11, 2014, 05:40:26 PM »

Code: [Select]
(while (and (not (setq ent (entsel "Select Entity :")))))
(if (osnap (cadr ent) "END")
  (alert "snap!")
  (alert "boo!")
)

Ron,

2-questions why add the and statement in the while function & using the "osnap" with the "END" does that default to the current osnap setting.

I see the result is the entity is snapped to an end-point or mid-point.

Thanks for your assistance in this.


ronjonp

  • Needs a day job
  • Posts: 7533
Re: Osnap during Entsel ?
« Reply #5 on: March 12, 2014, 08:50:29 AM »
Snownut2,

The 'AND' does not need not be there  :oops:  was written in haste. If you wanted it to use the current osnap settings, you'd have to look at the OSMODE variable and determine which snaps were active.
http://docs.autodesk.com/ACD/2014/ENU/files/GUID-DD9B3216-A533-4D47-95D8-7585F738FD75.htm


Looks like Irneb has created the function you need here:
http://www.theswamp.org/index.php?topic=44737.msg499586#msg499586

Here is a simple example:
Code: [Select]
(osnap (getpoint)
       (vl-string-right-trim
","
(apply 'strcat (mapcar '(lambda (x) (strcat x ",")) (osmode->snaplist (getvar 'osmode))))
       )
)
« Last Edit: March 12, 2014, 09:14:27 AM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC