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

Manipulate Table Objects?

10 REPLIES 10
Reply
Message 1 of 11
Shneuph
389 Views, 10 Replies

Manipulate Table Objects?

Can someone tell me why this code does not work? It is working directly in the command line... as you can tell...


Command: (tblnext "block" t)
((0 . "BLOCK") (2 . "44") (70 . 0) (10 0.0 0.0 0.0) (-2 .
7db0ea58>))

Command: (tblnext "block")
nil
___________________________________________________________________________

Command: (setq b1 (tblobjname "block" "44"))


Command: (setq b2 (cdr (car (entget (tblobjname "block" "44")))))


___________________________________________________________________________

(command "move" b2)

nil

Select objects: *Cancel*

Command: (command "move" b1)

nil
---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
10 REPLIES 10
Message 2 of 11
devitg
in reply to: Shneuph

You have to put a "" after B2 , and (from point) and ( to point)
Message 3 of 11
Shneuph
in reply to: Shneuph

Regardless, the command should continue afte the b1 or b2 variable is entered even with no "" or points. It would just prompt for user input. The problem is that the entity name is no good for some reason...

Command: (tblnext "block" t)
((0 . "BLOCK") (2 . "44") (70 . 0) (10 0.0 0.0 0.0) (-2 . Entity name:
7efa51d8))

Command: (setq b1 (tblobjname "block" "44"))
Entity name: 7efa5200

Command: (command "move" b1 "" (list 0.0 0.0 0.0) (list 1.0 0.0 0.0))
Bad Entity name: 7EFA5200
nil

Command: (setq b2 (cdr (car (entget (tblobjname "block" "44")))))
Entity name: 7efa5200

Command: (command "move" b2 "" (list 0.0 0.0 0.0) (list 1.0 0.0 0.0))
Bad Entity name: 7EFA5200
nil

gt lt symbols omitted because they would make some text not show in the post.
---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
Message 4 of 11
Anonymous
in reply to: Shneuph

You van NOT move a BLOCK definition, what you can move is an INSERT
instance of that block, that's why gives you bad entity error message
To move all the blocks names "44" you should do :
(setq gr44 (ssget "X" (list (cons 2 "44")))) and you will have a selection
available to a MOVE, COPY, ecc command




escribió en el mensaje news:5886682@discussion.autodesk.com...
Can someone tell me why this code does not work? It is working directly in
the command line... as you can tell...


Command: (tblnext "block" t)
((0 . "BLOCK") (2 . "44") (70 . 0) (10 0.0 0.0 0.0) (-2 .
7db0ea58>))

Command: (tblnext "block")
nil
___________________________________________________________________________

Command: (setq b1 (tblobjname "block" "44"))


Command: (setq b2 (cdr (car (entget (tblobjname "block" "44")))))


___________________________________________________________________________

(command "move" b2)

nil

Select objects: *Cancel*

Command: (command "move" b1)

nil
Message 5 of 11
Shneuph
in reply to: Shneuph

Thanks for that explanation Gustavo.. I was trying to manipulate actually unnamed blocks e.g. *D##. If I use the string you wrote for instance..
(setq grd10 (ssget "X" (list (cons 2 "*D10"))))
Will this work?
---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
Message 6 of 11
devitg
in reply to: Shneuph

Yes, it will
Message 7 of 11
Shneuph
in reply to: Shneuph

Thanks very much for your help.
---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
Message 8 of 11
Shneuph
in reply to: Shneuph

Command: (tblnext "block")
((0 . "BLOCK") (2 . "*U8") (70 . 1) (4 . "") (10 0.0 0.0 0.0) (-2 . Entity
name: 7e26dd2>))

Command: (setq ssu (ssget "x" (list (cons 2 "*U8"))))
nil

Am I doing something wrong here?

P.S. no Dimensions in Dwg.
---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
Message 9 of 11
Anonymous
in reply to: Shneuph

The asterisk is treated as a wildcard character (see wcmatch). Add a back-quote to treat it literally.

(setq ssu (ssget "x" (list '(0 . "INSERT") (cons 2 "`*U8"))))
Message 10 of 11
Shneuph
in reply to: Shneuph

Genius! Thanks... uh oh.. Yet another issue it looks like.. Have you ever seen this??

Command: (tblnext "block")
((0 . "BLOCK") (2 . "*U|REF11") (70 . 49) (4 . "") (10 0.0 0.0 0.0) (-2 .
Entity name: 748fdd90>))

Command: (setq bb (ssget "x" (list (cons 2 "`*U|ref11"))))
nil

Command: (command "move" bb "")
nil

Command: (setq bb (ssget "x" (list (cons 2 "`*U|REF11"))))
nil

Command: (setq bb (ssget "x" (list (cons 2 "`*U`|REF11"))))
nil

Command: (setq bb (ssget "x" (list (cons 2 "'*U'|REF11"))))
nil

Command: (setq bb (ssget "x" (list (cons 2 "'*U|REF11"))))
nil

Command: (setq bb (ssget "x" (list (cons 2 "`*U|REF11"))))
nil
---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
Message 11 of 11
Anonymous
in reply to: Shneuph

That block is defined within an xref. See the dxf reference help file. The 70 code, in particular. Be sure to inclode '(0 ."INSERT") in the ssget filter list. If it returns nil; then there are no inserts with that name. Next... Just move on.

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

Post to forums  

Autodesk Design & Make Report

”Boost