Double click Actions Problem

rapp5
edited August 2023 in LISP
I need to use the following code in double click actions / Attribute Block / Edit Block Attributes / Command Section, but it does not work. Works in Autocad

^C^C((= (substr (cdr (assoc 2 (entget (ssname (ssget "P") 0)))) 1 6) "POSE") (c:rea) (command "_eattedit" ))

ERROR :

: ((= (substr (cdr (assoc 2 (entget (ssname (ssget "P") 0)))) 1 6) "POSE") (c:rea) (command "_eattedit" ))
; ----- Error around expression -----
; (SSGET "P")
;
; error : no function definition <(= (SUBSTR (CDR (ASSOC 2 (ENTGET (SSNAME (SSGET "P") 0)))) 1 6) "POSE")> ; expected FUNCTION at [eval]

Comments

  • Still no reply?
  • Are you missing the 'if'?
    (if (= (substr (cdr (assoc 2 (entget (ssname (ssget "P") 0)))) 1 6) "POSE") (c:rea) (command "_eattedit" ))
  • Are you missing the 'if'?
    (if (= (substr (cdr (assoc 2 (entget (ssname (ssget "P") 0)))) 1 6) "POSE") (c:rea) (command "_eattedit" ))

    :
    : (if (= (substr (cdr (assoc 2 (entget (ssname (ssget "P") 0)))) 1 6) "POSE") (c:rea) (command "_eattedit" ))
    ; ----- Error around expression -----
    ; (SSGET "P")
    ;
    ; error : bad argument type ; expected SELECTIONSET at [ssname]

    still same problem
  • I suggest filing a bug report.
  • from error message, seems that (ssget "P") returns NIL (no previous set);
    you might try to replace
    (ssget "P")
    with
    (ssgetfirst)
    ?

    many greetings !
  • from error message, seems that (ssget "P") returns NIL (no previous set);
    you might try to replace
    (ssget "P")
    with
    (ssgetfirst)
    ?

    many greetings !

    Thank you, but I get same error
  • I think there is a fundamental flaw. You said this is for a double click action, which implies that you want to click on a block, read the attribute tag value, then either run c:rea or run the attribute editor.

    (ssget "P") reads whatever the last selection was. You are clicking on one entity but the code is working on the first entity of the last selection set before the double click. You might want to use ENTSEL or try "_+.:E:S:L" instead of "P".
  • rapp5
    edited September 2023

    I think there is a fundamental flaw. You said this is for a double click action, which implies that you want to click on a block, read the attribute tag value, then either run c:rea or run the attribute editor.

    (ssget "P") reads whatever the last selection was. You are clicking on one entity but the code is working on the first entity of the last selection set before the double click. You might want to use ENTSEL or try "_+.:E:S:L" instead of "P".

    ^C^C((= (substr (cdr (assoc 2 (entget (entsel "P") 0)))) 1 6) "POSE") (c:rea) (command "_eattedit" ))

    It opens with the following code, but some variables can be fixed in the lispin. For example, I fixed the length of a line to pose. When the length of the line changes, it changes automatically, but when it works with this code, that function does not work, I guess because it does not get ssname.