Hey All,
I'm trying to make (what seems like) a small change to this code, but I get an error returned when I used the modified version. I'm trying to look at the "model" number and determine which vis state to use. The code I'm beginning with only inserts the block with a pre-defined vis state.
Code:
"Error: bad function: #<VLA-OBJECT IAcadBlockReference2 000000003d5c0b78>"
Here's the code that works:
Code:
(if (setq tmp (vla-insertblock spc (vlax-3d-point ins) blk scl scl scl 0.0))
(xins:putdynamicproperty tmp "Visibility1" "COPELAND RECIP")
)
When I change the above to this, I get an error.
Code:
(cond
(
(and (setq blk "M-GROUP-CLD-XML")
(setq tmp (vla-insertblock spc (vlax-3d-point ins) blk scl scl scl 0.0))
(or (= (substr (xins:assoc "model" com) 1 2) "2D") ;; Copeland Recip - starts with "2D" or "3D"
(= (substr (xins:assoc "model" com) 1 2) "3D")
)
)
(
(setq tmp (vla-insertblock spc (vlax-3d-point ins) blk scl scl scl 0.0))
(setq vst "COPELAND RECIP")
(xins:putdynamicproperty tmp vis vst)
)
)
(
(and (setq blk "M-GROUP-CLD-XML")
(setq tmp (vla-insertblock spc (vlax-3d-point ins) blk scl scl scl 0.0))
(or (= (substr (xins:assoc "model" com) 1 2) "4D") ;; Copeland Recip - starts with "4D" or "6D"
(= (substr (xins:assoc "model" com) 1 2) "6D")
)
)
(
(setq tmp (vla-insertblock spc (vlax-3d-point ins) blk scl scl scl 0.0))
(setq vst "COPELAND RECIP - VA")
(xins:putdynamicproperty tmp vis vst)
)
)
)
(defun xins:putdynamicproperty (block propname value / p)
(if (setq p (vl-remove-if-not
'(lambda (x) (wcmatch (strcase (vla-get-propertyname x)) (strcase propname)))
(vlax-invoke block 'getdynamicblockproperties)
)
)
(vl-catch-all-apply 'vlax-put (list (car p) 'value value))
)
)
This function returns the model name, which I know works because I use it elsewhere in the code. It returns something like "4DJNR28ML-TSK-C27"
Code:
(xins:assoc "model" com)
Even if I change it and replace it with something like this (for testing), I get the same error.
Code:
(setq comp "4DJNR28ML-TSK-C27")
Is there any hope for me?