View Full Version : Is there a way to list the name of a Dynamic Block in LISP?
jakob_k
2006-12-06, 01:30 AM
hi,
is there a way to list the name of a dynamic block in lisp code? i mean other than the anonymous name (*U25).
karl
Mike.Perry
2006-12-06, 09:46 AM
Hi Karl
Please note I have *moved* this thread from the AutoCAD Dynamic Blocks (http://forums.augi.com/forumdisplay.php?f=198) forum to this one, as I believe it will be better served here.
Thanks, Mike
Forum Manager
kpblc2000
2006-12-06, 11:50 AM
Get EffectiveName property (if you're using vla-pointer to block).
jakob_k
2006-12-06, 03:44 PM
i read up on EffectiveName property.
i don't know vb.
could you push me with some vlisp?
karl
i figgered it out. for those who'd like to try:
(print ENT_NAME)
;(setq ENT_DATA (entget ENT_NAME))
;(print ENT_DATA)
(setq VLA_ENT (vlax-ename->vla-object ENT_NAME))
(print VLA_ENT)
(setq VLA_ENT_NAME (vlax-get-property VLA_ENT 'EFFECTIVENAME))
(print VLA_ENT_NAME)
(print)
now i'm as happy as when God gives me a plate o' grits with a ham hock!
karl :-)
kpblc2000
2006-12-07, 06:41 AM
Try this code:
(defun getblockname (blk / res)
(if blk
(progn
(if (= (type blk) 'ename)
(setq blk (vlax-ename->vla-object blk))
) ;_ end of if
(setq res (if (vlax-property-available-p blk 'effectivename)
(vla-get-effectivename blk)
(vla-get-name blk)
) ;_ end of if
) ;_ end of setq
) ;_ end of progn
) ;_ end of if
) ;_ end of defun
call parameters: blk - pointer to block reference (ename or vla-pointer). Works correctly in 2005 and 2006 - i tested it right now.
call samples:
(getblockname (car (entsel))
jakob_k
2006-12-07, 02:49 PM
thank you,
your's is easier. i'll use it for my future routines. what i've done now works.
i read a sheet for certain dynblocks (2d appearance), extract attributes and other info, then create 3d equavialents. (ie. push magic button and get instant building.)
karl
kpblc2000
2006-12-07, 03:01 PM
I not so well know English, therefore I ask to consider with understanding to that I shall tell:)
In Russia these wishes frequently name as "BRB" - Big Red Button: Press it and get the money.
Dynamic blocks as far as I know, not so correctly work (if work in general) in 3D. If 3-dimensional construction is necessary for you, I would try ADT or Revit. In the first (ADT) it is possible to work practically as in usual AutoCAD, in the second (Revit) very good engine.
I not so well know English, therefore I ask to consider with understanding to that I shall tell:)
In Russia these wishes frequently name as "BRB" - Big Red Button: Press it and get the money.
Dynamic blocks as far as I know, not so correctly work (if work in general) in 3D. If 3-dimensional construction is necessary for you, I would try ADT or Revit. In the first (ADT) it is possible to work practically as in usual AutoCAD, in the second (Revit) very good engine.
You are right...In AutoCAD 2006 you could at least 3dorbit in the block editor and in 2007 that got removed...There is no official support for 3d dynamic blocks...I really hope they fix some of that in the next release...
jakob_k
2006-12-08, 03:42 PM
i do use adt2006.
but the 3-d blocks are cumbersome to use, hence my using regular blocks as i normally do (for efficiency) but extracting info and creating the 3-d geometry as a separate routine (the big red button) and exporting to a file.
karl
kpblc2000
2006-12-08, 03:53 PM
So i think you'd better use AEC-objects (walls, windows, doors etc) and mass-objects to get all info you need (and, as a rule, to change it). But in this case you can only use vla-* functions (vlax-get-property, vlax-put-property) in many cases.
jakob_k
2006-12-28, 11:11 PM
yeah, that's what i'm learning...um, realizing.
karl :-)
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.