Author Topic: ENTSEL from context menu (right click)  (Read 5048 times)

0 Members and 1 Guest are viewing this topic.

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
ENTSEL from context menu (right click)
« on: May 21, 2008, 11:54:27 AM »
I want to right click on an object and get that objects data.  How do I pass the selected object to entsel? 

Code: [Select]
  (setq ent (entsel);set object to ent
entdata (car ent);strip second element
entdata (entget entdata);display entity data

deegeecees

  • Guest
Re: ENTSEL from context menu (right click)
« Reply #1 on: May 21, 2008, 01:41:13 PM »
Not sure what you are asking, with entsel, you are prompted to select an object (left click). I thought right clicking would bring up a context menu, which has no bearing on where your cursor is in the coordinate system.

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Re: ENTSEL from context menu (right click)
« Reply #2 on: May 21, 2008, 02:13:17 PM »
Sorry...

I want to select an object, right click to bring out the CMEDIT shortcut menu, select a custom command from the shortcut menu that will return the entity data of the selected object.  I don't want to have to re-pick the selected object once entsel is invoked.  If there is another way to go about this, by all means, let me know!

rkmcswain

  • Swamp Rat
  • Posts: 978
Re: ENTSEL from context menu (right click)
« Reply #3 on: May 21, 2008, 02:18:15 PM »
Quote from: Dommy2Hotty
I want to right click on an object and get that objects data.  How do I pass the selected object to entsel? 

Code: [Select]
  (setq ent (entsel);set object to ent
entdata (car ent);strip second element
entdata (entget entdata);display entity data

Code: [Select]
(entget (ssname (nth 1 (ssgetfirst)) 0))

...will return the entity list of the first entity in a selection of gripped entities.

If you want to view all selected entities, you will have to iterate the selection set returned by (ssgetfirst)

deegeecees

  • Guest
Re: ENTSEL from context menu (right click)
« Reply #4 on: May 21, 2008, 02:25:06 PM »
Typing before last post

I don't think you need to pass it to entsel once the object is selected. I checked "Developer Help" for "object selected", and looked in the "Create Shortcut Menus" section. They give this as an example, but you may want to look at it yourself. S'all I can do, but I know there are others watching. It may get you going in the right direction anyway:

The following AutoLISP® code defines the command OTYPE, which reports the selected object's DXF name.

(defun C:OTYPE()  (cdr (assoc 0 (entget (car (entsel))))))

daron

  • Guest
Re: ENTSEL from context menu (right click)
« Reply #5 on: May 21, 2008, 02:38:12 PM »
It's okay, before he clarified, I was going to suggest using grread to be able to select an object with the right click. Then I was going to suggest pickfirst, but RK did, so I just left.

deegeecees

  • Guest
Re: ENTSEL from context menu (right click)
« Reply #6 on: May 21, 2008, 02:39:57 PM »
Yeah, but I put so much time into typing that.   :roll:

Hope it works out for ya, and don't be a stranger DTH.   :-)

daron

  • Guest
Re: ENTSEL from context menu (right click)
« Reply #7 on: May 21, 2008, 02:46:44 PM »
Oh I put some work into it. Nothing fancy, but work nonetheless.

VovKa

  • Water Moccasin
  • Posts: 1632
  • Ukraine
Re: ENTSEL from context menu (right click)
« Reply #8 on: May 21, 2008, 02:58:22 PM »
another useless example :)
Code: [Select]
(vl-load-com)
(vlr-mouse-reactor nil '((:vlr-beginRightClick . doentget)))
(defun doentget (ReactorObject ParameterList / Ent)
  (if (setq Ent (car (nentselp (car ParameterList))))
    (princ (entget Ent))
  )
)

daron

  • Guest
Re: ENTSEL from context menu (right click)
« Reply #9 on: May 21, 2008, 03:10:49 PM »
Not as fancy but,
Code: [Select]
(if (and (= (car (grread)) 25)
      (setq ent (nentselp (grread t)))
   )
(setq elist (entget (car ent)))
)
Not sure if it will even work, but that's what I was looking at. Of course it has nothing to do with pickfirst.

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Re: ENTSEL from context menu (right click)
« Reply #10 on: May 21, 2008, 03:13:41 PM »
Code: [Select]
(entget (ssname (nth 1 (ssgetfirst)) 0))
...will return the entity list of the first entity in a selection of gripped entities.

Exactly what I was looking for!  Thank you all.  I always appreciate the help from everyone!  :mrgreen:

KewlToyZ

  • Guest
Re: ENTSEL from context menu (right click)
« Reply #11 on: May 22, 2008, 11:11:48 AM »
I'm curious what you are doing Dommy, 2009 has quick properties now and those can be fine tuned in the cui as well. 8-)

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Re: ENTSEL from context menu (right click)
« Reply #12 on: May 22, 2008, 11:57:04 AM »
I'm curious what you are doing Dommy, 2009 has quick properties now and those can be fine tuned in the cui as well. 8-)

Updating and standardizing our drawings.  This current build will be to convert MTEXT with a quick leader to an MLEADER entity.

Quote from: Pseudo Code
1. Select MTEXT entity
2. Right-Click and select "Create MLEADER"
3. Setq mtext contents
4. Delete MTEXT entity
5. Insert MLEADER using MTEXT contents

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Re: ENTSEL from context menu (right click)
« Reply #13 on: May 22, 2008, 12:11:41 PM »
Also, I will use that to update a selected block.

Right-click on a block
Get the block name
strcat that with a network path
Re-insert the block from the network
ATTSYNC the block that was already in the drawing.

KewlToyZ

  • Guest
Re: ENTSEL from context menu (right click)
« Reply #14 on: May 22, 2008, 04:23:27 PM »
Interesting production Dommy, at first you had me going back to look at CAB's TextInsertDCL but your doing things a bit more on the fly than static and your changing block name strings with it.
Pretty industrious  :kewl:

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Re: ENTSEL from context menu (right click)
« Reply #15 on: May 22, 2008, 05:56:14 PM »
Interesting production Dommy, at first you had me going back to look at CAB's TextInsertDCL but your doing things a bit more on the fly than static and your changing block name strings with it.
Pretty industrious  :kewl:

Thank you very much!  BUT!  Can I get it to work the way I want to???  I don't think what I want to do is too involved, but if I get it to work, I'll post the code.  Again, thank you everyone for your help.