I haven't tried this, and don't have MDT. But, as a general purpose debugging technique, do (vl-bt) before running your routine. That will give you code spill-out to show you where the problem is, which will usually help you solve it.
the problem is in some drawings is work well ,another drawings don´t work.
the command (vlax-put-property (vlax-invoke-method Ilist 'item 0) 'data alist2) give the error
the (vl-bt) give this:
Backtrace:
[0.59] (VL-BT)
[1.55] (*ERROR* "Automation Error. Description was not provided.") LAP+7
[2.49] (_call-err-hook #<USUBR @000000004f3e31b0 *ERROR*> "Automation Error.
Description was not provided.")
[3.43] (sys-error "Automation Error. Description was not provided.")
:ERROR-BREAK.38 "Automation Error. Description was not provided."
[4.35] (intelligent-invoke #<VLA-OBJECT IMcadBOMItem3 00000000294d2a98> DATA 4
#<variant 8200 ...>)
[5.27] (vlax-put-property #<VLA-OBJECT IMcadBOMItem3 00000000294d2a98> DATA
#<variant 8200 ...>)
[6.20] (C:MB_SYMDIM) LAP+629
[7.15] (#<SUBR @000000004f3e3b10 -rts_top->)
[8.12] (#<SUBR @000000002e80c700 veval-str-body> "(C:MB_SYMDIM)" T #<FILE
internal>)
:CALLBACK-ENTRY.6 (:CALLBACK-ENTRY)
:ARQ-SUBR-CALLBACK.3 (nil 0)
Mike,
It might be a good idea to attach one of the drawings that works and one that doesn't. That way we'll have any layers, blocks, etc. necessary.
That said, it's going-home time in my neck of the woods, but perhaps someone further west could help.
S
Mike - some suggestions:
Unlocalize your variables (temporarily, for testing)
Separate this line: (vlax-put-property(vlax-invoke-method Ilist 'item 0)'data alist2)
into two:
(setq obj (vlax-invoke-method Ilist 'item 0))
(vlax-put-property obj 'data alist2)
Run it (doing vl-bt first), and examine your variables. Use (vl-dump-object obj) to see what it is, and whether it actually has a data property available. Check alist2, and the variables that went into it. I think you'll be sure to find something not as it should be, which you can then either correct or trap for.
the problem is the command ammassprop, when i choose the material for the part
In ok.dwg the function work well ,when i do the command ammassprop, the function dont work
Command: (vlax-dump-object obj)
; IMcadBOMItem3: IMcadBOMItem3 Interface
; Property values:
; Application (RO) = #<VLA-OBJECT IAcadApplication 0000000140d28e28>
; AutoCalculateEnabled = -1
; Balloons (RO) = #<VLA-OBJECT IMcadBalloons 000000008025cde8>
; BOM (RO) = #<VLA-OBJECT IMcadBOM3 0000000080b88a08>
; Data = multi dimension safearray not supported
; Document (RO) = #<VLA-OBJECT IAcadDocument 000000008166a740>
; ExcludeFromPartList = 0
; Expanded = 0
; Handle (RO) = "C94"
; HasExtensionDictionary (RO) = 0
; IsExpandable (RO) = 0
; ItemNumber = "1"
; ObjectID (RO) = 42
; ObjectID32 (RO) = 42
; ObjectName (RO) = "AcmBomRow"
; OwnerID (RO) = 43
; OwnerID32 (RO) = 43
; Phantomed (RO) = 0
; Quantity = 1
; SortPriority = 1000
T
I'm still at a disadvantage in that I don't have MDT, but maybe I can help anyway. The problem seems to be here:
; Data = multi dimension safearray not supported
so you need to trap for that. You might try this:
(if (vlax-property-available-p obj 'data)
(progn
(vlax-put-property obj 'data alist2)
; do everything else here
)
; else
(princ "\nSkipping object - data property not available. ")
)
If vlax-property-available-p returns T for this (I can't test without having MDT), then use vl-catch-all-apply instead:
(setq catch (vl-catch-all-apply 'vlax-put-property (list obj 'data alist2)))
(if (vl-catch-all-error-p catch)
(princ "\nSkipping object - data property not available. ")
;else
(progn
; do everything else here
)
)
i only change
(vlax-put-property obj 'data alist2)
for this
(setq catch (vl-catch-all-apply 'vlax-put-property (list obj 'data alist2)))
and resulted.... thanks ken