Author Topic: confused on the name of ATTDYNBLOCKREF,please help  (Read 9509 times)

0 Members and 1 Guest are viewing this topic.

snddd2000

  • Guest
confused on the name of ATTDYNBLOCKREF,please help
« on: March 08, 2011, 02:38:47 AM »
now i have a block list as below
((-1 . <图元名: 7efc0300>) (0 . "INSERT") (5 . "B9B8") (102 . "{ACAD_XDICTIONARY") (360 . <图元名: 7ed09318>) (102 . "}") (330 . <图元名: 7efa9cf8>) (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "细实线") (100 . "AcDbBlockReference") (66 . 1) (2 . "*U661") (10 3672.0 784.0 0.0) (41 . 8.0) (42 . 8.0) (43 . 8.0) (50 . 0.0) (70 . 0) (71 . 0) (44 . 0.0) (45 . 0.0) (210 0.0 0.0 1.0))

the  (2 . "*U661") should be the name ,but when i defined this block the name is "qq",not "*U661"
why? confuesd long time
thanks
please help me!
my english is not good
 :-o

Tharwat

  • Swamp Rat
  • Posts: 710
  • Hypersensitive
Re: confused on the name of ATTDYNBLOCKREF,please help
« Reply #1 on: March 08, 2011, 02:54:17 AM »
I guess this would give the real name of it .

Code: [Select]
(setq ss (ssget "_+.:S" '((0 . "INSERT"))))
(setq BlkName (vla-get-effectivename  (vlax-ename->vla-object (ssname ss 0))))

Regards,

Tharwat

snddd2000

  • Guest
Re: confused on the name of ATTDYNBLOCKREF,please help
« Reply #2 on: March 08, 2011, 03:15:19 AM »
the real name ? means what? :oops:

thanks

Tharwat

  • Swamp Rat
  • Posts: 710
  • Hypersensitive
Re: confused on the name of ATTDYNBLOCKREF,please help
« Reply #3 on: March 08, 2011, 03:18:58 AM »
Your Block name before going to become a Dynamic Block

Try the codes and you will find it out .

this block the name is "qq",not "*U661"

snddd2000

  • Guest
Re: confused on the name of ATTDYNBLOCKREF,please help
« Reply #4 on: March 08, 2011, 03:21:56 AM »
when i copy this block to another dwg.
the *U661 would be changed ,and the "qq"  not changed.
press ctrl+1 the name "qq" in the list of properties

snddd2000

  • Guest
Re: confused on the name of ATTDYNBLOCKREF,please help
« Reply #5 on: March 08, 2011, 03:22:52 AM »
yes the block is Dynamic Block
Dynamic Block name must like this?

thanks

Jeff H

  • Needs a day job
  • Posts: 6151
Re: confused on the name of ATTDYNBLOCKREF,please help
« Reply #6 on: March 08, 2011, 03:24:31 AM »
You do understand with dynamic blocks anytime you change a dynamic property it will create a anonymous block?

snddd2000

  • Guest
Re: confused on the name of ATTDYNBLOCKREF,please help
« Reply #7 on: March 08, 2011, 03:26:46 AM »
thanks a lot
it works

one question
(setq ss (ssget "_+.:S" '((0 . "INSERT"))))
why add "_+.:" before :S?  :lol:

Tharwat

  • Swamp Rat
  • Posts: 710
  • Hypersensitive
Re: confused on the name of ATTDYNBLOCKREF,please help
« Reply #8 on: March 08, 2011, 03:29:55 AM »
thanks a lot
it works

one question
(setq ss (ssget "_+.:S" '((0 . "INSERT"))))
why add "_+.:" before :S?  :lol:

Because the ssget function is multi-selection set and to add "_+.:S" would force it for single selection set only ( one selection set).

Good luck.



snddd2000

  • Guest
Re: confused on the name of ATTDYNBLOCKREF,please help
« Reply #9 on: March 08, 2011, 03:31:28 AM »
You do understand with dynamic blocks anytime you change a dynamic property it will create a anonymous block?
but why select two diffrent block ,the name is same?

命令: (vlax-get-property (vlax-ename->vla-object  (car (entsel))) 'name)

选择对象: "*U661"

命令: (vlax-get-property (vlax-ename->vla-object  (car (entsel))) 'name)

选择对象: "*U661"

snddd2000

  • Guest
Re: confused on the name of ATTDYNBLOCKREF,please help
« Reply #10 on: March 08, 2011, 03:35:39 AM »
thanks a lot
it works

one question
(setq ss (ssget "_+.:S" '((0 . "INSERT"))))
why add "_+." before :S?  :lol:

Because the ssget function is multi-selection set and to add "_+.:S" would force it for single selection set only ( one selection set).

Good luck.

how can i filter this name block by ssget?
thanks

pBe

  • Bull Frog
  • Posts: 402
Re: confused on the name of ATTDYNBLOCKREF,please help
« Reply #11 on: March 08, 2011, 06:54:42 AM »
right after this: (as tharwats suggestion)
Code: [Select]
(setq ss (ssget "_+.:S" '((0 . "INSERT"))))
Before you processed the block, run this as a test for block name
Code: [Select]
(setq BlkName (vla-get-effectivename  (vlax-ename->vla-object (ssname ss 0))))
it will you give you name of the block for your test/cond
(if (eq BlkName "qq") (.... <----- test
But if you're going to select on screen as the example suggest, you dont really need to do this as you already know you're selecting the correct block, but if you have the need for the blockname then you should run the test.

Now if you select the entire database using "_X" (meaning no prompt for selection on the screen)
Code: [Select]
(setq ss (ssget "_X" '((0 . "INSERT")(2 . "*U*,qq"))))Then you need to run it through the test before you worked on the block

That is just how Dynamic Block behaves (Autodesk needs to do something about this I guess), converting it to an anonymous name

Hope this helps
« Last Edit: March 08, 2011, 07:12:56 AM by pBe »

snddd2000

  • Guest
Re: confused on the name of ATTDYNBLOCKREF,please help
« Reply #12 on: March 08, 2011, 08:14:05 PM »
right after this: (as tharwats suggestion)
Code: [Select]
(setq ss (ssget "_+.:S" '((0 . "INSERT"))))
Before you processed the block, run this as a test for block name
Code: [Select]
(setq BlkName (vla-get-effectivename  (vlax-ename->vla-object (ssname ss 0))))
it will you give you name of the block for your test/cond
(if (eq BlkName "qq") (.... <----- test
But if you're going to select on screen as the example suggest, you dont really need to do this as you already know you're selecting the correct block, but if you have the need for the blockname then you should run the test.

Now if you select the entire database using "_X" (meaning no prompt for selection on the screen)
Code: [Select]
(setq ss (ssget "_X" '((0 . "INSERT")(2 . "*U*,qq"))))Then you need to run it through the test before you worked on the block

That is just how Dynamic Block behaves (Autodesk needs to do something about this I guess), converting it to an anonymous name

Hope this helps

thanks a lot but this (setq ss (ssget "_X" '((0 . "INSERT")(2 . "*U*,qq")))) does not work
canot select any blocks,
now i use below way to do
Code: [Select]
(setq ss1 (ssget '((0 . "INSERT"))) )
(setq count  (sslength ss1)
      n       0
      n1      0
      zl1     0
      zzl1    0
)
(repeat count
 (if (/= "qq" (vla-get-effectivename (vlax-ename->vla-object (ssname ss1 n))))
  (progn
    (ssdel (ssname ss1 n) ss1)
    (setq n (1- n))
  )
 )
 (setq n (1+ n))
)
i do not know any better way.

thanks all

pBe

  • Bull Frog
  • Posts: 402
Re: confused on the name of ATTDYNBLOCKREF,please help
« Reply #13 on: March 08, 2011, 10:35:29 PM »
oops my bad
Code: [Select]
(setq ss (ssget "_X" '((0 . "INSERT")(2 . "*U*,qq"))))
Should be
Code: [Select]
(setq ss (ssget "_X" '((0 . "INSERT")(2 . "`*U*,qq"))))or
Code: [Select]
(setq ss (ssget  '((0 . "INSERT")(2 . "`*U*,qq"))))
But anyway, i see you got it figured out
« Last Edit: March 08, 2011, 11:05:30 PM by pBe »

snddd2000

  • Guest
Re: confused on the name of ATTDYNBLOCKREF,please help
« Reply #14 on: March 08, 2011, 10:48:30 PM »

oops my bad
Code: [Select]
(setq ss (ssget "_X" '((0 . "INSERT")(2 . "*U*,qq"))))
Should be
Code: [Select]
(setq ss (ssget "_X" '((0 . "INSERT")(2 . "`*U*,qq"))))
But anyway, i see you got it figured out
Great, it is right , i like your way
thank you very much