Author Topic: Question 28 goes here  (Read 2908 times)

0 Members and 1 Guest are viewing this topic.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Question 28 goes here
« on: September 14, 2005, 10:25:38 AM »
Quote
How do you get the 'true' name of a Dynamic Block?
TheSwamp.org  (serving the CAD community since 2003)

Peter Jamtgaard

  • Guest
Re: Question 28 goes here
« Reply #1 on: September 14, 2005, 11:29:12 AM »
(vla-get-EffectiveName (vlax-ename->vla-object (car (entsel "\nSelect Dynamic Block: "))))

Peter Jamtgaard P.E.

deegeecees

  • Guest
Re: Question 28 goes here
« Reply #2 on: September 14, 2005, 01:28:50 PM »
Thats hittin below the belt, c'mon now.

AutoCAD 2002 = N/A

*AutoCAD 2006 = DXF Group Code -1

*Denotes the inability to fully process request based on insufficient resources, processor has determined best possible answer based on availability of internal memory.

whdjr

  • Guest
Re: Question 28 goes here
« Reply #3 on: September 14, 2005, 01:44:12 PM »
 :-o

Where did that come from D?

deegeecees

  • Guest
Re: Question 28 goes here
« Reply #4 on: September 14, 2005, 01:51:31 PM »
<conjures up best Jeff Spicoli impression> "Dude, that was my skull... heh, heh, I'm so wasted!"

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Question 28 goes here
« Reply #5 on: September 14, 2005, 02:00:02 PM »
_LIST

_PROPERTIES

_BEDIT

AxPROPS

.. are a couple that come to mind ..
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

whdjr

  • Guest
Re: Question 28 goes here
« Reply #6 on: September 14, 2005, 03:44:08 PM »
Peter came up with the answer but if you all notice it took an Engineer to answer my question.


I recently took a trek to research that bit of info to pen this beut.  RIB :mrgreen:

Peter Jamtgaard

  • Guest
Re: Question 28 goes here
« Reply #7 on: September 14, 2005, 05:00:42 PM »
You can also link between them using xdata

Peter Jamtgaard ...


Code: [Select]
; Written By: Peter Jamtgaard copr 2005
; Extraction of Dynamic Block Real Name from
; Anonymous block entity using Xdata
; Syntax (getrealname (car (entsel)))
(defun GetRealName (objSelection      /
                    lstEntity
                    lstXdata
                    entBlockReference
                    objBlockReference
                    objSelection
                    strBlockName
                    strHandle
                   )
 (if (= (type objSelection) 'ENAME)
  (setq objSelection (vlax-ename->vla-object objSelection))
 )
 (if (wcmatch (vla-get-objectname objSelection)
              "AcDbBlockReference,AcDbMInsertBlock"
     )
  (progn
   (setq strBlockName (vla-get-name objSelection))
   (if (and (= (substr strBlockName 1 1) "*")
            (setq objBlockReference (vla-item
                                     (vla-get-blocks
                                      (vla-get-activedocument
                                       (vlax-get-acad-object)))
                                      (vla-get-name objSelection)))
            (setq lstEntity         (entget (vlax-vla-object->ename objBlockReference)
                                            (list "AcDbBlockRepBTag")))
            (setq lstXdata          (assoc -3 lstEntity))
            (setq strHandle         (cdr (assoc 1005 (cdadr lstXdata))))
            (setq entBlockReference (handent strhandle))
       )
    (setq strBlockName (vla-get-name
                        (vlax-ename->vla-object entBlockReference)))
   )
  )
 )
 strBlockName
)

Here is a bit more code for dynamic blocks :-P


Code: [Select]
(defun GetDynamicBlockPropertyList (objSelection / lstProperties)
 (if (and (vlax-property-available-p objSelection "IsDynamicBlock")
          (= (vla-get-IsDynamicBlock objSelection) :vlax-true)
          (setq lstProperties (errortrap '(vlax-safearray->list
                                           (variant-value
                                            (vla-GetDynamicBlockProperties objSelection)
                                           )
                                          )
                             )
          )
     )
  (progn
   (print lstProperties)
   (mapcar '(lambda (x)(cons (vla-get-propertyname X)(variant-value (vla-get-value X)))) lstProperties)
  )
 )
)