I'm trying to write some code to place a field which shows the value of a DB Parameter. E.g. say the block's name is "BlockX" and the Parameter is "Lenght1". If I have an instance of this block and get its Com Object, I can get the following:Now the Com Object of the parameter saved in the PropObj variable has the value and some properties available. There's nothing like an ObjectID or such. If I do a manual field of this DB+Param I get the following field code:Code:(setq BlockRefID (vla-get-ObjectID BlockRefObj)) ;Get the ID number, e.g. 2124660792 (setq PropList (vlax-Invoke BlockRefObj "GetDynamicBlockProperties")) ;Get list of Parameters (setq n 0 ;Initialize counter PropObj nil ;Initialize object ) ;; Step through list (while (or (not PropObj) ;Until found, or (< n (length PropList)) ;Till end of list ) ;; Check for prop's name (if (= (strcat (vla-get-PropertyName (nth n PropList))) "LENGTH1") (setq PropObj (nth n PropList)) ;Set the found object, else (setq n (1+ n)) ;Increment counter ) )Now clearly the ObjectID is the block reference's ID as saved in the BlockRefID variable. However, how do I get hold of the 42 number to identify which Parameter?Code:%<\AcObjProp Object(%<\_ObjId 2124660792>%).Parameter(42).UpdatedDistance>%
A vlax-dump-object of the ParamObj gives:It's the 1st (i.e. index number 0) of the Parameters in the PropList ... so that's not it.Code:; IAcadDynamicBlockReferenceProperty: AutoCAD Dynamic Block Property Interface ; Property values: ; AllowedValues (RO) = (1210.0 1510.0 1615.0 1790.0 1990.0) ; Description (RO) = "" ; PropertyName (RO) = "Length1" ; ReadOnly (RO) = 0 ; Show (RO) = -1 ; UnitsType (RO) = 2 ; Value = 1510.0 ; No methods
Trying to get the DXF values of the Param using:This returns nil, so there's no way of doing this either.Code:(setq PropEname (vlax-vla-object->ename PropObj))
Even looking through the ObjectARX & DotNet Managed help files I can't find anywhere which would give me this index code. Anyone got a clue?


Reply With Quote
