Author Topic: How to select in attipedit with lisp  (Read 4081 times)

0 Members and 1 Guest are viewing this topic.

Crank

  • Water Moccasin
  • Posts: 1503
How to select in attipedit with lisp
« on: September 20, 2007, 04:28:57 PM »
I'm trying to walk trough all attribs after a block has been inserted with lisp and then start the command ATTIPEDIT on every attribute. This is something I've tried:
Code: [Select]
(setq att (entlast))
(if (assoc 66 (entget att))(progn
         (setq att (entnext (entlast)))
(while (setq att (entnext att))
(if (= (cdr (assoc 0 (entget att))) "ATTRIB")
(vl-cmdf ".attipedit" (nentselp (cdr (assoc 11 (entget att)))))
)
)
))
The problem with this is that you need a point real close to the text. The coords of DXF-code 10 or 11 are not working because the text isn't on those insertion points.

So the big question is: How can I find a point that's exact on the text of the attribute, or is there another way to use ATTIPEDIT when you only have the ename of the block to go from?
« Last Edit: September 20, 2007, 04:38:42 PM by Crank »
Vault Professional 2023     +     AEC Collection

LE

  • Guest
Re: How to select in attipedit with lisp
« Reply #1 on: September 20, 2007, 04:43:10 PM »
ATTIPEDIT ?

is that a new command in A2008?

Crank

  • Water Moccasin
  • Posts: 1503
Re: How to select in attipedit with lisp
« Reply #2 on: September 20, 2007, 04:53:28 PM »
Yes, it's a command to edit an atrribute in place.
Vault Professional 2023     +     AEC Collection

T.Willey

  • Needs a day job
  • Posts: 5251
Re: How to select in attipedit with lisp
« Reply #3 on: September 20, 2007, 05:00:08 PM »
I don't have '08, so this is a guess/idea.  Couldn't you just pass the ename of the attribute to the comamnd?

Edit:  You may need to watch out for the error of nesting a command to deep.
« Last Edit: September 20, 2007, 05:01:23 PM by T.Willey »
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Crank

  • Water Moccasin
  • Posts: 1503
Re: How to select in attipedit with lisp
« Reply #4 on: September 20, 2007, 05:57:00 PM »
Negative. This doesn't work: (command "attipedit" (entnext (entlast))) , but this works: (command "attipedit" (nentsel)) or (command "attipedit" (nentselp))

The coords found with (nentselp) can also be used.
« Last Edit: September 20, 2007, 05:58:42 PM by Crank »
Vault Professional 2023     +     AEC Collection

T.Willey

  • Needs a day job
  • Posts: 5251
Re: How to select in attipedit with lisp
« Reply #5 on: September 20, 2007, 06:19:02 PM »
Try this it, worked with -attedit, so it might work with the new command.  Pass the command a list of the attribute's ename followed by the block's ename.

Edit:  This may not work, as shown with this little bit of code from the command line.
Quote
Command: (progn
(_> (setq blkent (car (entsel)))
(_> (setq attent (car (nentsel)))
(_> (command "-attedit" "" "" "" "" (list attent blkent))
(_> )

Select object:
Select object: -attedit
Edit attributes one at a time? [Yes/No] <Y>:
Enter block name specification <*>:
Enter attribute tag specification <*>:
Enter attribute value specification <*>: Select Attributes:
Command: nil

but if done from the command line it works, as shown here
Quote
Command: -attedit

Edit attributes one at a time? [Yes/No] <Y>:

Enter block name specification <*>:

Enter attribute tag specification <*>:

Enter attribute value specification <*>:
Select Attributes: (list attent blkent)
(<Entity name: 7efcdf98> <Entity name: 7efcdf90>)
1 found
Select Attributes: *Cancel*

Now I don't know what to say.....  :ugly:
« Last Edit: September 20, 2007, 06:50:09 PM by T.Willey »
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

CADchup

  • Mosquito
  • Posts: 2
Re: How to select in attipedit with lisp
« Reply #6 on: September 21, 2007, 03:45:37 AM »
The coordinate of gc10 needs to be trans'd to the current UCS:

Code: [Select]
(setq att (entlast))
(if (assoc 66 (entget att))
  (while (setq att (entnext att))
    (if (= (cdr (assoc 0 (entget att))) "ATTRIB")
      (vl-cmdf ".attipedit"
               (nentselp
                 (trans (cdr (assoc 10 (entget att)))
                        (cdr (assoc -1 (entget att)))
                        1
                        )
                 )
               )
      )
    )
  )

Next thing is: This depends on the current zoom factor and the size of PICKBOX. You might have to zoom to the block or even the attribute before running the code.


Markus

Crank

  • Water Moccasin
  • Posts: 1503
Re: How to select in attipedit with lisp
« Reply #7 on: September 21, 2007, 01:42:44 PM »
Thanks Markus.
That works with normal blocks. The problem seems to be that my blocks are annotative.  :-(

I have some ideas how to pick a point that's exact on the text, but it will take some time before I find the right answer.
Vault Professional 2023     +     AEC Collection

ASMI

  • Guest
Re: How to select in attipedit with lisp
« Reply #8 on: September 21, 2007, 03:33:53 PM »
I havn't 2008 and ATTPEDIT. But what for you select attributes with NENTSELP function? Maybe:

Code: [Select]
(setq att(entlast))
(if (assoc 66 (entget att))
  (while (setq att (entnext att))
    (if (= (cdr (assoc 0 (entget att))) "ATTRIB")
      (vl-cmdf ".attipedit" att)
      )
    )
  )