Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Double click block object

8 REPLIES 8
Reply
Message 1 of 9
leothebuilder
802 Views, 8 Replies

Double click block object

I have a block with attributes and on double click I would like to suppress the autocad attribute editor opening and instead have my own customized dialog box open for input. Is this possible and where would I begin. I have the dcl and lisp for the custom dialog running fine, but rather than invoke this with a command I would like to try if I can get this running by double cliking this block object.

8 REPLIES 8
Message 2 of 9
paullimapa
in reply to: leothebuilder

Just Undefine EATTEDIT and change your lisp command to be activated as EATTEDIT

 

 

Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator | Layer Apps | List on Steroids | VP Zoom Scales
Exchange App Store


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 3 of 9
dicra
in reply to: leothebuilder

Hi leo, pli,

 

You can do what pli is advising.

But on that way, your not going to be able to use eattedit command.

 

If You still need this command, I think there is a way that you change double click action in CUI for attributes.

This is going to activate your command, but I'm not sure how it is going to work with it. There might be a problem with selecting entity.

 

 

 

 

Message 4 of 9
leothebuilder
in reply to: paullimapa

Pli,

 

That did not work,

When I undefine the eattedit command and then activate the lisp as eattedit, it gives me "unknown command"

Message 5 of 9

Leo,

 

That is probably because your command defined in your program is something other than eattedit. You could either defun your command as c:eattedit or add eattedit in the pgp file as an alias for your command.

 

But, if the CUI allows you to assign the double click to your command as mentioned, that may be a better approach.

Patrick Hughes

Engineered Design Solutions
Developer of CadTempo - Cad Time Tracking
www.cadtempo.com
Message 6 of 9
phanaem
in reply to: leothebuilder

Define your function(s) like this:

 

(defun c:editblock ( / ss e)
  (if
    (setq ss (ssget ":E:S:L" '((0 . "INSERT"))))
    (MyEditCommand (ssname ss 0))
    )
  )

(defun MyEditCommand (e)
;your code here (foreach x (vlax-invoke (vlax-ename->vla-object e) 'GetAttributes) (print (vla-get-TagString x)) ) (princ) )

 Then edit CUI and change EATTEDIT command under DoubleClickAction with your function.

Message 7 of 9
leothebuilder
in reply to: phanaem

Thanks,

 

I see that this will work, but I am not sure if this is the way I should go as it will prevent the use of eattedit on other attribute blocks.

For the double click I was looking for something like: if this is "myblock" use my dialog box, if not "myblock" use eattedit.

Message 8 of 9
phanaem
in reply to: leothebuilder


@leothebuilder wrote:

Thanks,

 

I see that this will work, but I am not sure if this is the way I should go as it will prevent the use of eattedit on other attribute blocks.

For the double click I was looking for something like: if this is "myblock" use my dialog box, if not "myblock" use eattedit.


Try something like this

(defun c:editblock ( / ss e o)
  (if
    (setq ss (ssget ":E:S:L" '((0 . "INSERT"))))
    (if
      (member
        (vlax-get
          (setq o (vlax-ename->vla-object (setq e (ssname ss 0))))
          (if
            (vlax-property-available-p o 'EffectiveName)
            'EffectiveName
            'Name
            )
          )
        '("BlockName1" "BlockName2");<- Your block name list here
        )
        (MyEditCommand e)
        (command "_eattedit" e)
      )
    )
  (princ)
  )

(defun MyEditCommand (e)
  ;your code here
  (foreach x (vlax-invoke (vlax-ename->vla-object e) 'GetAttributes)
    (print (vla-get-TagString x))
  )
  (princ)
)

 

Message 9 of 9
leothebuilder
in reply to: phanaem

Thank you....I'll try that.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost