Author Topic: List of object properties to an array?  (Read 21759 times)

0 Members and 1 Guest are viewing this topic.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: List of object properties to an array?
« Reply #15 on: November 09, 2007, 10:04:23 AM »
Thanks guys, but all I really did was explore a help file and play with the Locals window in VBA.

Yeah, but it's a gooder!

Something I'm working on for the lispin' folks --

(_GetPropertiesAndMethods (_ObjSel))

Select object: <Michael selects a sphere>

(
    (PROPERTIES

        ("Application" #<VLA-OBJECT IAcadApplication 00d73d3c>)
        ("Centroid" (1568.79 542.192 0.0))
        ("color" 256)
        ("Database" #<VLA-OBJECT IAcadDatabase 0bc1cb6c>)
        ("Document" #<VLA-OBJECT IAcadDocument 0775f300>)
        ("EntityName" "AcDb3dSolid")
        ("EntityType" 3)
        ("Handle" "1AE")
        ("HasExtensionDictionary" 0)
        ("History" -1)
        ("Hyperlinks" #<VLA-OBJECT IAcadHyperlinks 0bc2851c>)
        ("Layer" "0")
        ("Linetype" "ByLayer")
        ("LinetypeScale" 1.0)
        ("Lineweight" -1)
        ("Material" "ByLayer")
        ("MomentOfInertia" (5.97049e+011 4.96199e+012 5.55409e+012))
        ("ObjectID" 2130322288)
        ("ObjectName" "AcDb3dSolid")
        ("OwnerID" 2130316536)
        ("PlotStyleName" "ByLayer")
        ("Position" (1568.79 542.192 0.0))
        ("PrincipalDirections" (1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0))
        ("PrincipalMoments" (4.94487e+009 4.94487e+009 4.94487e+009))
        ("ProductOfInertia" (1.71321e+012 0.0 0.0))
        ("RadiiOfGyration" (544.451 1569.57 1660.58))
        ("ShowHistory" 0)   
        ("SolidType" "Sphere")
        ("TrueColor" #<VLA-OBJECT IAcadAcCmColor 0bb8c3d0>)
        ("Visible" -1)
        ("Volume" 2.01415e+006)
   
    )
   
    (METHODS
   
        ;;  The number is the argument count. The next version will actually
        ;;  name the arguments and spec the data type. Ha ha ha ha ha ha.

        ("AddRef" 0)
        ("ArrayPolar" 3)
        ("ArrayRectangular" 6)
        ("Boolean" 2)
        ("CheckInterference" 2)
        ("color" 0)
        ("Copy" 0)
        ("Delete" 0)
        ("Erase" 0)
        ("GetBoundingBox" 2)
        ("GetExtensionDictionary" 0)
        ("GetIDsOfNames" 5)
        ("GetTypeInfo" 3)
        ("GetTypeInfoCount" 1)
        ("GetXData" 3)
        ("Highlight" 1)
        ("History" 0)
        ("IntersectWith" 2)
        ("Invoke" 8)
        ("Layer" 0)
        ("Linetype" 0)
        ("LinetypeScale" 0)
        ("Lineweight" 0)
        ("Material" 0)
        ("Mirror" 2)
        ("Mirror3D" 3)
        ("Move" 2)
        ("PlotStyleName" 0)
        ("Position" 0)
        ("QueryInterface" 2)
        ("Release" 0)
        ("Rotate" 2)
        ("Rotate3D" 3)
        ("ScaleEntity" 2)
        ("SectionSolid" 3)
        ("SetXData" 2)
        ("ShowHistory" 0)
        ("SliceSolid" 4)
        ("TransformBy" 1)
        ("TrueColor" 0)
        ("Update" 0)
        ("Visible" 0)

    )
   
)


Michael wanders off laughing maniacally looking for a life ...
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

FengK

  • Guest
Re: List of object properties to an array?
« Reply #16 on: March 26, 2008, 03:23:40 PM »
In case someone else can make use of it.

Code: [Select]
;;;=================================================================================
;;; 1. You need to register tlbinf32.dll before using these functions.
;;; 2. Thanks to Michael Puckett and David Blackmon for sharing their findings about
;;;    using tlbinf32.dll. Sorry if I missed anyone that should be credited.
;;; 3. Feel free to modify/use.
;;;=================================================================================

;;;Enum InvokeKinds
;;;  INVOKE_UNKNOWN = 0,
;;;  INVOKE_FUNC = 1,
;;;  INVOKE_PROPERTYGET = 2,
;;;  INVOKE_PROPERTYPUT = 4,
;;;  INVOKE_PROPERTYPUTREF = 8,
;;;  'Special TLI values
;;;  INVOKE_EVENTFUNC = 16,
;;;  INVOKE_CONST = 32
;;;End Enum

;;;=================================================================================
;;;(KF:Get_Object_TypeInfo
;;;  (car (entsel "\nPick object to list TypeInfo: "))
;;;)
(defun KF:Get_Object_TypeInfo (obj / appTli lstInvokeKind rv objInfo @)
  (if (setq appTli (vlax-create-object "TLI.TLIApplication"))
    (progn
      (if (eq 'ENAME (type obj))
(setq obj (vlax-ename->vla-object obj))
      )
      (setq lstInvokeKind (list 0 1 2 4 8 16 32)
    rv   (mapcar 'list lstInvokeKind)
      )
      (setq objInfo (vlax-invoke appTli 'InterfaceInfoFromObject obj))
      (vlax-for infoMember (vlax-get-property objInfo 'Members)
(setq @   (vl-position
    (vlax-get-property infoMember 'InvokeKind)
    lstInvokeKind
  )
      lst (nth @ rv)
      rv  (subst
    (cons (vlax-get-property infoMember 'Name) lst)
    lst
    rv
  )
)
      )
      (mapcar (function (lambda (lst)
  (cons (car lst) (vl-sort (cdr lst) '<))
)
      )
      (mapcar 'reverse rv)
      )
    )
  )
)

;;;=================================================================================
;;;(KF:Get_Object_PropertiesGet
;;;  (car (entsel "\nPick object to list applicable properties to get: "))
;;;)
(defun KF:Get_Object_PropertiesGet (obj / lst)
  (if (setq lst (KF:Get_Object_TypeInfo obj))
    (cdr (nth 2 lst))
  )
)

;;;=================================================================================
;;;(KF:Get_Object_PropertiesPut
;;;  (car (entsel "\nPick object to list applicable properties to put: "))
;;;)
(defun KF:Get_Object_PropertiesPut (obj / lst)
  (if (setq lst (KF:Get_Object_TypeInfo obj))
    (cdr (nth 3 lst))
  )
)

;;;=================================================================================
;;;(KF:Get_Object_Methods
;;;  (car (entsel "\nPick object to list applicable methods: "))
;;;)
(defun KF:Get_Object_Methods (obj / lst)
  (if (setq lst (KF:Get_Object_TypeInfo obj))
    (cdr (nth 1 lst))
  )
)

« Last Edit: March 26, 2008, 07:30:42 PM by Kelie »

taner

  • Guest
Re: List of object properties to an array?
« Reply #17 on: July 19, 2009, 02:32:43 AM »
Dear Sir,

Can you write a progress as KF:Get_Object_PropertiesGet_readonly(get the Properties list that is read-only).

Thanks!

FengK

  • Guest
Re: List of object properties to an array?
« Reply #18 on: July 19, 2009, 04:21:32 AM »
Try this:

Code: [Select]
(defun KF:Get_Object_PropertiesGet_ReadOnly (obj)
  (vl-remove-if (function (lambda (e)
    (member e (KF:Get_Object_PropertiesPut obj))
  )
)
(KF:Get_Object_PropertiesGet obj)
  )
)

chlh_jd

  • Guest
Re: List of object properties to an array?
« Reply #19 on: October 14, 2014, 08:14:17 AM »
Thanks xycadd for share it . :-D

mailmaverick

  • Bull Frog
  • Posts: 494
Re: List of object properties to an array?
« Reply #20 on: November 16, 2014, 11:23:40 PM »
Code: [Select]

;;; 1. You need to register tlbinf32.dll before using these functions.


How to register tlbinf32.dll in AUTOCAD ?
I have searched this file and it exists in C:\Program Files (x86)\VectorDraw\Components\1036\Ansi folder.